[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - unoxml/source
unoxml/source/dom/documentbuilder.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 0a60eea723f6155540c5847e33832b4c115d162a Author: rash419 AuthorDate: Tue Aug 8 13:02:53 2023 +0530 Commit: Andras Timar CommitDate: Wed Aug 9 17:34:27 2023 +0200 tdf#153009 Use recursive mutex in CDocumentBuilder This was changed from `osl::Mutex` to `std::mutex` in commit e66fdb597b30fc701bb068824d0ae4d89fecd55f Date: Sat Jul 31 20:12:30 2021 +0200 osl::Mutex->std::mutex in CDocumentBuilder , but `DOM::CDocumentBuilder::parseURI` locks the mutex and then calls `DOM::CDocumentBuilder::parse` for the // if we failed to parse the URI as a simple file, lets try via a ucb stream. // For Android file:///assets/ URLs which must go via the osl/ file API. case, which would result in a deadlock because `DOM::CDocumentBuilder::parse` wants to lock the mutex again. This happens once that code path is executed on Android Viewer when creating a new Impress presentation with Change-Id Iba1ac68c0b983d3e465515f07b3fc67162a0ee3f ("tdf#153009 android: Include more doc layout related XML files") in place. Fix the deadlock by using a "std::recursive_mutex` instead. Part of the backtrace: DOM::CDocumentBuilder::parse(const com::sun::star::uno::Reference<…> &) documentbuilder.cxx:331 DOM::CDocumentBuilder::parseURI(const rtl::OUString &) documentbuilder.cxx:387 non-virtual thunk to DOM::CDocumentBuilder::parseURI(rtl::OUString const&) documentbuilder.cxx:0 SdDrawDocument::InitLayoutVector() drawdoc.cxx:1130 SdDrawDocument::SdDrawDocument(DocumentType, SfxObjectShell *) drawdoc.cxx:147 sd::DrawDocShell::Construct(bool) docshell.cxx:94 sd::DrawDocShell::DrawDocShell(SfxModelFlags, bool, DocumentType) docshell.cxx:140 sd_PresentationDocument_get_implementation::$_1::operator()(SfxModelFlags) const unodoc.cxx:65 std::__ndk1::__invoke<…>(sd_PresentationDocument_get_implementation::$_1 &, SfxModelFlags &&) type_traits:4353 std::__ndk1::__invoke_void_return_wrapper::__call<…>(sd_PresentationDocument_get_implementation::$_1 &, SfxModelFlags &&) __functional_base:318 std::__ndk1::__function::__alloc_func::operator()(SfxModelFlags &&) functional:1527 std::__ndk1::__function::__func::operator()(SfxModelFlags &&) functional:1651 std::__ndk1::__function::__value_func::operator()(SfxModelFlags &&) const functional:1799 std::__ndk1::function::operator()(SfxModelFlags) const functional:2347 sfx2::createSfxModelInstance(const com::sun::star::uno::Sequence<…> &, std::__ndk1::function<…>) sfxmodelfactory.cxx:82 sd_PresentationDocument_get_implementation(com::sun::star::uno::XComponentContext *, const com::sun::star::uno::Sequence<…> &) unodoc.cxx:61 std::__ndk1::__invoke<…>(com::sun::star::uno::XInterface *(*&)(com::sun::star::uno::XComponentContext *, const com::sun::star::uno::Sequence<…> &), com::sun::star::uno::XComponentContext *&&, const com::sun::star::uno::Sequence<…> &) type_traits:4353 std::__ndk1::__invoke_void_return_wrapper::__call<…>(com::sun::star::uno::XInterface *(*&)(com::sun::star::uno::XComponentContext *, const com::sun::star::uno::Sequence<…> &), com::sun::star::uno::XComponentContext *&&, const com::sun::star::uno::Sequence<…> &) __functional_base:318 std::__ndk1::__function::__alloc_func::operator()(com::sun::star::uno::XComponentContext *&&, const com::sun::star::uno::Sequence<…> &) functional:1527 std::__ndk1::__function::__func::operator()(com::sun::star::uno::XComponentContext *&&, const com::sun::star::uno::Sequence<…> &) functional:1651 std::__ndk1::__function::__value_func::operator()(com::sun::star::uno::XComponentContext *&&, const com::sun::star::uno::Sequence<…> &) const functional:1799 std::__ndk1::function::operator()(com::sun::star::uno::XComponentContext *, const com::sun::star::uno::Sequence<…> &) const functional:2347 cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(const com::sun::star::uno::Reference<…> &) servicemanager.cxx:706 cppuhelper::ServiceManager::Data::Implementation::createInstance(const com::sun::star::uno::Reference<…> &, bool) servicemanager.cxx:675 cppuhelper::ServiceManager::createInstanceWithContext(const rtl::OUString &, const com::sun::star::uno::Reference<…> &) servicemanager.cxx:1006 non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference const&) servicemanager.cxx:0 SfxFrameLoader_Impl::load(const com::sun::star::uno::Sequence<…> &, const com::sun::star::uno::Reference<…> &) frmload.cxx:707 non-virtual thunk to (anonymous
[Libreoffice-commits] core.git: sd/inc sd/source
sd/inc/sdgrffilter.hxx |1 sd/source/filter/grf/sdgrffilter.cxx | 85 +-- 2 files changed, 54 insertions(+), 32 deletions(-) New commits: commit 1c47cd54da5f193f4b27cf86ef167c8a415c0408 Author: rash419 AuthorDate: Wed Jun 7 11:25:00 2023 +0530 Commit: Tomaž Vajngerl CommitDate: Thu Jun 8 14:30:52 2023 +0200 tdf#155444 added support for multi image tiff file Signed-off-by: rash419 Change-Id: I188aebae9c853e87dc50ffda5b7d88228559a7c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152657 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/sd/inc/sdgrffilter.hxx b/sd/inc/sdgrffilter.hxx index dc9027f94ca3..28ce9de6dd29 100644 --- a/sd/inc/sdgrffilter.hxx +++ b/sd/inc/sdgrffilter.hxx @@ -34,6 +34,7 @@ public: bool Export() override; static void HandleGraphicFilterError(ErrCode nFilterError, ErrCode nStreamError); +static void InsertSdrGrafObj(Graphic pGraphic, SdPage* pPage); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 71f9221ab055..693f297a19c6 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -156,50 +156,71 @@ bool SdGRFFilter::Import() if( mrDocument.GetPageCount() == 0 ) mrDocument.CreateFirstPages(); -SdPage* pPage = mrDocument.GetSdPage( 0, PageKind::Standard ); -Point aPos; -SizeaPagSize( pPage->GetSize() ); -SizeaGrfSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), -aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM))); - -aPagSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) ); -aPagSize.AdjustHeight( -(pPage->GetUpperBorder() + pPage->GetLowerBorder()) ); - -// scale to fit page -if ( ( ( aGrfSize.Height() > aPagSize.Height() ) || ( aGrfSize.Width() > aPagSize.Width() ) ) && -aGrfSize.Height() && aPagSize.Height() ) +GfxLink aGfxLink = aGraphic.GetGfxLink(); +if( aGfxLink.GetType() == GfxLinkType::NativeTif && aGraphic.IsAnimated() ) { -double fGrfWH = static_cast(aGrfSize.Width()) / aGrfSize.Height(); -double fWinWH = static_cast(aPagSize.Width()) / aPagSize.Height(); - -// adjust graphic to page size (scales) -if( fGrfWH < fWinWH ) +Animation aAnim( aGraphic.GetAnimation() ); +const auto nImages = aAnim.Count(); +for (size_t i = 0; i < nImages - 1; ++i) { -aGrfSize.setWidth( static_cast( aPagSize.Height() * fGrfWH ) ); -aGrfSize.setHeight( aPagSize.Height() ); +mrDocument.DuplicatePage(0); } -else if( fGrfWH > 0.F ) +for (size_t nPageIndex = 0; nPageIndex < nImages; ++nPageIndex) { -aGrfSize.setWidth( aPagSize.Width() ); -aGrfSize.setHeight( static_cast( aPagSize.Width() / fGrfWH ) ); +Graphic pGraphic = aAnim.Get(nPageIndex).maBitmapEx; +SdPage* pPage = mrDocument.GetSdPage(nPageIndex, PageKind::Standard); +InsertSdrGrafObj(pGraphic, pPage); } } - -// set output rectangle for graphic -aPos.setX( ( ( aPagSize.Width() - aGrfSize.Width() ) >> 1 ) + pPage->GetLeftBorder() ); -aPos.setY( ( ( aPagSize.Height() - aGrfSize.Height() ) >> 1 ) + pPage->GetUpperBorder() ); - -pPage->InsertObject( -new SdrGrafObj( -pPage->getSdrModelFromSdrPage(), -aGraphic, -::tools::Rectangle(aPos, aGrfSize))); +else +{ +SdPage* pPage = mrDocument.GetSdPage(0, PageKind::Standard); +InsertSdrGrafObj(aGraphic, pPage); +} bRet = true; } return bRet; } +void SdGRFFilter::InsertSdrGrafObj(Graphic pGraphic, SdPage* pPage) +{ +Point aPos; +Size aPagSize(pPage->GetSize()); +Size aGrfSize(OutputDevice::LogicToLogic(pGraphic.GetPrefSize(), pGraphic.GetPrefMapMode(), + MapMode(MapUnit::Map100thMM))); + +aPagSize.AdjustWidth(-(pPage->GetLeftBorder() + pPage->GetRightBorder())); +aPagSize.AdjustHeight(-(pPage->GetUpperBorder() + pPage->GetLowerBorder())); + +// scale to fit page +if (((aGrfSize.Height() > aPagSize.Height()) || (aGrfSize.Width() > aPagSize.Width())) +&& aGrfSize.Height() && aPagSize.Height()) +{ +double fGrfWH = static_cast(aGrfSize.Width()) / aGrfSize.Height(); +double fWinWH = static_cast(aPagSize.Width()) / aPagSize.Height(); + +// adjust graphic to page size (scales) +if (fGrfWH < fWinWH) +{ +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sd/inc sd/source
sd/inc/sdgrffilter.hxx |1 sd/source/filter/grf/sdgrffilter.cxx | 85 +-- 2 files changed, 54 insertions(+), 32 deletions(-) New commits: commit 844a97295444b30147ac484166353fba21c582c0 Author: rash419 AuthorDate: Wed Jun 7 11:25:00 2023 +0530 Commit: Tomaž Vajngerl CommitDate: Thu Jun 8 07:08:34 2023 +0200 tdf#155444 added support for multi image tiff file Signed-off-by: rash419 Change-Id: I188aebae9c853e87dc50ffda5b7d88228559a7c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152693 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl diff --git a/sd/inc/sdgrffilter.hxx b/sd/inc/sdgrffilter.hxx index dc9027f94ca3..28ce9de6dd29 100644 --- a/sd/inc/sdgrffilter.hxx +++ b/sd/inc/sdgrffilter.hxx @@ -34,6 +34,7 @@ public: bool Export() override; static void HandleGraphicFilterError(ErrCode nFilterError, ErrCode nStreamError); +static void InsertSdrGrafObj(Graphic pGraphic, SdPage* pPage); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 71f9221ab055..693f297a19c6 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -156,50 +156,71 @@ bool SdGRFFilter::Import() if( mrDocument.GetPageCount() == 0 ) mrDocument.CreateFirstPages(); -SdPage* pPage = mrDocument.GetSdPage( 0, PageKind::Standard ); -Point aPos; -SizeaPagSize( pPage->GetSize() ); -SizeaGrfSize( OutputDevice::LogicToLogic( aGraphic.GetPrefSize(), -aGraphic.GetPrefMapMode(), MapMode(MapUnit::Map100thMM))); - -aPagSize.AdjustWidth( -(pPage->GetLeftBorder() + pPage->GetRightBorder()) ); -aPagSize.AdjustHeight( -(pPage->GetUpperBorder() + pPage->GetLowerBorder()) ); - -// scale to fit page -if ( ( ( aGrfSize.Height() > aPagSize.Height() ) || ( aGrfSize.Width() > aPagSize.Width() ) ) && -aGrfSize.Height() && aPagSize.Height() ) +GfxLink aGfxLink = aGraphic.GetGfxLink(); +if( aGfxLink.GetType() == GfxLinkType::NativeTif && aGraphic.IsAnimated() ) { -double fGrfWH = static_cast(aGrfSize.Width()) / aGrfSize.Height(); -double fWinWH = static_cast(aPagSize.Width()) / aPagSize.Height(); - -// adjust graphic to page size (scales) -if( fGrfWH < fWinWH ) +Animation aAnim( aGraphic.GetAnimation() ); +const auto nImages = aAnim.Count(); +for (size_t i = 0; i < nImages - 1; ++i) { -aGrfSize.setWidth( static_cast( aPagSize.Height() * fGrfWH ) ); -aGrfSize.setHeight( aPagSize.Height() ); +mrDocument.DuplicatePage(0); } -else if( fGrfWH > 0.F ) +for (size_t nPageIndex = 0; nPageIndex < nImages; ++nPageIndex) { -aGrfSize.setWidth( aPagSize.Width() ); -aGrfSize.setHeight( static_cast( aPagSize.Width() / fGrfWH ) ); +Graphic pGraphic = aAnim.Get(nPageIndex).maBitmapEx; +SdPage* pPage = mrDocument.GetSdPage(nPageIndex, PageKind::Standard); +InsertSdrGrafObj(pGraphic, pPage); } } - -// set output rectangle for graphic -aPos.setX( ( ( aPagSize.Width() - aGrfSize.Width() ) >> 1 ) + pPage->GetLeftBorder() ); -aPos.setY( ( ( aPagSize.Height() - aGrfSize.Height() ) >> 1 ) + pPage->GetUpperBorder() ); - -pPage->InsertObject( -new SdrGrafObj( -pPage->getSdrModelFromSdrPage(), -aGraphic, -::tools::Rectangle(aPos, aGrfSize))); +else +{ +SdPage* pPage = mrDocument.GetSdPage(0, PageKind::Standard); +InsertSdrGrafObj(aGraphic, pPage); +} bRet = true; } return bRet; } +void SdGRFFilter::InsertSdrGrafObj(Graphic pGraphic, SdPage* pPage) +{ +Point aPos; +Size aPagSize(pPage->GetSize()); +Size aGrfSize(OutputDevice::LogicToLogic(pGraphic.GetPrefSize(), pGraphic.GetPrefMapMode(), + MapMode(MapUnit::Map100thMM))); + +aPagSize.AdjustWidth(-(pPage->GetLeftBorder() + pPage->GetRightBorder())); +aPagSize.AdjustHeight(-(pPage->GetUpperBorder() + pPage->GetLowerBorder())); + +// scale to fit page +if (((aGrfSize.Height() > aPagSize.Height()) || (aGrfSize.Width() > aPagSize.Width())) +&& aGrfSize.Height() && aPagSize.Height()) +{ +double fGrfWH = static_cast(aGrfSize.Width()) / aGrfSize.Height(); +double fWinWH = static_cast(aPagSize.Width()) / aPagSize.Height(); + +// adjust graphic to page size (scales) +if (fGrfWH < fWinWH) +{ +
[Libreoffice-commits] core.git: sw/source vcl/jsdialog
sw/source/ui/misc/contentcontroldlg.cxx |5 - vcl/jsdialog/enabled.cxx|4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) New commits: commit 67160035d65f9b43b8483e5900d2a2812e1bbecc Author: rash419 AuthorDate: Wed Jun 15 17:23:44 2022 +0530 Commit: Szymon Kłos CommitDate: Sun Nov 20 10:40:33 2022 +0100 sw: jsdialog: enable contentcontrol and contentcontrollistitem dialogs contentcontrol: fix: modify, remove, move up/down buttons doesnot work even if item is selected in jsdialog Signed-off-by: rash419 Change-Id: Ib038ce2a3ff6f92ab7314b18f36a038991a35f3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135902 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142971 Tested-by: Jenkins Reviewed-by: Szymon Kłos diff --git a/sw/source/ui/misc/contentcontroldlg.cxx b/sw/source/ui/misc/contentcontroldlg.cxx index ec45e87066c4..799f722945ff 100644 --- a/sw/source/ui/misc/contentcontroldlg.cxx +++ b/sw/source/ui/misc/contentcontroldlg.cxx @@ -400,11 +400,6 @@ IMPL_LINK_NOARG(SwContentControlDlg, MoveDownHdl, weld::Button&, void) IMPL_LINK_NOARG(SwContentControlDlg, SelectionChangedHdl, weld::TreeView&, void) { -if (!m_xListItems->has_focus()) -{ -return; -} - int nRow = m_xListItems->get_selected_index(); if (nRow < 0) { diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index 6ba2adc8b1fc..efb87ac0b9fe 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -61,7 +61,9 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"xmlsec/ui/certpage.ui" || rUIFile == u"svx/ui/accessibilitycheckdialog.ui" || rUIFile == u"modules/swriter/ui/translationdialog.ui" || rUIFile == u"svx/ui/accessibilitycheckentry.ui" -|| rUIFile == u"cui/ui/widgettestdialog.ui") +|| rUIFile == u"cui/ui/widgettestdialog.ui" +|| rUIFile == u"modules/swriter/ui/contentcontroldlg.ui" +|| rUIFile == u"modules/swriter/ui/contentcontrollistitemdlg.ui") { return true; }
[Libreoffice-commits] core.git: cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk include/sfx2 sfx2/sdi sfx2/source vcl/jsdialog
cui/Library_cui.mk |1 cui/UIConfig_cui.mk |1 cui/inc/widgettestdlg.hxx| 28 + cui/source/dialogs/widgettestdlg.cxx | 31 ++ cui/source/factory/dlgfact.cxx |9 cui/source/factory/dlgfact.hxx |6 cui/uiconfig/ui/widgettestdialog.ui | 496 +++ include/sfx2/sfxdlg.hxx |2 include/sfx2/sfxsids.hrc |1 sfx2/sdi/appslots.sdi|4 sfx2/sdi/sfx.sdi | 17 + sfx2/source/appl/appserv.cxx | 11 vcl/jsdialog/enabled.cxx |3 13 files changed, 609 insertions(+), 1 deletion(-) New commits: commit ba5e0013e74f072300e808e4d8d679b6f42bff92 Author: rash419 AuthorDate: Wed Apr 13 16:20:36 2022 +0530 Commit: Szymon Kłos CommitDate: Sun Nov 20 10:40:16 2022 +0100 jsdialogs: added WidgetTestDialog to test different vcl widgets in online side Signed-off-by: rash419 Change-Id: I27cbb72b4ccd486b58934503b1d3d5d7ff47cbfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132865 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142970 Tested-by: Jenkins diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 5918be60972c..e967e4491419 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -241,6 +241,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/tabpages/tptrans \ cui/source/tabpages/transfrm \ cui/source/util/FontFeatures \ +cui/source/dialogs/widgettestdlg \ )) # vim: set noet sw=4 ts=4: diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk index 89c8869ade36..4c0f9a7f2a75 100644 --- a/cui/UIConfig_cui.mk +++ b/cui/UIConfig_cui.mk @@ -228,6 +228,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/wordcompletionpage \ cui/uiconfig/ui/spinbox \ cui/uiconfig/ui/zoomdialog \ + cui/uiconfig/ui/widgettestdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/cui/inc/widgettestdlg.hxx b/cui/inc/widgettestdlg.hxx new file mode 100644 index ..dabc2ee14e75 --- /dev/null +++ b/cui/inc/widgettestdlg.hxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* +* This file is part of the LibreOffice project. +* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. +*/ + +#pragma once + +#include +#include +#include + +class WidgetTestDialog final : public weld::GenericDialogController +{ +private: +std::unique_ptr m_xOKButton; +std::unique_ptr m_xCancelButton; + +DECL_LINK(OkHdl, weld::Button&, void); +DECL_LINK(CancelHdl, weld::Button&, void); + +public: +WidgetTestDialog(weld::Window* pParent); +~WidgetTestDialog(); +}; diff --git a/cui/source/dialogs/widgettestdlg.cxx b/cui/source/dialogs/widgettestdlg.cxx new file mode 100644 index ..5475151a9af2 --- /dev/null +++ b/cui/source/dialogs/widgettestdlg.cxx @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* +* This file is part of the LibreOffice project. +* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. +*/ + +#include + +WidgetTestDialog::WidgetTestDialog(weld::Window* pParent) +: GenericDialogController(pParent, "cui/ui/widgettestdialog.ui", "WidgetTestDialog") +{ +m_xOKButton = m_xBuilder->weld_button("ok_btn"); +m_xCancelButton = m_xBuilder->weld_button("cancel_btn"); + +m_xOKButton->connect_clicked(LINK(this, WidgetTestDialog, OkHdl)); +m_xCancelButton->connect_clicked(LINK(this, WidgetTestDialog, CancelHdl)); +} + +WidgetTestDialog::~WidgetTestDialog() {} + +IMPL_LINK_NOARG(WidgetTestDialog, OkHdl, weld::Button&, void) { m_xDialog->response(RET_OK); } + +IMPL_LINK_NOARG(WidgetTestDialog, CancelHdl, weld::Button&, void) +{ +m_xDialog->response(RET_CANCEL); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 930452d64d09..0cd8d39688ad 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -89,6 +89,7 @@ #include #include #include +#include #include #include #include @@ -143,6 +144,7 @@ IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractControllerAsync,weld::DialogController) IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractTabController,SfxTabDialogController) IMPL_ABSTDLG_CLASS(CuiAbstractController) IMPL_ABSTDLG_CLASS(CuiAbstractSingleTabController) +IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractWidgetTestControllerAsync,weld::GenericDialogController) short
[Libreoffice-commits] core.git: sc/source
sc/source/ui/attrdlg/scdlgfact.cxx |7 ++ sc/source/ui/attrdlg/scdlgfact.hxx |5 + sc/source/ui/view/cellsh3.cxx | 96 + 3 files changed, 65 insertions(+), 43 deletions(-) New commits: commit 057eca05f23d9d15465e591bd0da671735d62d50 Author: rash419 AuthorDate: Tue Apr 12 20:00:13 2022 +0530 Commit: Aron Budea CommitDate: Tue Nov 15 06:34:37 2022 +0100 sc: convert optimal width/height and normal width/height dialog to async Signed-off-by: rash419 Change-Id: I96f6d90692d7767bdc276f753897bdc392c90411 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132919 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133127 Reviewed-by: Gökay ŞATIR Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142633 Tested-by: Jenkins Reviewed-by: Aron Budea diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 722c3b8c29e4..0eca6bafb8a7 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -204,6 +204,11 @@ short AbstractScMetricInputDlg_Impl::Execute() return m_xDlg->run(); } +bool AbstractScMetricInputDlg_Impl::StartExecuteAsync(AsyncContext& rCtx) +{ +return ScMetricInputDlg::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short AbstractScMoveTableDlg_Impl::Execute() { return m_xDlg->run(); @@ -1149,7 +1154,7 @@ VclPtr ScAbstractDialogFactory_Impl::CreateScMetricInp tools::Long nMaximum , tools::Long nMinimum ) { -return VclPtr::Create(std::make_unique(pParent, sDialogName, nCurrent ,nDefault, eFUnit, +return VclPtr::Create(std::make_shared(pParent, sDialogName, nCurrent ,nDefault, eFUnit, nDecimals, nMaximum , nMinimum)); } diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 35782000b979..e39428018287 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -348,13 +348,14 @@ public: class AbstractScMetricInputDlg_Impl : public AbstractScMetricInputDlg { -std::unique_ptr m_xDlg; +std::shared_ptr m_xDlg; public: -explicit AbstractScMetricInputDlg_Impl(std::unique_ptr p) +explicit AbstractScMetricInputDlg_Impl(std::shared_ptr p) : m_xDlg(std::move(p)) { } virtual short Execute() override; +virtual bool StartExecuteAsync(AsyncContext& rCtx) override; virtual int GetInputValue() const override; }; diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index a0d08a605058..9ab0e09ac00e 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -687,21 +687,24 @@ void ScCellShell::Execute( SfxRequest& rReq ) GetRowHeight( rData.GetCurY(), rData.GetTabNo() ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); -ScopedVclPtr pDlg(pFact->CreateScMetricInputDlg( +VclPtr pDlg(pFact->CreateScMetricInputDlg( pTabViewShell->GetFrameWeld(), "RowHeightDialog", nCurHeight, ScGlobal::nStdRowHeight, eMetric, 2, MAX_ROW_HEIGHT)); -if ( pDlg->Execute() == RET_OK ) -{ -tools::Long nVal = pDlg->GetInputValue(); -pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, static_cast(nVal) ); - -// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert -rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, static_cast(TwipsToEvenHMM(nVal)) ) ); -rReq.Done(); +pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){ +if (nResult == RET_OK) +{ +SfxRequest pRequest(pTabViewShell->GetViewFrame(), FID_ROW_HEIGHT); +tools::Long nVal = pDlg->GetInputValue(); +pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, static_cast(nVal) ); -} +// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert +pRequest.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, static_cast(TwipsToEvenHMM(nVal)) ) ); +pRequest.Done(); +} +pDlg->disposeOnce(); +}); } } break; @@ -725,20 +728,24 @@ void
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - include/svx svx/sdi svx/source sw/source
include/svx/hlnkitem.hxx|8 +++- include/svx/svxids.hrc |1 + svx/sdi/svxitems.sdi| 11 ++- svx/source/items/hlnkitem.cxx | 17 ++--- sw/source/uibase/shells/textfld.cxx | 15 ++- 5 files changed, 42 insertions(+), 10 deletions(-) New commits: commit fb3597932ad9322feb58115528ca1dae070edfa5 Author: rash419 AuthorDate: Thu Sep 15 18:02:06 2022 +0530 Commit: Szymon Kłos CommitDate: Tue Sep 27 11:15:56 2022 +0200 svx: extended SvxHyperlinkItem to have a new property sReplacementText this property is use to pass text that needs to be replaced when executing uno:SetHyperlink command in online for inserting the mention Signed-off-by: rash419 Change-Id: I48fba347bda0652f7b657524f23c2dd837cd8186 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140015 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice diff --git a/include/svx/hlnkitem.hxx b/include/svx/hlnkitem.hxx index 5d6ac5689401..7c6501cd 100644 --- a/include/svx/hlnkitem.hxx +++ b/include/svx/hlnkitem.hxx @@ -26,6 +26,7 @@ #include #include #include +#include enum class HyperDialogEvent { NONE= 0x, @@ -51,6 +52,7 @@ class SVX_DLLPUBLIC SvxHyperlinkItem final : public SfxPoolItem OUString sURL; OUString sTarget; SvxLinkInsertMode eType; +OUString sReplacementText; OUString sIntName; std::unique_ptr pMacroTable; @@ -67,7 +69,8 @@ public: const OUString& rTarget, const OUString& rIntName, SvxLinkInsertMode eTyp, HyperDialogEvent nEvents, -SvxMacroTableDtor const *pMacroTbl ); +SvxMacroTableDtor const *pMacroTbl, +const OUString& rReplacementText = OUString()); virtual bool operator==( const SfxPoolItem& ) const override; virtual SvxHyperlinkItem* Clone( SfxItemPool *pPool = nullptr ) const override; @@ -97,6 +100,9 @@ public: void SetMacroEvents (const HyperDialogEvent nEvents) { nMacroEvents = nEvents; } HyperDialogEvent GetMacroEvents() const { return nMacroEvents; } +const OUString& GetReplacementText() const { return sReplacementText; } +voidSetReplacementText(const OUString& rReplacementText) { sReplacementText = rReplacementText; } + }; #endif diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index f8e162a973a6..e19f5121d5de 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -67,6 +67,7 @@ class SdrAngleItem; #define MID_HLINK_TARGET0x71 #define MID_HLINK_TYPE 0x72 #define MID_HLINK_TEXT 0x73 +#define MID_HLINK_REPLACEMENTTEXT 0x74 #define MID_VIEWLAYOUT_COLUMNS 0x77 #define MID_VIEWLAYOUT_BOOKMODE 0x78 diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index 549ffc3f3227..b34a317b3449 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -343,11 +343,12 @@ item SvxLongULSpace SvxLongULSpaceItem; struct SvxHyperlink { -String TextMID_HLINK_TEXT; -String URL MID_HLINK_URL; -String Target MID_HLINK_TARGET; -String NameMID_HLINK_NAME; -INT32 TypeMID_HLINK_TYPE; +String Text MID_HLINK_TEXT; +String URLMID_HLINK_URL; +String Target MID_HLINK_TARGET; +String Name MID_HLINK_NAME; +INT32 Type MID_HLINK_TYPE; +String ReplacementTextMID_HLINK_REPLACEMENTTEXT }; item SvxHyperlink SvxHyperlinkItem; diff --git a/svx/source/items/hlnkitem.cxx b/svx/source/items/hlnkitem.cxx index 7a092b36fc5a..f8500277316a 100644 --- a/svx/source/items/hlnkitem.cxx +++ b/svx/source/items/hlnkitem.cxx @@ -33,6 +33,7 @@ SvxHyperlinkItem::SvxHyperlinkItem( const SvxHyperlinkItem& rHyperlinkItem ): eType = rHyperlinkItem.eType; sIntName = rHyperlinkItem.sIntName; nMacroEvents = rHyperlinkItem.nMacroEvents; +sReplacementText = rHyperlinkItem.sReplacementText; if( rHyperlinkItem.GetMacroTable() ) pMacroTable.reset( new SvxMacroTableDtor( *rHyperlinkItem.GetMacroTable() ) ); @@ -41,14 +42,15 @@ SvxHyperlinkItem::SvxHyperlinkItem( const SvxHyperlinkItem& rHyperlinkItem ): SvxHyperlinkItem::SvxHyperlinkItem( sal_uInt16 _nWhich, const OUString& rName, const OUString& rURL, const OUString& rTarget, const OUString& rIntName, SvxLinkInsertMode eTyp, -HyperDialogEvent nEvents, SvxMacroTableDtor const *pMacroTbl ): +HyperDialogEvent nEvents, SvxMacroTableDtor const *pMacroTbl, const OUString& rReplacementText): SfxPoolItem (_nWhich), sName (rName), sURL(rURL), sTarget
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source vcl/jsdialog
sw/source/ui/misc/contentcontroldlg.cxx |5 - vcl/jsdialog/enabled.cxx|4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) New commits: commit 8c53583faa493abf6cd7b2e56b5df7343e922133 Author: rash419 AuthorDate: Wed Jun 15 17:23:44 2022 +0530 Commit: Miklos Vajna CommitDate: Thu Jun 16 15:02:13 2022 +0200 sw: jsdialog: enable contentcontrol and contentcontrollistitem dialogs contentcontrol: fix: modify, remove, move up/down buttons doesnot work even if item is selected in jsdialog Signed-off-by: rash419 Change-Id: Ib038ce2a3ff6f92ab7314b18f36a038991a35f3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135902 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/source/ui/misc/contentcontroldlg.cxx b/sw/source/ui/misc/contentcontroldlg.cxx index 95c86120e497..5e4347e62afb 100644 --- a/sw/source/ui/misc/contentcontroldlg.cxx +++ b/sw/source/ui/misc/contentcontroldlg.cxx @@ -374,11 +374,6 @@ IMPL_LINK_NOARG(SwContentControlDlg, MoveDownHdl, weld::Button&, void) IMPL_LINK_NOARG(SwContentControlDlg, SelectionChangedHdl, weld::TreeView&, void) { -if (!m_xListItems->has_focus()) -{ -return; -} - int nRow = m_xListItems->get_selected_index(); if (nRow < 0) { diff --git a/vcl/jsdialog/enabled.cxx b/vcl/jsdialog/enabled.cxx index f7849bb9e3e4..7984dab3d6f8 100644 --- a/vcl/jsdialog/enabled.cxx +++ b/vcl/jsdialog/enabled.cxx @@ -58,7 +58,9 @@ bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile) || rUIFile == u"xmlsec/ui/viewcertdialog.ui" || rUIFile == u"xmlsec/ui/certgeneral.ui" || rUIFile == u"xmlsec/ui/certpage.ui" || rUIFile == u"svx/ui/accessibilitycheckdialog.ui" || rUIFile == u"svx/ui/accessibilitycheckentry.ui" -|| rUIFile == u"cui/ui/widgettestdialog.ui") +|| rUIFile == u"cui/ui/widgettestdialog.ui" +|| rUIFile == u"modules/swriter/ui/contentcontroldlg.ui" +|| rUIFile == u"modules/swriter/ui/contentcontrollistitemdlg.ui") { return true; }
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/source
sc/source/ui/attrdlg/scdlgfact.cxx |7 ++ sc/source/ui/attrdlg/scdlgfact.hxx |5 + sc/source/ui/view/cellsh3.cxx | 96 + 3 files changed, 65 insertions(+), 43 deletions(-) New commits: commit 7f7e81f70304d672b85fe457c126285a5abac103 Author: rash419 AuthorDate: Tue Apr 12 20:00:13 2022 +0530 Commit: Gökay ŞATIR CommitDate: Thu Apr 21 18:28:28 2022 +0200 sc: convert optimal width/height and normal width/height dialog to async Signed-off-by: rash419 Change-Id: I96f6d90692d7767bdc276f753897bdc392c90411 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132919 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133127 Reviewed-by: Gökay ŞATIR diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 9fbfccaa4d38..ab8741a9e8d8 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -194,6 +194,11 @@ short AbstractScMetricInputDlg_Impl::Execute() return m_xDlg->run(); } +bool AbstractScMetricInputDlg_Impl::StartExecuteAsync(AsyncContext& rCtx) +{ +return ScMetricInputDlg::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short AbstractScMoveTableDlg_Impl::Execute() { return m_xDlg->run(); @@ -1112,7 +1117,7 @@ VclPtr ScAbstractDialogFactory_Impl::CreateScMetricInp tools::Long nMaximum , tools::Long nMinimum ) { -return VclPtr::Create(std::make_unique(pParent, sDialogName, nCurrent ,nDefault, eFUnit, +return VclPtr::Create(std::make_shared(pParent, sDialogName, nCurrent ,nDefault, eFUnit, nDecimals, nMaximum , nMinimum)); } diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index fef206002dea..b3756bb075af 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -390,13 +390,14 @@ public: class AbstractScMetricInputDlg_Impl : public AbstractScMetricInputDlg { -std::unique_ptr m_xDlg; +std::shared_ptr m_xDlg; public: -explicit AbstractScMetricInputDlg_Impl(std::unique_ptr p) +explicit AbstractScMetricInputDlg_Impl(std::shared_ptr p) : m_xDlg(std::move(p)) { } virtual short Execute() override; +virtual bool StartExecuteAsync(AsyncContext& rCtx) override; virtual int GetInputValue() const override; }; diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index f24c06e9a0d2..f5c1155ec218 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -687,21 +687,24 @@ void ScCellShell::Execute( SfxRequest& rReq ) GetRowHeight( rData.GetCurY(), rData.GetTabNo() ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); -ScopedVclPtr pDlg(pFact->CreateScMetricInputDlg( +VclPtr pDlg(pFact->CreateScMetricInputDlg( pTabViewShell->GetFrameWeld(), "RowHeightDialog", nCurHeight, ScGlobal::nStdRowHeight, eMetric, 2, MAX_ROW_HEIGHT)); -if ( pDlg->Execute() == RET_OK ) -{ -tools::Long nVal = pDlg->GetInputValue(); -pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, static_cast(nVal) ); - -// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert -rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, static_cast(TwipsToEvenHMM(nVal)) ) ); -rReq.Done(); +pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){ +if (nResult == RET_OK) +{ +SfxRequest pRequest(pTabViewShell->GetViewFrame(), FID_ROW_HEIGHT); +tools::Long nVal = pDlg->GetInputValue(); +pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, static_cast(nVal) ); -} +// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert +pRequest.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, static_cast(TwipsToEvenHMM(nVal)) ) ); +pRequest.Done(); +} +pDlg->disposeOnce(); +}); } } break; @@ -725,20 +728,24 @@ void ScCellShell::Execute( SfxRequest& rReq ) FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk include/sfx2 sfx2/sdi sfx2/source vcl/jsdialog
cui/Library_cui.mk |1 cui/UIConfig_cui.mk |1 cui/inc/widgettestdlg.hxx| 30 ++ cui/source/dialogs/widgettestdlg.cxx | 36 ++ cui/source/factory/dlgfact.cxx |9 cui/source/factory/dlgfact.hxx |6 cui/uiconfig/ui/widgettestdialog.ui | 496 +++ include/sfx2/sfxdlg.hxx |2 include/sfx2/sfxsids.hrc |1 sfx2/sdi/appslots.sdi|4 sfx2/sdi/sfx.sdi | 17 + sfx2/source/appl/appserv.cxx | 11 vcl/jsdialog/enabled.cxx |3 13 files changed, 616 insertions(+), 1 deletion(-) New commits: commit 7f44d4b0efa23affc71b5dc77ac2fd78cc76e87e Author: rash419 AuthorDate: Wed Apr 13 16:20:36 2022 +0530 Commit: Szymon Kłos CommitDate: Fri Apr 15 12:23:49 2022 +0200 jsdialogs: added WidgetTestDialog to test different vcl widgets in online side Signed-off-by: rash419 Change-Id: I27cbb72b4ccd486b58934503b1d3d5d7ff47cbfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132865 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index fb3546b4e9ad..88e75ee1faef 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -231,6 +231,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/tabpages/tptrans \ cui/source/tabpages/transfrm \ cui/source/util/FontFeatures \ +cui/source/dialogs/widgettestdlg \ )) # vim: set noet sw=4 ts=4: diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk index daa8a1e3d55d..c70cbd94588c 100644 --- a/cui/UIConfig_cui.mk +++ b/cui/UIConfig_cui.mk @@ -220,6 +220,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/wordcompletionpage \ cui/uiconfig/ui/spinbox \ cui/uiconfig/ui/zoomdialog \ + cui/uiconfig/ui/widgettestdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/cui/inc/widgettestdlg.hxx b/cui/inc/widgettestdlg.hxx new file mode 100644 index ..15a480d7119d --- /dev/null +++ b/cui/inc/widgettestdlg.hxx @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* +* This file is part of the LibreOffice project. +* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. +*/ + +#pragma once + +#include "tools/link.hxx" +#include +#include + +class WidgetTestDialog final : public weld::GenericDialogController +{ +private: +std::unique_ptr m_xOKButton; +std::unique_ptr m_xCancelButton; + +DECL_LINK(OkHdl, weld::Button&, void); +DECL_LINK(CancelHdl, weld::Button&, void); + +public: +WidgetTestDialog(weld::Window *pParent); +~WidgetTestDialog(); +}; + + diff --git a/cui/source/dialogs/widgettestdlg.cxx b/cui/source/dialogs/widgettestdlg.cxx new file mode 100644 index ..891d3f542438 --- /dev/null +++ b/cui/source/dialogs/widgettestdlg.cxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* +* This file is part of the LibreOffice project. +* +* This Source Code Form is subject to the terms of the Mozilla Public +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. +*/ + +#include + +WidgetTestDialog::WidgetTestDialog(weld::Window *pParent) + : GenericDialogController(pParent, "cui/ui/widgettestdialog.ui", "WidgetTestDialog") +{ +m_xOKButton = m_xBuilder->weld_button("ok_btn"); +m_xCancelButton = m_xBuilder->weld_button("cancel_btn"); + +m_xOKButton->connect_clicked(LINK(this, WidgetTestDialog, OkHdl)); +m_xCancelButton->connect_clicked(LINK(this, WidgetTestDialog, CancelHdl)); +} + +WidgetTestDialog::~WidgetTestDialog() +{ +} + +IMPL_LINK_NOARG(WidgetTestDialog, OkHdl, weld::Button&, void) +{ +m_xDialog->response(RET_OK); +} + +IMPL_LINK_NOARG(WidgetTestDialog, CancelHdl, weld::Button&, void) +{ +m_xDialog->response(RET_CANCEL); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index bd3130fd0fc7..4496b8e8799d 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -88,6 +88,7 @@ #include #include #include +#include #include #include #include @@ -142,6 +143,7 @@ IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractControllerAsync,weld::DialogController) IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractTabController,SfxTabDialogController) IMPL_ABSTDLG_CLASS(CuiAbstractController) IMPL_ABSTDLG_CLASS(CuiAbstractSingleTabController) +IMPL_ABSTDLG_CLASS_ASYNC(CuiAbstractWidgetTestControllerAsync,weld::GenericDialogController) const SfxItemSet* AbstractSvxCharacterMapDialog_Impl::GetOutputItemSet() const { @@ -1488,6
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - sc/source
sc/source/ui/attrdlg/scdlgfact.cxx |7 ++ sc/source/ui/attrdlg/scdlgfact.hxx |5 + sc/source/ui/view/cellsh3.cxx | 96 + 3 files changed, 65 insertions(+), 43 deletions(-) New commits: commit f7e1018f88f400aeee91a0b85a26964492e216fc Author: rash419 AuthorDate: Tue Apr 12 20:00:13 2022 +0530 Commit: Szymon Kłos CommitDate: Fri Apr 15 10:47:56 2022 +0200 sc: convert optimal width/height and normal width/height dialog to async Signed-off-by: rash419 Change-Id: I96f6d90692d7767bdc276f753897bdc392c90411 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132919 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 928f235882ad..57648f857fef 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -192,6 +192,11 @@ short AbstractScMetricInputDlg_Impl::Execute() return m_xDlg->run(); } +bool AbstractScMetricInputDlg_Impl::StartExecuteAsync(AsyncContext& rCtx) +{ +return ScMetricInputDlg::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + short AbstractScMoveTableDlg_Impl::Execute() { return m_xDlg->run(); @@ -1105,7 +1110,7 @@ VclPtr ScAbstractDialogFactory_Impl::CreateScMetricInp tools::Long nMaximum , tools::Long nMinimum ) { -return VclPtr::Create(std::make_unique(pParent, sDialogName, nCurrent ,nDefault, eFUnit, +return VclPtr::Create(std::make_shared(pParent, sDialogName, nCurrent ,nDefault, eFUnit, nDecimals, nMaximum , nMinimum)); } diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 46583103919f..b7e8d9efbe65 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -392,13 +392,14 @@ public: class AbstractScMetricInputDlg_Impl : public AbstractScMetricInputDlg { -std::unique_ptr m_xDlg; +std::shared_ptr m_xDlg; public: -explicit AbstractScMetricInputDlg_Impl(std::unique_ptr p) +explicit AbstractScMetricInputDlg_Impl(std::shared_ptr p) : m_xDlg(std::move(p)) { } virtual short Execute() override; +virtual bool StartExecuteAsync(AsyncContext& rCtx) override; virtual int GetInputValue() const override; }; diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 924ce27ab5f8..e2e31108c944 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -697,21 +697,24 @@ void ScCellShell::Execute( SfxRequest& rReq ) GetRowHeight( pData->GetCurY(), pData->GetTabNo() ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); -ScopedVclPtr pDlg(pFact->CreateScMetricInputDlg( +VclPtr pDlg(pFact->CreateScMetricInputDlg( pTabViewShell->GetFrameWeld(), "RowHeightDialog", nCurHeight, ScGlobal::nStdRowHeight, eMetric, 2, MAX_ROW_HEIGHT)); -if ( pDlg->Execute() == RET_OK ) -{ -tools::Long nVal = pDlg->GetInputValue(); -pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, static_cast(nVal) ); - -// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert -rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, static_cast(TwipsToEvenHMM(nVal)) ) ); -rReq.Done(); +pDlg->StartExecuteAsync([pDlg, pTabViewShell](sal_Int32 nResult){ +if (nResult == RET_OK) +{ +SfxRequest pRequest(pTabViewShell->GetViewFrame(), FID_ROW_HEIGHT); +tools::Long nVal = pDlg->GetInputValue(); +pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, static_cast(nVal) ); -} +// #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert +pRequest.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, static_cast(TwipsToEvenHMM(nVal)) ) ); +pRequest.Done(); +} +pDlg->disposeOnce(); +}); } } break; @@ -735,20 +738,24 @@ void ScCellShell::Execute( SfxRequest& rReq ) FieldUnit eMetric = SC_MOD()->GetAppOptions().GetAppMetric(); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - filter/qa filter/source
filter/qa/unit/data/attributeRedefinedTest.odp |binary filter/qa/unit/svg.cxx | 42 + filter/source/svg/svgwriter.cxx| 14 +++- 3 files changed, 55 insertions(+), 1 deletion(-) New commits: commit 0b5c5a4691cdfeeac3d00a74dd7d7e1fe0af5fb6 Author: Rash419 AuthorDate: Mon Jan 24 15:56:15 2022 +0530 Commit: Andras Timar CommitDate: Thu Jan 27 10:32:40 2022 +0100 svgexport: fix: attribute id redefined If there is a id for empty paragraph exist we need to create a empty text paragraph to accomodate the id if we don't do that then we get multiple id attribute on same element for example: Change-Id: I41c21dc94deef93e423aaff2248f6931fa6ca8de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128856 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128924 Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128954 diff --git a/filter/qa/unit/data/attributeRedefinedTest.odp b/filter/qa/unit/data/attributeRedefinedTest.odp new file mode 100644 index ..dfb814bfb9ec Binary files /dev/null and b/filter/qa/unit/data/attributeRedefinedTest.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 3e3508fd52ca..a93d92c7d1ea 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -209,6 +209,48 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testCustomBullet) CPPUNIT_ASSERT(!getXPath(pXmlDoc, "//svg:g[@class='BulletChars']//svg:path", "d").isEmpty()); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, attributeRedefinedTest) +{ +// Load document containing empty paragraphs with ids. +load(u"attributeRedefinedTest.odp"); + +// Export to SVG. +uno::Reference xStorable(getComponent(), 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 four paragraph +// 2 empty paragraphs with ids +// 2 paragraphs with text +// Without the accompanying fix the test would have failed with +// Expected : 4 +// Actual : 2 +// i.e. 2 of the empty paragraph do not get generated even if there +// is id imported for the paragraphs +// If we don't create the empty paragraphs the id attribute attribute gets redefined like this: +// + +OString xPath = "//svg:g[@class='TextShape']//svg:text[@class='SVGTextShape']//" +"svg:tspan[@class='TextParagraph']"; +assertXPath(pXmlDoc, xPath, 4); + +//assert that each tspan element with TextParagraph class has id and the tspan element of +//each empty paragraph doesnot contain tspan element with class TextPosition +assertXPath(pXmlDoc, xPath + "[1]", "id", "id4"); +assertXPath(pXmlDoc, xPath + "[2]", "id", "id5"); +assertXPath(pXmlDoc, xPath + "[2]//svg:tspan[@class='TextPosition']", 0); +assertXPath(pXmlDoc, xPath + "[3]", "id", "id6"); +assertXPath(pXmlDoc, xPath + "[3]//svg:tspan[@class='TextPosition']", 0); +assertXPath(pXmlDoc, xPath + "[4]", "id", "id7"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 159ae1b9a9c2..10d4982bee80 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1098,7 +1098,19 @@ bool SVGTextWriter::nextParagraph() const OUString& rParagraphId = implGetValidIDFromInterface( Reference(xTextContent, UNO_QUERY) ); if( !rParagraphId.isEmpty() ) { -mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +// if there is id for empty paragraph we need to create a empty text paragraph +Reference < XTextRange > xRange( xTextContent, UNO_QUERY_THROW ); +if ( xRange.is() && xRange->getString().isEmpty() ) +{ +endTextParagraph(); +mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "TextParagraph" ); +mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +mpTextParagraphElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS )); +} +else +{ +mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +} } return true; }
[Libreoffice-commits] core.git: filter/qa filter/source
filter/qa/unit/data/attributeRedefinedTest.odp |binary filter/qa/unit/svg.cxx | 42 + filter/source/svg/svgwriter.cxx| 14 +++- 3 files changed, 55 insertions(+), 1 deletion(-) New commits: commit b37e3e8c8c545a0776a9fcdbad3cb752162d2e3d Author: Rash419 AuthorDate: Mon Jan 24 15:56:15 2022 +0530 Commit: Andras Timar CommitDate: Wed Jan 26 12:01:48 2022 +0100 svgexport: fix: attribute id redefined If there is a id for empty paragraph exist we need to create a empty text paragraph to accomodate the id if we don't do that then we get multiple id attribute on same element for example: Change-Id: I41c21dc94deef93e423aaff2248f6931fa6ca8de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128856 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128924 Tested-by: Jenkins diff --git a/filter/qa/unit/data/attributeRedefinedTest.odp b/filter/qa/unit/data/attributeRedefinedTest.odp new file mode 100644 index ..dfb814bfb9ec Binary files /dev/null and b/filter/qa/unit/data/attributeRedefinedTest.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 3e3508fd52ca..a93d92c7d1ea 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -209,6 +209,48 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testCustomBullet) CPPUNIT_ASSERT(!getXPath(pXmlDoc, "//svg:g[@class='BulletChars']//svg:path", "d").isEmpty()); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, attributeRedefinedTest) +{ +// Load document containing empty paragraphs with ids. +load(u"attributeRedefinedTest.odp"); + +// Export to SVG. +uno::Reference xStorable(getComponent(), 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 four paragraph +// 2 empty paragraphs with ids +// 2 paragraphs with text +// Without the accompanying fix the test would have failed with +// Expected : 4 +// Actual : 2 +// i.e. 2 of the empty paragraph do not get generated even if there +// is id imported for the paragraphs +// If we don't create the empty paragraphs the id attribute attribute gets redefined like this: +// + +OString xPath = "//svg:g[@class='TextShape']//svg:text[@class='SVGTextShape']//" +"svg:tspan[@class='TextParagraph']"; +assertXPath(pXmlDoc, xPath, 4); + +//assert that each tspan element with TextParagraph class has id and the tspan element of +//each empty paragraph doesnot contain tspan element with class TextPosition +assertXPath(pXmlDoc, xPath + "[1]", "id", "id4"); +assertXPath(pXmlDoc, xPath + "[2]", "id", "id5"); +assertXPath(pXmlDoc, xPath + "[2]//svg:tspan[@class='TextPosition']", 0); +assertXPath(pXmlDoc, xPath + "[3]", "id", "id6"); +assertXPath(pXmlDoc, xPath + "[3]//svg:tspan[@class='TextPosition']", 0); +assertXPath(pXmlDoc, xPath + "[4]", "id", "id7"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index e066806cea9a..3d8183ebb2fd 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1099,7 +1099,19 @@ bool SVGTextWriter::nextParagraph() const OUString& rParagraphId = implGetValidIDFromInterface( Reference(xTextContent, UNO_QUERY) ); if( !rParagraphId.isEmpty() ) { -mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +// if there is id for empty paragraph we need to create a empty text paragraph +Reference < XTextRange > xRange( xTextContent, UNO_QUERY_THROW ); +if ( xRange.is() && xRange->getString().isEmpty() ) +{ +endTextParagraph(); +mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "TextParagraph" ); +mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +mpTextParagraphElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS )); +} +else +{ +mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +} } return true; }
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - filter/qa filter/source
filter/qa/unit/data/attributeRedefinedTest.odp |binary filter/qa/unit/svg.cxx | 42 + filter/source/svg/svgwriter.cxx| 14 +++- 3 files changed, 55 insertions(+), 1 deletion(-) New commits: commit e3a0ef15eb7abccff6b55940dbd9b3278004388a Author: Rash419 AuthorDate: Mon Jan 24 15:56:15 2022 +0530 Commit: Andras Timar CommitDate: Tue Jan 25 09:24:33 2022 +0100 svgexport: fix: attribute id redefined If there is a id for empty paragraph exist we need to create a empty text paragraph to accomodate the id if we don't do that then we get multiple id attribute on same element for example: Change-Id: I41c21dc94deef93e423aaff2248f6931fa6ca8de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128884 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/filter/qa/unit/data/attributeRedefinedTest.odp b/filter/qa/unit/data/attributeRedefinedTest.odp new file mode 100644 index ..dfb814bfb9ec Binary files /dev/null and b/filter/qa/unit/data/attributeRedefinedTest.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index c59d3cf63dca..95f894ed42cd 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -138,6 +138,48 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testShapeNographic) xStorable->storeToURL("private:stream", aMediaDescriptor.getAsConstPropertyValueList()); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, attributeRedefinedTest) +{ +// Load document containing empty paragraphs with ids. +load("attributeRedefinedTest.odp"); + +// Export to SVG. +uno::Reference xStorable(getComponent(), 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); + +xmlDocPtr pXmlDoc = parseXmlStream(); + +// We expect four paragraph +// 2 empty paragraphs with ids +// 2 paragraphs with text +// Without the accompanying fix the test would have failed with +// Expected : 4 +// Actual : 2 +// i.e. 2 of the empty paragraph do not get generated even if there +// is id imported for the paragraphs +// If we don't create the empty paragraphs the id attribute attribute gets redefined like this: +// + +OString xPath = "//svg:g[@class='TextShape']//svg:text[@class='SVGTextShape']//" +"svg:tspan[@class='TextParagraph']"; +assertXPath(pXmlDoc, xPath, 4); + +//assert that each tspan element with TextParagraph class has id and the tspan element of +//each empty paragraph doesnot contain tspan element with class TextPosition +assertXPath(pXmlDoc, xPath + "[1]", "id", "id4"); +assertXPath(pXmlDoc, xPath + "[2]", "id", "id5"); +assertXPath(pXmlDoc, xPath + "[2]//svg:tspan[@class='TextPosition']", 0); +assertXPath(pXmlDoc, xPath + "[3]", "id", "id6"); +assertXPath(pXmlDoc, xPath + "[3]//svg:tspan[@class='TextPosition']", 0); +assertXPath(pXmlDoc, xPath + "[4]", "id", "id7"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 95980ce9b932..694cc073a81c 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1077,7 +1077,19 @@ bool SVGTextWriter::nextParagraph() const OUString& rParagraphId = implGetValidIDFromInterface( Reference(xTextContent, UNO_QUERY) ); if( !rParagraphId.isEmpty() ) { -mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +// if there is id for empty paragraph we need to create a empty text paragraph +Reference < XTextRange > xRange( xTextContent, UNO_QUERY_THROW ); +if ( xRange.is() && xRange->getString().isEmpty() ) +{ +endTextParagraph(); +mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "TextParagraph" ); +mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +mpTextParagraphElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS )); +} +else +{ +mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +} } return true; }
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - filter/qa filter/source
filter/qa/unit/data/attributeRedefinedTest.odp |binary filter/qa/unit/svg.cxx | 42 + filter/source/svg/svgwriter.cxx| 14 +++- 3 files changed, 55 insertions(+), 1 deletion(-) New commits: commit be982751a2d365ef6de3dcb03afc32abda8f9b30 Author: Rash419 AuthorDate: Mon Jan 24 15:56:15 2022 +0530 Commit: Andras Timar CommitDate: Mon Jan 24 20:40:20 2022 +0100 svgexport: fix: attribute id redefined If there is a id for empty paragraph exist we need to create a empty text paragraph to accomodate the id if we don't do that then we get multiple id attribute on same element for example: Change-Id: I41c21dc94deef93e423aaff2248f6931fa6ca8de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128856 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/filter/qa/unit/data/attributeRedefinedTest.odp b/filter/qa/unit/data/attributeRedefinedTest.odp new file mode 100644 index ..dfb814bfb9ec Binary files /dev/null and b/filter/qa/unit/data/attributeRedefinedTest.odp differ diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 8f03e7120d75..31c8076637a8 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -206,6 +206,48 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testCustomBullet) CPPUNIT_ASSERT(!getXPath(pXmlDoc, "//svg:g[@class='BulletChars']//svg:path", "d").isEmpty()); } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, attributeRedefinedTest) +{ +// Load document containing empty paragraphs with ids. +load("attributeRedefinedTest.odp"); + +// Export to SVG. +uno::Reference xStorable(getComponent(), 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 four paragraph +// 2 empty paragraphs with ids +// 2 paragraphs with text +// Without the accompanying fix the test would have failed with +// Expected : 4 +// Actual : 2 +// i.e. 2 of the empty paragraph do not get generated even if there +// is id imported for the paragraphs +// If we don't create the empty paragraphs the id attribute attribute gets redefined like this: +// + +OString xPath = "//svg:g[@class='TextShape']//svg:text[@class='SVGTextShape']//" +"svg:tspan[@class='TextParagraph']"; +assertXPath(pXmlDoc, xPath, 4); + +//assert that each tspan element with TextParagraph class has id and the tspan element of +//each empty paragraph doesnot contain tspan element with class TextPosition +assertXPath(pXmlDoc, xPath + "[1]", "id", "id4"); +assertXPath(pXmlDoc, xPath + "[2]", "id", "id5"); +assertXPath(pXmlDoc, xPath + "[2]//svg:tspan[@class='TextPosition']", 0); +assertXPath(pXmlDoc, xPath + "[3]", "id", "id6"); +assertXPath(pXmlDoc, xPath + "[3]//svg:tspan[@class='TextPosition']", 0); +assertXPath(pXmlDoc, xPath + "[4]", "id", "id7"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 866594439abc..f5c96878d4f4 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1106,7 +1106,19 @@ bool SVGTextWriter::nextParagraph() const OUString& rParagraphId = implGetValidIDFromInterface( Reference(xTextContent, UNO_QUERY) ); if( !rParagraphId.isEmpty() ) { -mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +// if there is id for empty paragraph we need to create a empty text paragraph +Reference < XTextRange > xRange( xTextContent, UNO_QUERY_THROW ); +if ( xRange.is() && xRange->getString().isEmpty() ) +{ +endTextParagraph(); +mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "TextParagraph" ); +mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +mpTextParagraphElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS )); +} +else +{ +mrExport.AddAttribute( XML_NAMESPACE_NONE, "id", rParagraphId ); +} } return true; }