core.git: Branch 'distro/collabora/co-23.05' - vcl/inc vcl/jsdialog
vcl/inc/jsdialog/jsdialogbuilder.hxx |1 + vcl/jsdialog/jsdialogbuilder.cxx |6 ++ 2 files changed, 7 insertions(+) New commits: commit f0748eae8a4a64c84aa5aca69b10688d330f93eb Author: Jaume Pujantell AuthorDate: Mon Mar 18 15:40:20 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Mar 20 15:41:26 2024 +0100 jsdialog: send update on spin button range change On Online, on the Table Properties dialog, when changing mesures from absolute to relative, the browser whould complain about values being out range since it still expected absolute values. Change-Id: I2a3ae844b4f4f874ea2140dec313794a87d9f2cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164973 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit c3227d33ef18f090d858e93e9dc516db25995ebe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164997 diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 7884fe3f2ed2..0729b220d46b 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -656,6 +656,7 @@ public: bool bTakeOwnership); virtual void set_value(sal_Int64 value) override; +virtual void set_range(sal_Int64 min, sal_Int64 max) override; }; class JSFormattedSpinButton final diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index a55c7b9fbf5b..a535d8b65e8e 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1778,6 +1778,12 @@ void JSSpinButton::set_value(sal_Int64 value) sendAction(std::move(pMap)); } +void JSSpinButton::set_range(sal_Int64 min, sal_Int64 max) +{ +SalInstanceSpinButton::set_range(min, max); +sendUpdate(); +} + JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget(pSender, pSpin, pBuilder,
core.git: vcl/inc vcl/jsdialog
vcl/inc/jsdialog/jsdialogbuilder.hxx |1 + vcl/jsdialog/jsdialogbuilder.cxx |6 ++ 2 files changed, 7 insertions(+) New commits: commit d94288a6f26a6f0d58901732c562dfad861ec4c5 Author: Jaume Pujantell AuthorDate: Mon Mar 18 15:40:20 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Mar 20 15:41:08 2024 +0100 jsdialog: send update on spin button range change On Online, on the Table Properties dialog, when changing mesures from absolute to relative, the browser whould complain about values being out range since it still expected absolute values. Change-Id: I2a3ae844b4f4f874ea2140dec313794a87d9f2cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164973 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit c3227d33ef18f090d858e93e9dc516db25995ebe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164998 Tested-by: Jenkins diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 315b8605582f..34fdb7a068d5 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -659,6 +659,7 @@ public: bool bTakeOwnership); virtual void set_value(sal_Int64 value) override; +virtual void set_range(sal_Int64 min, sal_Int64 max) override; }; class JSFormattedSpinButton final diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 08a3f53b6059..1f56bda71bba 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1746,6 +1746,12 @@ void JSSpinButton::set_value(sal_Int64 value) sendAction(std::move(pMap)); } +void JSSpinButton::set_range(sal_Int64 min, sal_Int64 max) +{ +SalInstanceSpinButton::set_range(min, max); +sendUpdate(); +} + JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget(pSender, pSpin, pBuilder,
core.git: Branch 'distro/collabora/co-24.04' - vcl/inc vcl/jsdialog
vcl/inc/jsdialog/jsdialogbuilder.hxx |1 + vcl/jsdialog/jsdialogbuilder.cxx |6 ++ 2 files changed, 7 insertions(+) New commits: commit c3227d33ef18f090d858e93e9dc516db25995ebe Author: Jaume Pujantell AuthorDate: Mon Mar 18 15:40:20 2024 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 19 13:50:15 2024 +0100 jsdialog: send update on spin button range change On Online, on the Table Properties dialog, when changing mesures from absolute to relative, the browser whould complain about values being out range since it still expected absolute values. Change-Id: I2a3ae844b4f4f874ea2140dec313794a87d9f2cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164973 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 7ef9c1cfc833..066dcddfcfc8 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -656,6 +656,7 @@ public: bool bTakeOwnership); virtual void set_value(sal_Int64 value) override; +virtual void set_range(sal_Int64 min, sal_Int64 max) override; }; class JSFormattedSpinButton final diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 7eda7861fc8d..97675b6267c1 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -1751,6 +1751,12 @@ void JSSpinButton::set_value(sal_Int64 value) sendAction(std::move(pMap)); } +void JSSpinButton::set_range(sal_Int64 min, sal_Int64 max) +{ +SalInstanceSpinButton::set_range(min, max); +sendUpdate(); +} + JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget(pSender, pSpin, pBuilder,
core.git: sfx2/source svx/source sw/source
sfx2/source/appl/module.cxx | 14 +- sfx2/source/dialog/mgetempl.cxx |4 +--- sfx2/source/sidebar/ControllerItem.cxx | 12 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |4 +--- svx/source/sidebar/possize/PosSizePropertyPanel.cxx |4 +--- sw/source/uibase/sidebar/PageFormatPanel.cxx|4 +--- 6 files changed, 25 insertions(+), 17 deletions(-) New commits: commit e2708fecb34fb4084f8db5f2c5ffb4d8923002ca Author: Jaume Pujantell AuthorDate: Fri Mar 8 16:24:11 2024 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 12 08:34:39 2024 +0100 lok: use locale units in dialogs and sidebar When oepning tha same doucment with different locales, the dailogs and sidebar show units (cm/inch) of the first locale (or the locale used in preloading, en-US) for all the views. This patch changes the units used according to the LOK locale. Change-Id: I3d515873bde661f2d9048bbc405843e83134cca7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164589 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 3ca938a25439d6f23bbd6830a96e5180ff94f757) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164619 Tested-by: Jenkins diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 03f4fc2fa8f5..b610c2ee8e2a 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -32,6 +32,8 @@ #include #include #include +#include +#include #define ShellClass_SfxModule #include @@ -245,11 +247,7 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit eUnit = FieldUnit::INCH; SfxModule* pModule = GetActiveModule(); if ( pModule ) -{ -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); -} +return pModule->GetFieldUnit(); else SAL_WARN( "sfx.appl", "GetModuleFieldUnit(): no module found" ); return eUnit; @@ -257,6 +255,12 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit SfxModule::GetFieldUnit() const { +if (comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +return MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; +} FieldUnit eUnit = FieldUnit::INCH; const SfxPoolItem* pItem = GetItem( SID_ATTR_METRIC ); if ( pItem ) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 977c5e8a93dd..ef97d253bd88 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -301,9 +301,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() SfxModule* pModule = SfxModule::GetActiveModule(); if ( pModule ) { -const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pPoolItem ) -eFieldUnit = static_cast(static_cast( pPoolItem )->GetValue()); +eFieldUnit = pModule->GetFieldUnit(); } switch ( eFieldUnit ) diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index e02276ec0cdd..28248710f1a6 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -20,6 +20,11 @@ #include #include +#include +#include +#include +#include +#include using namespace css; using namespace css::uno; @@ -59,6 +64,13 @@ void ControllerItem::RequestUpdate() { std::unique_ptr pState; const SfxItemState eState (GetBindings().QueryState(GetId(), pState)); +if (GetId() == SID_ATTR_METRIC && comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +FieldUnit eUnit = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; + static_cast(pState.get())->SetValue(static_cast(eUnit)); +} mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState.get()); } diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index 20e05096d6c4..8e88bdc2c656 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -374,9 +374,7 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI SfxModule* pModule = pSh->GetModule(); if ( pModule ) { -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); +eUnit = pModule->GetFieldUnit(); }
core.git: Branch 'distro/collabora/co-23.05' - sfx2/source svx/source sw/source
sfx2/source/appl/module.cxx | 14 +- sfx2/source/dialog/mgetempl.cxx |4 +--- sfx2/source/sidebar/ControllerItem.cxx | 12 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |4 +--- svx/source/sidebar/possize/PosSizePropertyPanel.cxx |4 +--- sw/source/uibase/sidebar/PageFormatPanel.cxx|4 +--- 6 files changed, 25 insertions(+), 17 deletions(-) New commits: commit 149080faa86e660d02c4b35a416b3a7169855897 Author: Jaume Pujantell AuthorDate: Fri Mar 8 16:24:11 2024 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 12 08:33:32 2024 +0100 lok: use locale units in dialogs and sidebar When oepning tha same doucment with different locales, the dailogs and sidebar show units (cm/inch) of the first locale (or the locale used in preloading, en-US) for all the views. This patch changes the units used according to the LOK locale. Change-Id: I3d515873bde661f2d9048bbc405843e83134cca7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164589 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 3ca938a25439d6f23bbd6830a96e5180ff94f757) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164620 diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 03f4fc2fa8f5..b610c2ee8e2a 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -32,6 +32,8 @@ #include #include #include +#include +#include #define ShellClass_SfxModule #include @@ -245,11 +247,7 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit eUnit = FieldUnit::INCH; SfxModule* pModule = GetActiveModule(); if ( pModule ) -{ -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); -} +return pModule->GetFieldUnit(); else SAL_WARN( "sfx.appl", "GetModuleFieldUnit(): no module found" ); return eUnit; @@ -257,6 +255,12 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit SfxModule::GetFieldUnit() const { +if (comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +return MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; +} FieldUnit eUnit = FieldUnit::INCH; const SfxPoolItem* pItem = GetItem( SID_ATTR_METRIC ); if ( pItem ) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 624caf17f8fd..1a0a925611e8 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -301,9 +301,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() SfxModule* pModule = SfxModule::GetActiveModule(); if ( pModule ) { -const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pPoolItem ) -eFieldUnit = static_cast(static_cast( pPoolItem )->GetValue()); +eFieldUnit = pModule->GetFieldUnit(); } switch ( eFieldUnit ) diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index e02276ec0cdd..28248710f1a6 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -20,6 +20,11 @@ #include #include +#include +#include +#include +#include +#include using namespace css; using namespace css::uno; @@ -59,6 +64,13 @@ void ControllerItem::RequestUpdate() { std::unique_ptr pState; const SfxItemState eState (GetBindings().QueryState(GetId(), pState)); +if (GetId() == SID_ATTR_METRIC && comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +FieldUnit eUnit = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; + static_cast(pState.get())->SetValue(static_cast(eUnit)); +} mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState.get()); } diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index a5a341376838..6257c7cfbce8 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -374,9 +374,7 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI SfxModule* pModule = pSh->GetModule(); if ( pModule ) { -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); +eUnit = pModule->GetFieldUnit(); } else
core.git: Branch 'distro/collabora/co-24.04' - sfx2/source svx/source sw/source
sfx2/source/appl/module.cxx | 14 +- sfx2/source/dialog/mgetempl.cxx |4 +--- sfx2/source/sidebar/ControllerItem.cxx | 12 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |4 +--- svx/source/sidebar/possize/PosSizePropertyPanel.cxx |4 +--- sw/source/uibase/sidebar/PageFormatPanel.cxx|4 +--- 6 files changed, 25 insertions(+), 17 deletions(-) New commits: commit 3ca938a25439d6f23bbd6830a96e5180ff94f757 Author: Jaume Pujantell AuthorDate: Fri Mar 8 16:24:11 2024 +0100 Commit: Miklos Vajna CommitDate: Mon Mar 11 09:17:21 2024 +0100 lok: use locale units in dialogs and sidebar When oepning tha same doucment with different locales, the dailogs and sidebar show units (cm/inch) of the first locale (or the locale used in preloading, en-US) for all the views. This patch changes the units used according to the LOK locale. Change-Id: I3d515873bde661f2d9048bbc405843e83134cca7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164589 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index 03f4fc2fa8f5..b610c2ee8e2a 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -32,6 +32,8 @@ #include #include #include +#include +#include #define ShellClass_SfxModule #include @@ -245,11 +247,7 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit eUnit = FieldUnit::INCH; SfxModule* pModule = GetActiveModule(); if ( pModule ) -{ -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); -} +return pModule->GetFieldUnit(); else SAL_WARN( "sfx.appl", "GetModuleFieldUnit(): no module found" ); return eUnit; @@ -257,6 +255,12 @@ FieldUnit SfxModule::GetCurrentFieldUnit() FieldUnit SfxModule::GetFieldUnit() const { +if (comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +return MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; +} FieldUnit eUnit = FieldUnit::INCH; const SfxPoolItem* pItem = GetItem( SID_ATTR_METRIC ); if ( pItem ) diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index a9b62452591e..7e9faad8dcd3 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -301,9 +301,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() SfxModule* pModule = SfxModule::GetActiveModule(); if ( pModule ) { -const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pPoolItem ) -eFieldUnit = static_cast(static_cast( pPoolItem )->GetValue()); +eFieldUnit = pModule->GetFieldUnit(); } switch ( eFieldUnit ) diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx index e02276ec0cdd..28248710f1a6 100644 --- a/sfx2/source/sidebar/ControllerItem.cxx +++ b/sfx2/source/sidebar/ControllerItem.cxx @@ -20,6 +20,11 @@ #include #include +#include +#include +#include +#include +#include using namespace css; using namespace css::uno; @@ -59,6 +64,13 @@ void ControllerItem::RequestUpdate() { std::unique_ptr pState; const SfxItemState eState (GetBindings().QueryState(GetId(), pState)); +if (GetId() == SID_ATTR_METRIC && comphelper::LibreOfficeKit::isActive()) +{ +MeasurementSystem eSystem += LocaleDataWrapper(comphelper::LibreOfficeKit::getLocale()).getMeasurementSystemEnum(); +FieldUnit eUnit = MeasurementSystem::Metric == eSystem ? FieldUnit::CM : FieldUnit::INCH; + static_cast(pState.get())->SetValue(static_cast(eUnit)); +} mrItemUpdateReceiver.NotifyItemUpdate(GetId(), eState, pState.get()); } diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index 20e05096d6c4..8e88bdc2c656 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -374,9 +374,7 @@ FieldUnit ParaPropertyPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolI SfxModule* pModule = pSh->GetModule(); if ( pModule ) { -const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); -if ( pItem ) -eUnit = static_cast(static_cast(pItem)->GetValue()); +eUnit = pModule->GetFieldUnit(); } else { diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index
core.git: Branch 'libreoffice-24-2' - external/libvisio
external/libvisio/UnpackedTarball_libvisio.mk| 2 external/libvisio/solid-fill-style.patch | 198 ++ external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch | 13 3 files changed, 199 insertions(+), 14 deletions(-) New commits: commit ccda2c60affd2c10f4a23046e3a9332265b357af Author: Jaume Pujantell AuthorDate: Mon Feb 19 09:22:47 2024 +0100 Commit: Michael Stahl CommitDate: Fri Feb 23 12:08:29 2024 +0100 libvisio: read and use simple solid fill styles Implemented the reading of simple solid fills from the fill styles list in a vsdx theme. And it's use with the quick style fill matrix value. This patch includes an alternative fix to tdf#77915 so the previous patch is no longer needed. Change-Id: Iccfe915c90bcb1280cfcbfa4920d2989d18518ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163581 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar (cherry picked from commit fb9ca6bba9bc3ce9feb9a066636dcd986dca096b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163544 Tested-by: Jenkins (cherry picked from commit 043e090069b3bd4c660743f6f639d002f403a7b8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163546 Reviewed-by: Michael Stahl diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk index 85e356db8837..b5f530fb2763 100644 --- a/external/libvisio/UnpackedTarball_libvisio.mk +++ b/external/libvisio/UnpackedTarball_libvisio.mk @@ -17,7 +17,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libvisio)) $(eval $(call gb_UnpackedTarball_add_patches,libvisio, \ external/libvisio/ubsan.patch \ -external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch \ +external/libvisio/solid-fill-style.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libvisio/solid-fill-style.patch b/external/libvisio/solid-fill-style.patch new file mode 100644 index ..53dc6a405e71 --- /dev/null +++ b/external/libvisio/solid-fill-style.patch @@ -0,0 +1,198 @@ +--- src/lib/VSDStyles.h src/lib/VSDStyles.h +@@ -179,14 +177,13 @@ struct VSDFillStyle + ASSIGN_OPTIONAL(style.qsFillMatrix, qsFillMatrix); + if (theme) + { +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), fgColour); +- +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), bgColour); +- +- if (!!style.qsShadowColour && style.qsShadowColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.get()), shadowFgColour); ++ // Quick Style Colour 100 is special. It is the default, ++ // and it is not saved explicitely in the VSDX file. ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), fgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), bgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.value_or(100)), shadowFgColour); ++ if (!!style.qsFillMatrix && style.qsFillMatrix.get() >= 0) ++ASSIGN_OPTIONAL(theme->getFillStyleColour(style.qsFillMatrix.get()), fgColour); + } + ASSIGN_OPTIONAL(style.fgColour, fgColour); + ASSIGN_OPTIONAL(style.bgColour, bgColour); +--- src/lib/VSDXTheme.cpp src/lib/VSDXTheme.cpp +@@ -63,7 +63,8 @@ libvisio::VSDXFontScheme::VSDXFontScheme() + + libvisio::VSDXTheme::VSDXTheme() + : m_clrScheme(), +-m_fontScheme() ++m_fontScheme(), ++m_fillStyleLst(std::vector>(6)) + { + } + +@@ -102,6 +103,9 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) + case XML_A_FONTSCHEME: + readFontScheme(reader.get()); + break; ++ case XML_A_FMTSCHEME: ++readFmtScheme(reader.get()); ++break; + default: + break; + } +@@ -320,7 +324,7 @@ void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader) + while ((XML_A_CLRSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + } + +-void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour ) ++bool libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour ) + { + int ret = 1; + int tokenId = XML_TOKEN_INVALID; +@@ -350,7 +354,11 @@ void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, + while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + + if (colour) ++ { + clr = *colour; ++return true; ++ } ++ return false; + } + + void libvisio::VSDXTheme::readVariationClrSchemeLst(xmlTextReaderPtr reader) +@@ -491,4 +499,96 @@ boost::optional libvisio::VSDXTheme::getThemeColour(unsigned v + return
core.git: Branch 'distro/collabora/co-24.04' - external/libvisio
external/libvisio/UnpackedTarball_libvisio.mk| 2 external/libvisio/solid-fill-style.patch | 198 ++ external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch | 13 3 files changed, 199 insertions(+), 14 deletions(-) New commits: commit f47a53da20f09d97b0686f2c212264dcae62181e Author: Jaume Pujantell AuthorDate: Mon Feb 19 09:22:47 2024 +0100 Commit: Andras Timar CommitDate: Mon Feb 19 15:53:21 2024 +0100 libvisio: read and use simple solid fill styles Implemented the reading of simple solid fills from the fill styles list in a vsdx theme. And it's use with the quick style fill matrix value. This patch includes an alternative fix to tdf#77915 so the previous patch is no longer needed. Change-Id: Iccfe915c90bcb1280cfcbfa4920d2989d18518ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163581 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar (cherry picked from commit fb9ca6bba9bc3ce9feb9a066636dcd986dca096b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163547 diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk index 85e356db8837..b5f530fb2763 100644 --- a/external/libvisio/UnpackedTarball_libvisio.mk +++ b/external/libvisio/UnpackedTarball_libvisio.mk @@ -17,7 +17,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libvisio)) $(eval $(call gb_UnpackedTarball_add_patches,libvisio, \ external/libvisio/ubsan.patch \ -external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch \ +external/libvisio/solid-fill-style.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libvisio/solid-fill-style.patch b/external/libvisio/solid-fill-style.patch new file mode 100644 index ..53dc6a405e71 --- /dev/null +++ b/external/libvisio/solid-fill-style.patch @@ -0,0 +1,198 @@ +--- src/lib/VSDStyles.h src/lib/VSDStyles.h +@@ -179,14 +177,13 @@ struct VSDFillStyle + ASSIGN_OPTIONAL(style.qsFillMatrix, qsFillMatrix); + if (theme) + { +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), fgColour); +- +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), bgColour); +- +- if (!!style.qsShadowColour && style.qsShadowColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.get()), shadowFgColour); ++ // Quick Style Colour 100 is special. It is the default, ++ // and it is not saved explicitely in the VSDX file. ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), fgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), bgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.value_or(100)), shadowFgColour); ++ if (!!style.qsFillMatrix && style.qsFillMatrix.get() >= 0) ++ASSIGN_OPTIONAL(theme->getFillStyleColour(style.qsFillMatrix.get()), fgColour); + } + ASSIGN_OPTIONAL(style.fgColour, fgColour); + ASSIGN_OPTIONAL(style.bgColour, bgColour); +--- src/lib/VSDXTheme.cpp src/lib/VSDXTheme.cpp +@@ -63,7 +63,8 @@ libvisio::VSDXFontScheme::VSDXFontScheme() + + libvisio::VSDXTheme::VSDXTheme() + : m_clrScheme(), +-m_fontScheme() ++m_fontScheme(), ++m_fillStyleLst(std::vector>(6)) + { + } + +@@ -102,6 +103,9 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) + case XML_A_FONTSCHEME: + readFontScheme(reader.get()); + break; ++ case XML_A_FMTSCHEME: ++readFmtScheme(reader.get()); ++break; + default: + break; + } +@@ -320,7 +324,7 @@ void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader) + while ((XML_A_CLRSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + } + +-void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour ) ++bool libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour ) + { + int ret = 1; + int tokenId = XML_TOKEN_INVALID; +@@ -350,7 +354,11 @@ void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, + while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + + if (colour) ++ { + clr = *colour; ++return true; ++ } ++ return false; + } + + void libvisio::VSDXTheme::readVariationClrSchemeLst(xmlTextReaderPtr reader) +@@ -491,4 +499,96 @@ boost::optional libvisio::VSDXTheme::getThemeColour(unsigned v + return boost::optional(); + } + ++void libvisio::VSDXTheme::readFmtScheme(xmlTextReaderPtr reader) ++{ ++ VSD_DEBUG_MSG(("VSDXTheme::readFmtScheme ")); ++ int ret = 1; ++ int tokenId =
core.git: external/libvisio
external/libvisio/UnpackedTarball_libvisio.mk| 2 external/libvisio/solid-fill-style.patch | 198 ++ external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch | 13 3 files changed, 199 insertions(+), 14 deletions(-) New commits: commit 043e090069b3bd4c660743f6f639d002f403a7b8 Author: Jaume Pujantell AuthorDate: Mon Feb 19 09:22:47 2024 +0100 Commit: Andras Timar CommitDate: Mon Feb 19 13:17:03 2024 +0100 libvisio: read and use simple solid fill styles Implemented the reading of simple solid fills from the fill styles list in a vsdx theme. And it's use with the quick style fill matrix value. This patch includes an alternative fix to tdf#77915 so the previous patch is no longer needed. Change-Id: Iccfe915c90bcb1280cfcbfa4920d2989d18518ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163581 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar (cherry picked from commit fb9ca6bba9bc3ce9feb9a066636dcd986dca096b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163544 Tested-by: Jenkins diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk index 85e356db8837..b5f530fb2763 100644 --- a/external/libvisio/UnpackedTarball_libvisio.mk +++ b/external/libvisio/UnpackedTarball_libvisio.mk @@ -17,7 +17,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libvisio)) $(eval $(call gb_UnpackedTarball_add_patches,libvisio, \ external/libvisio/ubsan.patch \ -external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch \ +external/libvisio/solid-fill-style.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libvisio/solid-fill-style.patch b/external/libvisio/solid-fill-style.patch new file mode 100644 index ..53dc6a405e71 --- /dev/null +++ b/external/libvisio/solid-fill-style.patch @@ -0,0 +1,198 @@ +--- src/lib/VSDStyles.h src/lib/VSDStyles.h +@@ -179,14 +177,13 @@ struct VSDFillStyle + ASSIGN_OPTIONAL(style.qsFillMatrix, qsFillMatrix); + if (theme) + { +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), fgColour); +- +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), bgColour); +- +- if (!!style.qsShadowColour && style.qsShadowColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.get()), shadowFgColour); ++ // Quick Style Colour 100 is special. It is the default, ++ // and it is not saved explicitely in the VSDX file. ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), fgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), bgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.value_or(100)), shadowFgColour); ++ if (!!style.qsFillMatrix && style.qsFillMatrix.get() >= 0) ++ASSIGN_OPTIONAL(theme->getFillStyleColour(style.qsFillMatrix.get()), fgColour); + } + ASSIGN_OPTIONAL(style.fgColour, fgColour); + ASSIGN_OPTIONAL(style.bgColour, bgColour); +--- src/lib/VSDXTheme.cpp src/lib/VSDXTheme.cpp +@@ -63,7 +63,8 @@ libvisio::VSDXFontScheme::VSDXFontScheme() + + libvisio::VSDXTheme::VSDXTheme() + : m_clrScheme(), +-m_fontScheme() ++m_fontScheme(), ++m_fillStyleLst(std::vector>(6)) + { + } + +@@ -102,6 +103,9 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) + case XML_A_FONTSCHEME: + readFontScheme(reader.get()); + break; ++ case XML_A_FMTSCHEME: ++readFmtScheme(reader.get()); ++break; + default: + break; + } +@@ -320,7 +324,7 @@ void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader) + while ((XML_A_CLRSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + } + +-void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour ) ++bool libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour ) + { + int ret = 1; + int tokenId = XML_TOKEN_INVALID; +@@ -350,7 +354,11 @@ void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, + while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + + if (colour) ++ { + clr = *colour; ++return true; ++ } ++ return false; + } + + void libvisio::VSDXTheme::readVariationClrSchemeLst(xmlTextReaderPtr reader) +@@ -491,4 +499,96 @@ boost::optional libvisio::VSDXTheme::getThemeColour(unsigned v + return boost::optional(); + } + ++void libvisio::VSDXTheme::readFmtScheme(xmlTextReaderPtr reader) ++{ ++ VSD_DEBUG_MSG(("VSDXTheme::readFmtScheme ")); ++ int ret = 1; ++
core.git: Branch 'distro/collabora/co-23.05' - external/libvisio
external/libvisio/UnpackedTarball_libvisio.mk| 2 external/libvisio/solid-fill-style.patch | 198 ++ external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch | 13 3 files changed, 199 insertions(+), 14 deletions(-) New commits: commit fb9ca6bba9bc3ce9feb9a066636dcd986dca096b Author: Jaume Pujantell AuthorDate: Mon Feb 19 09:22:47 2024 +0100 Commit: Andras Timar CommitDate: Mon Feb 19 11:23:32 2024 +0100 libvisio: read and use simple solid fill styles Implemented the reading of simple solid fills from the fill styles list in a vsdx theme. And it's use with the quick style fill matrix value. This patch includes an alternative fix to tdf#77915 so the previous patch is no longer needed. Change-Id: Iccfe915c90bcb1280cfcbfa4920d2989d18518ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163581 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/external/libvisio/UnpackedTarball_libvisio.mk b/external/libvisio/UnpackedTarball_libvisio.mk index 85e356db8837..b5f530fb2763 100644 --- a/external/libvisio/UnpackedTarball_libvisio.mk +++ b/external/libvisio/UnpackedTarball_libvisio.mk @@ -17,7 +17,7 @@ $(eval $(call gb_UnpackedTarball_update_autoconf_configs,libvisio)) $(eval $(call gb_UnpackedTarball_add_patches,libvisio, \ external/libvisio/ubsan.patch \ -external/libvisio/tdf-77915-fix-import-of-default-shape-fill-color.patch \ +external/libvisio/solid-fill-style.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libvisio/solid-fill-style.patch b/external/libvisio/solid-fill-style.patch new file mode 100644 index ..53dc6a405e71 --- /dev/null +++ b/external/libvisio/solid-fill-style.patch @@ -0,0 +1,198 @@ +--- src/lib/VSDStyles.h src/lib/VSDStyles.h +@@ -179,14 +177,13 @@ struct VSDFillStyle + ASSIGN_OPTIONAL(style.qsFillMatrix, qsFillMatrix); + if (theme) + { +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), fgColour); +- +- if (!!style.qsFillColour && style.qsFillColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.get()), bgColour); +- +- if (!!style.qsShadowColour && style.qsShadowColour.get() >= 0) +-ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.get()), shadowFgColour); ++ // Quick Style Colour 100 is special. It is the default, ++ // and it is not saved explicitely in the VSDX file. ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), fgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsFillColour.value_or(100)), bgColour); ++ ASSIGN_OPTIONAL(theme->getThemeColour(style.qsShadowColour.value_or(100)), shadowFgColour); ++ if (!!style.qsFillMatrix && style.qsFillMatrix.get() >= 0) ++ASSIGN_OPTIONAL(theme->getFillStyleColour(style.qsFillMatrix.get()), fgColour); + } + ASSIGN_OPTIONAL(style.fgColour, fgColour); + ASSIGN_OPTIONAL(style.bgColour, bgColour); +--- src/lib/VSDXTheme.cpp src/lib/VSDXTheme.cpp +@@ -63,7 +63,8 @@ libvisio::VSDXFontScheme::VSDXFontScheme() + + libvisio::VSDXTheme::VSDXTheme() + : m_clrScheme(), +-m_fontScheme() ++m_fontScheme(), ++m_fillStyleLst(std::vector>(6)) + { + } + +@@ -102,6 +103,9 @@ bool libvisio::VSDXTheme::parse(librevenge::RVNGInputStream *input) + case XML_A_FONTSCHEME: + readFontScheme(reader.get()); + break; ++ case XML_A_FMTSCHEME: ++readFmtScheme(reader.get()); ++break; + default: + break; + } +@@ -320,7 +324,7 @@ void libvisio::VSDXTheme::readClrScheme(xmlTextReaderPtr reader) + while ((XML_A_CLRSCHEME != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + } + +-void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour ) ++bool libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, Colour ) + { + int ret = 1; + int tokenId = XML_TOKEN_INVALID; +@@ -350,7 +354,11 @@ void libvisio::VSDXTheme::readThemeColour(xmlTextReaderPtr reader, int idToken, + while ((idToken != tokenId || XML_READER_TYPE_END_ELEMENT != tokenType) && 1 == ret); + + if (colour) ++ { + clr = *colour; ++return true; ++ } ++ return false; + } + + void libvisio::VSDXTheme::readVariationClrSchemeLst(xmlTextReaderPtr reader) +@@ -491,4 +499,96 @@ boost::optional libvisio::VSDXTheme::getThemeColour(unsigned v + return boost::optional(); + } + ++void libvisio::VSDXTheme::readFmtScheme(xmlTextReaderPtr reader) ++{ ++ VSD_DEBUG_MSG(("VSDXTheme::readFmtScheme ")); ++ int ret = 1; ++ int tokenId = XML_TOKEN_INVALID; ++ int tokenType = -1; ++ do ++ { ++ret = xmlTextReaderRead(reader); ++tokenId = getElementToken(reader); ++if
core.git: Branch 'libreoffice-24-2' - filter/qa svx/source
filter/qa/unit/data/text-in-image.odp |binary filter/qa/unit/svg.cxx| 18 + svx/source/svdraw/svdxcgv.cxx | 63 +- 3 files changed, 51 insertions(+), 30 deletions(-) New commits: commit 0655736b20fd84e6948d21c31fe388dc83801ad3 Author: Jaume Pujantell AuthorDate: Tue Feb 13 09:27:00 2024 +0100 Commit: Xisco Fauli CommitDate: Thu Feb 15 12:32:28 2024 +0100 tdf#159704 svx: preserve text when getting grpahic from sdrobject When getting a Graphic object from an SdrGrafObj with text the text was lost. Change-Id: I3a8316511e502b832b65dc72faebaf8c00923c38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163293 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit d0241915eba35c9dc0cc42f322df798a270db00f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163342 Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163377 diff --git a/filter/qa/unit/data/text-in-image.odp b/filter/qa/unit/data/text-in-image.odp new file mode 100644 index ..660e27062373 Binary files /dev/null and b/filter/qa/unit/data/text-in-image.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 30a47557f9bb..4446fa35cb9b 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -293,6 +293,24 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab) assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']"_ostr, 2); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, textInImage) +{ +// Load document containing empty paragraphs with ids. +loadFromFile(u"text-in-image.odp"); + +// Export to SVG. +save("impress_svg_Export"); + +xmlDocUniquePtr pXmlDoc = parseExportedFile(); + +// We expect the Graphic to have an image and a text +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:image"_ostr, 1); +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:text"_ostr, 1); +// Without the accomanying fix, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 050a99707740..5d16cbae2598 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -599,42 +599,45 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) { Graphic aRet; -// try to get a graphic from the object first -const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >()); -const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >()); - -if(pSdrGrafObj) +if (!rSdrObject.HasText()) { -if(pSdrGrafObj->isEmbeddedVectorGraphicData()) +// try to get a graphic from the object first +const SdrGrafObj* pSdrGrafObj(dynamic_cast()); +const SdrOle2Obj* pSdrOle2Obj(dynamic_cast()); + +if (pSdrGrafObj) { -// get Metafile for Svg content -aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +if (pSdrGrafObj->isEmbeddedVectorGraphicData()) +{ +// get Metafile for Svg content +aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +} +else +{ +// Make behaviour coherent with metafile +// recording below (which of course also takes +// view-transformed objects) +aRet = pSdrGrafObj->GetTransformedGraphic(); +} } -else +else if (pSdrOle2Obj) { -// Make behaviour coherent with metafile -// recording below (which of course also takes -// view-transformed objects) -aRet = pSdrGrafObj->GetTransformedGraphic(); -} -} -else if(pSdrOle2Obj) -{ -if(pSdrOle2Obj->GetGraphic()) -{ -aRet = *pSdrOle2Obj->GetGraphic(); +if (pSdrOle2Obj->GetGraphic()) +{ +aRet = *pSdrOle2Obj->GetGraphic(); +} } -} -else -{ -// Support extracting a snapshot from video media, if possible. -const SdrMediaObj* pSdrMediaObj = dynamic_cast(); -if (pSdrMediaObj) +else { -const css::uno::Reference& xGraphic -= pSdrMediaObj->getSnapshot(); -if (xGraphic.is()) -aRet = Graphic(xGraphic); +// Support extracting a snapshot from video media, if possible. +const SdrMediaObj* pSdrMediaObj = dynamic_cast(); +if (pSdrMediaObj) +{ +const css::uno::Reference& xGraphic += pSdrMediaObj->getSnapshot(); +if
core.git: Branch 'distro/collabora/co-24.04' - filter/qa svx/source
filter/qa/unit/data/text-in-image.odp |binary filter/qa/unit/svg.cxx| 25 + svx/source/svdraw/svdxcgv.cxx | 63 +- 3 files changed, 58 insertions(+), 30 deletions(-) New commits: commit a85070ec1bd01ed7a3c2149919edc5e4f39da7b6 Author: Jaume Pujantell AuthorDate: Tue Feb 13 09:27:00 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Feb 14 15:20:02 2024 +0100 tdf#159704 svx: preserve text when getting grpahic from sdrobject When getting a Graphic object from an SdrGrafObj with text the text was lost. Change-Id: I3a8316511e502b832b65dc72faebaf8c00923c38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163293 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit d0241915eba35c9dc0cc42f322df798a270db00f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163343 diff --git a/filter/qa/unit/data/text-in-image.odp b/filter/qa/unit/data/text-in-image.odp new file mode 100644 index ..660e27062373 Binary files /dev/null and b/filter/qa/unit/data/text-in-image.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 8e4f5f5130a4..24c5c0fc161f 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -349,6 +349,31 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab) assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']"_ostr, 2); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, textInImage) +{ +// Load document containing empty paragraphs with ids. +loadFromFile(u"text-in-image.odp"); + +// Export to SVG. +uno::Reference xStorable(mxComponent, uno::UNO_QUERY_THROW); +SvMemoryStream aStream; +uno::Reference xOut = new utl::OOutputStreamWrapper(aStream); +utl::MediaDescriptor aMediaDescriptor; +aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export"); +aMediaDescriptor["OutputStream"] <<= xOut; +xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList()); +aStream.Seek(STREAM_SEEK_TO_BEGIN); + +xmlDocUniquePtr pXmlDoc = parseXmlStream(); + +// We expect the Graphic to have an image and a text +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:image"_ostr, 1); +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:text"_ostr, 1); +// Without the accomanying fix, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 050a99707740..5d16cbae2598 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -599,42 +599,45 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) { Graphic aRet; -// try to get a graphic from the object first -const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >()); -const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >()); - -if(pSdrGrafObj) +if (!rSdrObject.HasText()) { -if(pSdrGrafObj->isEmbeddedVectorGraphicData()) +// try to get a graphic from the object first +const SdrGrafObj* pSdrGrafObj(dynamic_cast()); +const SdrOle2Obj* pSdrOle2Obj(dynamic_cast()); + +if (pSdrGrafObj) { -// get Metafile for Svg content -aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +if (pSdrGrafObj->isEmbeddedVectorGraphicData()) +{ +// get Metafile for Svg content +aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +} +else +{ +// Make behaviour coherent with metafile +// recording below (which of course also takes +// view-transformed objects) +aRet = pSdrGrafObj->GetTransformedGraphic(); +} } -else +else if (pSdrOle2Obj) { -// Make behaviour coherent with metafile -// recording below (which of course also takes -// view-transformed objects) -aRet = pSdrGrafObj->GetTransformedGraphic(); -} -} -else if(pSdrOle2Obj) -{ -if(pSdrOle2Obj->GetGraphic()) -{ -aRet = *pSdrOle2Obj->GetGraphic(); +if (pSdrOle2Obj->GetGraphic()) +{ +aRet = *pSdrOle2Obj->GetGraphic(); +} } -} -else -{ -// Support extracting a snapshot from video media, if possible. -const SdrMediaObj* pSdrMediaObj = dynamic_cast(); -if (pSdrMediaObj) +else { -const css::uno::Reference& xGraphic -= pSdrMediaObj->getSnapshot(); -if (xGraphic.is()) -aRet = Graphic(xGraphic);
core.git: filter/qa svx/source
filter/qa/unit/data/text-in-image.odp |binary filter/qa/unit/svg.cxx| 18 + svx/source/svdraw/svdxcgv.cxx | 63 +- 3 files changed, 51 insertions(+), 30 deletions(-) New commits: commit 6565e46f3e49173c4c37f8b51450f5352ac08341 Author: Jaume Pujantell AuthorDate: Tue Feb 13 09:27:00 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Feb 14 14:51:16 2024 +0100 tdf#159704 svx: preserve text when getting grpahic from sdrobject When getting a Graphic object from an SdrGrafObj with text the text was lost. Change-Id: I3a8316511e502b832b65dc72faebaf8c00923c38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163293 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit d0241915eba35c9dc0cc42f322df798a270db00f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163342 Tested-by: Jenkins diff --git a/filter/qa/unit/data/text-in-image.odp b/filter/qa/unit/data/text-in-image.odp new file mode 100644 index ..660e27062373 Binary files /dev/null and b/filter/qa/unit/data/text-in-image.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 30a47557f9bb..4446fa35cb9b 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -293,6 +293,24 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab) assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']"_ostr, 2); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, textInImage) +{ +// Load document containing empty paragraphs with ids. +loadFromFile(u"text-in-image.odp"); + +// Export to SVG. +save("impress_svg_Export"); + +xmlDocUniquePtr pXmlDoc = parseExportedFile(); + +// We expect the Graphic to have an image and a text +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:image"_ostr, 1); +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:text"_ostr, 1); +// Without the accomanying fix, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 050a99707740..5d16cbae2598 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -599,42 +599,45 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) { Graphic aRet; -// try to get a graphic from the object first -const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >()); -const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >()); - -if(pSdrGrafObj) +if (!rSdrObject.HasText()) { -if(pSdrGrafObj->isEmbeddedVectorGraphicData()) +// try to get a graphic from the object first +const SdrGrafObj* pSdrGrafObj(dynamic_cast()); +const SdrOle2Obj* pSdrOle2Obj(dynamic_cast()); + +if (pSdrGrafObj) { -// get Metafile for Svg content -aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +if (pSdrGrafObj->isEmbeddedVectorGraphicData()) +{ +// get Metafile for Svg content +aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +} +else +{ +// Make behaviour coherent with metafile +// recording below (which of course also takes +// view-transformed objects) +aRet = pSdrGrafObj->GetTransformedGraphic(); +} } -else +else if (pSdrOle2Obj) { -// Make behaviour coherent with metafile -// recording below (which of course also takes -// view-transformed objects) -aRet = pSdrGrafObj->GetTransformedGraphic(); -} -} -else if(pSdrOle2Obj) -{ -if(pSdrOle2Obj->GetGraphic()) -{ -aRet = *pSdrOle2Obj->GetGraphic(); +if (pSdrOle2Obj->GetGraphic()) +{ +aRet = *pSdrOle2Obj->GetGraphic(); +} } -} -else -{ -// Support extracting a snapshot from video media, if possible. -const SdrMediaObj* pSdrMediaObj = dynamic_cast(); -if (pSdrMediaObj) +else { -const css::uno::Reference& xGraphic -= pSdrMediaObj->getSnapshot(); -if (xGraphic.is()) -aRet = Graphic(xGraphic); +// Support extracting a snapshot from video media, if possible. +const SdrMediaObj* pSdrMediaObj = dynamic_cast(); +if (pSdrMediaObj) +{ +const css::uno::Reference& xGraphic += pSdrMediaObj->getSnapshot(); +if (xGraphic.is()) +aRet = Graphic(xGraphic); +} } }
core.git: Branch 'distro/collabora/co-23.05' - filter/qa svx/source
filter/qa/unit/data/text-in-image.odp |binary filter/qa/unit/svg.cxx| 25 + svx/source/svdraw/svdxcgv.cxx | 63 +- 3 files changed, 58 insertions(+), 30 deletions(-) New commits: commit d0241915eba35c9dc0cc42f322df798a270db00f Author: Jaume Pujantell AuthorDate: Tue Feb 13 09:27:00 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Feb 14 09:37:04 2024 +0100 tdf#159704 svx: preserve text when getting grpahic from sdrobject When getting a Graphic object from an SdrGrafObj with text the text was lost. Change-Id: I3a8316511e502b832b65dc72faebaf8c00923c38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163293 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/filter/qa/unit/data/text-in-image.odp b/filter/qa/unit/data/text-in-image.odp new file mode 100644 index ..660e27062373 Binary files /dev/null and b/filter/qa/unit/data/text-in-image.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 4c1ddd10b58a..4900c742200e 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -346,6 +346,31 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab) assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']", 2); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, textInImage) +{ +// Load document containing empty paragraphs with ids. +loadFromURL(u"text-in-image.odp"); + +// Export to SVG. +uno::Reference xStorable(mxComponent, uno::UNO_QUERY_THROW); +SvMemoryStream aStream; +uno::Reference xOut = new utl::OOutputStreamWrapper(aStream); +utl::MediaDescriptor aMediaDescriptor; +aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export"); +aMediaDescriptor["OutputStream"] <<= xOut; +xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList()); +aStream.Seek(STREAM_SEEK_TO_BEGIN); + +xmlDocUniquePtr pXmlDoc = parseXmlStream(); + +// We expect the Graphic to have an image and a text +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:image", 1); +assertXPath(pXmlDoc, "//svg:g[@class='Graphic']//svg:text", 1); +// Without the accomanying fix, this test would have failed with: +// - Expected: 1 +// - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index f9365136afbd..01a43f86819c 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -604,42 +604,45 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) { Graphic aRet; -// try to get a graphic from the object first -const SdrGrafObj* pSdrGrafObj(dynamic_cast< const SdrGrafObj* >()); -const SdrOle2Obj* pSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >()); - -if(pSdrGrafObj) +if (!rSdrObject.HasText()) { -if(pSdrGrafObj->isEmbeddedVectorGraphicData()) +// try to get a graphic from the object first +const SdrGrafObj* pSdrGrafObj(dynamic_cast()); +const SdrOle2Obj* pSdrOle2Obj(dynamic_cast()); + +if (pSdrGrafObj) { -// get Metafile for Svg content -aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +if (pSdrGrafObj->isEmbeddedVectorGraphicData()) +{ +// get Metafile for Svg content +aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); +} +else +{ +// Make behaviour coherent with metafile +// recording below (which of course also takes +// view-transformed objects) +aRet = pSdrGrafObj->GetTransformedGraphic(); +} } -else +else if (pSdrOle2Obj) { -// Make behaviour coherent with metafile -// recording below (which of course also takes -// view-transformed objects) -aRet = pSdrGrafObj->GetTransformedGraphic(); -} -} -else if(pSdrOle2Obj) -{ -if(pSdrOle2Obj->GetGraphic()) -{ -aRet = *pSdrOle2Obj->GetGraphic(); +if (pSdrOle2Obj->GetGraphic()) +{ +aRet = *pSdrOle2Obj->GetGraphic(); +} } -} -else -{ -// Support extracting a snapshot from video media, if possible. -const SdrMediaObj* pSdrMediaObj = dynamic_cast(); -if (pSdrMediaObj) +else { -const css::uno::Reference& xGraphic -= pSdrMediaObj->getSnapshot(); -if (xGraphic.is()) -aRet = Graphic(xGraphic); +// Support extracting a snapshot from video media, if possible. +const SdrMediaObj* pSdrMediaObj = dynamic_cast(); +
core.git: sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 29 --- sw/source/filter/ww8/docxattributeoutput.hxx |2 - 2 files changed, 19 insertions(+), 12 deletions(-) New commits: commit e6be502d833e0380d225218abf4896a635525301 Author: Jaume Pujantell AuthorDate: Wed Jan 3 19:32:25 2024 +0100 Commit: Andras Timar CommitDate: Mon Jan 15 20:00:26 2024 +0100 sw: search for alternative weights when embeding on docx Sometimes a docx document might come whith a font with niether normal or bold weight embedded as regular, so when embedding a font in docx search for alternative weights if neither a normal or bold matching font has been found. Change-Id: I95cf2634c392cec6e97e5dd12a90de6e50228ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161596 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian (cherry picked from commit 96d52b9e6879df3ab9697a7c0322cda5e08eb9af) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161942 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5ec368a97b40..a865697d4a89 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7352,10 +7352,16 @@ void DocxAttributeOutput::EmbedFont( std::u16string_view name, FontFamily family { if( !m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) return; // no font embedding with this document -EmbedFontStyle( name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch ); -EmbedFontStyle( name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch ); +bool foundFont += EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch); +foundFont += EmbedFontStyle(name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch) || foundFont; +foundFont = EmbedFontStyle(name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch) +|| foundFont; +foundFont = EmbedFontStyle(name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch) +|| foundFont; +if (!foundFont) +EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_DONTKNOW, pitch); } static char toHexChar( int value ) @@ -7363,21 +7369,21 @@ static char toHexChar( int value ) return value >= 10 ? value + 'A' - 10 : value + '0'; } -void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, FontFamily family, FontItalic italic, -FontWeight weight, FontPitch pitch ) +bool DocxAttributeOutput::EmbedFontStyle(std::u16string_view name, int tag, FontFamily family, + FontItalic italic, FontWeight weight, FontPitch pitch) { // Embed font if at least viewing is allowed (in which case the opening app must check // the font license rights too and open either read-only or not use the font for editing). OUString fontUrl = EmbeddedFontsHelper::fontFileUrl( name, family, italic, weight, pitch, EmbeddedFontsHelper::FontRights::ViewingAllowed ); if( fontUrl.isEmpty()) -return; +return false; // TODO IDocumentSettingAccess::EMBED_SYSTEM_FONTS if( !m_FontFilesMap.count( fontUrl )) { osl::File file( fontUrl ); if( file.open( osl_File_OpenFlag_Read ) != osl::File::E_None ) -return; +return false; uno::Reference< css::io::XOutputStream > xOutStream = m_rExport.GetFilter().openFragmentStream( "word/fonts/font" + OUString::number(m_nextFontId) + ".odttf", "application/vnd.openxmlformats-officedocument.obfuscatedFont" ); @@ -7396,7 +7402,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Font file size too small (" << fontUrl << ")" ); xOutStream->closeOutput(); -return; +return false; } for( int i = 0; i < 16; @@ -7413,7 +7419,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( eof ) break; @@ -7421,7 +7427,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -
core.git: Branch 'distro/collabora/co-24.04' - vcl/jsdialog
vcl/jsdialog/enabled.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 915697a17765db27b88cc84144b497e098975271 Author: Jaume Pujantell AuthorDate: Mon Jan 8 17:20:28 2024 +0100 Commit: Andras Timar CommitDate: Mon Jan 15 19:59:11 2024 +0100 cool#7996 enable jsdialog for font page in document properties The checkboxes of font page on the document properties dialog were not saving the changes after pressing ok. Change-Id: I5e7d16de267dd5d6874a84b518f6ec769db4fcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161795 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 545d512a5f7b866696b3a4dfc0e00748029d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161863 Tested-by: Jenkins diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index d5997c9c6a9f..058880a97835 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -227,6 +227,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" +|| rUIFile == u"sfx/ui/documentfontspage.ui" || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui" || rUIFile == u"svx/ui/headfootformatpage.ui"
core.git: Branch 'distro/collabora/co-22.05' - sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 29 --- sw/source/filter/ww8/docxattributeoutput.hxx |2 - 2 files changed, 19 insertions(+), 12 deletions(-) New commits: commit 49c49d2b1687172216a37dfdbb8f7ed1583e6d75 Author: Jaume Pujantell AuthorDate: Wed Jan 3 19:32:25 2024 +0100 Commit: Jaume Pujantell CommitDate: Fri Jan 12 09:01:20 2024 +0100 sw: search for alternative weights when embeding on docx Sometimes a docx document might come whith a font with niether normal or bold weight embedded as regular, so when embedding a font in docx search for alternative weights if neither a normal or bold matching font has been found. Change-Id: I95cf2634c392cec6e97e5dd12a90de6e50228ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161566 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a70bee00967a..2d6ed05c3247 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7857,10 +7857,16 @@ void DocxAttributeOutput::EmbedFont( std::u16string_view name, FontFamily family { if( !m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) return; // no font embedding with this document -EmbedFontStyle( name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch ); -EmbedFontStyle( name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch ); +bool foundFont += EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch); +foundFont += EmbedFontStyle(name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch) || foundFont; +foundFont = EmbedFontStyle(name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch) +|| foundFont; +foundFont = EmbedFontStyle(name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch) +|| foundFont; +if (!foundFont) +EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_DONTKNOW, pitch); } static char toHexChar( int value ) @@ -7868,21 +7874,21 @@ static char toHexChar( int value ) return value >= 10 ? value + 'A' - 10 : value + '0'; } -void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, FontFamily family, FontItalic italic, -FontWeight weight, FontPitch pitch ) +bool DocxAttributeOutput::EmbedFontStyle(std::u16string_view name, int tag, FontFamily family, + FontItalic italic, FontWeight weight, FontPitch pitch) { // Embed font if at least viewing is allowed (in which case the opening app must check // the font license rights too and open either read-only or not use the font for editing). OUString fontUrl = EmbeddedFontsHelper::fontFileUrl( name, family, italic, weight, pitch, EmbeddedFontsHelper::FontRights::ViewingAllowed ); if( fontUrl.isEmpty()) -return; +return false; // TODO IDocumentSettingAccess::EMBED_SYSTEM_FONTS if( !fontFilesMap.count( fontUrl )) { osl::File file( fontUrl ); if( file.open( osl_File_OpenFlag_Read ) != osl::File::E_None ) -return; +return false; uno::Reference< css::io::XOutputStream > xOutStream = m_rExport.GetFilter().openFragmentStream( "word/fonts/font" + OUString::number(m_nextFontId) + ".odttf", "application/vnd.openxmlformats-officedocument.obfuscatedFont" ); @@ -7901,7 +7907,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Font file size too small (" << fontUrl << ")" ); xOutStream->closeOutput(); -return; +return false; } for( int i = 0; i < 16; @@ -7918,7 +7924,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( eof ) break; @@ -7926,7 +7932,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( readSize == 0 ) break; @@ -7946,6 +7952,7 @@ void DocxAttributeOutput::EmbedFontStyle(
core.git: Branch 'distro/collabora/co-23.05' - sw/source
sw/source/filter/ww8/docxattributeoutput.cxx | 29 --- sw/source/filter/ww8/docxattributeoutput.hxx |2 - 2 files changed, 19 insertions(+), 12 deletions(-) New commits: commit 96d52b9e6879df3ab9697a7c0322cda5e08eb9af Author: Jaume Pujantell AuthorDate: Wed Jan 3 19:32:25 2024 +0100 Commit: Jaume Pujantell CommitDate: Fri Jan 12 09:01:01 2024 +0100 sw: search for alternative weights when embeding on docx Sometimes a docx document might come whith a font with niether normal or bold weight embedded as regular, so when embedding a font in docx search for alternative weights if neither a normal or bold matching font has been found. Change-Id: I95cf2634c392cec6e97e5dd12a90de6e50228ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161596 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3ae94d3c6e69..394d4a715e1a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7259,10 +7259,16 @@ void DocxAttributeOutput::EmbedFont( std::u16string_view name, FontFamily family { if( !m_rExport.m_rDoc.getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS )) return; // no font embedding with this document -EmbedFontStyle( name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch ); -EmbedFontStyle( name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch ); -EmbedFontStyle( name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch ); +bool foundFont += EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_NORMAL, pitch); +foundFont += EmbedFontStyle(name, XML_embedBold, family, ITALIC_NONE, WEIGHT_BOLD, pitch) || foundFont; +foundFont = EmbedFontStyle(name, XML_embedItalic, family, ITALIC_NORMAL, WEIGHT_NORMAL, pitch) +|| foundFont; +foundFont = EmbedFontStyle(name, XML_embedBoldItalic, family, ITALIC_NORMAL, WEIGHT_BOLD, pitch) +|| foundFont; +if (!foundFont) +EmbedFontStyle(name, XML_embedRegular, family, ITALIC_NONE, WEIGHT_DONTKNOW, pitch); } static char toHexChar( int value ) @@ -7270,21 +7276,21 @@ static char toHexChar( int value ) return value >= 10 ? value + 'A' - 10 : value + '0'; } -void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, FontFamily family, FontItalic italic, -FontWeight weight, FontPitch pitch ) +bool DocxAttributeOutput::EmbedFontStyle(std::u16string_view name, int tag, FontFamily family, + FontItalic italic, FontWeight weight, FontPitch pitch) { // Embed font if at least viewing is allowed (in which case the opening app must check // the font license rights too and open either read-only or not use the font for editing). OUString fontUrl = EmbeddedFontsHelper::fontFileUrl( name, family, italic, weight, pitch, EmbeddedFontsHelper::FontRights::ViewingAllowed ); if( fontUrl.isEmpty()) -return; +return false; // TODO IDocumentSettingAccess::EMBED_SYSTEM_FONTS if( !m_FontFilesMap.count( fontUrl )) { osl::File file( fontUrl ); if( file.open( osl_File_OpenFlag_Read ) != osl::File::E_None ) -return; +return false; uno::Reference< css::io::XOutputStream > xOutStream = m_rExport.GetFilter().openFragmentStream( "word/fonts/font" + OUString::number(m_nextFontId) + ".odttf", "application/vnd.openxmlformats-officedocument.obfuscatedFont" ); @@ -7303,7 +7309,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Font file size too small (" << fontUrl << ")" ); xOutStream->closeOutput(); -return; +return false; } for( int i = 0; i < 16; @@ -7320,7 +7326,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( eof ) break; @@ -7328,7 +7334,7 @@ void DocxAttributeOutput::EmbedFontStyle( std::u16string_view name, int tag, Fon { SAL_WARN( "sw.ww8", "Error reading font file " << fontUrl ); xOutStream->closeOutput(); -return; +return false; } if( readSize == 0 ) break; @@ -7348,6 +7354,7 @@ void DocxAttributeOutput::EmbedFontStyle(
core.git: Branch 'distro/collabora/co-22.05' - vcl/jsdialog
vcl/jsdialog/enabled.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit e8ca2d11cf62d78ba1bc3aa9afb57b010a9002cf Author: Jaume Pujantell AuthorDate: Mon Jan 8 17:20:28 2024 +0100 Commit: Miklos Vajna CommitDate: Thu Jan 11 13:46:48 2024 +0100 cool#7996 enable jsdialog for font page in document properties The checkboxes of font page on the document properties dialog were not saving the changes after pressing ok. Change-Id: I5e7d16de267dd5d6874a84b518f6ec769db4fcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161795 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 545d512a5f7b866696b3a4dfc0e00748029d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161862 diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index 6969dace6f58..986769af39e8 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -85,6 +85,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" +|| rUIFile == u"sfx/ui/documentfontspage.ui" || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui" || rUIFile == u"sfx/ui/linefragment.ui"
core.git: vcl/jsdialog
vcl/jsdialog/enabled.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 54ef7f9ea9e6d0c62076b4fc296ea1feb506b309 Author: Jaume Pujantell AuthorDate: Mon Jan 8 17:20:28 2024 +0100 Commit: Miklos Vajna CommitDate: Thu Jan 11 13:45:55 2024 +0100 cool#7996 enable jsdialog for font page in document properties The checkboxes of font page on the document properties dialog were not saving the changes after pressing ok. Change-Id: I5e7d16de267dd5d6874a84b518f6ec769db4fcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161795 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna (cherry picked from commit 545d512a5f7b866696b3a4dfc0e00748029d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161863 Tested-by: Jenkins diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index d5997c9c6a9f..058880a97835 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -227,6 +227,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" +|| rUIFile == u"sfx/ui/documentfontspage.ui" || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui" || rUIFile == u"svx/ui/headfootformatpage.ui"
core.git: Branch 'distro/collabora/co-23.05' - vcl/jsdialog
vcl/jsdialog/enabled.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 545d512a5f7b866696b3a4dfc0e00748029d Author: Jaume Pujantell AuthorDate: Mon Jan 8 17:20:28 2024 +0100 Commit: Miklos Vajna CommitDate: Wed Jan 10 14:54:42 2024 +0100 cool#7996 enable jsdialog for font page in document properties The checkboxes of font page on the document properties dialog were not saving the changes after pressing ok. Change-Id: I5e7d16de267dd5d6874a84b518f6ec769db4fcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161795 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index d5997c9c6a9f..058880a97835 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -227,6 +227,7 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"sfx/ui/custominfopage.ui" || rUIFile == u"sfx/ui/descriptioninfopage.ui" || rUIFile == u"sfx/ui/documentinfopage.ui" +|| rUIFile == u"sfx/ui/documentfontspage.ui" || rUIFile == u"sfx/ui/documentpropertiesdialog.ui" || rUIFile == u"sfx/ui/editdurationdialog.ui" || rUIFile == u"svx/ui/headfootformatpage.ui"
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - writerfilter/qa writerfilter/source
writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx |6 ++ writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx |binary writerfilter/source/dmapper/DomainMapper.cxx| 26 +++--- writerfilter/source/dmapper/SdtHelper.cxx |1 4 files changed, 16 insertions(+), 17 deletions(-) New commits: commit a8ee639d256315e730bc4014dcca0d78f2de686f Author: Jaume Pujantell AuthorDate: Wed Nov 22 11:59:09 2023 +0100 Commit: Miklos Vajna CommitDate: Thu Nov 23 14:09:33 2023 +0100 fix a regression crash from commit 5082d50 The commit generated crashes in the crashtest documents 7711 bugtrackers/docx/fdo78333-1.docx and 695 forums/docx/forum-mso-en-4096.docx. This was due to "m_xFieldStartRange", the start of the text portion of the block SDT, being recorded too early. This led to including characters that shouldn't be there in the generated content control. This patch moves the calls to setFieldStartRange to just before the first appendTextPortion call. Change-Id: I7230346fee9a37ebac70beb9bcafd9d7b612eb00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159816 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 7c4dba1deffd81f647a4a3be7a79f68f3bf9f1ba) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159761 Tested-by: Jenkins CollaboraOffice diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx index 7cafcd19f280..ec771ba0f1b4 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx @@ -149,6 +149,12 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtBlockText) xContentControlProps->getPropertyValue("Alias") >>= aAlias; CPPUNIT_ASSERT_EQUAL(OUString("myalias"), aAlias); } + +CPPUNIT_TEST_FIXTURE(Test, testFdo78333) +{ +// just care that it doesn't crash/assert +loadFromURL(u"fdo78333-1-minimized.docx"); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx b/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx new file mode 100644 index ..0c4a5bc67288 Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx differ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 0c5f5d855261..9f279469362f 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1190,9 +1190,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) m_pImpl->PushSdt(); break; } -if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText -&& GetCurrentTextRange().is()) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); m_pImpl->SetSdt(true); } break; @@ -4115,7 +4112,6 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) { m_pImpl->m_pSdtHelper->createPlainTextControl(); finishParagraph(); - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); return; } } @@ -4369,10 +4365,9 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) m_pImpl->clearDeferredBreaks(); } -bool bSdtBlockUnusedText -= m_pImpl->m_pSdtHelper->GetSdtType() != NS_ooxml::LN_CT_SdtRun_sdtContent - && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText - && m_pImpl->m_pSdtHelper->hasUnusedText(); +bool bInSdtBlockText += m_pImpl->m_pSdtHelper->GetSdtType() == NS_ooxml::LN_CT_SdtBlock_sdtContent + && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText; if (pContext && pContext->GetFootnote().is()) { pContext->GetFootnote()->setLabel( sText ); @@ -4382,32 +4377,29 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) } else if (m_pImpl->IsOpenFieldCommand() && !m_pImpl->IsForceGenericFields()) { -if (bSdtBlockUnusedText) +if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()) m_pImpl->m_pSdtHelper->createPlainTextControl(); m_pImpl->AppendFieldCommand(sText); -if (bSdtBlockUnusedText) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); } else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString()) { -if
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/qa sw/source
sw/qa/core/unocore/data/tdf108272-1-minimal.docx |binary sw/qa/core/unocore/unocore.cxx |6 ++ sw/source/core/unocore/unotext.cxx |1 + 3 files changed, 7 insertions(+) New commits: commit 9201a9f0aa239b4a2fce17b7c45175590855f349 Author: Jaume Pujantell AuthorDate: Mon Nov 20 10:24:18 2023 +0100 Commit: Miklos Vajna CommitDate: Thu Nov 23 14:09:02 2023 +0100 fix a regression crash Fixes a crash introduced by commit 5082d50 in crashtesting file 7693 bugtrackers/docx/tdf108272-1.docx. Change-Id: Id33c49165c4d345d652a546db14df98ee0ff754a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159736 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit 43868de0ddabba952b923f6189d1fefeddb70bcf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159760 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/qa/core/unocore/data/tdf108272-1-minimal.docx b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx new file mode 100644 index ..28efdf65b9af Binary files /dev/null and b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx differ diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index f3b102f096cc..dd4d71eda57c 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -932,6 +932,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testCollectFrameAtNodeWithLayout) assertXPath(pXmlDoc, "//draw:frame", 1); } +// just care that it doesn't crash/assert +CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf108272Crash) +{ +createSwDoc("tdf108272-1-minimal.docx"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 98b9cecbf57c..3f8cf8dee72c 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1690,6 +1690,7 @@ SwXText::convertToTextFrame( (pStartStartNode != GetStartNode())) { // if not - remove the additional paragraphs and throw +oAnchorCheckPam.reset(); // clear SwIndex before deleting nodes if (bParaBeforeInserted) { SwCursor aDelete(*pStartPam->GetPoint(), nullptr);
[Libreoffice-commits] core.git: writerfilter/qa writerfilter/source
writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx |6 ++ writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx |binary writerfilter/source/dmapper/DomainMapper.cxx| 26 +++--- writerfilter/source/dmapper/SdtHelper.cxx |1 4 files changed, 16 insertions(+), 17 deletions(-) New commits: commit 7c4dba1deffd81f647a4a3be7a79f68f3bf9f1ba Author: Jaume Pujantell AuthorDate: Wed Nov 22 11:59:09 2023 +0100 Commit: Miklos Vajna CommitDate: Thu Nov 23 08:27:57 2023 +0100 fix a regression crash from commit 5082d50 The commit generated crashes in the crashtest documents 7711 bugtrackers/docx/fdo78333-1.docx and 695 forums/docx/forum-mso-en-4096.docx. This was due to "m_xFieldStartRange", the start of the text portion of the block SDT, being recorded too early. This led to including characters that shouldn't be there in the generated content control. This patch moves the calls to setFieldStartRange to just before the first appendTextPortion call. Change-Id: I7230346fee9a37ebac70beb9bcafd9d7b612eb00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159816 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx index 7cafcd19f280..ec771ba0f1b4 100644 --- a/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx +++ b/writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx @@ -149,6 +149,12 @@ CPPUNIT_TEST_FIXTURE(Test, testSdtBlockText) xContentControlProps->getPropertyValue("Alias") >>= aAlias; CPPUNIT_ASSERT_EQUAL(OUString("myalias"), aAlias); } + +CPPUNIT_TEST_FIXTURE(Test, testFdo78333) +{ +// just care that it doesn't crash/assert +loadFromURL(u"fdo78333-1-minimized.docx"); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx b/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx new file mode 100644 index ..0c4a5bc67288 Binary files /dev/null and b/writerfilter/qa/cppunittests/dmapper/data/fdo78333-1-minimized.docx differ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index e2ef4ec4a4b2..70fc7820844c 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1192,9 +1192,6 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) m_pImpl->PushSdt(); break; } -if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText -&& GetCurrentTextRange().is()) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); m_pImpl->SetSdt(true); } break; @@ -4229,7 +4226,6 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) { m_pImpl->m_pSdtHelper->createPlainTextControl(); finishParagraph(); - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); return; } } @@ -4487,10 +4483,9 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) m_pImpl->clearDeferredBreaks(); } -bool bSdtBlockUnusedText -= m_pImpl->m_pSdtHelper->GetSdtType() != NS_ooxml::LN_CT_SdtRun_sdtContent - && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText - && m_pImpl->m_pSdtHelper->hasUnusedText(); +bool bInSdtBlockText += m_pImpl->m_pSdtHelper->GetSdtType() == NS_ooxml::LN_CT_SdtBlock_sdtContent + && m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::plainText; if (pContext && pContext->GetFootnote().is()) { pContext->GetFootnote()->setLabel( sText ); @@ -4500,32 +4495,29 @@ void DomainMapper::lcl_utext(const sal_Unicode *const data_, size_t len) } else if (m_pImpl->IsOpenFieldCommand() && !m_pImpl->IsForceGenericFields()) { -if (bSdtBlockUnusedText) +if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText()) m_pImpl->m_pSdtHelper->createPlainTextControl(); m_pImpl->AppendFieldCommand(sText); -if (bSdtBlockUnusedText) - m_pImpl->m_pSdtHelper->setFieldStartRange(GetCurrentTextRange()->getEnd()); } else if( m_pImpl->IsOpenField() && m_pImpl->IsFieldResultAsString()) { -if (bSdtBlockUnusedText) +if (bInSdtBlockText && m_pImpl->m_pSdtHelper->hasUnusedText())
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/core/unocore/data/tdf108272-1-minimal.docx |binary sw/qa/core/unocore/unocore.cxx |6 ++ sw/source/core/unocore/unotext.cxx |1 + 3 files changed, 7 insertions(+) New commits: commit 43868de0ddabba952b923f6189d1fefeddb70bcf Author: Jaume Pujantell AuthorDate: Mon Nov 20 10:24:18 2023 +0100 Commit: Jaume Pujantell CommitDate: Mon Nov 20 12:18:23 2023 +0100 fix a regression crash Fixes a crash introduced by commit 5082d50. Change-Id: Id33c49165c4d345d652a546db14df98ee0ff754a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159736 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/sw/qa/core/unocore/data/tdf108272-1-minimal.docx b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx new file mode 100644 index ..28efdf65b9af Binary files /dev/null and b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx differ diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx index fd5c139e979a..00c61a042b77 100644 --- a/sw/qa/core/unocore/unocore.cxx +++ b/sw/qa/core/unocore/unocore.cxx @@ -1025,6 +1025,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf149555) CPPUNIT_ASSERT_EQUAL(OUString("HEADER 2"), xHeaderText->getString()); } +// just care that it doesn't crash/assert +CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf108272Crash) +{ +createSwDoc("tdf108272-1-minimal.docx"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 5fef89f3ffde..f959d6a6104c 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1579,6 +1579,7 @@ SwXText::convertToTextFrame( (pStartStartNode != GetStartNode())) { // if not - remove the additional paragraphs and throw +oAnchorCheckPam.reset(); // clear SwIndex before deleting nodes if (bParaBeforeInserted) { SwCursor aDelete(*pStartPam->GetPoint(), nullptr);
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - offapi/com sw/inc sw/qa sw/source writerfilter/qa writerfilter/source
offapi/com/sun/star/text/ContentControl.idl |6 sw/inc/formatcontentcontrol.hxx |9 sw/inc/unoprnms.hxx |1 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx| 33 --- sw/qa/extras/ooxmlexport/ooxmlexport18.cxx|5 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |3 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |2 sw/source/core/txtnode/attrcontentcontrol.cxx |3 sw/source/core/unocore/unocontentcontrol.cxx | 28 ++ sw/source/core/unocore/unomap1.cxx|1 sw/source/filter/ww8/docxattributeoutput.cxx |6 writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx | 30 ++ writerfilter/qa/cppunittests/dmapper/data/sdt-block-text.docx |binary writerfilter/source/dmapper/DomainMapper.cxx | 30 ++ writerfilter/source/dmapper/SdtHelper.cxx | 108 -- writerfilter/source/dmapper/SdtHelper.hxx | 13 - 16 files changed, 220 insertions(+), 58 deletions(-) New commits: commit 2f60fa7ccdefd76b61e1c7b7cc27ae92824111da Author: Jaume Pujantell AuthorDate: Wed Sep 13 08:58:21 2023 +0200 Commit: Miklos Vajna CommitDate: Thu Oct 12 08:21:39 2023 +0200 writerfilter: use content controls for text in block SDTs Text inside block SDTs was shown as Text Fields wich ignored properties such as alias and formatting. Now those texts are imported as content controls like in the case of run SDTs. Added the ability for content controls to remember and export the "multiline" property of block SDT text. Some existing tests have been changed due to some different export results. Change-Id: Ice1eb4ca6dd53c99d5abb239371f8ac896c3b6e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156867 Reviewed-by: Miklos Vajna Tested-by: Jenkins (cherry picked from commit f974779b18609c35e548c27118827af20e55306a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157787 Tested-by: Jenkins CollaboraOffice diff --git a/offapi/com/sun/star/text/ContentControl.idl b/offapi/com/sun/star/text/ContentControl.idl index c2fe46757656..41f538415af9 100644 --- a/offapi/com/sun/star/text/ContentControl.idl +++ b/offapi/com/sun/star/text/ContentControl.idl @@ -147,6 +147,12 @@ service ContentControl @since LibreOffice 7.6 */ [optional, property] string Lock; + +/** Indicates if the control accepts soft breaks. + +@since LibreOffice 24.2 +*/ +[optional, property] string MultiLine; }; diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx index d0801f671cd3..9bad2bd23ff3 100644 --- a/sw/inc/formatcontentcontrol.hxx +++ b/sw/inc/formatcontentcontrol.hxx @@ -173,7 +173,7 @@ class SW_DLLPUBLIC SwContentControl : public sw::BroadcastingModify /// The appearance: just remembered. OUString m_aAppearance; -/// The alias: just remembered. +/// The alias. OUString m_aAlias; /// The tag: just remembered. @@ -188,6 +188,9 @@ class SW_DLLPUBLIC SwContentControl : public sw::BroadcastingModify /// The control and content locks: mostly just remembered. OUString m_aLock; +/// The multiline property: just remembered. +OUString m_aMultiLine; + /// Stores a list item index, in case the doc model is not yet updated. // i.e. temporarily store the selected item until the text is inserted by GotoContentControl. std::optional m_oSelectedListItem; @@ -389,6 +392,10 @@ public: // At the implementation level, define whether the user can directly modify the contents. bool GetReadWrite() const { return m_bReadWrite; } +void SetMultiLine(const OUString& rMultiline) { m_aMultiLine = rMultiline; } + +const OUString& GetMultiLine() const { return m_aMultiLine; } + SwContentControlType GetType() const; }; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index d72883efdb9f..9d484371ed5f 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -942,6 +942,7 @@ inline constexpr OUStringLiteral UNO_NAME_TAG = u"Tag"; inline constexpr OUStringLiteral UNO_NAME_ID = u"Id"; inline constexpr OUStringLiteral UNO_NAME_TAB_INDEX = u"TabIndex"; inline constexpr OUStringLiteral UNO_NAME_LOCK = u"Lock"; +inline constexpr OUStringLiteral UNO_NAME_MULTILINE = u"MultiLine"; inline constexpr OUStringLiteral UNO_NAME_DATE_STRING = u"DateString"; inline constexpr OUStringLiteral UNO_NAME_PARA_ID = u"ParaId"; inline constexpr OUStringLiteral UNO_NAME_PARA_ID_PARENT = u"ParaIdParent"; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 0c3ff64e52f7..c8d37ee0e1c7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++
[Libreoffice-commits] core.git: offapi/com sw/inc sw/qa sw/source writerfilter/qa writerfilter/source
offapi/com/sun/star/text/ContentControl.idl |6 sw/inc/formatcontentcontrol.hxx |9 sw/inc/unoprnms.hxx |1 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx| 30 -- sw/qa/extras/ooxmlexport/ooxmlexport19.cxx|5 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx |3 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |2 sw/source/core/txtnode/attrcontentcontrol.cxx |3 sw/source/core/unocore/unocontentcontrol.cxx | 28 ++ sw/source/core/unocore/unomap1.cxx|1 sw/source/filter/ww8/docxattributeoutput.cxx |6 writerfilter/qa/cppunittests/dmapper/DomainMapper.cxx | 30 ++ writerfilter/qa/cppunittests/dmapper/data/sdt-block-text.docx |binary writerfilter/source/dmapper/DomainMapper.cxx | 30 ++ writerfilter/source/dmapper/SdtHelper.cxx | 109 -- writerfilter/source/dmapper/SdtHelper.hxx | 13 - 16 files changed, 221 insertions(+), 55 deletions(-) New commits: commit 5082d50d24c3fec4487c724a15eb0d54a82ecd0d Author: Jaume Pujantell AuthorDate: Wed Sep 13 08:58:21 2023 +0200 Commit: Jaume Pujantell CommitDate: Wed Oct 11 15:19:58 2023 +0200 writerfilter: use content controls for text in block SDTs Text inside block SDTs was shown as Text Fields wich ignored properties such as alias and formatting. Now those texts are imported as content controls like in the case of run SDTs. Added the ability for content controls to remember and export the "multiline" property of block SDT text. Some existing tests have been changed due to some different export results. Change-Id: Ice1eb4ca6dd53c99d5abb239371f8ac896c3b6e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156867 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/offapi/com/sun/star/text/ContentControl.idl b/offapi/com/sun/star/text/ContentControl.idl index 34beff3cb127..6f6aa80ca54d 100644 --- a/offapi/com/sun/star/text/ContentControl.idl +++ b/offapi/com/sun/star/text/ContentControl.idl @@ -147,6 +147,12 @@ service ContentControl @since LibreOffice 7.6 */ [optional, property] string Lock; + +/** Indicates if the control accepts soft breaks. + +@since LibreOffice 24.2 +*/ +[optional, property] string MultiLine; }; diff --git a/sw/inc/formatcontentcontrol.hxx b/sw/inc/formatcontentcontrol.hxx index 190d0bd540fe..cffe326d0703 100644 --- a/sw/inc/formatcontentcontrol.hxx +++ b/sw/inc/formatcontentcontrol.hxx @@ -173,7 +173,7 @@ class SW_DLLPUBLIC SwContentControl final : public sw::BroadcastingModify /// The appearance: just remembered. OUString m_aAppearance; -/// The alias: just remembered. +/// The alias. OUString m_aAlias; /// The tag: just remembered. @@ -188,6 +188,9 @@ class SW_DLLPUBLIC SwContentControl final : public sw::BroadcastingModify /// The control and content locks: mostly just remembered. OUString m_aLock; +/// The multiline property: just remembered. +OUString m_aMultiLine; + /// Stores a list item index, in case the doc model is not yet updated. // i.e. temporarily store the selected item until the text is inserted by GotoContentControl. std::optional m_oSelectedListItem; @@ -389,6 +392,10 @@ public: // At the implementation level, define whether the user can directly modify the contents. bool GetReadWrite() const { return m_bReadWrite; } +void SetMultiLine(const OUString& rMultiline) { m_aMultiLine = rMultiline; } + +const OUString& GetMultiLine() const { return m_aMultiLine; } + SwContentControlType GetType() const; }; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 6553153b459d..630028f0e7a6 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -941,6 +941,7 @@ inline constexpr OUStringLiteral UNO_NAME_TAG = u"Tag"; inline constexpr OUStringLiteral UNO_NAME_ID = u"Id"; inline constexpr OUStringLiteral UNO_NAME_TAB_INDEX = u"TabIndex"; inline constexpr OUStringLiteral UNO_NAME_LOCK = u"Lock"; +inline constexpr OUStringLiteral UNO_NAME_MULTILINE = u"MultiLine"; inline constexpr OUStringLiteral UNO_NAME_DATE_STRING = u"DateString"; inline constexpr OUStringLiteral UNO_NAME_PARA_ID = u"ParaId"; inline constexpr OUStringLiteral UNO_NAME_PARA_ID_PARENT = u"ParaIdParent"; diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 90c3c750c53c..6d3d0452740a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -683,28 +683,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123642_BookmarkAtDocEnd, "tdf123642.docx") DECLARE_OOXMLEXPORT_TEST(testTdf148361,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sc/qa sc/source
sc/qa/unit/uicalc/uicalc2.cxx | 27 ++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 245 insertions(+), 157 deletions(-) New commits: commit 39aa1f6424390821579bfb6b6ba14e9ce11040ce Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Xisco Fauli CommitDate: Thu Aug 3 10:31:14 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154093 Tested-by: Jenkins Reviewed-by: Jaume Pujantell (cherry picked from commit 341029de72cf957b7bc7775e51544070d4a49874) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154126 diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index 1ec77ad7ad37..ea5956c2bf81 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -1445,6 +1445,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf156174) CPPUNIT_ASSERT(!pDBs->empty()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf155796) +{ +createScDoc(); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = getViewShell()->GetViewData().GetMarkData().GetMarkedRanges(); +ScDocument* pDoc = getScDoc(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, , pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 6b1cfef156f7..442dc92ccb73 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -pDoc->SkipOverlapped(rCol, rRow, nTab); -} +SCROW rowStart = std::min(rRow, nStartY); +
[Libreoffice-commits] core.git: desktop/source sfx2/source
desktop/source/lib/init.cxx | 21 + sfx2/source/doc/sfxbasemodel.cxx | 18 +- 2 files changed, 38 insertions(+), 1 deletion(-) New commits: commit a52ba26e6a3567a1f63aeb8d20c084eb286974b4 Author: Jaume Pujantell AuthorDate: Fri Jul 14 09:11:07 2023 +0200 Commit: Caolán McNamara CommitDate: Fri Jul 28 10:04:50 2023 +0200 Added possibility to set password on save through arguments Change-Id: I579ed7487f87515a21d83912d9c0d12e9edc5eea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154415 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 8d830c0cbd00..6e8c0db99223 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3270,6 +3270,23 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha bool bFullSheetPreview = sFullSheetPreview == u"true"; +OUString filePassword; +if ((aIndex = aFilterOptions.indexOf(",Password=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDEND"); +filePassword = aFilterOptions.subView(aIndex + 10, bIndex - (aIndex + 10)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 11); +} +OUString filePasswordToModify; +if ((aIndex = aFilterOptions.indexOf(",PasswordToModify=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDTOMODIFYEND"); +filePassword = aFilterOptions.subView(aIndex + 18, bIndex - (aIndex + 18)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 19); +} + // Select a pdf version if specified a valid one. If not specified then ignore. // If invalid then fail. sal_Int32 pdfVer = 0; @@ -3344,6 +3361,10 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha { aSaveMediaDescriptor["FilterData"] <<= aFilterDataMap.getAsConstPropertyValueList(); } +if (!filePassword.isEmpty()) +aSaveMediaDescriptor["Password"] <<= filePassword; +if (!filePasswordToModify.isEmpty()) +aSaveMediaDescriptor["PasswordToModify"] <<= filePasswordToModify; // add interaction handler too if (gImpl) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 2b34d5fd5b46..ac0de0cc89a5 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -131,6 +131,7 @@ #include #include "printhelper.hxx" #include +#include #include #include #include @@ -3046,13 +3047,13 @@ void SfxBaseModel::impl_store( const OUString& sURL throw frame::IllegalArgumentIOException(); bool bSaved = false; +::comphelper::SequenceAsHashMap aArgHash(seqArguments); if ( !bSaveTo && m_pData->m_pObjectShell.is() && !sURL.isEmpty() && !sURL.startsWith( "private:stream" ) && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) ) { // this is the same file URL as the current document location, try to use storeOwn if possible -::comphelper::SequenceAsHashMap aArgHash( seqArguments ); static constexpr OUStringLiteral aFilterString( u"FilterName" ); const OUString aFilterName( aArgHash.getUnpackedValueOrDefault( aFilterString, OUString() ) ); if ( !aFilterName.isEmpty() ) @@ -3122,11 +3123,26 @@ void SfxBaseModel::impl_store( const OUString& sURL SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDoc : SfxEventHintId::SaveAsDoc, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), m_pData->m_pObjectShell.get() ) ); +const OUString aFilterName(aArgHash.getUnpackedValueOrDefault("FilterName", OUString())); +OUString aPassword, aPasswordToModify; +if (!aArgHash.getUnpackedValueOrDefault("EncryptionData", Sequence()) + .hasElements()) +aPassword = aArgHash.getUnpackedValueOrDefault("Password", OUString()); +if (!aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", Sequence()) + .hasElements() +&& aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", static_cast(0)) == 0) +aPasswordToModify = aArgHash.getUnpackedValueOrDefault("PasswordToModify", OUString()); +aArgHash.erase("PasswordToModify"); + std::optional pItemSet(SfxGetpApp()->GetPool()); pItemSet->Put(SfxStringItem(SID_FILE_NAME, sURL)); if ( bSaveTo ) pItemSet->Put(SfxBoolItem(SID_SAVETO, true)); +if (!aFilterName.isEmpty() && (!aPassword.isEmpty() ||
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - desktop/source sfx2/source
desktop/source/lib/init.cxx | 21 + sfx2/source/doc/sfxbasemodel.cxx | 18 +- 2 files changed, 38 insertions(+), 1 deletion(-) New commits: commit b95739d70806c121cdc38e4e3eb86683e1581c57 Author: Jaume Pujantell AuthorDate: Fri Jul 14 09:11:07 2023 +0200 Commit: Caolán McNamara CommitDate: Fri Jul 28 10:05:03 2023 +0200 Added possibility to set password on save throug arguments Change-Id: I579ed7487f87515a21d83912d9c0d12e9edc5eea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154433 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c1ebf5d934ea..112b134b5e84 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3308,6 +3308,23 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha bool bFullSheetPreview = sFullSheetPreview == u"true"; +OUString filePassword; +if ((aIndex = aFilterOptions.indexOf(",Password=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDEND"); +filePassword = aFilterOptions.subView(aIndex + 10, bIndex - (aIndex + 10)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 11); +} +OUString filePasswordToModify; +if ((aIndex = aFilterOptions.indexOf(",PasswordToModify=")) >= 0) +{ +int bIndex = aFilterOptions.indexOf("PASSWORDTOMODIFYEND"); +filePassword = aFilterOptions.subView(aIndex + 18, bIndex - (aIndex + 18)); +aFilterOptions = OUString::Concat(aFilterOptions.subView(0, aIndex)) + + aFilterOptions.subView(bIndex + 19); +} + // Select a pdf version if specified a valid one. If not specified then ignore. // If invalid then fail. sal_Int32 pdfVer = 0; @@ -3382,6 +3399,10 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha { aSaveMediaDescriptor["FilterData"] <<= aFilterDataMap.getAsConstPropertyValueList(); } +if (!filePassword.isEmpty()) +aSaveMediaDescriptor["Password"] <<= filePassword; +if (!filePasswordToModify.isEmpty()) +aSaveMediaDescriptor["PasswordToModify"] <<= filePasswordToModify; // add interaction handler too if (gImpl) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 8a539f660409..f5759950d29b 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -129,6 +129,7 @@ #include #include "printhelper.hxx" #include +#include #include #include #include @@ -3023,13 +3024,13 @@ void SfxBaseModel::impl_store( const OUString& sURL throw frame::IllegalArgumentIOException(); bool bSaved = false; +::comphelper::SequenceAsHashMap aArgHash(seqArguments); if ( !bSaveTo && m_pData->m_pObjectShell.is() && !sURL.isEmpty() && !sURL.startsWith( "private:stream" ) && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) ) { // this is the same file URL as the current document location, try to use storeOwn if possible -::comphelper::SequenceAsHashMap aArgHash( seqArguments ); static const OUStringLiteral aFilterString( u"FilterName" ); const OUString aFilterName( aArgHash.getUnpackedValueOrDefault( aFilterString, OUString() ) ); if ( !aFilterName.isEmpty() ) @@ -3099,11 +3100,26 @@ void SfxBaseModel::impl_store( const OUString& sURL SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SfxEventHintId::SaveToDoc : SfxEventHintId::SaveAsDoc, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), m_pData->m_pObjectShell.get() ) ); +const OUString aFilterName(aArgHash.getUnpackedValueOrDefault("FilterName", OUString())); +OUString aPassword, aPasswordToModify; +if (!aArgHash.getUnpackedValueOrDefault("EncryptionData", Sequence()) + .hasElements()) +aPassword = aArgHash.getUnpackedValueOrDefault("Password", OUString()); +if (!aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", Sequence()) + .hasElements() +&& aArgHash.getUnpackedValueOrDefault("ModifyPasswordInfo", static_cast(0)) == 0) +aPasswordToModify = aArgHash.getUnpackedValueOrDefault("PasswordToModify", OUString()); +aArgHash.erase("PasswordToModify"); + std::optional pItemSet(SfxGetpApp()->GetPool()); pItemSet->Put(SfxStringItem(SID_FILE_NAME, sURL)); if ( bSaveTo ) pItemSet->Put(SfxBoolItem(SID_SAVETO, true)); +if (!aFilterName.isEmpty() && (!aPassword.isEmpty() ||
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 27 ++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 245 insertions(+), 157 deletions(-) New commits: commit d161b4b1290c42dfe4b7c7951408fa712c185a44 Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Jaume Pujantell CommitDate: Fri Jul 7 08:59:49 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154047 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice Reviewed-by: Jaume Pujantell diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 19aa8a703943..9e1459d7fca6 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -3037,6 +3037,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152577) CPPUNIT_ASSERT(!pDBs->empty()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf155796) +{ +createScDoc(); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = getViewShell()->GetViewData().GetMarkData().GetMarkedRanges(); +ScDocument* pDoc = getScDoc(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, , pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 6b1cfef156f7..442dc92ccb73 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -pDoc->SkipOverlapped(rCol, rRow, nTab); -} +SCROW rowStart = std::min(rRow, nStartY); +SCROW rowEnd = std::max(rRow, nStartY); -if (nOld < rCol) +for
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 29 +++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 247 insertions(+), 157 deletions(-) New commits: commit c5a98bb91b4994b2197a104bf209f0d77596ec16 Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Jaume Pujantell CommitDate: Fri Jul 7 09:00:01 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154048 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice Reviewed-by: Jaume Pujantell diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 056a34e9b4e8..6f1c490b90f4 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1997,6 +1997,35 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testUnallocatedColumnsAttributes) CPPUNIT_ASSERT_EQUAL_MESSAGE("font should be bold", WEIGHT_BOLD, aFont.GetWeight()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf155796) +{ +mxComponent = loadFromDesktop("private:factory/scalc"); +ScModelObj* pModelObj = dynamic_cast(mxComponent.get()); +CPPUNIT_ASSERT(pModelObj); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = ScDocShell::GetViewData()->GetMarkData().GetMarkedRanges(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, , pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 226023b2914e..6e5ee8527d54 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/uicalc/uicalc2.cxx | 27 ++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 245 insertions(+), 157 deletions(-) New commits: commit 341029de72cf957b7bc7775e51544070d4a49874 Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Jaume Pujantell CommitDate: Fri Jul 7 08:59:31 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154093 Tested-by: Jenkins Reviewed-by: Jaume Pujantell diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index 3be123de219d..44ebf12935bc 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -1419,6 +1419,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf152577) CPPUNIT_ASSERT(!pDBs->empty()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf155796) +{ +createScDoc(); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = getViewShell()->GetViewData().GetMarkData().GetMarkedRanges(); +ScDocument* pDoc = getScDoc(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, , pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 6b1cfef156f7..442dc92ccb73 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -pDoc->SkipOverlapped(rCol, rRow, nTab); -} +SCROW rowStart = std::min(rRow, nStartY); +SCROW rowEnd = std::max(rRow, nStartY); -if (nOld < rCol) +for (SCROW i = rowStart; i <= rowEnd && rCol <
[Libreoffice-commits] core.git: include/LibreOfficeKit libreofficekit/source sfx2/source
include/LibreOfficeKit/LibreOfficeKitEnums.h | 10 +- libreofficekit/source/gtk/lokdocview.cxx |1 + sfx2/source/dialog/dinfdlg.cxx |8 3 files changed, 18 insertions(+), 1 deletion(-) New commits: commit bbf5f97967fb3cde25829e1c428ace31d7d5b8c7 Author: Jaume Pujantell AuthorDate: Wed May 10 23:19:04 2023 +0200 Commit: Andras Timar CommitDate: Fri Jun 9 09:50:10 2023 +0200 notify async password change Change-Id: I2d16c9804e65f093239e810d466de35286b28dee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151651 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index d6e46e96aee1..d2a03c8ce9b6 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -960,7 +960,13 @@ typedef enum /** * Informs the LibreOfficeKit client that the color palettes have changed. */ -LOK_CALLBACK_COLOR_PALETTES = 65 +LOK_CALLBACK_COLOR_PALETTES = 65, + +/** + * Informs that the document password has been succesfully changed. + * The payload contains the the new password and the type. +*/ +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66 } LibreOfficeKitCallbackType; @@ -1121,6 +1127,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED"; case LOK_CALLBACK_COLOR_PALETTES: return "LOK_CALLBACK_COLOR_PALETTES"; +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: +return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 305ac5a477d2..7245c8e2096f 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1492,6 +1492,7 @@ callback (gpointer pData) case LOK_CALLBACK_A11Y_CARET_CHANGED: case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED: case LOK_CALLBACK_COLOR_PALETTES: +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: { // TODO: Implement me break; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 7d97ab8b3ba8..f702c2ec10c1 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include @@ -71,6 +73,7 @@ #include #include #include +#include #include #include @@ -792,6 +795,11 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) { sfx2::SetPassword(pFilter, pMedSet, m_xPasswordDialog->GetPasswordToOpen(), m_xPasswordDialog->GetPasswordToOpen(), true); +tools::JsonWriter payloadJson; +payloadJson.put("password", m_xPasswordDialog->GetPasswordToOpen()); +payloadJson.put("isToModify", false); +pShell->GetViewShell()->libreOfficeKitViewCallback( +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET, payloadJson.finishAndGetAsOString()); pShell->SetModified(); } m_xPasswordDialog->disposeOnce();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/LibreOfficeKit libreofficekit/source sfx2/source
include/LibreOfficeKit/LibreOfficeKitEnums.h | 10 +- libreofficekit/source/gtk/lokdocview.cxx |1 + sfx2/source/dialog/dinfdlg.cxx |9 + 3 files changed, 19 insertions(+), 1 deletion(-) New commits: commit 5ec8b322107480075e6edae2711e87ca59ed5eef Author: Jaume Pujantell AuthorDate: Wed May 10 23:19:04 2023 +0200 Commit: Andras Timar CommitDate: Thu Jun 8 21:55:25 2023 +0200 notify async password change Change-Id: I2d16c9804e65f093239e810d466de35286b28dee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152653 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index d6e46e96aee1..d2a03c8ce9b6 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -960,7 +960,13 @@ typedef enum /** * Informs the LibreOfficeKit client that the color palettes have changed. */ -LOK_CALLBACK_COLOR_PALETTES = 65 +LOK_CALLBACK_COLOR_PALETTES = 65, + +/** + * Informs that the document password has been succesfully changed. + * The payload contains the the new password and the type. +*/ +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 66 } LibreOfficeKitCallbackType; @@ -1121,6 +1127,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED"; case LOK_CALLBACK_COLOR_PALETTES: return "LOK_CALLBACK_COLOR_PALETTES"; +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: +return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 305ac5a477d2..7245c8e2096f 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1492,6 +1492,7 @@ callback (gpointer pData) case LOK_CALLBACK_A11Y_CARET_CHANGED: case LOK_CALLBACK_A11Y_TEXT_SELECTION_CHANGED: case LOK_CALLBACK_COLOR_PALETTES: +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: { // TODO: Implement me break; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 3067229b96eb..85b9e50fc941 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include @@ -71,6 +73,7 @@ #include #include #include +#include #include #include @@ -792,6 +795,12 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) { sfx2::SetPassword(pFilter, pMedSet, m_xPasswordDialog->GetPasswordToOpen(), m_xPasswordDialog->GetPasswordToOpen(), true); +tools::JsonWriter payloadJson; +payloadJson.put("password", m_xPasswordDialog->GetPasswordToOpen()); +payloadJson.put("isToModify", false); +pShell->GetViewShell()->libreOfficeKitViewCallback( +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET, +payloadJson.extractAsOString().getStr()); pShell->SetModified(); } m_xPasswordDialog->disposeOnce();
[Libreoffice-commits] core.git: include/vcl sd/inc sd/source vcl/source
include/vcl/pdfwriter.hxx |4 + sd/inc/Annotation.hxx |5 ++ sd/source/core/annotations/Annotation.cxx | 12 +++-- sd/source/filter/pdf/sdpdffilter.cxx |5 ++ sd/source/ui/annotations/annotationtag.cxx | 23 +++--- sd/source/ui/unoidl/unomodel.cxx | 17 ++- vcl/source/filter/ipdf/pdfread.cxx |1 vcl/source/gdi/pdfwriter_impl.cxx | 64 +++-- vcl/source/pdf/PDFiumLibrary.cxx | 24 -- 9 files changed, 133 insertions(+), 22 deletions(-) New commits: commit 53d610786ba8085fcce331174c74294c90c41a20 Author: Jaume Pujantell AuthorDate: Mon Jun 5 11:49:41 2023 +0200 Commit: Andras Timar CommitDate: Thu Jun 8 21:53:59 2023 +0200 pdfium: better suport for annotations and some fixes Added suport to import FreeText annotations. Added some suport to export graphical annotations. Fixed some color issues to be more inline with the pdfium library. Change-Id: I7371595ebb95594ee765ae532ca7c7d4f0499592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152606 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 156720fed840..1abd5bf80151 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -66,6 +66,10 @@ struct PDFNote OUString Title; // optional title for the popup containing the note OUString Contents; // contents of the note css::util::DateTime maModificationDate; +bool isFreeText; +std::vector maPolygons; +Color annotColor; +Color interiorColor; }; class VCL_DLLPUBLIC PDFOutputStream diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index 707f2cdc8e78..00870dc703e8 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -133,6 +133,10 @@ public: return bool(m_pCustomAnnotationMarker); } +void setIsFreeText(bool value) { m_bIsFreeText = value; } + +bool isFreeText() const { return m_bIsFreeText; } + private: // destructor is private and will be called indirectly by the release call virtual ~Annotation() {} @@ -152,6 +156,7 @@ private: rtl::Reference m_TextRange; std::unique_ptr m_pCustomAnnotationMarker; +bool m_bIsFreeText; }; } diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 850f1a973ff1..432d38f9cb32 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -117,11 +117,13 @@ void createAnnotation(uno::Reference& xAnnotation, SdPage* sal_uInt32 Annotation::m_nLastId = 1; -Annotation::Annotation( const uno::Reference& context, SdPage* pPage ) -: ::cppu::WeakComponentImplHelper(m_aMutex) -, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, uno::Sequence()) -, m_nId( m_nLastId++ ) -, mpPage( pPage ) +Annotation::Annotation(const uno::Reference& context, SdPage* pPage) +: ::cppu::WeakComponentImplHelper(m_aMutex) +, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, +uno::Sequence()) +, m_nId(m_nLastId++) +, mpPage(pPage) +, m_bIsFreeText(false) { } diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 39c6ada55f4e..35b1bffbcb73 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -189,6 +189,11 @@ bool SdPdfFilter::Import() rCustomAnnotationMarker.maFillColor = COL_TRANSPARENT; } } +else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::FreeText) +{ +auto* pAnnotation = static_cast(xAnnotation.get()); +pAnnotation->setIsFreeText(true); +} } } mrDocument.setLock(bWasLocked); diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 7afe26ee54b0..dbadf4cb6fe1 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -524,18 +524,29 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected ) { ScopedVclPtrInstance< VirtualDevice > pVDev; -OUString sInitials(mxAnnotation->getInitials()); -if (sInitials.isEmpty()) -sInitials = getInitials(mxAnnotation->getAuthor()); +OUString sText; +auto* pAnnotation = dynamic_cast(mxAnnotation.get()); +if (pAnnotation && pAnnotation->isFreeText()) +{ +sText = mxAnnotation->getTextRange()->getString(); +} +else +{ +OUString sInitials(mxAnnotation->getInitials()); +if (sInitials.isEmpty()) +{ +sInitials = getInitials(mxAnnotation->getAuthor()); +} -OUString sAuthor(sInitials + " " +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/vcl sd/inc sd/source vcl/source
include/vcl/pdfwriter.hxx |4 + sd/inc/Annotation.hxx |5 ++ sd/source/core/annotations/Annotation.cxx | 12 +++-- sd/source/filter/pdf/sdpdffilter.cxx |5 ++ sd/source/ui/annotations/annotationtag.cxx | 23 +++--- sd/source/ui/unoidl/unomodel.cxx | 17 ++- vcl/source/filter/ipdf/pdfread.cxx |1 vcl/source/gdi/pdfwriter_impl.cxx | 64 +++-- vcl/source/pdf/PDFiumLibrary.cxx | 24 -- 9 files changed, 133 insertions(+), 22 deletions(-) New commits: commit d01c4ebd00a7ec0249f34b26715802036db4 Author: Jaume Pujantell AuthorDate: Mon Jun 5 11:49:41 2023 +0200 Commit: Andras Timar CommitDate: Thu Jun 8 21:53:44 2023 +0200 pdfium: better suport for annotations and some fixes Added suport to import FreeText annotations. Added some suport to export graphical annotations. Fixed some color issues to be more inline with the pdfium library. Change-Id: I7371595ebb95594ee765ae532ca7c7d4f0499592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152548 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 4236d2f3ea21..a03cee4dc362 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -66,6 +66,10 @@ struct PDFNote OUString Title; // optional title for the popup containing the note OUString Contents; // contents of the note css::util::DateTime maModificationDate; +bool isFreeText; +std::vector maPolygons; +Color annotColor; +Color interiorColor; }; class VCL_DLLPUBLIC PDFOutputStream diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index 707f2cdc8e78..00870dc703e8 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -133,6 +133,10 @@ public: return bool(m_pCustomAnnotationMarker); } +void setIsFreeText(bool value) { m_bIsFreeText = value; } + +bool isFreeText() const { return m_bIsFreeText; } + private: // destructor is private and will be called indirectly by the release call virtual ~Annotation() {} @@ -152,6 +156,7 @@ private: rtl::Reference m_TextRange; std::unique_ptr m_pCustomAnnotationMarker; +bool m_bIsFreeText; }; } diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 991412f063d5..3656c54f241a 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -117,11 +117,13 @@ void createAnnotation(uno::Reference& xAnnotation, SdPage* sal_uInt32 Annotation::m_nLastId = 1; -Annotation::Annotation( const uno::Reference& context, SdPage* pPage ) -: ::cppu::WeakComponentImplHelper(m_aMutex) -, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, uno::Sequence()) -, m_nId( m_nLastId++ ) -, mpPage( pPage ) +Annotation::Annotation(const uno::Reference& context, SdPage* pPage) +: ::cppu::WeakComponentImplHelper(m_aMutex) +, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, +uno::Sequence()) +, m_nId(m_nLastId++) +, mpPage(pPage) +, m_bIsFreeText(false) { } diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 002c1c5db4e6..b54703c3f0e7 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -189,6 +189,11 @@ bool SdPdfFilter::Import() rCustomAnnotationMarker.maFillColor = COL_TRANSPARENT; } } +else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::FreeText) +{ +auto* pAnnotation = static_cast(xAnnotation.get()); +pAnnotation->setIsFreeText(true); +} } } mrDocument.setLock(bWasLocked); diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index cfd632dcc2bd..a44acdf74a6c 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -523,18 +523,29 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected ) { ScopedVclPtrInstance< VirtualDevice > pVDev; -OUString sInitials(mxAnnotation->getInitials()); -if (sInitials.isEmpty()) -sInitials = getInitials(mxAnnotation->getAuthor()); +OUString sText; +auto* pAnnotation = dynamic_cast(mxAnnotation.get()); +if (pAnnotation && pAnnotation->isFreeText()) +{ +sText = mxAnnotation->getTextRange()->getString(); +} +else +{ +OUString sInitials(mxAnnotation->getInitials()); +if (sInitials.isEmpty()) +{ +sInitials = getInitials(mxAnnotation->getAuthor()); +} -OUString sAuthor(sInitials + " " +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - include/vcl sd/inc sd/source vcl/source
include/vcl/pdfwriter.hxx |4 + sd/inc/Annotation.hxx |5 ++ sd/source/core/annotations/Annotation.cxx | 12 +++-- sd/source/filter/pdf/sdpdffilter.cxx |5 ++ sd/source/ui/annotations/annotationtag.cxx | 23 +++--- sd/source/ui/unoidl/unomodel.cxx | 17 ++- vcl/source/filter/ipdf/pdfread.cxx |1 vcl/source/gdi/pdfwriter_impl.cxx | 64 +++-- vcl/source/pdf/PDFiumLibrary.cxx | 24 -- 9 files changed, 133 insertions(+), 22 deletions(-) New commits: commit 13c3bc9094c56136d1b7d35ecf6fbfa4655448bc Author: Jaume Pujantell AuthorDate: Mon Jun 5 11:49:41 2023 +0200 Commit: Andras Timar CommitDate: Thu Jun 8 21:53:14 2023 +0200 pdfium: better suport for annotations and some fixes Added suport to import FreeText annotations. Added some suport to export graphical annotations. Fixed some color issues to be more inline with the pdfium library. Change-Id: I7371595ebb95594ee765ae532ca7c7d4f0499592 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152549 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 6fe273054b4b..5f5ad9a851ec 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -66,6 +66,10 @@ struct PDFNote OUString Title; // optional title for the popup containing the note OUString Contents; // contents of the note css::util::DateTime maModificationDate; +bool isFreeText; +std::vector maPolygons; +Color annotColor; +Color interiorColor; }; class VCL_DLLPUBLIC PDFOutputStream diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx index 707f2cdc8e78..00870dc703e8 100644 --- a/sd/inc/Annotation.hxx +++ b/sd/inc/Annotation.hxx @@ -133,6 +133,10 @@ public: return bool(m_pCustomAnnotationMarker); } +void setIsFreeText(bool value) { m_bIsFreeText = value; } + +bool isFreeText() const { return m_bIsFreeText; } + private: // destructor is private and will be called indirectly by the release call virtual ~Annotation() {} @@ -152,6 +156,7 @@ private: rtl::Reference m_TextRange; std::unique_ptr m_pCustomAnnotationMarker; +bool m_bIsFreeText; }; } diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 991412f063d5..3656c54f241a 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -117,11 +117,13 @@ void createAnnotation(uno::Reference& xAnnotation, SdPage* sal_uInt32 Annotation::m_nLastId = 1; -Annotation::Annotation( const uno::Reference& context, SdPage* pPage ) -: ::cppu::WeakComponentImplHelper(m_aMutex) -, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, uno::Sequence()) -, m_nId( m_nLastId++ ) -, mpPage( pPage ) +Annotation::Annotation(const uno::Reference& context, SdPage* pPage) +: ::cppu::WeakComponentImplHelper(m_aMutex) +, ::cppu::PropertySetMixin(context, IMPLEMENTS_PROPERTY_SET, +uno::Sequence()) +, m_nId(m_nLastId++) +, mpPage(pPage) +, m_bIsFreeText(false) { } diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 39c6ada55f4e..35b1bffbcb73 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -189,6 +189,11 @@ bool SdPdfFilter::Import() rCustomAnnotationMarker.maFillColor = COL_TRANSPARENT; } } +else if (rPDFAnnotation.meSubType == vcl::pdf::PDFAnnotationSubType::FreeText) +{ +auto* pAnnotation = static_cast(xAnnotation.get()); +pAnnotation->setIsFreeText(true); +} } } mrDocument.setLock(bWasLocked); diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index 7afe26ee54b0..dbadf4cb6fe1 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -524,18 +524,29 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool bSelected ) { ScopedVclPtrInstance< VirtualDevice > pVDev; -OUString sInitials(mxAnnotation->getInitials()); -if (sInitials.isEmpty()) -sInitials = getInitials(mxAnnotation->getAuthor()); +OUString sText; +auto* pAnnotation = dynamic_cast(mxAnnotation.get()); +if (pAnnotation && pAnnotation->isFreeText()) +{ +sText = mxAnnotation->getTextRange()->getString(); +} +else +{ +OUString sInitials(mxAnnotation->getInitials()); +if (sInitials.isEmpty()) +{ +sInitials = getInitials(mxAnnotation->getAuthor()); +} -OUString sAuthor(sInitials + " " +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/LibreOfficeKit libreofficekit/source sfx2/source
include/LibreOfficeKit/LibreOfficeKitEnums.h |8 libreofficekit/source/gtk/lokdocview.cxx |1 + sfx2/source/dialog/dinfdlg.cxx |9 + 3 files changed, 18 insertions(+) New commits: commit 88db520407ed5786466513c9486ebb633ce140df Author: Jaume Pujantell AuthorDate: Wed May 10 23:19:04 2023 +0200 Commit: Ashod Nakashian CommitDate: Tue May 23 04:21:52 2023 +0200 notify async password change Change-Id: I2d16c9804e65f093239e810d466de35286b28dee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151789 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h index 0094b94de559..7e1110089e52 100644 --- a/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -907,6 +907,12 @@ typedef enum * "file:///tmp/hello-world.pdf" */ LOK_CALLBACK_EXPORT_FILE = 59, + +/** + * Informs that the document password has been succesfully changed. + * The payload contains the the new password and the type. +*/ +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET = 62 } LibreOfficeKitCallbackType; @@ -1055,6 +1061,8 @@ static inline const char* lokCallbackTypeToString(int nType) return "LOK_CALLBACK_MEDIA_SHAPE"; case LOK_CALLBACK_EXPORT_FILE: return "LOK_CALLBACK_EXPORT_FILE"; +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: +return "LOK_CALLBACK_DOCUMENT_PASSWORD_RESET"; } assert(!"Unknown LibreOfficeKitCallbackType type."); diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index ce5b059a9006..c12067a483e1 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -1487,6 +1487,7 @@ callback (gpointer pData) case LOK_CALLBACK_FONTS_MISSING: case LOK_CALLBACK_MEDIA_SHAPE: case LOK_CALLBACK_EXPORT_FILE: +case LOK_CALLBACK_DOCUMENT_PASSWORD_RESET: { // TODO: Implement me break; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 799d8fbd3168..71eeafc6ff6f 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include @@ -70,6 +72,7 @@ #include #include #include +#include #include #include @@ -789,6 +792,12 @@ IMPL_LINK_NOARG(SfxDocumentPage, ChangePassHdl, weld::Button&, void) { sfx2::SetPassword(pFilter, pMedSet, m_xPasswordDialog->GetPasswordToOpen(), m_xPasswordDialog->GetPasswordToOpen(), true); +tools::JsonWriter payloadJson; +payloadJson.put("password", m_xPasswordDialog->GetPasswordToOpen()); +payloadJson.put("isToModify", false); +pShell->GetViewShell()->libreOfficeKitViewCallback( +LOK_CALLBACK_DOCUMENT_PASSWORD_RESET, +payloadJson.extractAsOString().getStr()); pShell->SetModified(); } m_xPasswordDialog->disposeOnce();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) New commits: commit 1600181e74692714d844e7e51f411765895ea3de Author: Jaume Pujantell AuthorDate: Thu Apr 27 14:54:55 2023 +0200 Commit: Justin Luth CommitDate: Fri May 5 12:56:49 2023 +0200 tdf#154478 fix comments empy after ToC TOC creation entered a malformed state where it interfered with the creation of other elements (e.g. annotations and textboxes). This change is also a fix to tdf#154481, so the patch from 94de79e7d3c98 can be removed. Change-Id: I423f9d048b8c5b89fd38229c4f3ad41213d5ab67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151103 Tested-by: Jenkins Reviewed-by: Ashod Nakashian (cherry picked from commit 5431b756d45bebe74beaba2026704552ee6891f0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151281 Tested-by: Jenkins CollaboraOffice Reviewed-by: Justin Luth diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index bb8ac11129b3..7086a4329cc9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6539,7 +6539,13 @@ uno::Reference DomainMapper_Impl::createSectionForRange( if (stepLeft) xCursor->goLeft(1, true); uno::Reference< text::XTextContent > xSection( m_xTextFactory->createInstance(sObjectType), uno::UNO_QUERY_THROW ); -xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +try +{ +xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +} +catch(const uno::Exception&) +{ +} xRet.set(xSection, uno::UNO_QUERY ); } catch(const uno::Exception&)
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) New commits: commit ccc3db142bcc229181f981aa79f7a5c6b022092a Author: Jaume Pujantell AuthorDate: Thu Apr 27 14:54:55 2023 +0200 Commit: Xisco Fauli CommitDate: Thu May 4 15:46:08 2023 +0200 tdf#154478 fix comments empy after ToC TOC creation entered a malformed state where it interfered with the creation of other elements (e.g. annotations and textboxes). This change is also a fix to tdf#154481, so the patch from 94de79e7d3c98 can be removed. Change-Id: I423f9d048b8c5b89fd38229c4f3ad41213d5ab67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151103 Tested-by: Jenkins Reviewed-by: Ashod Nakashian (cherry picked from commit 5431b756d45bebe74beaba2026704552ee6891f0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151287 Reviewed-by: Xisco Fauli diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index ac080656a98a..12c7e57f34a8 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5046,15 +5046,6 @@ void DomainMapper_Impl::PushTextBoxContent() if (m_bIsInTextBox) return; -// tdf#154481: check for TOC creation with empty field stack, -// and close TOC, unless pages will lost. FIXME. -if (IsInTOC() && m_aFieldStack.size() == 0) -{ -m_bStartTOC = false; -SAL_WARN("writerfilter.dmapper", - "broken TOC creation in textbox, but field stack is empty, so closing TOC!"); -} - try { uno::Reference xTBoxFrame( @@ -6558,7 +6549,13 @@ uno::Reference DomainMapper_Impl::createSectionForRange( if (stepLeft) xCursor->goLeft(1, true); uno::Reference< text::XTextContent > xSection( m_xTextFactory->createInstance(sObjectType), uno::UNO_QUERY_THROW ); -xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +try +{ +xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +} +catch(const uno::Exception&) +{ +} xRet.set(xSection, uno::UNO_QUERY ); } catch(const uno::Exception&)
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) New commits: commit 08e111b488c7cddfcacbd66560cf40b060ec4b75 Author: Jaume Pujantell AuthorDate: Thu Apr 27 14:54:55 2023 +0200 Commit: Andras Timar CommitDate: Thu May 4 09:27:04 2023 +0200 tdf#154478 fix comments empy after ToC TOC creation entered a malformed state where it interfered with the creation of other elements (e.g. annotations and textboxes). This change is also a fix to tdf#154481, so the patch from 94de79e7d3c98 can be removed. Change-Id: I423f9d048b8c5b89fd38229c4f3ad41213d5ab67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151103 Tested-by: Jenkins Reviewed-by: Ashod Nakashian (cherry picked from commit 5431b756d45bebe74beaba2026704552ee6891f0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151282 Tested-by: Andras Timar Reviewed-by: Andras Timar diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8b8bff35e40e..e2c2475ecf9f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6030,7 +6030,13 @@ uno::Reference DomainMapper_Impl::createSectionForRange( if (stepLeft) xCursor->goLeft(1, true); uno::Reference< text::XTextContent > xSection( m_xTextFactory->createInstance(sObjectType), uno::UNO_QUERY_THROW ); -xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +try +{ +xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +} +catch(const uno::Exception&) +{ +} xRet.set(xSection, uno::UNO_QUERY ); } catch(const uno::Exception&)
[Libreoffice-commits] core.git: writerfilter/source
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) New commits: commit 5431b756d45bebe74beaba2026704552ee6891f0 Author: Jaume Pujantell AuthorDate: Thu Apr 27 14:54:55 2023 +0200 Commit: Ashod Nakashian CommitDate: Wed May 3 12:42:31 2023 +0200 tdf#154478 fix comments empy after ToC TOC creation entered a malformed state where it interfered with the creation of other elements (e.g. annotations and textboxes). This change is also a fix to tdf#154481, so the patch from 94de79e7d3c98 can be removed. Change-Id: I423f9d048b8c5b89fd38229c4f3ad41213d5ab67 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151103 Tested-by: Jenkins Reviewed-by: Ashod Nakashian diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 8407aaf7c58a..b3942b4654e9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -5215,15 +5215,6 @@ void DomainMapper_Impl::PushTextBoxContent() if (m_bIsInTextBox) return; -// tdf#154481: check for TOC creation with empty field stack, -// and close TOC, unless pages will lost. FIXME. -if (IsInTOC() && m_aFieldStack.size() == 0) -{ -m_bStartTOC = false; -SAL_WARN("writerfilter.dmapper", - "broken TOC creation in textbox, but field stack is empty, so closing TOC!"); -} - try { uno::Reference xTBoxFrame( @@ -6720,7 +6711,13 @@ uno::Reference DomainMapper_Impl::createSectionForRange( if (stepLeft) xCursor->goLeft(1, true); uno::Reference< text::XTextContent > xSection( m_xTextFactory->createInstance(sObjectType), uno::UNO_QUERY_THROW ); -xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +try +{ +xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); +} +catch(const uno::Exception&) +{ +} xRet.set(xSection, uno::UNO_QUERY ); } catch(const uno::Exception&)
[Libreoffice-commits] core.git: tools/source
tools/source/misc/json_writer.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 2fe581d916b76d613742c983731fb4a10b4ee95f Author: Jaume Pujantell AuthorDate: Tue Apr 18 10:34:47 2023 +0200 Commit: Miklos Vajna CommitDate: Thu Apr 27 12:13:37 2023 +0200 fix bug in json_writer Ruler stores null-terminated strings in fixed length char arrays, so when creating a JSON a string might end earlier that it's size sugsests. Change-Id: Icdcaf35f9ce54c24dcd36368dc49bb688a2a65ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150542 Reviewed-by: Michael Meeks Tested-by: Jenkins diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx index e7a0f55fd6c2..3111cac2f816 100644 --- a/tools/source/misc/json_writer.cxx +++ b/tools/source/misc/json_writer.cxx @@ -236,7 +236,8 @@ void JsonWriter::put(std::string_view pPropName, std::string_view rPropVal) ++mPos; // copy and perform escaping -for (size_t i = 0; i < rPropVal.size(); ++i) +bool bReachedEnd = false; +for (size_t i = 0; i < rPropVal.size() && !bReachedEnd; ++i) { char ch = rPropVal[i]; switch (ch) @@ -251,6 +252,9 @@ void JsonWriter::put(std::string_view pPropName, std::string_view rPropVal) case '\\': writeEscapedSequence(ch, mPos); break; +case 0: +bReachedEnd = true; +break; case '\xE2': // Special processing of U+2028 and U+2029 if (i + 2 < rPropVal.size() && rPropVal[i + 1] == '\x80' && (rPropVal[i + 2] == '\xA8' || rPropVal[i + 2] == '\xA9'))
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - tools/source
tools/source/misc/json_writer.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 8790a9c408e3d8732993b228012eeb0c941ec2fb Author: Jaume Pujantell AuthorDate: Tue Apr 18 10:34:47 2023 +0200 Commit: Michael Meeks CommitDate: Tue Apr 18 13:33:23 2023 +0200 fix bug in json_writer Ruler stores null-terminated strings in fixed length char arrays, so when creating a JSON a string might end earlier that it's size sugsests. Change-Id: Icdcaf35f9ce54c24dcd36368dc49bb688a2a65ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150558 Tested-by: Michael Meeks Reviewed-by: Michael Meeks diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx index 3d78f82e08e6..aea89a15d421 100644 --- a/tools/source/misc/json_writer.cxx +++ b/tools/source/misc/json_writer.cxx @@ -274,7 +274,8 @@ void JsonWriter::put(const char* pPropName, std::string_view rPropVal) mPos += 4; // copy and perform escaping -for (size_t i = 0; i < rPropVal.size(); ++i) +bool bReachedEnd = false; +for (size_t i = 0; i < rPropVal.size() && !bReachedEnd; ++i) { char ch = rPropVal[i]; switch (ch) @@ -289,6 +290,9 @@ void JsonWriter::put(const char* pPropName, std::string_view rPropVal) case '\\': writeEscapedSequence(ch, mPos); break; +case 0: +bReachedEnd = true; +break; case '\xE2': // Special processing of U+2028 and U+2029 if (i + 2 < rPropVal.size() && rPropVal[i + 1] == '\x80' && (rPropVal[i + 2] == '\xA8' || rPropVal[i + 2] == '\xA9'))
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sfx2/source
sfx2/source/doc/docfile.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 4300ea07cfa664a1de9509cb9cd83c7ae46afe87 Author: Jaume Pujantell AuthorDate: Wed Mar 29 14:32:55 2023 +0200 Commit: Adolfo Jayme Barrientos CommitDate: Sun Apr 9 22:58:40 2023 +0200 tdf#149064 ensure interaction handler is present when transfering with webDAV Change-Id: I7a31f708e6fe01f07c7187aacd4657b5c6156c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149722 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 50848b06ea58a147f5b89f057880266518ce79e7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149697 Reviewed-by: Xisco Fauli (cherry picked from commit 439d8466c10473d1f3859ffa6c87fef6209e93eb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150141 Reviewed-by: Adolfo Jayme Barrientos diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 63966fb3c6ab..fafe05d150b4 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2318,7 +2318,8 @@ void SfxMedium::Transfer_Impl() // a special case, an interaction handler should be used for // authentication in case it is available Reference< css::ucb::XCommandEnvironment > xComEnv; -Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(); +bool bForceInteractionHandler = GetURLObject().isAnyKnownWebDAVScheme(); +Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(bForceInteractionHandler); if (xInteractionHandler.is()) xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< css::ucb::XProgressHandler >() );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sfx2/source
sfx2/source/doc/docfile.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 439d8466c10473d1f3859ffa6c87fef6209e93eb Author: Jaume Pujantell AuthorDate: Wed Mar 29 14:32:55 2023 +0200 Commit: Xisco Fauli CommitDate: Fri Apr 7 18:44:09 2023 +0200 tdf#149064 ensure interaction handler is present when transfering with webDAV Change-Id: I7a31f708e6fe01f07c7187aacd4657b5c6156c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149722 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 50848b06ea58a147f5b89f057880266518ce79e7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149697 Reviewed-by: Xisco Fauli diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index c81b79e8ec4e..c17b7827145d 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2368,7 +2368,8 @@ void SfxMedium::Transfer_Impl() // a special case, an interaction handler should be used for // authentication in case it is available Reference< css::ucb::XCommandEnvironment > xComEnv; -Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(); +bool bForceInteractionHandler = GetURLObject().isAnyKnownWebDAVScheme(); +Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(bForceInteractionHandler); if (xInteractionHandler.is()) xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< css::ucb::XProgressHandler >() );
[Libreoffice-commits] core.git: sfx2/source
sfx2/source/doc/docfile.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 20132d64bbd448950bcbd2b0d31504d5025ac6c7 Author: Jaume Pujantell AuthorDate: Wed Mar 29 14:32:55 2023 +0200 Commit: Andras Timar CommitDate: Wed Mar 29 15:20:45 2023 + tdf#149064 ensure interaction handler is present when transfering with webDAV Change-Id: I7a31f708e6fe01f07c7187aacd4657b5c6156c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149722 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 6b33abb1c3ee..f43213b67e97 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2367,7 +2367,8 @@ void SfxMedium::Transfer_Impl() // a special case, an interaction handler should be used for // authentication in case it is available Reference< css::ucb::XCommandEnvironment > xComEnv; -Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(); +bool bForceInteractionHandler = GetURLObject().isAnyKnownWebDAVScheme(); +Reference< css::task::XInteractionHandler > xInteractionHandler = GetInteractionHandler(bForceInteractionHandler); if (xInteractionHandler.is()) xComEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< css::ucb::XProgressHandler >() );
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sw/qa sw/source
sw/qa/core/layout/data/header-textbox.docx |binary sw/qa/core/layout/layout.cxx | 15 +++ sw/source/core/draw/dcontact.cxx |9 - sw/source/core/layout/anchoreddrawobject.cxx |8 4 files changed, 31 insertions(+), 1 deletion(-) New commits: commit 4170ecddacc568922d8182d03d3a23e72c0524ce Author: Jaume Pujantell AuthorDate: Tue Mar 21 16:03:54 2023 +0100 Commit: Aron Budea CommitDate: Wed Mar 29 12:21:25 2023 + Fix wrong layout of textbox in header In some cases the text box wasn't properly moved after it's position had been calculated. Also now when the shape and text element are brought together in the Z ordering, the one with higher Z moves down. Change-Id: I0512db4b6466532b5af4e3c091fd65bd0a416381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149221 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 826b20b049449c9c335ce00c781cdb52e4ee0512) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149306 Tested-by: Jenkins CollaboraOffice Reviewed-by: Aron Budea diff --git a/sw/qa/core/layout/data/header-textbox.docx b/sw/qa/core/layout/data/header-textbox.docx new file mode 100644 index ..4df72cccd3e7 Binary files /dev/null and b/sw/qa/core/layout/data/header-textbox.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 8a5c90a972b8..758640d6d765 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -258,6 +258,21 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) CPPUNIT_ASSERT(!pDocShell->IsModified()); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned) +{ +// Load a document with a floating text box in the header +createSwDoc("header-textbox.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +CPPUNIT_ASSERT(pXmlDoc); + +// Without the fix in place, this test would have failed with +// - Expected: 8051 +// - Actual : 1418 +// Comparison with 7000 chosen due to variability between devices +CPPUNIT_ASSERT_GREATEREQUAL( +double(7000), getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toDouble()); +} + CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 156f73adc58a..3cebc41c06ba 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1975,7 +1975,14 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) if (pDrawPage) { sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum(); - pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +if (maAnchoredDrawObj.GetDrawObj()->GetOrdNum() >= nOrdNum) +{ + pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +} +else +{ + pDrawPage->SetObjectOrdNum(nOrdNum, maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect() + 1); +} break; } } diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 491e860014f2..6dc6cac5d1b2 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -516,6 +517,13 @@ void SwAnchoredDrawObject::SetDrawObjAnchor() DrawObj()->SetAnchorPos( aNewAnchorPos ); // correct object position, caused by setting new anchor position DrawObj()->Move( aMove ); +// Sync textbox if it wasn't done at move +if ( SwTextBoxHelper::isTextBox((), RES_DRAWFRMFMT) && GetFrameFormat().GetDoc() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor()) +{ +SwTextBoxHelper::changeAnchor((), GetFrameFormat().FindRealSdrObject()); +} // --> #i70122# - missing invalidation
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - sw/qa sw/source
sw/qa/core/layout/data/header-textbox.docx |binary sw/qa/core/layout/layout.cxx | 15 +++ sw/source/core/draw/dcontact.cxx |9 - sw/source/core/layout/anchoreddrawobject.cxx |8 4 files changed, 31 insertions(+), 1 deletion(-) New commits: commit 5bab8fc3b9dd27c0e37cf9a62b1b27c2bf243788 Author: Jaume Pujantell AuthorDate: Tue Mar 21 16:03:54 2023 +0100 Commit: Xisco Fauli CommitDate: Fri Mar 24 09:09:03 2023 + Fix wrong layout of textbox in header In some cases the text box wasn't properly moved afeter it's position had been calculated. Also now when the shape and text element are brought together in the Z ordering, the one with higher Z moves down. Change-Id: I0512db4b6466532b5af4e3c091fd65bd0a416381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149221 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 826b20b049449c9c335ce00c781cdb52e4ee0512) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149438 Reviewed-by: Xisco Fauli diff --git a/sw/qa/core/layout/data/header-textbox.docx b/sw/qa/core/layout/data/header-textbox.docx new file mode 100644 index ..4df72cccd3e7 Binary files /dev/null and b/sw/qa/core/layout/data/header-textbox.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 8a5c90a972b8..758640d6d765 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -258,6 +258,21 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) CPPUNIT_ASSERT(!pDocShell->IsModified()); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned) +{ +// Load a document with a floating text box in the header +createSwDoc("header-textbox.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +CPPUNIT_ASSERT(pXmlDoc); + +// Without the fix in place, this test would have failed with +// - Expected: 8051 +// - Actual : 1418 +// Comparison with 7000 chosen due to variability between devices +CPPUNIT_ASSERT_GREATEREQUAL( +double(7000), getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toDouble()); +} + CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 156f73adc58a..3cebc41c06ba 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1975,7 +1975,14 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) if (pDrawPage) { sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum(); - pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +if (maAnchoredDrawObj.GetDrawObj()->GetOrdNum() >= nOrdNum) +{ + pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +} +else +{ + pDrawPage->SetObjectOrdNum(nOrdNum, maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect() + 1); +} break; } } diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 491e860014f2..6dc6cac5d1b2 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -516,6 +517,13 @@ void SwAnchoredDrawObject::SetDrawObjAnchor() DrawObj()->SetAnchorPos( aNewAnchorPos ); // correct object position, caused by setting new anchor position DrawObj()->Move( aMove ); +// Sync textbox if it wasn't done at move +if ( SwTextBoxHelper::isTextBox((), RES_DRAWFRMFMT) && GetFrameFormat().GetDoc() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor()) +{ +SwTextBoxHelper::changeAnchor((), GetFrameFormat().FindRealSdrObject()); +} // --> #i70122# - missing invalidation InvalidateObjRectWithSpaces(); }
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/qa sw/source
sw/qa/core/layout/data/header-textbox.docx |binary sw/qa/core/layout/layout.cxx | 15 +++ sw/source/core/draw/dcontact.cxx |9 - sw/source/core/layout/anchoreddrawobject.cxx |8 4 files changed, 31 insertions(+), 1 deletion(-) New commits: commit 87c1d93fd2b192f341112a609c741370561879a2 Author: Jaume Pujantell AuthorDate: Tue Mar 21 16:03:54 2023 +0100 Commit: Andras Timar CommitDate: Thu Mar 23 07:10:06 2023 + Fix wrong layout of textbox in header In some cases the text box wasn't properly moved afeter it's position had been calculated. Also now when the shape and text element are brought together in the Z ordering, the one with higher Z moves down. Change-Id: I0512db4b6466532b5af4e3c091fd65bd0a416381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149221 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 826b20b049449c9c335ce00c781cdb52e4ee0512) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149305 Tested-by: Andras Timar diff --git a/sw/qa/core/layout/data/header-textbox.docx b/sw/qa/core/layout/data/header-textbox.docx new file mode 100644 index ..4df72cccd3e7 Binary files /dev/null and b/sw/qa/core/layout/data/header-textbox.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index abd77b3e217d..3bdeabe9b9f7 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -238,6 +238,21 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) CPPUNIT_ASSERT(!pDocShell->IsModified()); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned) +{ +// Load a document with a floating text box in the header +load(DATA_DIRECTORY, "header-textbox.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +CPPUNIT_ASSERT(pXmlDoc); + +// Without the fix in place, this test would have failed with +// - Expected: 8051 +// - Actual : 1418 +// Comparison with 7000 chosen due to variability between devices +CPPUNIT_ASSERT_GREATEREQUAL( +double(7000), getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toDouble()); +} + CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 63011f0171a8..8a6871373ccf 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1965,7 +1965,14 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) if (pDrawPage) { sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum(); - pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +if (maAnchoredDrawObj.GetDrawObj()->GetOrdNum() >= nOrdNum) +{ + pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +} +else +{ + pDrawPage->SetObjectOrdNum(nOrdNum, maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect() + 1); +} break; } } diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 3e37961dffd6..6cc597ef9a64 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -512,6 +513,13 @@ void SwAnchoredDrawObject::SetDrawObjAnchor() DrawObj()->SetAnchorPos( aNewAnchorPos ); // correct object position, caused by setting new anchor position DrawObj()->Move( aMove ); +// Sync textbox if it wasn't done at move +if ( SwTextBoxHelper::isTextBox((), RES_DRAWFRMFMT) && GetFrameFormat().GetDoc() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor()) +{ +SwTextBoxHelper::changeAnchor((), GetFrameFormat().FindRealSdrObject()); +} // --> #i70122# - missing invalidation InvalidateObjRectWithSpaces(); }
[Libreoffice-commits] core.git: sw/qa sw/source
sw/qa/core/layout/data/header-textbox.docx |binary sw/qa/core/layout/layout.cxx | 15 +++ sw/source/core/draw/dcontact.cxx |9 - sw/source/core/layout/anchoreddrawobject.cxx |8 4 files changed, 31 insertions(+), 1 deletion(-) New commits: commit 826b20b049449c9c335ce00c781cdb52e4ee0512 Author: Jaume Pujantell AuthorDate: Tue Mar 21 16:03:54 2023 +0100 Commit: Andras Timar CommitDate: Wed Mar 22 16:49:49 2023 + Fix wrong layout of textbox in header In some cases the text box wasn't properly moved afeter it's position had been calculated. Also now when the shape and text element are brought together in the Z ordering, the one with higher Z moves down. Change-Id: I0512db4b6466532b5af4e3c091fd65bd0a416381 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149221 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/sw/qa/core/layout/data/header-textbox.docx b/sw/qa/core/layout/data/header-textbox.docx new file mode 100644 index ..4df72cccd3e7 Binary files /dev/null and b/sw/qa/core/layout/data/header-textbox.docx differ diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 2669b05fb2a2..f8878ef77bb4 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -258,6 +258,21 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextboxModification) CPPUNIT_ASSERT(!pDocShell->IsModified()); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testTextBoxInHeaderIsPositioned) +{ +// Load a document with a floating text box in the header +createSwDoc("header-textbox.docx"); +xmlDocUniquePtr pXmlDoc = parseLayoutDump(); +CPPUNIT_ASSERT(pXmlDoc); + +// Without the fix in place, this test would have failed with +// - Expected: 8051 +// - Actual : 1418 +// Comparison with 7000 chosen due to variability between devices +CPPUNIT_ASSERT_GREATEREQUAL( +double(7000), getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "left").toDouble()); +} + CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testBtlrNestedCell) { // Load a document with a nested table, the inner A1 cell has a btlr text direction. diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index a7c57ec0d609..8675f62e72c9 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1975,7 +1975,14 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch ) if (pDrawPage) { sal_uInt32 nOrdNum = pAnchoredObj->GetDrawObj()->GetOrdNum(); - pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +if (maAnchoredDrawObj.GetDrawObj()->GetOrdNum() >= nOrdNum) +{ + pDrawPage->SetObjectOrdNum(maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect(), nOrdNum); +} +else +{ + pDrawPage->SetObjectOrdNum(nOrdNum, maAnchoredDrawObj.GetDrawObj()->GetOrdNumDirect() + 1); +} break; } } diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 491e860014f2..6dc6cac5d1b2 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -516,6 +517,13 @@ void SwAnchoredDrawObject::SetDrawObjAnchor() DrawObj()->SetAnchorPos( aNewAnchorPos ); // correct object position, caused by setting new anchor position DrawObj()->Move( aMove ); +// Sync textbox if it wasn't done at move +if ( SwTextBoxHelper::isTextBox((), RES_DRAWFRMFMT) && GetFrameFormat().GetDoc() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() && + GetFrameFormat().GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()->IsInConstructor()) +{ +SwTextBoxHelper::changeAnchor((), GetFrameFormat().FindRealSdrObject()); +} // --> #i70122# - missing invalidation InvalidateObjRectWithSpaces(); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit 84d5dcc7365246352a7126ae15c54cd66bf344d9 Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Xisco Fauli CommitDate: Wed Mar 8 10:58:35 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 574e89ccda1b389faca9f3e44d909a71b5599473) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148394 Reviewed-by: Xisco Fauli diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 1c143a1b8319..c27555ca1d70 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -186,6 +186,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = createFileURL(u"array-mixed-numbers-and-elements.pdf"); +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 19748e241ead..5ff50d3b55ac 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3248,6 +3248,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3268,6 +3280,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit b4c912f680bb195ca17a506ed3037c588144a423 Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Andras Timar CommitDate: Tue Mar 7 22:44:58 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 574e89ccda1b389faca9f3e44d909a71b5599473) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148332 Tested-by: Jenkins CollaboraOffice diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 2de6cd4889d5..9077e6ba5d45 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -201,6 +201,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "array-mixed-numbers-and-elements.pdf"; +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 9ef202ee132b..c8882a6a709b 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3247,6 +3247,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3267,6 +3279,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto&
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit da1d2ef7bb9de291941f1048b4012a730e159b2f Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Andras Timar CommitDate: Tue Mar 7 20:52:23 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 574e89ccda1b389faca9f3e44d909a71b5599473) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148333 Tested-by: Andras Timar diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 93cc22360b56..32bd15643259 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -197,6 +197,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "array-mixed-numbers-and-elements.pdf"; +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 7569deede0f5..8bc66d0c010d 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3221,6 +3221,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3241,6 +3253,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto& pNumber :
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit 505abcce16134d30ffb842fa569126198ac31388 Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Andras Timar CommitDate: Tue Mar 7 13:58:34 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit 574e89ccda1b389faca9f3e44d909a71b5599473) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148331 Tested-by: Andras Timar diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 1c143a1b8319..c27555ca1d70 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -186,6 +186,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = createFileURL(u"array-mixed-numbers-and-elements.pdf"); +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 19748e241ead..5ff50d3b55ac 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3248,6 +3248,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3268,6 +3280,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +
[Libreoffice-commits] core.git: vcl/qa vcl/source
vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf | 55 ++ vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 25 vcl/source/filter/ipdf/pdfdocument.cxx | 45 3 files changed, 125 insertions(+) New commits: commit 574e89ccda1b389faca9f3e44d909a71b5599473 Author: Jaume Pujantell AuthorDate: Fri Mar 3 19:25:11 2023 +0100 Commit: Andras Timar CommitDate: Tue Mar 7 08:36:01 2023 + Fix a bug parsing pdf arrays The parser ignored number elements in some situations, like before a reference element. This manifested in creating an invalid pdf file when exporting as pdf a document that contains a pdf. Change-Id: I98625c8da8631056079814f7e824f36177cf41c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148198 Tested-by: Jenkins Reviewed-by: Andras Timar diff --git a/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf new file mode 100644 index ..01030ecf88bc --- /dev/null +++ b/vcl/qa/cppunit/filter/ipdf/data/array-mixed-numbers-and-elements.pdf @@ -0,0 +1,55 @@ +%PDF-1.7 +%��� +1 0 obj << + /Type /Catalog + /Pages 2 0 R +>> +endobj +2 0 obj << + /Type /Pages + /MediaBox [0 0 200 300] + /Count 1 + /Kids [3 0 R] +>> +endobj +3 0 obj << + /Type /Page + /Parent 2 0 R + /Contents 4 0 R + /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +>> +endobj +4 0 obj << + /Length 188 +>> +stream +q +0 0 0 rg +0 290 10 10 re B* +10 150 50 30 re B* +0 0 1 rg +190 290 10 10 re B* +70 232 50 30 re B* +0 1 0 rg +190 0 10 10 re B* +130 150 50 30 re B* +1 0 0 rg +0 0 10 10 re B* +70 67 50 30 re B* +Q +endstream +endobj +xref +0 5 +00 65535 f +15 0 n +68 0 n +000157 0 n +000270 0 n +trailer << + /Root 1 0 R + /Size 5 +>> +startxref +510 +%%EOF diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index 1c143a1b8319..c27555ca1d70 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -186,6 +186,31 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testCommentEnd) CPPUNIT_ASSERT(aDocument.Read(aFile)); } +CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testMixedArrayWithNumbers) +{ +// Load a file that has markup like this: +// 3 0 obj << +// /Test [1 4 0 R 3 false 5 (Lieral) 7 <90>] +// >> +OUString aSourceURL = createFileURL(u"array-mixed-numbers-and-elements.pdf"); +SvFileStream aFile(aSourceURL, StreamMode::READ); +vcl::filter::PDFDocument aDocument; +CPPUNIT_ASSERT(aDocument.Read(aFile)); +std::vector aPages = aDocument.GetPages(); +CPPUNIT_ASSERT(!aPages.empty()); +vcl::filter::PDFObjectElement* pPage = aPages[0]; +auto pTest = dynamic_cast(pPage->Lookup("Test")); +std::vector aElements = pTest->GetElements(); + +// Without the accompanying fix in place, this test would have failed with +// the array containing the wrong number of elements and in the incorrect order +CPPUNIT_ASSERT_EQUAL(8, static_cast(aElements.size())); +CPPUNIT_ASSERT(dynamic_cast(aElements[0])); +CPPUNIT_ASSERT(dynamic_cast(aElements[2])); +CPPUNIT_ASSERT(dynamic_cast(aElements[4])); +CPPUNIT_ASSERT(dynamic_cast(aElements[6])); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 19748e241ead..5ff50d3b55ac 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -3248,6 +3248,18 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pReference = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (aNumbers.size() > 2) +{ +aNumbers.resize(aNumbers.size() - 2); +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) { pParsingArray->PushBack(pReference); @@ -3268,6 +3280,17 @@ size_t PDFObjectParser::parse(PDFElement* pParsingElement, size_t nStartIndex, i } else if (auto pLiteralString = dynamic_cast(pCurrentElement)) { +// Handle previously stored number +if (!aNumbers.empty()) +{ +if (pParsingArray) +{ +for (auto& pNumber : aNumbers) +pParsingArray->PushBack(pNumber); +} +aNumbers.clear(); +} + if (pParsingArray) {