include/linguistic/misc.hxx | 2 linguistic/source/misc.cxx | 7 - sfx2/source/view/viewfrm.cxx | 211 ++++++++++++++++++++++--------------------- 3 files changed, 116 insertions(+), 104 deletions(-)
New commits: commit e6328c4600466f35c2527172465c5c818717efee Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Feb 27 11:02:45 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Feb 28 12:15:25 2024 +0100 use more string view in linguistic Change-Id: Ib5c776f95b424128871a1676d996ae95b7048c64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164016 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/linguistic/misc.hxx b/include/linguistic/misc.hxx index 57c7179a2007..a9a7d074d63d 100644 --- a/include/linguistic/misc.hxx +++ b/include/linguistic/misc.hxx @@ -133,7 +133,7 @@ LNG_DLLPUBLIC bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_In inline bool IsUpper( const OUString &rText, LanguageType nLanguage ) { return IsUpper( rText, 0, rText.getLength(), nLanguage ); } LNG_DLLPUBLIC CapType capitalType(const OUString&, CharClass const *); -LNG_DLLPUBLIC bool HasDigits( const OUString &rText ); +LNG_DLLPUBLIC bool HasDigits( std::u16string_view rText ); LNG_DLLPUBLIC bool IsNumeric( std::u16string_view rText ); diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 5c50af6f1946..f80a849116eb 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -42,6 +42,7 @@ #include <unotools/localedatawrapper.hxx> #include <svtools/strings.hrc> #include <unotools/resmgr.hxx> +#include <o3tl/string_view.hxx> #include <linguistic/misc.hxx> #include <linguistic/hyphdta.hxx> @@ -625,14 +626,14 @@ const sal_uInt32 the_aDigitZeroes [] = 0x0001D7CE //1D7FF ; Decimal # Nd [50] MATHEMATICAL BOLD DIGIT ZERO..MATHEMATICAL MONOSPACE DIGIT NINE }; -bool HasDigits( const OUString &rText ) +bool HasDigits( std::u16string_view rText ) { - const sal_Int32 nLen = rText.getLength(); + const sal_Int32 nLen = rText.size(); sal_Int32 i = 0; while (i < nLen) // for all characters ... { - const sal_uInt32 nCodePoint = rText.iterateCodePoints( &i ); // handle unicode surrogates correctly... + const sal_uInt32 nCodePoint = o3tl::iterateCodePoints( rText, &i ); // handle unicode surrogates correctly... for (unsigned int nDigitZero : the_aDigitZeroes) // ... check in all 0..9 ranges { if (nDigitZero > nCodePoint) commit 607740654f2264e13469e4da1d020448217d7222 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Wed Feb 28 10:30:48 2024 +0100 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Wed Feb 28 12:15:16 2024 +0100 Resolves tdf#131550 - Suppress Donate/Involve infobar if another is visible Change-Id: I013f0a1f0aa020f10d6beb21940959508eba4547 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164082 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index e2dad9605d45..31fd9471455c 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1497,107 +1497,8 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) rBind.Invalidate( SID_RELOAD ); rBind.Invalidate( SID_EDITDOC ); -#if !ENABLE_WASM_STRIP_PINGUSER - bool bIsHeadlessOrUITest = SfxApplication::IsHeadlessOrUITest(); //uitest.uicheck fails when the dialog is open - - //what's new infobar - if (utl::isProductVersionUpgraded(true) && !bIsHeadlessOrUITest) - { - VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", "", SfxResId(STR_WHATSNEW_TEXT), InfobarType::INFO); - if (pInfoBar) - { - weld::Button& rWhatsNewButton = pInfoBar->addButton(); - rWhatsNewButton.set_label(SfxResId(STR_WHATSNEW_BUTTON)); - rWhatsNewButton.connect_clicked(LINK(this, SfxViewFrame, WhatsNewHandler)); - } - } - - // show tip-of-the-day dialog if it due, but not if there is the impress modal template dialog - // open where SdModule::ExecuteNewDocument will launch it instead when that dialog is dismissed - if (SfxApplication::IsTipOfTheDayDue() && !bIsHeadlessOrUITest && !IsInModalMode()) - { - bool bIsBaseFormOpen = false; - - const auto xCurrentFrame = GetFrame().GetFrameInterface(); - const auto xContext = comphelper::getProcessComponentContext(); - const auto xModuleManager = css::frame::ModuleManager::create(xContext); - switch (vcl::EnumContext::GetApplicationEnum( - vcl::CommandInfoProvider::GetModuleIdentifier(xCurrentFrame))) - { - case vcl::EnumContext::Application::WriterForm: - case vcl::EnumContext::Application::WriterReport: - bIsBaseFormOpen = true; - break; - default: - break; - } - if (!bIsBaseFormOpen) - { - // tdf#127946 pass in argument for dialog parent - SfxUnoFrameItem aDocFrame(SID_FILLFRAME, xCurrentFrame); - GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, - { &aDocFrame }); - } - } - - // inform about the community involvement - const auto t0 = std::chrono::system_clock::now().time_since_epoch(); - const sal_Int64 nLastGetInvolvedShown = officecfg::Setup::Product::LastTimeGetInvolvedShown::get(); - const sal_Int64 nNow = std::chrono::duration_cast<std::chrono::seconds>(t0).count(); - const sal_Int64 nPeriodSec(60 * 60 * 24 * 180); // 180 days in seconds - bool bUpdateLastTimeGetInvolvedShown = false; + bool bIsInfobarShown(false); - if (nLastGetInvolvedShown == 0) - bUpdateLastTimeGetInvolvedShown = true; - else if (nPeriodSec < nNow && nLastGetInvolvedShown < (nNow + nPeriodSec/2) - nPeriodSec) // 90d alternating with donation - { - bUpdateLastTimeGetInvolvedShown = true; - - VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("getinvolved", "", SfxResId(STR_GET_INVOLVED_TEXT), InfobarType::INFO); - - if (pInfoBar) - { - weld::Button& rGetInvolvedButton = pInfoBar->addButton(); - rGetInvolvedButton.set_label(SfxResId(STR_GET_INVOLVED_BUTTON)); - rGetInvolvedButton.connect_clicked(LINK(this, SfxViewFrame, GetInvolvedHandler)); - } - } - - if (bUpdateLastTimeGetInvolvedShown - && !officecfg::Setup::Product::LastTimeGetInvolvedShown::isReadOnly()) - { - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - officecfg::Setup::Product::LastTimeGetInvolvedShown::set(nNow, batch); - batch->commit(); - } - - // inform about donations - const sal_Int64 nLastDonateShown = officecfg::Setup::Product::LastTimeDonateShown::get(); - bool bUpdateLastTimeDonateShown = false; - - if (nLastDonateShown == 0) - bUpdateLastTimeDonateShown = true; - else if (nPeriodSec < nNow && nLastDonateShown < nNow - nPeriodSec) // 90d alternating with getinvolved - { - bUpdateLastTimeDonateShown = true; - - VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("donate", "", SfxResId(STR_DONATE_TEXT), InfobarType::INFO); - if (pInfoBar) - { - weld::Button& rDonateButton = pInfoBar->addButton(); - rDonateButton.set_label(SfxResId(STR_DONATE_BUTTON)); - rDonateButton.connect_clicked(LINK(this, SfxViewFrame, DonationHandler)); - } - } - - if (bUpdateLastTimeDonateShown - && !officecfg::Setup::Product::LastTimeDonateShown::isReadOnly()) - { - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - officecfg::Setup::Product::LastTimeDonateShown::set(nNow, batch); - batch->commit(); - } -#endif if (officecfg::Office::Common::Passwords::HasMaster::get() && officecfg::Office::Common::Passwords::StorageVersion::get() == 0) { @@ -1605,6 +1506,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) VclPtr<SfxInfoBarWindow> pOldMasterPasswordInfoBar = AppendInfoBar("oldmasterpassword", "", SfxResId(STR_REFRESH_MASTER_PASSWORD), InfobarType::DANGER, false); + bIsInfobarShown = true; if (pOldMasterPasswordInfoBar) { weld::Button& rButton = pOldMasterPasswordInfoBar->addButton(); @@ -1631,10 +1533,14 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) (( pVSh = m_xObjSh->GetViewShell()) && (pFSh = pVSh->GetFormShell()) && pFSh->IsDesignMode()))) { AppendReadOnlyInfobar(); + bIsInfobarShown = true; } if (!bEmbedded && m_xObjSh->Get_Impl()->getCurrentMacroExecMode() == css::document::MacroExecMode::NEVER_EXECUTE) + { AppendContainsMacrosInfobar(); + bIsInfobarShown = true; + } if (vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame().GetFrameInterface()) == "com.sun.star.text.TextDocument") sfx2::SfxNotebookBar::ReloadNotebookBar(u"modules/swriter/ui/"); @@ -1675,6 +1581,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage, aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType, aInfobarData.mbShowCloseButton); + bIsInfobarShown = true; // tdf#148913 don't extend this condition to keep it thread-safe if (pInfoBar) @@ -1700,11 +1607,115 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) AppendInfoBar(aInfobarData.msId, aInfobarData.msPrimaryMessage, aInfobarData.msSecondaryMessage, aInfobarData.maInfobarType, aInfobarData.mbShowCloseButton); + bIsInfobarShown = true; } aPendingInfobars.pop_back(); } +#if !ENABLE_WASM_STRIP_PINGUSER + bool bIsHeadlessOrUITest = SfxApplication::IsHeadlessOrUITest(); //uitest.uicheck fails when the dialog is open + + //what's new infobar + if (!bIsInfobarShown && utl::isProductVersionUpgraded(true) && !bIsHeadlessOrUITest) + { + VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("whatsnew", "", SfxResId(STR_WHATSNEW_TEXT), InfobarType::INFO); + bIsInfobarShown = true; + if (pInfoBar) + { + weld::Button& rWhatsNewButton = pInfoBar->addButton(); + rWhatsNewButton.set_label(SfxResId(STR_WHATSNEW_BUTTON)); + rWhatsNewButton.connect_clicked(LINK(this, SfxViewFrame, WhatsNewHandler)); + } + } + + // show tip-of-the-day dialog if it due, but not if there is the impress modal template dialog + // open where SdModule::ExecuteNewDocument will launch it instead when that dialog is dismissed + if (SfxApplication::IsTipOfTheDayDue() && !bIsHeadlessOrUITest && !IsInModalMode()) + { + bool bIsBaseFormOpen = false; + + const auto xCurrentFrame = GetFrame().GetFrameInterface(); + const auto xContext = comphelper::getProcessComponentContext(); + const auto xModuleManager = css::frame::ModuleManager::create(xContext); + switch (vcl::EnumContext::GetApplicationEnum( + vcl::CommandInfoProvider::GetModuleIdentifier(xCurrentFrame))) + { + case vcl::EnumContext::Application::WriterForm: + case vcl::EnumContext::Application::WriterReport: + bIsBaseFormOpen = true; + break; + default: + break; + } + if (!bIsBaseFormOpen) + { + // tdf#127946 pass in argument for dialog parent + SfxUnoFrameItem aDocFrame(SID_FILLFRAME, xCurrentFrame); + GetDispatcher()->ExecuteList(SID_TIPOFTHEDAY, SfxCallMode::SLOT, {}, + { &aDocFrame }); + } + } + + // inform about the community involvement + const auto t0 = std::chrono::system_clock::now().time_since_epoch(); + const sal_Int64 nLastGetInvolvedShown = officecfg::Setup::Product::LastTimeGetInvolvedShown::get(); + const sal_Int64 nNow = std::chrono::duration_cast<std::chrono::seconds>(t0).count(); + const sal_Int64 nPeriodSec(60 * 60 * 24 * 180); // 180 days in seconds + bool bUpdateLastTimeGetInvolvedShown = false; + + if (nLastGetInvolvedShown == 0) + bUpdateLastTimeGetInvolvedShown = true; + else if (!bIsInfobarShown && nPeriodSec < nNow && nLastGetInvolvedShown < (nNow + nPeriodSec/2) - nPeriodSec) // 90d alternating with donation + { + bUpdateLastTimeGetInvolvedShown = true; + + VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("getinvolved", "", SfxResId(STR_GET_INVOLVED_TEXT), InfobarType::INFO); + bIsInfobarShown = true; + if (pInfoBar) + { + weld::Button& rGetInvolvedButton = pInfoBar->addButton(); + rGetInvolvedButton.set_label(SfxResId(STR_GET_INVOLVED_BUTTON)); + rGetInvolvedButton.connect_clicked(LINK(this, SfxViewFrame, GetInvolvedHandler)); + } + } + + if (bUpdateLastTimeGetInvolvedShown + && !officecfg::Setup::Product::LastTimeGetInvolvedShown::isReadOnly()) + { + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); + officecfg::Setup::Product::LastTimeGetInvolvedShown::set(nNow, batch); + batch->commit(); + } + + // inform about donations + const sal_Int64 nLastDonateShown = officecfg::Setup::Product::LastTimeDonateShown::get(); + bool bUpdateLastTimeDonateShown = false; + + if (nLastDonateShown == 0) + bUpdateLastTimeDonateShown = true; + else if (!bIsInfobarShown && nPeriodSec < nNow && nLastDonateShown < nNow - nPeriodSec) // 90d alternating with getinvolved + { + bUpdateLastTimeDonateShown = true; + + VclPtr<SfxInfoBarWindow> pInfoBar = AppendInfoBar("donate", "", SfxResId(STR_DONATE_TEXT), InfobarType::INFO); + if (pInfoBar) + { + weld::Button& rDonateButton = pInfoBar->addButton(); + rDonateButton.set_label(SfxResId(STR_DONATE_BUTTON)); + rDonateButton.connect_clicked(LINK(this, SfxViewFrame, DonationHandler)); + } + } + + if (bUpdateLastTimeDonateShown + && !officecfg::Setup::Product::LastTimeDonateShown::isReadOnly()) + { + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); + officecfg::Setup::Product::LastTimeDonateShown::set(nNow, batch); + batch->commit(); + } +#endif + break; } default: break;