From aa443205e634880c8e3e35776f2b07675a798f85 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Mon, 2 Dec 2024 11:21:26 +0100 Subject: [PATCH 001/155] Remove unused empty string Change-Id: If29babb15d0e594e2746d6124218704e3f49728b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177670 Tested-by: Jenkins Reviewed-by: Andras Timar --- sc/inc/globstr.hrc | 1 - 1 file changed, 1 deletion(-) diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 743a57913196..ceca2b5d31c7 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -271,7 +271,6 @@ #define STR_HIDE NC_("STR_HIDE", "Hide") #define STR_PRINT NC_("STR_PRINT", "Print") #define STR_INVALID_AFAREA NC_("STR_INVALID_AFAREA", "To apply an AutoFormat,\na table range of at least\n3 × 3 cells must be selected.") -#define STR_AUTOFORMAT_WAIT_WARNING_TITLE NC_("STR_AUTOFORMAT_WAIT_WARNING_TITLE", "") #define STR_AUTOFORMAT_WAIT_WARNING NC_("STR_AUTOFORMAT_WAIT_WARNING", "Applying AutoFormat to the selected range (more than one million cells) may take a long time.\nDo you want to proceed?") #define STR_OPTIONAL NC_("STR_OPTIONAL", "(optional)") #define STR_REQUIRED NC_("STR_REQUIRED", "(required)") From 18c2199537b405dfb549d44ee1d29a58105ec86c Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 2 Dec 2024 12:08:32 +0200 Subject: [PATCH 002/155] loplugin:unnecessaryvirtual Change-Id: Ie010deb5cdf9da20f2ca60d79feabf1c0de93c57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177669 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/drawinglayer/primitive2d/textprimitive2d.hxx | 2 +- include/sfx2/tabdlg.hxx | 4 ++-- include/vcl/window.hxx | 4 ++-- sd/source/ui/inc/unomodel.hxx | 2 +- sw/source/writerfilter/ooxml/OOXMLPropertySet.hxx | 2 +- vcl/inc/salinst.hxx | 1 - vcl/inc/unx/geninst.h | 1 - vcl/ios/dummies.cxx | 4 ---- vcl/unx/generic/print/genprnpsp.cxx | 5 ----- 9 files changed, 7 insertions(+), 18 deletions(-) diff --git a/include/drawinglayer/primitive2d/textprimitive2d.hxx b/include/drawinglayer/primitive2d/textprimitive2d.hxx index a71c24732d45..878ef9d8291c 100644 --- a/include/drawinglayer/primitive2d/textprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/textprimitive2d.hxx @@ -179,7 +179,7 @@ public: virtual bool hasTextRelief() const; virtual bool hasShadow() const; virtual bool hasTextDecoration() const; - virtual bool hasOutline() const; + bool hasOutline() const; /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 336fe80c11dd..b63bac0db100 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -265,8 +265,8 @@ public: virtual void FillUserData(); virtual bool IsReadOnly() const; // Whether the user has canceled the dialog. Allows to restore settings, etc. - virtual bool IsCancelMode() { return mbCancel; } - virtual void SetCancelMode(bool bCancel) { mbCancel = bCancel; } + bool IsCancelMode() { return mbCancel; } + void SetCancelMode(bool bCancel) { mbCancel = bCancel; } virtual void PageCreated (const SfxAllItemSet& aSet); virtual void ChangesApplied(); static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true ); diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 008415417350..a9a6ac6eee3a 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1122,8 +1122,8 @@ public: /// Use OS specific way to bring user attention to current window virtual void FlashWindow() const; - virtual void SetTaskBarProgress(int nCurrentProgress); - virtual void SetTaskBarState(VclTaskBarStates eTaskBarState); + void SetTaskBarProgress(int nCurrentProgress); + void SetTaskBarState(VclTaskBarStates eTaskBarState); /** @name Accessibility */ diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 91d4fd87be94..13a2635c781a 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -405,7 +405,7 @@ public: virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; private: - virtual css::uno::Reference< ::css::drawing::XDrawPage > insertNewImpl( sal_Int32 nIndex, std::optional oName ); + css::uno::Reference< ::css::drawing::XDrawPage > insertNewImpl( sal_Int32 nIndex, std::optional oName ); }; /*********************************************************************** diff --git a/sw/source/writerfilter/ooxml/OOXMLPropertySet.hxx b/sw/source/writerfilter/ooxml/OOXMLPropertySet.hxx index 3fc77dc5bc20..c23d57ed8c71 100644 --- a/sw/source/writerfilter/ooxml/OOXMLPropertySet.hxx +++ b/sw/source/writerfilter/ooxml/OOXMLPropertySet.hxx @@ -67,7 +67,7 @@ public: #ifdef DBG_UTIL virtual std::string toString() const override; #endif - virtual OOXMLValue* clone() const; + OOXMLValue* clone() const; private: typedef std::variant CreatePrintGraphics() = 0; diff --git a/vcl/ios/dummies.cxx b/vcl/ios/dummies.cxx index a1d3cbcb674e..42ecc363e35d 100644 --- a/vcl/ios/dummies.cxx +++ b/vcl/ios/dummies.cxx @@ -99,10 +99,6 @@ void SalGenericInstance::updatePrinterUpdate() { } -void SalGenericInstance::jobEndedPrinterUpdate() -{ -} - using namespace psp; bool AquaGraphicsBackend::drawNativeControl(ControlType /* nType */, diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index b9dd1ec6f465..bbba1230b624 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -721,7 +721,6 @@ bool PspSalPrinter::StartJob( bool PspSalPrinter::EndJob() { - GetSalInstance()->jobEndedPrinterUpdate(); return true; } @@ -1035,8 +1034,4 @@ void SalGenericInstance::updatePrinterUpdate() PostPrintersChanged(); } -void SalGenericInstance::jobEndedPrinterUpdate() -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 7ea2e48c431dad2fd704a0f75c0059904e37c715 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 09:19:55 +0100 Subject: [PATCH 003/155] vcl: Consolidate to one Menu::pWindow getter There are two getters for that member: Menu::ImplGetWindow and Menu::GetWindow. Replace uses of the former with the latter and drop Menu::ImplGetWindow. Change-Id: Ieaefe43258172f6000c326503eeeefe1a05faabb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177657 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/menu.hxx | 1 - vcl/source/window/menu.cxx | 26 ++++++++++++------------ vcl/source/window/menubarwindow.cxx | 4 ++-- vcl/source/window/menufloatingwindow.cxx | 12 +++++------ vcl/source/window/syswin.cxx | 8 ++++---- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 90f6d22b0ebd..dad0e7b642bb 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -209,7 +209,6 @@ protected: public: SAL_DLLPRIVATE void ImplKillLayoutData() const; - SAL_DLLPRIVATE vcl::Window* ImplGetWindow() const { return pWindow; } #if defined(MACOSX) void ImplSelectWithStart( Menu* pStartMenu = nullptr ); #endif diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 9b00d9cb23bf..bebdfd2f0eee 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -445,7 +445,7 @@ void Menu::InsertItem(sal_uInt16 nItemId, const OUString& rStr, MenuItemBits nIt // put Item in MenuItemList NbcInsertItem(nItemId, nItemBits, rStr, this, nPos, rIdent); - vcl::Window* pWin = ImplGetWindow(); + vcl::Window* pWin = GetWindow(); mpLayoutData.reset(); if ( pWin ) { @@ -509,7 +509,7 @@ void Menu::RemoveItem( sal_uInt16 nPos ) bRemove = true; } - vcl::Window* pWin = ImplGetWindow(); + vcl::Window* pWin = GetWindow(); if ( pWin ) { ImplCalcSize( pWin ); @@ -939,7 +939,7 @@ void Menu::EnableItem( sal_uInt16 nItemId, bool bEnable ) pItemData->bEnabled = bEnable; - vcl::Window* pWin = ImplGetWindow(); + vcl::Window* pWin = GetWindow(); if ( pWin && pWin->IsVisible() ) { SAL_WARN_IF(!IsMenuBar(), "vcl", "Menu::EnableItem - Popup visible!" ); @@ -983,7 +983,7 @@ void Menu::ShowItem( sal_uInt16 nItemId, bool bVisible ) if (IsMenuBar() || !pData || (pData->bVisible == bVisible)) return; - vcl::Window* pWin = ImplGetWindow(); + vcl::Window* pWin = GetWindow(); if ( pWin && pWin->IsVisible() ) { SAL_WARN( "vcl", "Menu::ShowItem - ignored for visible popups!" ); @@ -1015,7 +1015,7 @@ void Menu::SetItemText( sal_uInt16 nItemId, const OUString& rStr ) if( ImplGetSalMenu() && pData->pSalMenuItem ) ImplGetSalMenu()->SetItemText( nPos, pData->pSalMenuItem.get(), rStr ); - vcl::Window* pWin = ImplGetWindow(); + vcl::Window* pWin = GetWindow(); mpLayoutData.reset(); if (pWin && IsMenuBar()) { @@ -2510,7 +2510,7 @@ VclPtr MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWind void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete ) { - vcl::Window *pWindow = pMenu->ImplGetWindow(); + vcl::Window *pWindow = pMenu->GetWindow(); if (pWindow && bDelete) { MenuBarWindow* pMenuWin = pMenu->getMenuBarWindow(); @@ -2545,7 +2545,7 @@ bool MenuBar::ImplHandleKeyEvent( const KeyEvent& rKEvent ) bool bDone = false; // check for enabled, if this method is called from another window... - vcl::Window* pWin = ImplGetWindow(); + vcl::Window* pWin = GetWindow(); if (pWin && pWin->IsEnabled() && pWin->IsInputEnabled() && !pWin->IsInModalMode()) { MenuBarWindow* pMenuWin = getMenuBarWindow(); @@ -2562,7 +2562,7 @@ bool MenuBar::ImplHandleCmdEvent( const CommandEvent& rCEvent ) return false; // check for enabled, if this method is called from another window... - MenuBarWindow* pWin = static_cast(ImplGetWindow()); + MenuBarWindow* pWin = static_cast(GetWindow()); if ( pWin && pWin->IsEnabled() && pWin->IsInputEnabled() && ! pWin->IsInModalMode() ) { if (rCEvent.GetCommand() == CommandEventId::ModKeyChange && ImplGetSVData()->maNWFData.mbAutoAccel) @@ -2728,7 +2728,7 @@ int MenuBar::GetMenuBarHeight() const // bool PopupMenu::bAnyPopupInExecute = false; MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow() const { - return static_cast(Menu::ImplGetWindow()); + return static_cast(Menu::GetWindow()); } PopupMenu::PopupMenu() @@ -2749,7 +2749,7 @@ PopupMenu::~PopupMenu() void PopupMenu::ClosePopup(Menu* pMenu) { - MenuFloatingWindow* p = dynamic_cast(ImplGetWindow()); + MenuFloatingWindow* p = dynamic_cast(GetWindow()); PopupMenu *pPopup = dynamic_cast(pMenu); if (p && pPopup) p->KillActivePopup(pPopup); @@ -2771,13 +2771,13 @@ PopupMenu* PopupMenu::GetActivePopupMenu() void PopupMenu::EndExecute() { - if ( ImplGetWindow() ) + if (GetWindow()) ImplGetFloatingWindow()->EndExecute( 0 ); } void PopupMenu::SelectItem(sal_uInt16 nId) { - if ( !ImplGetWindow() ) + if (!GetWindow()) return; if( nId != ITEMPOS_INVALID ) @@ -2887,7 +2887,7 @@ bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectang | FloatWinPopupEndFlags::CloseAll); } - SAL_WARN_IF( ImplGetWindow(), "vcl", "Win?!" ); + SAL_WARN_IF(GetWindow(), "vcl", "Win?!"); rRect.SetPos(pParentWin->OutputToScreenPixel(rRect.TopLeft())); nPopupModeFlags |= FloatWinPopupFlags::NoKeyClose | FloatWinPopupFlags::AllMouseButtonClose | FloatWinPopupFlags::GrabFocus; diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 9062e9952d9e..1ec31bdd7cc7 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -361,7 +361,7 @@ void MenuBarWindow::KillActivePopup() m_pActivePopup->Deactivate(); m_pActivePopup->bInCallback = false; // check for pActivePopup, if stopped by deactivate... - if ( m_pActivePopup->ImplGetWindow() ) + if (m_pActivePopup->GetWindow()) { if (mpParentPopup) { @@ -470,7 +470,7 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b // #57934# close active popup if applicable, as TH's background storage works. MenuItemData* pNextData = m_pMenu->pItemList->GetDataFromPos( n ); - if ( m_pActivePopup && m_pActivePopup->ImplGetWindow() && ( !pNextData || ( m_pActivePopup != pNextData->pSubMenu ) ) ) + if (m_pActivePopup && m_pActivePopup->GetWindow() && (!pNextData || (m_pActivePopup != pNextData->pSubMenu))) KillActivePopup(); // pActivePopup when applicable without pWin, if Rescheduled in Activate() // activate menubar only ones per cycle... diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 7de7a5801282..fc4f12288e46 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -85,7 +85,7 @@ void MenuFloatingWindow::doShutdown() } if( i < nCount ) { - MenuFloatingWindow* pPWin = static_cast(pMenu->pStartedFrom->ImplGetWindow()); + MenuFloatingWindow* pPWin = static_cast(pMenu->pStartedFrom->GetWindow()); if (pPWin) pPWin->InvalidateItem(i); } @@ -375,7 +375,7 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer, void ) SetPopupModeFlags( nOldFlags ); // nRet != 0, if it was stopped during Activate()... - if ( !nRet && ( pActivePopup == pTest ) && pActivePopup->ImplGetWindow() ) + if ( !nRet && ( pActivePopup == pTest ) && pActivePopup->GetWindow() ) pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this ); } @@ -495,7 +495,7 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) pPopup->bInCallback = true; pPopup->Deactivate(); pPopup->bInCallback = false; - if ( pPopup->ImplGetWindow() ) + if (pPopup->GetWindow()) { pPopup->ImplGetFloatingWindow()->StopExecute(); pPopup->ImplGetFloatingWindow()->doShutdown(); @@ -765,7 +765,7 @@ void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTime } if( i < nCount ) { - MenuFloatingWindow* pPWin = static_cast(pMenu->pStartedFrom->ImplGetWindow()); + MenuFloatingWindow* pPWin = static_cast(pMenu->pStartedFrom->GetWindow()); if( pPWin && pPWin->nHighlightedItem != i ) { pPWin->InvalidateItem(i); @@ -1118,7 +1118,7 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent ) if (pStart && pStart->IsMenuBar()) { // Forward... - pStart->ImplGetWindow()->KeyInput( rKEvent ); + pStart->GetWindow()->KeyInput(rKEvent); } } } @@ -1149,7 +1149,7 @@ void MenuFloatingWindow::KeyInput( const KeyEvent& rKEvent ) if (pStart && pStart->IsMenuBar()) { // Forward... - pStart->ImplGetWindow()->KeyInput( rKEvent ); + pStart->GetWindow()->KeyInput(rKEvent); } } } diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 810f1c5cf4ff..1109e1b48b8b 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -253,7 +253,7 @@ TaskPaneList* SystemWindow::GetTaskPaneList() pMBar = static_cast(pWin)->GetMenuBar(); } if( pMBar ) - mpImplData->mpTaskPaneList->AddWindow( pMBar->ImplGetWindow() ); + mpImplData->mpTaskPaneList->AddWindow(pMBar->GetWindow()); return mpImplData->mpTaskPaneList.get(); } } @@ -851,7 +851,7 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar) if ( mpWindowImpl->mpBorderWindow && (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) ) { if ( pOldMenuBar ) - pOldWindow = pOldMenuBar->ImplGetWindow(); + pOldWindow = pOldMenuBar->GetWindow(); else pOldWindow = nullptr; if ( pOldWindow ) @@ -888,9 +888,9 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar) else { if( pMenuBar ) - pNewWindow = pMenuBar->ImplGetWindow(); + pNewWindow = pMenuBar->GetWindow(); if( pOldMenuBar ) - pOldWindow = pOldMenuBar->ImplGetWindow(); + pOldWindow = pOldMenuBar->GetWindow(); } // update taskpane list to make menubar accessible From 66dcd9ea8af085f222d59aea25da1fae500a5e6a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 09:38:40 +0100 Subject: [PATCH 004/155] vcl: Prefix Menu::pWindow member with "m_" This makes a bit more obvious that this is a class member while reading code where it's involved, in particular since local `pWindow` variables are used in addition. Change-Id: Ic68e856a0c3ddedbf510124937cf4bc21febf916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177658 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- include/vcl/menu.hxx | 4 +- vcl/source/window/menu.cxx | 92 ++++++++++++------------ vcl/source/window/menubarwindow.cxx | 6 +- vcl/source/window/menufloatingwindow.cxx | 6 +- vcl/source/window/syswin.cxx | 2 +- 5 files changed, 55 insertions(+), 55 deletions(-) diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index dad0e7b642bb..893959e82634 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -126,7 +126,7 @@ private: ImplMenuDelData* mpFirstDel; std::unique_ptr pItemList; // list with MenuItems VclPtr pStartedFrom; - VclPtr pWindow; + VclPtr m_pWindow; Link aActivateHdl; // Active-Handler Link aDeactivateHdl; // Deactivate-Handler @@ -375,7 +375,7 @@ public: // gets the activation key of the specified item KeyEvent GetActivationKey( sal_uInt16 nItemId ) const; - vcl::Window* GetWindow() const { return pWindow; } + vcl::Window* GetWindow() const { return m_pWindow; } void SetAccessibleName( sal_uInt16 nItemId, const OUString& rStr ); OUString GetAccessibleName( sal_uInt16 nItemId ) const; diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index bebdfd2f0eee..04e351ce4ae0 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -161,7 +161,7 @@ Menu::Menu() : mpFirstDel(nullptr), pItemList(new MenuItemList), pStartedFrom(nullptr), - pWindow(nullptr), + m_pWindow(nullptr), nTitleHeight(0), nEventId(nullptr), mnHighlightedItemPos(ITEMPOS_INVALID), @@ -186,12 +186,12 @@ void Menu::dispose() // at the window free the reference to the accessible component // and make sure the MenuFloatingWindow knows about our destruction - if ( pWindow ) + if (m_pWindow) { - MenuFloatingWindow* pFloat = static_cast(pWindow.get()); + MenuFloatingWindow* pFloat = static_cast(m_pWindow.get()); if( pFloat->pMenu.get() == this ) pFloat->pMenu.clear(); - pWindow->SetAccessible( css::uno::Reference< css::accessibility::XAccessible >() ); + m_pWindow->SetAccessible( css::uno::Reference< css::accessibility::XAccessible >() ); } // dispose accessible components @@ -233,7 +233,7 @@ void Menu::dispose() mpSalMenu.reset(); pStartedFrom.clear(); - pWindow.clear(); + m_pWindow.clear(); VclReferenceBase::dispose(); } @@ -1302,7 +1302,7 @@ bool Menu::IsItemPosVisible( sal_uInt16 nItemPos ) const bool Menu::IsMenuVisible() const { - return pWindow && pWindow->IsReallyVisible(); + return m_pWindow && m_pWindow->IsReallyVisible(); } bool Menu::ImplIsSelectable( sal_uInt16 nPos ) const @@ -1629,20 +1629,20 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) aSz.setHeight( nFontHeight+6 ); // get menubar height from native methods if supported - if( pWindow->IsNativeControlSupported( ControlType::Menubar, ControlPart::Entire ) ) + if (m_pWindow->IsNativeControlSupported(ControlType::Menubar, ControlPart::Entire)) { ImplControlValue aVal; tools::Rectangle aNativeBounds; tools::Rectangle aNativeContent; Point tmp( 0, 0 ); tools::Rectangle aCtrlRegion( tmp, Size( 100, 15 ) ); - if( pWindow->GetNativeControlRegion( ControlType::Menubar, - ControlPart::Entire, - aCtrlRegion, - ControlState::ENABLED, - aVal, - aNativeBounds, - aNativeContent ) + if (m_pWindow->GetNativeControlRegion(ControlType::Menubar, + ControlPart::Entire, + aCtrlRegion, + ControlState::ENABLED, + aVal, + aNativeBounds, + aNativeContent) ) { int nNativeHeight = aNativeBounds.GetHeight(); @@ -1653,7 +1653,7 @@ Size Menu::ImplCalcSize( vcl::Window* pWin ) // account for the size of the close button, which actually is a toolbox // due to NWF this is variable - tools::Long nCloseButtonHeight = static_cast(pWindow.get())->MinCloseButtonSize().Height(); + tools::Long nCloseButtonHeight = static_cast(m_pWindow.get())->MinCloseButtonSize().Height(); if (aSz.Height() < nCloseButtonHeight) aSz.setHeight( nCloseButtonHeight ); } @@ -1819,7 +1819,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize, // contained. The application itself should check for this! // Otherwise it could happen entries are disabled due to // asynchronous loading - if (!pData->bEnabled || !pWindow->IsEnabled()) + if (!pData->bEnabled || !m_pWindow->IsEnabled()) { nTextStyle |= DrawTextFlags::Disable; nSymbolStyle |= DrawSymbolFlags::Disable; @@ -1833,7 +1833,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize, if (rRenderContext.IsNativeControlSupported(ControlType::MenuPopup, ControlPart::Separator)) { ControlState nState = ControlState::NONE; - if (pData->bEnabled && pWindow->IsEnabled()) + if (pData->bEnabled && m_pWindow->IsEnabled()) nState |= ControlState::ENABLED; if (bHighlighted) nState |= ControlState::SELECTED; @@ -1885,7 +1885,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize, if (pData->bChecked) nState |= ControlState::PRESSED; - if (pData->bEnabled && pWindow->IsEnabled()) + if (pData->bEnabled && m_pWindow->IsEnabled()) nState |= ControlState::ENABLED; if (bHighlighted) @@ -1905,7 +1905,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize, } else if (pData->bChecked) // by default do nothing for unchecked items { - ImplPaintCheckBackground(rRenderContext, *pWindow, aOuterCheckRect, pThisItemOnly && bHighlighted); + ImplPaintCheckBackground(rRenderContext, *m_pWindow, aOuterCheckRect, pThisItemOnly && bHighlighted); SymbolType eSymbol; Size aSymbolSize; @@ -1932,7 +1932,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize, { // Don't render an image for a check thing if (pData->bChecked) - ImplPaintCheckBackground(rRenderContext, *pWindow, aOuterCheckRect, pThisItemOnly && bHighlighted); + ImplPaintCheckBackground(rRenderContext, *m_pWindow, aOuterCheckRect, pThisItemOnly && bHighlighted); Image aImage = pData->aImage; @@ -1953,7 +1953,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize, const Menu *pMenu = this; while (!pMenu->IsMenuBar() && pMenu->pStartedFrom) pMenu = pMenu->pStartedFrom; - if (!pMenu->IsMenuBar() || !static_cast(pMenu->pWindow.get())->GetMBWHideAccel()) + if (!pMenu->IsMenuBar() || !static_cast(pMenu->m_pWindow.get())->GetMBWHideAccel()) nStyle |= DrawTextFlags::Mnemonic; if (pData->bIsTemporary) @@ -2048,7 +2048,7 @@ void Menu::ImplPaint(vcl::RenderContext& rRenderContext, Size const & rSize, aSpacing = nOuterSpaceX; } - if (pData->bEnabled && pWindow->IsEnabled()) + if (pData->bEnabled && m_pWindow->IsEnabled()) nState |= ControlState::ENABLED; if (bHighlighted) nState |= ControlState::SELECTED; @@ -2238,18 +2238,18 @@ void Menu::ImplKillLayoutData() const void Menu::ImplFillLayoutData() const { - if (!(pWindow && pWindow->IsReallyVisible())) + if (!(m_pWindow && m_pWindow->IsReallyVisible())) return; mpLayoutData.reset(new MenuLayoutData); if (IsMenuBar()) { - ImplPaint(*pWindow->GetOutDev(), pWindow->GetOutputSizePixel(), 0, 0, nullptr, false, true); // FIXME + ImplPaint(*m_pWindow->GetOutDev(), m_pWindow->GetOutputSizePixel(), 0, 0, nullptr, false, true); // FIXME } else { - MenuFloatingWindow* pFloat = static_cast(pWindow.get()); - ImplPaint(*pWindow->GetOutDev(), pWindow->GetOutputSizePixel(), pFloat->nScrollerHeight, pFloat->ImplGetStartY(), + MenuFloatingWindow* pFloat = static_cast(m_pWindow.get()); + ImplPaint(*m_pWindow->GetOutDev(), m_pWindow->GetOutputSizePixel(), pFloat->nScrollerHeight, pFloat->ImplGetStartY(), nullptr, false, true); //FIXME } } @@ -2364,12 +2364,12 @@ bool Menu::IsHighlighted( sal_uInt16 nItemPos ) const { bool bRet = false; - if( pWindow ) + if (m_pWindow) { if (IsMenuBar()) - bRet = ( nItemPos == static_cast< MenuBarWindow * > (pWindow.get())->GetHighlightedItem() ); + bRet = ( nItemPos == static_cast< MenuBarWindow * > (m_pWindow.get())->GetHighlightedItem() ); else - bRet = ( nItemPos == static_cast< MenuFloatingWindow * > (pWindow.get())->GetHighlightedItem() ); + bRet = ( nItemPos == static_cast< MenuFloatingWindow * > (m_pWindow.get())->GetHighlightedItem() ); } return bRet; @@ -2377,18 +2377,18 @@ bool Menu::IsHighlighted( sal_uInt16 nItemPos ) const void Menu::HighlightItem( sal_uInt16 nItemPos ) { - if ( !pWindow ) + if ( !m_pWindow ) return; if (IsMenuBar()) { - MenuBarWindow* pMenuWin = static_cast< MenuBarWindow* >( pWindow.get() ); + MenuBarWindow* pMenuWin = static_cast< MenuBarWindow* >( m_pWindow.get() ); pMenuWin->SetAutoPopup( false ); pMenuWin->ChangeHighlightItem( nItemPos, false ); } else { - static_cast< MenuFloatingWindow* >( pWindow.get() )->ChangeHighlightItem( nItemPos, false ); + static_cast< MenuFloatingWindow* >( m_pWindow.get() )->ChangeHighlightItem( nItemPos, false ); } } @@ -2396,9 +2396,9 @@ MenuBarWindow* MenuBar::getMenuBarWindow() { // so far just a dynamic_cast, hopefully to be turned into something saner // at some stage - MenuBarWindow *pWin = dynamic_cast(pWindow.get()); + MenuBarWindow *pWin = dynamic_cast(m_pWindow.get()); //either there is no window (fdo#87663) or it is a MenuBarWindow - assert(!pWindow || pWin); + assert(!m_pWindow || pWin); return pWin; } @@ -2442,7 +2442,7 @@ void MenuBar::ClosePopup(Menu *pMenu) void MenuBar::MenuBarKeyInput(const KeyEvent& rEvent) { - pWindow->KeyInput(rEvent); + m_pWindow->KeyInput(rEvent); } void MenuBar::ShowCloseButton(bool bShow) @@ -2493,7 +2493,7 @@ VclPtr MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWind } pMenu->pStartedFrom = nullptr; - pMenu->pWindow = pWindow; + pMenu->m_pWindow = pWindow; pMenuBarWindow->SetMenu(pMenu); tools::Long nHeight = pWindow ? pMenu->ImplCalcSize(pWindow).Height() : 0; @@ -2518,7 +2518,7 @@ void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete ) pMenuWin->KillActivePopup(); pWindow->disposeOnce(); } - pMenu->pWindow = nullptr; + pMenu->m_pWindow = nullptr; if (pMenu->mpSalMenu) { pMenu->mpSalMenu->ShowMenuBar(false); } @@ -2582,10 +2582,10 @@ bool MenuBar::ImplHandleCmdEvent( const CommandEvent& rCEvent ) void MenuBar::SelectItem(sal_uInt16 nId) { - if (!pWindow) + if (!m_pWindow) return; - pWindow->GrabFocus(); + m_pWindow->GrabFocus(); nId = GetItemPos( nId ); MenuBarWindow* pMenuWin = getMenuBarWindow(); @@ -2947,16 +2947,16 @@ bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectang pWin->SetBorderStyle( WindowBorderStyle::NOBORDER ); else pWin->SetBorderStyle( pWin->GetBorderStyle() | WindowBorderStyle::MENU ); - pWindow = pWin; + m_pWindow = pWin; Size aSz = ImplCalcSize( pWin ); AbsoluteScreenPixelRectangle aDesktopRect(pWin->GetDesktopRectPixel()); if( Application::GetScreenCount() > 1 ) { - vcl::Window* pDeskW = pWindow->GetWindow( GetWindowType::RealParent ); + vcl::Window* pDeskW = m_pWindow->GetWindow( GetWindowType::RealParent ); if( ! pDeskW ) - pDeskW = pWindow; + pDeskW = m_pWindow; AbsoluteScreenPixelPoint aDesktopTL(pDeskW->OutputToAbsoluteScreenPixel(rRect.TopLeft())); aDesktopRect = Application::GetScreenPosSizePixel( Application::GetBestScreen(AbsoluteScreenPixelRectangle(aDesktopTL, rRect.GetSize()))); @@ -2992,7 +2992,7 @@ bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectang if (pStartedFrom && pStartedFrom->IsMenuBar()) nMaxHeight -= pParentWin->GetSizePixel().Height(); sal_Int32 nLeft, nTop, nRight, nBottom; - pWindow->GetBorder( nLeft, nTop, nRight, nBottom ); + m_pWindow->GetBorder( nLeft, nTop, nRight, nBottom ); nMaxHeight -= nTop+nBottom; if ( aSz.Height() > nMaxHeight ) { @@ -3019,9 +3019,9 @@ bool PopupMenu::Run(const VclPtr& pWin, const bool bRealExec { sal_uInt16 aPos; if (pSFrom->IsMenuBar()) - aPos = static_cast(pSFrom->pWindow.get())->GetHighlightedItem(); + aPos = static_cast(pSFrom->m_pWindow.get())->GetHighlightedItem(); else - aPos = static_cast(pSFrom->pWindow.get())->GetHighlightedItem(); + aPos = static_cast(pSFrom->m_pWindow.get())->GetHighlightedItem(); pWin->SetPosInParent(aPos); // store position to be sent in SUBMENUDEACTIVATE pSFrom->ImplCallEventListeners(VclEventId::MenuSubmenuActivate, aPos); @@ -3077,7 +3077,7 @@ void PopupMenu::FinishRun(const VclPtr& pWin, const VclPtrStopExecute(); pWin->doShutdown(); - pWindow.disposeAndClear(); + m_pWindow.disposeAndClear(); ImplClosePopupToolBox(pParentWin); ImplFlushPendingSelect(); } diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 1ec31bdd7cc7..9eaaba67db81 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -350,8 +350,8 @@ void MenuBarWindow::KillActivePopup() if ( !m_pActivePopup ) return; - if( m_pActivePopup->pWindow ) - if( static_cast(m_pActivePopup->pWindow.get())->IsInCleanUp() ) + if (m_pActivePopup->m_pWindow) + if (static_cast(m_pActivePopup->m_pWindow.get())->IsInCleanUp()) return; // kill it later if ( m_pActivePopup->bInCallback ) @@ -375,7 +375,7 @@ void MenuBarWindow::KillActivePopup() } m_pActivePopup->ImplGetFloatingWindow()->StopExecute(); m_pActivePopup->ImplGetFloatingWindow()->doShutdown(); - m_pActivePopup->pWindow.disposeAndClear(); + m_pActivePopup->m_pWindow.disposeAndClear(); } m_pActivePopup = nullptr; } diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index fc4f12288e46..4597a993e7f0 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -482,8 +482,8 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) if ( !pActivePopup || ( pThisOnly && ( pThisOnly != pActivePopup ) ) ) return; - if( pActivePopup->pWindow ) - if( static_cast(pActivePopup->pWindow.get())->IsInCleanUp() ) + if (pActivePopup->m_pWindow) + if (static_cast(pActivePopup->m_pWindow.get())->IsInCleanUp()) return; // kill it later if ( pActivePopup->bInCallback ) pActivePopup->bCanceled = true; @@ -499,7 +499,7 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) { pPopup->ImplGetFloatingWindow()->StopExecute(); pPopup->ImplGetFloatingWindow()->doShutdown(); - pPopup->pWindow.disposeAndClear(); + pPopup->m_pWindow.disposeAndClear(); PaintImmediately(); } diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 1109e1b48b8b..d4e1f9e51997 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -861,7 +861,7 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar) } if ( pMenuBar ) { - SAL_WARN_IF( pMenuBar->pWindow, "vcl", "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" ); + SAL_WARN_IF( pMenuBar->m_pWindow, "vcl", "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" ); pNewWindow = MenuBar::ImplCreate(mpWindowImpl->mpBorderWindow, pOldWindow, pMenuBar); static_cast(mpWindowImpl->mpBorderWindow.get())->SetMenuBarWindow(pNewWindow); From d49091617b8fa6fc8bce611323758fcf60e49b8b Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 10:22:31 +0100 Subject: [PATCH 005/155] vcl: Make Menu::ImplGetSalMenu const And drop the then no longer needed const_cast in Menu::GetSystemMenuData. Change-Id: Iac438850c5258e5fc23a4b3901f4601edf82e57c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177659 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- include/vcl/menu.hxx | 2 +- vcl/source/window/menu.cxx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 893959e82634..6c6aa9945583 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -182,7 +182,7 @@ protected: DECL_DLLPRIVATE_LINK(ImplCallSelect, void*, void ); SAL_DLLPRIVATE void ImplFillLayoutData() const; - SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() { return mpSalMenu.get(); } + SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() const { return mpSalMenu.get(); } SAL_DLLPRIVATE OUString ImplGetHelpText( sal_uInt16 nItemId ) const; // returns native check and option menu symbol height in rCheckHeight and rRadioHeight diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 04e351ce4ae0..9750fc75ba6a 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2353,10 +2353,9 @@ OUString Menu::GetAccessibleDescription( sal_uInt16 nItemId ) const void Menu::GetSystemMenuData( SystemMenuData* pData ) const { - Menu* pMenu = const_cast(this); - if( pData && pMenu->ImplGetSalMenu() ) + if (pData && ImplGetSalMenu()) { - pMenu->ImplGetSalMenu()->GetSystemMenuData( pData ); + ImplGetSalMenu()->GetSystemMenuData(pData); } } From e45cf9aab3de52ebcbefb70bec81f407d037b166 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 10:32:24 +0100 Subject: [PATCH 006/155] vcl: Add a default SalMenu::GetSystemMenuData implementation Have a default SalMenu::GetSystemMenuData implementation that does nothing instead of being purely virtual and all subclasses except WinSalMenu::GetSystemMenuData having to override it to do nothing. Change-Id: Ia47af286f0fd3c1e3c6a00fff4512c9334fd6e9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177660 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/inc/osx/salmenu.h | 1 - vcl/inc/qt5/QtMenu.hxx | 1 - vcl/inc/salmenu.hxx | 2 +- vcl/inc/unx/gtk/gtksalmenu.hxx | 1 - vcl/osx/salmenu.cxx | 4 ---- vcl/qt5/QtMenu.cxx | 2 -- vcl/source/app/salvtables.cxx | 2 ++ vcl/unx/gtk3/gtksalmenu.cxx | 4 ---- 8 files changed, 3 insertions(+), 14 deletions(-) diff --git a/vcl/inc/osx/salmenu.h b/vcl/inc/osx/salmenu.h index 597180cc1ac3..e750f1fd1596 100644 --- a/vcl/inc/osx/salmenu.h +++ b/vcl/inc/osx/salmenu.h @@ -66,7 +66,6 @@ public: virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) override; virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage) override; virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override; - virtual void GetSystemMenuData( SystemMenuData* pData ) override; virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override; virtual bool AddMenuBarButton( const SalMenuButtonItem& ) override; virtual void RemoveMenuBarButton( sal_uInt16 nId ) override; diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx index 8c44c079668d..8042c67720ba 100644 --- a/vcl/inc/qt5/QtMenu.hxx +++ b/vcl/inc/qt5/QtMenu.hxx @@ -93,7 +93,6 @@ public: const Image& rImage) override; virtual void SetAccelerator(unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName) override; - virtual void GetSystemMenuData(SystemMenuData* pData) override; virtual void ShowCloseButton(bool bShow) override; virtual bool AddMenuBarButton(const SalMenuButtonItem&) override; virtual void RemoveMenuBarButton(sal_uInt16 nId) override; diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx index 975df9391eae..5cc316acc46e 100644 --- a/vcl/inc/salmenu.hxx +++ b/vcl/inc/salmenu.hxx @@ -73,7 +73,7 @@ public: virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText )= 0; virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0; virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) = 0; - virtual void GetSystemMenuData( SystemMenuData* pData ) = 0; + virtual void GetSystemMenuData(SystemMenuData* pData); virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags); virtual void ShowCloseButton(bool bShow); virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index eadb096e0c1e..3172c37656bd 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -84,7 +84,6 @@ public: virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) override; virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage) override; virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override; - virtual void GetSystemMenuData( SystemMenuData* pData ) override; void SetMenu( Menu* pMenu ) { mpVCLMenu = pMenu; } Menu* GetMenu() { return mpVCLMenu; } diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index 08a0a3620137..a14f1874c83e 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -744,10 +744,6 @@ void AquaSalMenu::SetAccelerator( unsigned /*nPos*/, SalMenuItem* pSalMenuItem, [pString release]; } -void AquaSalMenu::GetSystemMenuData( SystemMenuData* ) -{ -} - AquaSalMenu::MenuBarButtonEntry* AquaSalMenu::findButtonItem( sal_uInt16 i_nItemId ) { for( size_t i = 0; i < maButtons.size(); ++i ) diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index 6cdc6cf25d86..b306e35eb54a 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -597,8 +597,6 @@ void QtMenu::SetAccelerator(unsigned, SalMenuItem* pItem, const vcl::KeyCode&, pAction->setShortcut(QKeySequence(toQString(rText), QKeySequence::PortableText)); } -void QtMenu::GetSystemMenuData(SystemMenuData*) {} - QtMenu* QtMenu::GetTopLevel() { QtMenu* pMenu = this; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 4f2928e53747..0f353a9eed19 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -214,6 +214,8 @@ SalObject::~SalObject() {} SalMenu::~SalMenu() {} +void SalMenu::GetSystemMenuData(SystemMenuData*) {} + bool SalMenu::ShowNativePopupMenu(FloatingWindow*, const tools::Rectangle&, FloatWinPopupFlags) { return false; diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index efe4da3dde44..50aa39919749 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -1622,10 +1622,6 @@ void GtkSalMenu::SetAccelerator( unsigned, SalMenuItem*, const vcl::KeyCode&, co { } -void GtkSalMenu::GetSystemMenuData( SystemMenuData* ) -{ -} - int GtkSalMenu::GetMenuBarHeight() const { return mpMenuBarWidget ? gtk_widget_get_allocated_height(mpMenuBarWidget) : 0; From 5b47e57f177df6ae0f5f3afd7f0bee47a208fd6d Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 10:41:36 +0100 Subject: [PATCH 007/155] vcl: Pass GetSystemMenuData param by ref Change-Id: I04cae4a880dcf5c34e35ade9983b56d8ff8ed496 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177661 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- framework/source/uielement/menubarmanager.cxx | 2 +- include/vcl/menu.hxx | 3 +-- vcl/inc/salmenu.hxx | 2 +- vcl/inc/win/salmenu.h | 2 +- vcl/source/app/salvtables.cxx | 2 +- vcl/source/window/menu.cxx | 6 +++--- vcl/win/window/salmenu.cxx | 5 ++--- 7 files changed, 10 insertions(+), 12 deletions(-) diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index c262a990a8c6..caa0aaa36ce3 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -115,7 +115,7 @@ Any SAL_CALL MenuBarManager::getMenuHandle( const Sequence< sal_Int8 >& /*Proces { SystemMenuData aSystemMenuData; - m_pVCLMenu->GetSystemMenuData( &aSystemMenuData ); + m_pVCLMenu->GetSystemMenuData(aSystemMenuData); #ifdef _WIN32 if( SystemType == SystemDependent::SYSTEM_WIN32 ) { diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 6c6aa9945583..bac335d305d9 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -354,8 +354,7 @@ public: } // returns the system's menu handle if native menus are supported - // pData must point to a SystemMenuData structure - void GetSystemMenuData( SystemMenuData* pData ) const; + void GetSystemMenuData(SystemMenuData& rData) const; // accessibility helpers diff --git a/vcl/inc/salmenu.hxx b/vcl/inc/salmenu.hxx index 5cc316acc46e..469c4e3b4945 100644 --- a/vcl/inc/salmenu.hxx +++ b/vcl/inc/salmenu.hxx @@ -73,7 +73,7 @@ public: virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText )= 0; virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) = 0; virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) = 0; - virtual void GetSystemMenuData(SystemMenuData* pData); + virtual void GetSystemMenuData(SystemMenuData& rData); virtual bool ShowNativePopupMenu(FloatingWindow * pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags); virtual void ShowCloseButton(bool bShow); virtual bool AddMenuBarButton( const SalMenuButtonItem& ); // return false if not implemented or failure diff --git a/vcl/inc/win/salmenu.h b/vcl/inc/win/salmenu.h index 7058d9c82b8a..93f2610867d7 100644 --- a/vcl/inc/win/salmenu.h +++ b/vcl/inc/win/salmenu.h @@ -40,7 +40,7 @@ public: virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) override; virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage ) override; virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override; - virtual void GetSystemMenuData( SystemMenuData* pData ) override; + virtual void GetSystemMenuData(SystemMenuData& rData) override; HMENU mhMenu; // the menu handle bool mbMenuBar; // true for menu bars diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 0f353a9eed19..a20c1831626d 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -214,7 +214,7 @@ SalObject::~SalObject() {} SalMenu::~SalMenu() {} -void SalMenu::GetSystemMenuData(SystemMenuData*) {} +void SalMenu::GetSystemMenuData(SystemMenuData&) {} bool SalMenu::ShowNativePopupMenu(FloatingWindow*, const tools::Rectangle&, FloatWinPopupFlags) { diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 9750fc75ba6a..80f14042b0b7 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2351,11 +2351,11 @@ OUString Menu::GetAccessibleDescription( sal_uInt16 nItemId ) const return GetHelpText(nItemId); } -void Menu::GetSystemMenuData( SystemMenuData* pData ) const +void Menu::GetSystemMenuData(SystemMenuData& rData) const { - if (pData && ImplGetSalMenu()) + if (ImplGetSalMenu()) { - ImplGetSalMenu()->GetSystemMenuData(pData); + ImplGetSalMenu()->GetSystemMenuData(rData); } } diff --git a/vcl/win/window/salmenu.cxx b/vcl/win/window/salmenu.cxx index 91a15284aeb5..afb69de605a5 100644 --- a/vcl/win/window/salmenu.cxx +++ b/vcl/win/window/salmenu.cxx @@ -302,10 +302,9 @@ void WinSalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const } } -void WinSalMenu::GetSystemMenuData( SystemMenuData* pData ) +void WinSalMenu::GetSystemMenuData(SystemMenuData& rData) { - if( pData ) - pData->hMenu = mhMenu; + rData.hMenu = mhMenu; } /* From 1336fc1713f50d743cc151c78ead4621d48ecfb9 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 11:25:38 +0100 Subject: [PATCH 008/155] vcl: Use VclPtr and reduce casting MenuFloatingWindow::pMenu is always a PopupMenu, so use a VclPtr for it, instead of a VclPtr and casting in multiple places. Change-Id: I004fc57063fc1cd50e5f14463367af3063a247b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177671 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menufloatingwindow.cxx | 10 +++++----- vcl/source/window/menufloatingwindow.hxx | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 4597a993e7f0..64fba7d7a4f6 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -29,7 +29,7 @@ #include #include -MenuFloatingWindow::MenuFloatingWindow( Menu* pMen, vcl::Window* pParent, WinBits nStyle ) : +MenuFloatingWindow::MenuFloatingWindow(PopupMenu* pMen, vcl::Window* pParent, WinBits nStyle ) : FloatingWindow( pParent, nStyle ), pMenu(pMen), aHighlightChangedTimer("vcl::MenuFloatingWindow aHighlightChangedTimer"), @@ -451,7 +451,7 @@ void MenuFloatingWindow::Execute() { ImplSVData* pSVData = ImplGetSVData(); - pSVData->maAppData.mpActivePopupMenu = static_cast(pMenu.get()); + pSVData->maAppData.mpActivePopupMenu = pMenu.get(); Start(); @@ -679,7 +679,7 @@ void MenuFloatingWindow::ImplScroll( bool bUp ) tools::Long nHeight = GetOutputSizePixel().Height(); sal_uInt16 nLastVisible; - static_cast(pMenu.get())->ImplCalcVisEntries( nHeight, nFirstEntry, &nLastVisible ); + pMenu->ImplCalcVisEntries(nHeight, nFirstEntry, &nLastVisible); if ( pMenu->ImplGetNextVisible( nLastVisible ) == ITEMPOS_INVALID ) { bScrollDown = false; @@ -1015,11 +1015,11 @@ void MenuFloatingWindow::ImplCursorUpDown( bool bUp, bool bHomeEnd ) Size aOutSz = GetOutputSizePixel(); sal_uInt16 nLastVisible; - static_cast(pMenu.get())->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible ); + pMenu->ImplCalcVisEntries(aOutSz.Height(), nFirstEntry, &nLastVisible); while ( n > nLastVisible ) { ImplScroll( false ); - static_cast(pMenu.get())->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible ); + pMenu->ImplCalcVisEntries(aOutSz.Height(), nFirstEntry, &nLastVisible); } } ChangeHighlightItem( n, false ); diff --git a/vcl/source/window/menufloatingwindow.hxx b/vcl/source/window/menufloatingwindow.hxx index f26fb50373ca..5324197aa8bd 100644 --- a/vcl/source/window/menufloatingwindow.hxx +++ b/vcl/source/window/menufloatingwindow.hxx @@ -35,7 +35,7 @@ class MenuFloatingWindow : public FloatingWindow, public MenuWindow friend void Menu::dispose(); private: - VclPtr pMenu; + VclPtr pMenu; VclPtr pActivePopup; Timer aHighlightChangedTimer; Timer aSubmenuCloseTimer; @@ -83,7 +83,7 @@ protected: void InvalidateItem( sal_uInt16 nPos ); public: - MenuFloatingWindow(Menu* pMenu, vcl::Window* pParent, WinBits nStyle); + MenuFloatingWindow(PopupMenu* pMenu, vcl::Window* pParent, WinBits nStyle); virtual ~MenuFloatingWindow() override; virtual void dispose() override; From 44f6a3e9583357ac882f1660285214231961204a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 11:45:22 +0100 Subject: [PATCH 009/155] vcl: Use existing PopupMenu::ImplGetFloatingWindow ... instead of manually casting the `m_pWindow` member in another place. While at it, also just call GetWindow() in PopupMenu::ImplGetFloatingWindow, not explicitly the base class Menu::ImplGetFloatingWindow. Both are the same, as this is a non-virtual method only implemented in the base class. Change-Id: I12debc7c5bad8b21722fabb093cbc4a7a669dff1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177672 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menu.cxx | 2 +- vcl/source/window/menufloatingwindow.cxx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 80f14042b0b7..300ecf535980 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2727,7 +2727,7 @@ int MenuBar::GetMenuBarHeight() const // bool PopupMenu::bAnyPopupInExecute = false; MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow() const { - return static_cast(Menu::GetWindow()); + return static_cast(GetWindow()); } PopupMenu::PopupMenu() diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 64fba7d7a4f6..0d6a60689c35 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -482,9 +482,11 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) if ( !pActivePopup || ( pThisOnly && ( pThisOnly != pActivePopup ) ) ) return; - if (pActivePopup->m_pWindow) - if (static_cast(pActivePopup->m_pWindow.get())->IsInCleanUp()) + if (MenuFloatingWindow* pFloatWin = pActivePopup->ImplGetFloatingWindow()) + { + if (pFloatWin->IsInCleanUp()) return; // kill it later + } if ( pActivePopup->bInCallback ) pActivePopup->bCanceled = true; From 9a730cd0793919e3b60fe5b32aaba0fe5eb2a115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 2 Dec 2024 11:48:55 +0000 Subject: [PATCH 010/155] crashtesting: failure to import rtf output of forum-en-44797.odt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit field text ended in \ so next } was escaped Change-Id: I2129f410a1d1c3d507a223c3576f02b78f7aac63 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177681 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/filter/ww8/rtfattributeoutput.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 228fcd65ce97..d2484c941825 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2434,7 +2434,8 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi m_aRun->append('}'); m_aRun->append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); xPropSet->getPropertyValue(u"Text"_ustr) >>= aTmp; - m_aRun->append(OUStringToOString(aTmp, m_rExport.GetCurrentEncoding())); + m_aRun->append( + msfilter::rtfutil::OutString(aTmp, m_rExport.GetCurrentEncoding())); m_aRun->append('}'); m_aRun->append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD @@ -2446,8 +2447,8 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); - m_aRun->append( - OUStringToOString(aTmp, m_rExport.GetCurrentEncoding())); + m_aRun->append(msfilter::rtfutil::OutString( + aTmp, m_rExport.GetCurrentEncoding())); m_aRun->append('}'); } @@ -2458,8 +2459,8 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi m_aRun->append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); m_aRun->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); - m_aRun->append( - OUStringToOString(aTmp, m_rExport.GetCurrentEncoding())); + m_aRun->append(msfilter::rtfutil::OutString( + aTmp, m_rExport.GetCurrentEncoding())); m_aRun->append('}'); } m_aRun->append("}"); From d4d74fc3b44b8e9b00330d2fd9c4f8809f01f063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 2 Dec 2024 12:01:47 +0000 Subject: [PATCH 011/155] mnOriginalTextPos is only written to, never read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iaca97dc3a0534847cbe96816a0827549a8f8d371 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177685 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- filter/source/msfilter/svdfppt.cxx | 7 +------ include/filter/msfilter/svdfppt.hxx | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index bea4a2aec8e5..472a1e106f40 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -4408,8 +4408,7 @@ PPTStyleSheet::~PPTStyleSheet() } PPTParaPropSet::PPTParaPropSet() - : mnOriginalTextPos(0) - , mxParaSet( new ImplPPTParaPropSet ) + : mxParaSet( new ImplPPTParaPropSet ) { mxParaSet->mnHasAnm = 1; } @@ -4417,7 +4416,6 @@ PPTParaPropSet::PPTParaPropSet() PPTParaPropSet::PPTParaPropSet( PPTParaPropSet const & rParaPropSet ) { mxParaSet = rParaPropSet.mxParaSet; - mnOriginalTextPos = rParaPropSet.mnOriginalTextPos; } PPTParaPropSet::~PPTParaPropSet() @@ -4429,7 +4427,6 @@ PPTParaPropSet& PPTParaPropSet::operator=( const PPTParaPropSet& rParaPropSet ) if ( this != &rParaPropSet ) { mxParaSet = rParaPropSet.mxParaSet; - mnOriginalTextPos = rParaPropSet.mnOriginalTextPos; } return *this; } @@ -5069,7 +5066,6 @@ void PPTStyleTextPropReader::ReadParaProps(SvStream& rIn, const DffRecordHeader& OSL_FAIL( "SJ:PPTStyleTextPropReader::could not get this PPT_PST_StyleTextPropAtom by reading the paragraph attributes" ); } PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet ); - pPara->mnOriginalTextPos = nCharReadCnt; aParaPropList.emplace_back( pPara ); if ( nCharCount ) { @@ -5079,7 +5075,6 @@ void PPTStyleTextPropReader::ReadParaProps(SvStream& rIn, const DffRecordHeader& if ( pDat[ nCount ] == 0xd ) { pPara = new PPTParaPropSet( aParaPropSet ); - pPara->mnOriginalTextPos = nCharReadCnt + nCount + 1; aParaPropList.emplace_back( pPara ); } } diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index dcb6f87061d2..094c22a5918f 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -903,7 +903,6 @@ struct ImplPPTParaPropSet final : public salhelper::SimpleReferenceObject struct PPTParaPropSet { - sal_uInt32 mnOriginalTextPos; rtl::Reference mxParaSet; PPTParaPropSet(); From 264c333b055bcebf0ba85f5d7ebf66fe6b245bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 2 Dec 2024 11:00:59 +0000 Subject: [PATCH 012/155] crashtesting: failure to reload conversion of forum-de3-6592.odt to docx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic2781bbd25e794992a181b2f4807fc0ca08ef33b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177673 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- oox/source/shape/WpsContext.cxx | 49 ++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 4734505302bb..78cef2a0d45c 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -682,6 +682,8 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken xPropertySet->setPropertyValue(u"InteropGrabBag"_ustr, uno::Any(aGrabBag)); } + auto xPropertySetInfo = xPropertySet->getPropertySetInfo(); + if (xServiceInfo.is()) { // Handle inset attributes for Writer textframes. @@ -701,16 +703,29 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken = { u"TextLeftDistance"_ustr, u"TextUpperDistance"_ustr, u"TextRightDistance"_ustr, u"TextLowerDistance"_ustr }; for (std::size_t i = 0; i < SAL_N_ELEMENTS(aShapeProps); ++i) - if (oInsets[i]) + { + if (!oInsets[i]) + continue; + if (xPropertySetInfo && xPropertySetInfo->hasPropertyByName(aShapeProps[i])) xPropertySet->setPropertyValue(aShapeProps[i], uno::Any(*oInsets[i])); + else + SAL_WARN("oox", "Property: " << aShapeProps[i] << " not supported"); + } } // Handle text vertical adjustment inside a text frame if (rAttribs.hasAttribute(XML_anchor)) { - drawing::TextVerticalAdjust eAdjust - = drawingml::GetTextVerticalAdjust(rAttribs.getToken(XML_anchor, XML_t)); - xPropertySet->setPropertyValue(u"TextVerticalAdjust"_ustr, uno::Any(eAdjust)); + if (xPropertySetInfo + && xPropertySetInfo->hasPropertyByName(u"TextVerticalAdjust"_ustr)) + { + drawing::TextVerticalAdjust eAdjust = drawingml::GetTextVerticalAdjust( + rAttribs.getToken(XML_anchor, XML_t)); + xPropertySet->setPropertyValue(u"TextVerticalAdjust"_ustr, + uno::Any(eAdjust)); + } + else + SAL_WARN("oox", "Property: TextVerticalAdjust not supported"); } // Apply character color of the shape to the shape's textbox. @@ -775,9 +790,14 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken } } - auto nWrappingType = rAttribs.getToken(XML_wrap, XML_square); - xPropertySet->setPropertyValue(u"TextWordWrap"_ustr, - uno::Any(nWrappingType == XML_square)); + if (xPropertySetInfo && xPropertySetInfo->hasPropertyByName(u"TextWordWrap"_ustr)) + { + auto nWrappingType = rAttribs.getToken(XML_wrap, XML_square); + xPropertySet->setPropertyValue(u"TextWordWrap"_ustr, + uno::Any(nWrappingType == XML_square)); + } + else + SAL_WARN("oox", "Property: TextWordWrap not supported"); return this; } @@ -831,9 +851,18 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken u"FrameIsAutomaticHeight"_ustr, uno::Any(getBaseToken(nElementToken) == XML_spAutoFit)); else - xPropertySet->setPropertyValue( - u"TextAutoGrowHeight"_ustr, - uno::Any(getBaseToken(nElementToken) == XML_spAutoFit)); + { + auto xPropertySetInfo = xPropertySet->getPropertySetInfo(); + if (xPropertySetInfo + && xPropertySetInfo->hasPropertyByName(u"TextAutoGrowHeight"_ustr)) + { + xPropertySet->setPropertyValue( + u"TextAutoGrowHeight"_ustr, + uno::Any(getBaseToken(nElementToken) == XML_spAutoFit)); + } + else + SAL_WARN("oox", "Property: TextAutoGrowHeight not supported"); + } } } break; From ae281b51456196246a5b21929f6624bf6c030294 Mon Sep 17 00:00:00 2001 From: Sarper Akdemir Date: Mon, 2 Dec 2024 12:45:27 +0100 Subject: [PATCH 013/155] tdf#163948: fix crash when NotesPane is enabled on Tabbed UI Pane shells (BottomImpressPane, LeftImpressPane etc.) do not implement any slot handling, so make sure they are not activated on the top of the shellstack. Another solution for this could have been getting ChildWindowPanes properly dispose instead of Hide() at BasicPaneFactory::releaseResource, and adapting the rest of the code which assumes these Panes are recycled. This is since ConfigurationUpdater::UpdateCore attempts at releasing via ConfigurationUpdater::CheckPureAnchors and ConfigurationControllerResourceManager::DeactivateResources calls. But in the end the ChildWindowPane is hidden on the DeactivateResource call instead of being diposed, so the "PureAnchor"'s Shell stays at the shellstack. Change-Id: I52788d350b66ae22875683f57d87326f4a9a77de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177686 Reviewed-by: Sarper Akdemir Tested-by: Jenkins --- .../framework/factories/ChildWindowPane.cxx | 4 ++- sd/source/ui/inc/ViewShellManager.hxx | 5 ++++ sd/source/ui/view/ViewShellManager.cxx | 28 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx b/sd/source/ui/framework/factories/ChildWindowPane.cxx index 1eaf0f0aeeb2..6e9e237c166f 100644 --- a/sd/source/ui/framework/factories/ChildWindowPane.cxx +++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx @@ -48,7 +48,9 @@ ChildWindowPane::ChildWindowPane ( mpShell(std::move(pShell)), mbHasBeenActivated(false) { - mrViewShellBase.GetViewShellManager()->ActivateShell(mpShell.get()); + // ChildWindowPane shells don't implement dispatch slots, so activate them + // at the bottom of the shellstack. + mrViewShellBase.GetViewShellManager()->ActivateLowPriorityShell(mpShell.get()); SfxViewFrame& rViewFrame = mrViewShellBase.GetViewFrame(); diff --git a/sd/source/ui/inc/ViewShellManager.hxx b/sd/source/ui/inc/ViewShellManager.hxx index 70fe4d548cbe..929877ad1484 100644 --- a/sd/source/ui/inc/ViewShellManager.hxx +++ b/sd/source/ui/inc/ViewShellManager.hxx @@ -88,6 +88,11 @@ public: */ void ActivateShell(SfxShell* pShell); + /** Activate the given shell, putting it at the bottom of the stack instead of + the top. + */ + void ActivateLowPriorityShell(SfxShell* pShell); + /** Deactivate the specified shell, i.e. take it and all of its object bars from the shell stack. @param pShell diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index 7f150b3d4f1c..a82a1be2dc82 100644 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -108,8 +108,10 @@ public: ViewShell* pViewShell); void DeactivateViewShell (const ViewShell& rShell); void ActivateShell (SfxShell& rShell); + void ActivateLowPriorityShell (SfxShell& rShell); void DeactivateShell (const SfxShell& rShell); void ActivateShell (const ShellDescriptor& rDescriptor); + void ActivateLowPriorityShell (const ShellDescriptor& rDescriptor); void SetFormShell (const ViewShell* pViewShell, FmFormShell* pFormShell, bool bAbove); void ActivateSubShell (const SfxShell& rParentShell, ShellId nId); void DeactivateSubShell (const SfxShell& rParentShell, ShellId nId); @@ -317,6 +319,12 @@ void ViewShellManager::ActivateShell (SfxShell* pShell) mpImpl->ActivateShell(*pShell); } +void ViewShellManager::ActivateLowPriorityShell (SfxShell* pShell) +{ + if (mbValid && pShell!=nullptr) + mpImpl->ActivateLowPriorityShell(*pShell); +} + void ViewShellManager::DeactivateShell (const SfxShell* pShell) { if (mbValid && pShell!=nullptr) @@ -498,6 +506,17 @@ void ViewShellManager::Implementation::ActivateShell (SfxShell& rShell) ActivateShell(aDescriptor); } +void ViewShellManager::Implementation::ActivateLowPriorityShell (SfxShell& rShell) +{ + ::osl::MutexGuard aGuard (maMutex); + + // Create a new shell or recycle on in the cache. + ShellDescriptor aDescriptor; + aDescriptor.mpShell = &rShell; + + ActivateLowPriorityShell(aDescriptor); +} + void ViewShellManager::Implementation::ActivateShell (const ShellDescriptor& rDescriptor) { // Put shell on top of the active view shells. @@ -507,6 +526,15 @@ void ViewShellManager::Implementation::ActivateShell (const ShellDescriptor& rDe } } +void ViewShellManager::Implementation::ActivateLowPriorityShell (const ShellDescriptor& rDescriptor) +{ + // Put shell on bottom of the active view shells. + if (rDescriptor.mpShell != nullptr) + { + maActiveViewShells.push_back( rDescriptor ); + } +} + void ViewShellManager::Implementation::DeactivateShell (const SfxShell& rShell) { ::osl::MutexGuard aGuard (maMutex); From f75b9f7e1eda6e9ab6e45df774134dcd3665f60e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 2 Dec 2024 13:26:55 +0200 Subject: [PATCH 014/155] loplugin:unusedmethods Change-Id: I85ef1d4e9391e211c9e5e7ac6e9de875e9f5f5af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177679 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/inc/MacroManagerDialog.hxx | 4 ---- include/oox/core/contexthandler2.hxx | 1 - include/sfx2/minfitem.hxx | 1 - sc/inc/document.hxx | 1 - sc/source/core/data/documen3.cxx | 14 -------------- sc/source/ui/condformat/condformatmgr.cxx | 7 ------- sc/source/ui/inc/condformatmgr.hxx | 1 - sfx2/source/control/minfitem.cxx | 10 ---------- 8 files changed, 39 deletions(-) diff --git a/cui/source/inc/MacroManagerDialog.hxx b/cui/source/inc/MacroManagerDialog.hxx index 64854d6980a6..25b24c1b6c8e 100644 --- a/cui/source/inc/MacroManagerDialog.hxx +++ b/cui/source/inc/MacroManagerDialog.hxx @@ -151,10 +151,6 @@ public: { m_xTreeView->connect_changed(rLink); } - void set_size_request(int nWidth, int nHeight) - { - m_xTreeView->set_size_request(nWidth, nHeight); - } weld::TreeView& get_widget() { return *m_xTreeView; } void ClearAll(); diff --git a/include/oox/core/contexthandler2.hxx b/include/oox/core/contexthandler2.hxx index 0101bd956a21..b6664704044e 100644 --- a/include/oox/core/contexthandler2.hxx +++ b/include/oox/core/contexthandler2.hxx @@ -202,7 +202,6 @@ protected: void implEndRecord( sal_Int32 nRecId ); bool prepareMceContext( sal_Int32 nElement, const AttributeList& rAttribs ); - XmlFilterBase& getDocFilter() const { return mrFilter; } enum class MCE_STATE { diff --git a/include/sfx2/minfitem.hxx b/include/sfx2/minfitem.hxx index bbf4744afd62..1b6ff400c6bf 100644 --- a/include/sfx2/minfitem.hxx +++ b/include/sfx2/minfitem.hxx @@ -64,7 +64,6 @@ public: { aLibName = r; } const BasicManager* GetBasicManager() const { return pBasicManager; } - OUString GetQualifiedName() const; const OUString& GetLocation() const { return aLocationName; } }; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index bf3d15092e68..b1e80798410b 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -927,7 +927,6 @@ public: SC_DLLPUBLIC bool HasPivotTable() const; SC_DLLPUBLIC ScDPCollection* GetDPCollection(); SC_DLLPUBLIC const ScDPCollection* GetDPCollection() const; - SC_DLLPUBLIC const ScDPObject* GetDPAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; SC_DLLPUBLIC ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; SC_DLLPUBLIC ScDPObject* GetDPAtCursor(ScAddress const& rAddress) const { diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 602d3b573535..3c95015874c0 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -379,20 +379,6 @@ const ScDPCollection* ScDocument::GetDPCollection() const return pDPCollection.get(); } -const ScDPObject* ScDocument::GetDPAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const -{ - if (!pDPCollection) - return nullptr; - - sal_uInt16 nCount = pDPCollection->GetCount(); - ScRange aRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab); - for (sal_uInt16 i = 0; i < nCount; i++) - if ((*pDPCollection)[i].GetOutRange() == aRange) - return &(*pDPCollection)[i]; - - return nullptr; -} - ScDPObject* ScDocument::GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const { if (!pDPCollection) diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index fcb1b8afd3a0..f5add41fda9d 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -185,13 +185,6 @@ void ScCondFormatManagerDlg::UpdateButtonSensitivity() m_xBtnEdit->set_sensitive(bNewSensitivity); } -// Get the current conditional format selected. -// -ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected() -{ - return m_xCtrlManager->GetSelection(); -} - void ScCondFormatManagerDlg::ShowEasyConditionalDialog(bool isEdit) { SfxViewShell* pViewShell = SfxViewShell::Current(); diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 564415186ac0..301f74499063 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -48,7 +48,6 @@ public: bool CondFormatsChanged() const; void SetModified(); - ScConditionalFormat* GetCondFormatSelected(); void ShowEasyConditionalDialog(bool isEdit = false); private: diff --git a/sfx2/source/control/minfitem.cxx b/sfx2/source/control/minfitem.cxx index 7b5b2d62bc2a..765eada62029 100644 --- a/sfx2/source/control/minfitem.cxx +++ b/sfx2/source/control/minfitem.cxx @@ -63,16 +63,6 @@ SfxMacroInfoItem* SfxMacroInfoItem::Clone( SfxItemPool *) const return new SfxMacroInfoItem(*this); } -OUString SfxMacroInfoItem::GetQualifiedName() const -{ - OUString aMacroName = aLibName + - "." + - aModuleName + - "." + - aMethodName; - return aMacroName; -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From adfbf35c0c102c7cead29845bde807947df4e30d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sun, 1 Dec 2024 15:19:27 +0000 Subject: [PATCH 015/155] cid#1606759 Data race condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1357972c5ca8c6441533f15423134707efd36e33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177684 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- svx/inc/shapecollection.hxx | 4 ++-- svx/source/accessibility/ChildrenManagerImpl.cxx | 6 ++++-- svx/source/unodraw/unoshcol.cxx | 12 ++++++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/svx/inc/shapecollection.hxx b/svx/inc/shapecollection.hxx index 44988281bb75..47eaec2e2e6d 100644 --- a/svx/inc/shapecollection.hxx +++ b/svx/inc/shapecollection.hxx @@ -31,7 +31,7 @@ class SvxShapeCollection final css::lang::XComponent> { private: - std::mutex m_aMutex; + mutable std::mutex m_aMutex; std::vector> maShapeContainer; comphelper::OInterfaceContainerHelper4 maEventListeners; bool bDisposed = false; @@ -67,7 +67,7 @@ public: virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; - void getAllShapes(std::vector>& rShapes) const; + std::vector> getAllShapes() const; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 70c9e4e37b2b..29b3f76bf891 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -871,17 +871,19 @@ void ChildrenManagerImpl::UpdateSelection() if (!xSelectedShape.is() && xSelectedShapeAccess.is()) { sal_Int32 nCount = xSelectedShapeAccess->getCount(); - aSortedSelectedShapes.reserve(nCount); if (auto pSvxShape = dynamic_cast(xSelectedShapeAccess.get())) { - pSvxShape->getAllShapes(aSortedSelectedShapes); + aSortedSelectedShapes = pSvxShape->getAllShapes(); } else + { + aSortedSelectedShapes.reserve(nCount); for (sal_Int32 i = 0; i < nCount; ++i) { css::uno::Reference xShape(xSelectedShapeAccess->getByIndex(i), uno::UNO_QUERY); aSortedSelectedShapes.push_back(xShape); } + } std::sort(aSortedSelectedShapes.begin(), aSortedSelectedShapes.end()); } diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx index b99f6674a371..116247e1916b 100644 --- a/svx/source/unodraw/unoshcol.cxx +++ b/svx/source/unodraw/unoshcol.cxx @@ -147,7 +147,6 @@ sal_Int32 SAL_CALL SvxShapeCollection::getCount() return maShapeContainer.size(); } - uno::Any SAL_CALL SvxShapeCollection::getByIndex( sal_Int32 Index ) { if( Index < 0 || Index >= getCount() ) @@ -158,6 +157,12 @@ uno::Any SAL_CALL SvxShapeCollection::getByIndex( sal_Int32 Index ) return uno::Any( xShape ); } +std::vector> SvxShapeCollection::getAllShapes() const +{ + std::unique_lock g(m_aMutex); + return maShapeContainer; +} + // XElementAccess uno::Type SAL_CALL SvxShapeCollection::getElementType() { @@ -185,11 +190,6 @@ uno::Sequence< OUString > SAL_CALL SvxShapeCollection::getSupportedServiceNames( return { u"com.sun.star.drawing.Shapes"_ustr, u"com.sun.star.drawing.ShapeCollection"_ustr }; } -void SvxShapeCollection::getAllShapes(std::vector>& rShapes) const -{ - rShapes = maShapeContainer; -} - extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_drawing_SvxShapeCollection_get_implementation( css::uno::XComponentContext *, From 6091e6b0ed363b7e65569830ac76cdcb7ba99b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 2 Dec 2024 11:03:47 +0000 Subject: [PATCH 016/155] crashtesting: further failure to reload forum-de3-6592.docx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git show -w Change-Id: I2963833726779d784bcdfa772e152e65dfde3af5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177674 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- oox/source/shape/WpsContext.cxx | 95 +++++++++++++++++---------------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 78cef2a0d45c..56abef55fcc1 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -730,60 +730,63 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken // Apply character color of the shape to the shape's textbox. uno::Reference xText(mxShape, uno::UNO_QUERY); - uno::Any xCharColor = xPropertySet->getPropertyValue(u"CharColor"_ustr); - Color aColor = COL_AUTO; - if ((xCharColor >>= aColor) && aColor != COL_AUTO) + if (xText) { - // tdf#135923 Apply character color of the shape to the textrun - // when the character color of the textrun is default. - // tdf#153791 But only if the run has no background color (shd element in OOXML) - if (uno::Reference paraEnumAccess{ - xText, uno::UNO_QUERY }) + uno::Any xCharColor = xPropertySet->getPropertyValue(u"CharColor"_ustr); + Color aColor = COL_AUTO; + if ((xCharColor >>= aColor) && aColor != COL_AUTO) { - uno::Reference paraEnum( - paraEnumAccess->createEnumeration()); - - while (paraEnum->hasMoreElements()) + // tdf#135923 Apply character color of the shape to the textrun + // when the character color of the textrun is default. + // tdf#153791 But only if the run has no background color (shd element in OOXML) + if (uno::Reference paraEnumAccess{ + xText, uno::UNO_QUERY }) { - uno::Reference xParagraph(paraEnum->nextElement(), - uno::UNO_QUERY); - uno::Reference runEnumAccess( - xParagraph, uno::UNO_QUERY); - if (!runEnumAccess.is()) - continue; - if (uno::Reference xParaPropSet{ xParagraph, - uno::UNO_QUERY }) - if ((xParaPropSet->getPropertyValue(u"ParaBackColor"_ustr) - >>= aColor) - && aColor != COL_AUTO) - continue; + uno::Reference paraEnum( + paraEnumAccess->createEnumeration()); - uno::Reference runEnum - = runEnumAccess->createEnumeration(); - - while (runEnum->hasMoreElements()) + while (paraEnum->hasMoreElements()) { - uno::Reference xRun(runEnum->nextElement(), - uno::UNO_QUERY); - const uno::Reference xRunState( - xRun, uno::UNO_QUERY); - if (!xRunState - || xRunState->getPropertyState(u"CharColor"_ustr) - == beans::PropertyState_DEFAULT_VALUE) - { - uno::Reference xRunPropSet(xRun, - uno::UNO_QUERY); - if (!xRunPropSet) - continue; - if ((xRunPropSet->getPropertyValue(u"CharBackColor"_ustr) + uno::Reference xParagraph(paraEnum->nextElement(), + uno::UNO_QUERY); + uno::Reference runEnumAccess( + xParagraph, uno::UNO_QUERY); + if (!runEnumAccess.is()) + continue; + if (uno::Reference xParaPropSet{ + xParagraph, uno::UNO_QUERY }) + if ((xParaPropSet->getPropertyValue(u"ParaBackColor"_ustr) >>= aColor) && aColor != COL_AUTO) continue; - if (!(xRunPropSet->getPropertyValue(u"CharColor"_ustr) - >>= aColor) - || aColor == COL_AUTO) - xRunPropSet->setPropertyValue(u"CharColor"_ustr, - xCharColor); + + uno::Reference runEnum + = runEnumAccess->createEnumeration(); + + while (runEnum->hasMoreElements()) + { + uno::Reference xRun(runEnum->nextElement(), + uno::UNO_QUERY); + const uno::Reference xRunState( + xRun, uno::UNO_QUERY); + if (!xRunState + || xRunState->getPropertyState(u"CharColor"_ustr) + == beans::PropertyState_DEFAULT_VALUE) + { + uno::Reference xRunPropSet( + xRun, uno::UNO_QUERY); + if (!xRunPropSet) + continue; + if ((xRunPropSet->getPropertyValue(u"CharBackColor"_ustr) + >>= aColor) + && aColor != COL_AUTO) + continue; + if (!(xRunPropSet->getPropertyValue(u"CharColor"_ustr) + >>= aColor) + || aColor == COL_AUTO) + xRunPropSet->setPropertyValue(u"CharColor"_ustr, + xCharColor); + } } } } From 654e3134adbf48c61aaa29dcd9f52ce236694535 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 2 Dec 2024 15:21:24 +0100 Subject: [PATCH 017/155] unotest,sw: introduce queryDispatchStatus() ... and reset the view options that are toggled in testHiddenParagraphFollowFrame and testHiddenParagraphFlys. Backporting these tests to the libreoffice-24-8 branch broke 2 unrelated tests because of the changed view settings: Test name: (anonymous namespace)::testHiddenSectionPageDescs::TestBody equality assertion failed - Expected: 532 - Actual : 798 - In <>, attribute 'height' of '/root/page[2]/body/section[1]/infos/bounds' incorrect value. xmltesttools.cxx:203:Assertion Test name: (anonymous namespace)::testTable0HeightRows::TestBody equality assertion failed - Expected: 28 - Actual : 22 - In <>, XPath '/root/page[1]/body/tab/row' number of nodes is incorrect Change-Id: Ie58242348fecabe163e54048f3896c6d427d2608 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177691 Tested-by: Jenkins Reviewed-by: Michael Stahl --- include/unotest/macros_test.hxx | 6 ++++ sw/qa/extras/layout/layout3.cxx | 16 +++++++++ unotest/source/cpp/macros_test.cxx | 57 ++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx index 663fcf22b68d..7757e1436545 100644 --- a/include/unotest/macros_test.hxx +++ b/include/unotest/macros_test.hxx @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -92,6 +93,11 @@ public: const OUString& rCommand, const css::uno::Sequence& rPropertyValues); + static css::uno::Any + queryDispatchStatus(css::uno::Reference const& xComponent, + css::uno::Reference const& xContext, + OUString const& rURL); + /// Opens rStreamName from rTempFile, assuming it's a ZIP storage. static std::unique_ptr parseExportStream(const OUString& url, const OUString& rStreamName); diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index b7dfcd739d61..ef5e948d5abf 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -1833,6 +1833,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFollowFrame) { createSwDoc("hidden-para-follow-frame.fodt"); + uno::Any aOldValue{ queryDispatchStatus(mxComponent, m_xContext, ".uno:ShowHiddenParagraphs") }; + + Resetter g([this, aOldValue] { + uno::Sequence argsSH( + comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", aOldValue } })); + dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); + }); + uno::Sequence argsSH( comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", uno::Any(true) } })); dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); @@ -1871,6 +1879,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testHiddenParagraphFlys) { createSwDoc("hidden-para-as-char-fly.fodt"); + uno::Any aOldValue{ queryDispatchStatus(mxComponent, m_xContext, ".uno:ShowHiddenParagraphs") }; + + Resetter g([this, aOldValue] { + uno::Sequence argsSH( + comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", aOldValue } })); + dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); + }); + uno::Sequence argsSH( comphelper::InitPropertySequence({ { "ShowHiddenParagraphs", uno::Any(true) } })); dispatchCommand(mxComponent, ".uno:ShowHiddenParagraphs", argsSH); diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index 83df09259d45..f353eba782e5 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -98,6 +99,62 @@ MacrosTest::dispatchCommand(const uno::Reference& xComponent, return ret; } +namespace +{ +class StateGetter : public ::cppu::WeakImplHelper +{ +public: + uno::Any& m_rOldValue; + bool m_Received{ false }; + StateGetter(uno::Any& rOldValue) + : m_rOldValue(rOldValue) + { + } + + virtual void SAL_CALL disposing(lang::EventObject const&) override + { + CPPUNIT_ASSERT(m_Received); + } + virtual void SAL_CALL statusChanged(frame::FeatureStateEvent const& rEvent) override + { + if (!m_Received) + { + m_rOldValue = rEvent.State; + m_Received = true; + } + } +}; + +} // namespace + +uno::Any MacrosTest::queryDispatchStatus(uno::Reference const& xComponent, + uno::Reference const& xContext, + OUString const& rURL) +{ + uno::Any ret; + + util::URL url; + url.Complete = rURL; + { + uno::Reference const xParser( + css::util::URLTransformer::create(xContext)); + CPPUNIT_ASSERT(xParser.is()); + xParser->parseStrict(url); + } + + uno::Reference const xController + = uno::Reference(xComponent, uno::UNO_QUERY_THROW)->getCurrentController(); + uno::Reference const xFrame(xController->getFrame(), uno::UNO_QUERY); + CPPUNIT_ASSERT(xFrame.is()); + uno::Reference const xDisp(xFrame->queryDispatch(url, "", 0)); + CPPUNIT_ASSERT(xDisp.is()); + + uno::Reference const xListener{ new StateGetter(ret) }; + xDisp->addStatusListener(xListener, url); + + return ret; +} + std::unique_ptr MacrosTest::parseExportStream(const OUString& url, const OUString& rStreamName) { From 09187a0208b9d531be75b780055002db620c4d96 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 12:55:09 +0100 Subject: [PATCH 018/155] vcl: No longer let MenuFloatingWindow be a friend of MenuBar MenuFloatingWindow is the window used of PopupMenu, while the window for MenuBar is MenuBarWindow. MenuFloatingWindow only needs access to the menu bar's MenuBarWindow, so make MenuBar::getMenuBarWindow public and no longer let MenuFloatingWindow be a friend of MenuBar, to make a little clearer who is able to access whose private members,... Change-Id: I7ee492e36d6e94884d1dba652d11f26cb8543a52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177692 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- include/vcl/menu.hxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index bac335d305d9..6a9e3141f219 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -420,7 +420,6 @@ class VCL_DLLPUBLIC MenuBar final : public Menu friend class Application; friend class Menu; friend class MenuBarWindow; - friend class MenuFloatingWindow; friend class SystemWindow; SAL_DLLPRIVATE static VclPtr ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu); @@ -428,9 +427,6 @@ class VCL_DLLPUBLIC MenuBar final : public Menu SAL_DLLPRIVATE bool ImplHandleKeyEvent(const KeyEvent& rKEvent); SAL_DLLPRIVATE bool ImplHandleCmdEvent(const CommandEvent& rCEvent); - /// Return the MenuBarWindow. - SAL_DLLPRIVATE MenuBarWindow* getMenuBarWindow(); - public: MenuBar(); SAL_DLLPRIVATE MenuBar( const MenuBar& rMenu ); @@ -441,6 +437,9 @@ public: virtual bool IsMenuBar() const override { return true; } + /// Return the MenuBarWindow. + SAL_DLLPRIVATE MenuBarWindow* getMenuBarWindow(); + /// Close the 'pStartedFrom' menu window. virtual void ClosePopup(Menu* pMenu) override; From ed6d0b6a2037fddcc5869c9cebf999cf4060e973 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 13:00:41 +0100 Subject: [PATCH 019/155] vcl MenuBar: Drop friend class Application Application doesn't need access to any private members. Change-Id: Ia69b64ecf8e380b0b8da7477e3a3c7d312629965 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177693 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/menu.hxx | 1 - 1 file changed, 1 deletion(-) diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 6a9e3141f219..0f6a0c414926 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -417,7 +417,6 @@ class VCL_DLLPUBLIC MenuBar final : public Menu bool mbHideBtnVisible : 1; bool mbDisplayable : 1; - friend class Application; friend class Menu; friend class MenuBarWindow; friend class SystemWindow; From d4903bb537f8645e756f8621c26685f2fddb6217 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 13:25:05 +0100 Subject: [PATCH 020/155] vcl: Merge PopupMenu::PrepareRun into PopupMenu::ImplExecute Merge PopupMenu::PrepareRun into its only caller which makes it a little easier to follow the logic and track what's assigned to what local variable than when using many out params. Change-Id: Id967040a579e3f6532afa523215049bdb68f1cd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177694 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/menu.hxx | 1 - vcl/source/window/menu.cxx | 51 ++++++++++++++++---------------------- 2 files changed, 21 insertions(+), 31 deletions(-) diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 0f6a0c414926..b60cdc42b39b 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -499,7 +499,6 @@ class VCL_DLLPUBLIC PopupMenu final : public Menu private: SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const; - SAL_DLLPRIVATE bool PrepareRun(const VclPtr& pParentWin, tools::Rectangle& rRect, FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom, bool& bRealExecute, VclPtr&); SAL_DLLPRIVATE bool Run(const VclPtr&, bool bRealExecute, bool bPreSelectFirst, FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, const tools::Rectangle& rRect); SAL_DLLPRIVATE void FinishRun(const VclPtr&, const VclPtr& pParentWin, bool bRealExecute, bool bIsNativeMenu); SAL_DLLPRIVATE sal_uInt16 ImplExecute(const VclPtr& pParentWin, const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, bool bPreSelectFirst); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 300ecf535980..63597fc9dee4 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2853,14 +2853,16 @@ void PopupMenu::ImplFlushPendingSelect() } } -bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectangle& rRect, - FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom, - bool& bRealExecute, VclPtr& pWin) +sal_uInt16 PopupMenu::ImplExecute(const VclPtr& pParentWin, const tools::Rectangle& rRect, + FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, bool bPreSelectFirst) { - bRealExecute = false; + // tdf#126054 hold this until after function completes + VclPtr xThis(this); + + bool bRealExecute = false; const sal_uInt16 nItemCount = GetItemCount(); if (!pSFrom && (vcl::IsInPopupMenuExecute() || !nItemCount)) - return false; + return 0; mpLayoutData.reset(); @@ -2887,7 +2889,8 @@ bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectang } SAL_WARN_IF(GetWindow(), "vcl", "Win?!"); - rRect.SetPos(pParentWin->OutputToScreenPixel(rRect.TopLeft())); + tools::Rectangle aRect(rRect); + aRect.SetPos(pParentWin->OutputToScreenPixel(aRect.TopLeft())); nPopupModeFlags |= FloatWinPopupFlags::NoKeyClose | FloatWinPopupFlags::AllMouseButtonClose | FloatWinPopupFlags::GrabFocus; if (bRealExecute) @@ -2901,13 +2904,13 @@ bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectang SetMenuFlags(nMenuFlagsSaved); if (pParentWin->isDisposed()) - return false; + return 0; if ( bCanceled || bKilled ) - return false; + return 0; if (!nItemCount) - return false; + return 0; // The flag MenuFlags::HideDisabledEntries is inherited. if ( pSFrom ) @@ -2934,7 +2937,7 @@ bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectang ImplCallEventListeners(VclEventId::MenuSubmenuChanged, nPos); } - pWin = VclPtrInstance(this, pParentWin, WB_BORDER | WB_SYSTEMWINDOW); + VclPtr pWin = VclPtrInstance(this, pParentWin, WB_BORDER | WB_SYSTEMWINDOW); if (comphelper::LibreOfficeKit::isActive() && get_id() == "editviewspellmenu") { VclPtr xNotifierParent = pParentWin->GetParentWithLOKNotifier(); @@ -2956,9 +2959,9 @@ bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectang vcl::Window* pDeskW = m_pWindow->GetWindow( GetWindowType::RealParent ); if( ! pDeskW ) pDeskW = m_pWindow; - AbsoluteScreenPixelPoint aDesktopTL(pDeskW->OutputToAbsoluteScreenPixel(rRect.TopLeft())); + AbsoluteScreenPixelPoint aDesktopTL(pDeskW->OutputToAbsoluteScreenPixel(aRect.TopLeft())); aDesktopRect = Application::GetScreenPosSizePixel( - Application::GetBestScreen(AbsoluteScreenPixelRectangle(aDesktopTL, rRect.GetSize()))); + Application::GetBestScreen(AbsoluteScreenPixelRectangle(aDesktopTL, aRect.GetSize()))); } tools::Long nMaxHeight = aDesktopRect.GetHeight(); @@ -2973,8 +2976,8 @@ bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectang if ( pRef->GetParent() ) pRef = pRef->GetParent(); - AbsoluteScreenPixelRectangle devRect(pRef->OutputToAbsoluteScreenPixel(rRect.TopLeft()), - pRef->OutputToAbsoluteScreenPixel(rRect.BottomRight())); + AbsoluteScreenPixelRectangle devRect(pRef->OutputToAbsoluteScreenPixel(aRect.TopLeft()), + pRef->OutputToAbsoluteScreenPixel(aRect.BottomRight())); tools::Long nHeightAbove = devRect.Top() - aDesktopRect.Top(); tools::Long nHeightBelow = aDesktopRect.Bottom() - devRect.Bottom(); @@ -3003,7 +3006,10 @@ bool PopupMenu::PrepareRun(const VclPtr& pParentWin, tools::Rectang pWin->SetFocusId( xFocusId ); pWin->SetOutputSizePixel( aSz ); - return true; + + const bool bNative = Run(pWin, bRealExecute, bPreSelectFirst, nPopupModeFlags, pSFrom, aRect); + FinishRun(pWin, pParentWin, bRealExecute, bNative); + return nSelectedId; } bool PopupMenu::Run(const VclPtr& pWin, const bool bRealExecute, const bool bPreSelectFirst, @@ -3081,21 +3087,6 @@ void PopupMenu::FinishRun(const VclPtr& pWin, const VclPtr& pParentWin, const tools::Rectangle& rRect, - FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, bool bPreSelectFirst) -{ - // tdf#126054 hold this until after function completes - VclPtr xThis(this); - bool bRealExecute = false; - tools::Rectangle aRect(rRect); - VclPtr pWin; - if (!PrepareRun(pParentWin, aRect, nPopupModeFlags, pSFrom, bRealExecute, pWin)) - return 0; - const bool bNative = Run(pWin, bRealExecute, bPreSelectFirst, nPopupModeFlags, pSFrom, aRect); - FinishRun(pWin, pParentWin, bRealExecute, bNative); - return nSelectedId; -} - sal_uInt16 PopupMenu::ImplCalcVisEntries( tools::Long nMaxHeight, sal_uInt16 nStartEntry, sal_uInt16* pLastVisible ) const { nMaxHeight -= 2 * ImplGetFloatingWindow()->GetScrollerHeight(); From 99379a3260f790d3a19662b08fd892da4f7323a3 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 13:49:55 +0100 Subject: [PATCH 021/155] vcl: Drop commented code in menu.cxx Commented out ever since commit 8ab086b6cc054501bfbf7ef6fa509c393691e860 Author: Jens-Heiner Rechtien Date: Mon Sep 18 16:07:07 2000 +0000 initial import Change-Id: I147a6f6376e624bce2164d156e9360f99ac3b1d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177695 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/source/window/menu.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 63597fc9dee4..11d38a1a3bfb 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2724,8 +2724,6 @@ int MenuBar::GetMenuBarHeight() const return nMenubarHeight; } -// bool PopupMenu::bAnyPopupInExecute = false; - MenuFloatingWindow * PopupMenu::ImplGetFloatingWindow() const { return static_cast(GetWindow()); } From 88a6a8eb9a0b30a25a6996cd8677b47a42f4822a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 14:16:19 +0100 Subject: [PATCH 022/155] vcl: Consistently use pMenuBarWindow in MenuBar::ImplCreate Use `pWindow` only to assign initial value to `pMenuBarWindow`, then consistently use only the latter instead of keeping both in sync and using interchangeably. This also prepares for changing the `pWindow` param from `vcl::Window*` to `MenuBarWindow*` in an upcoming commit without upsetting clang plugins. Change-Id: I07482e23c365ce39c4aa581fb42bf97ad03f6e1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177696 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menu.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 11d38a1a3bfb..ff6581d207a9 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2488,13 +2488,13 @@ VclPtr MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWind VclPtr pMenuBarWindow = dynamic_cast(pWindow); if (!pMenuBarWindow) { - pWindow = pMenuBarWindow = VclPtr::Create( pParent ); + pMenuBarWindow = VclPtr::Create(pParent); } pMenu->pStartedFrom = nullptr; - pMenu->m_pWindow = pWindow; + pMenu->m_pWindow = pMenuBarWindow; pMenuBarWindow->SetMenu(pMenu); - tools::Long nHeight = pWindow ? pMenu->ImplCalcSize(pWindow).Height() : 0; + tools::Long nHeight = pMenuBarWindow ? pMenu->ImplCalcSize(pMenuBarWindow).Height() : 0; // depending on the native implementation or the displayable flag // the menubar windows is suppressed (ie, height=0) @@ -2504,7 +2504,7 @@ VclPtr MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWind } pMenuBarWindow->SetHeight(nHeight); - return pWindow; + return pMenuBarWindow; } void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete ) From 185f7fa290d2d7e6f79b543acdc239323f727a5e Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 14:20:20 +0100 Subject: [PATCH 023/155] vcl: Switch MenuBar::ImplCreate param to MenuBarWindow* This avoids the need to do a dynamic_cast and makes clear that this method always gets called with either a window of a proper type or nullptr. Change-Id: I8ca4020476c806ad423379c7c7ee6fdc6ceccd3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177697 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/menu.hxx | 2 +- vcl/source/window/menu.cxx | 4 ++-- vcl/source/window/syswin.cxx | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index b60cdc42b39b..36259d5ffb7f 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -421,7 +421,7 @@ class VCL_DLLPUBLIC MenuBar final : public Menu friend class MenuBarWindow; friend class SystemWindow; - SAL_DLLPRIVATE static VclPtr ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu); + SAL_DLLPRIVATE static VclPtr ImplCreate(vcl::Window* pParent, MenuBarWindow* pWindow, MenuBar* pMenu); SAL_DLLPRIVATE static void ImplDestroy(MenuBar* pMenu, bool bDelete); SAL_DLLPRIVATE bool ImplHandleKeyEvent(const KeyEvent& rKEvent); SAL_DLLPRIVATE bool ImplHandleCmdEvent(const CommandEvent& rCEvent); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index ff6581d207a9..6bc427ba28f3 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2483,9 +2483,9 @@ void MenuBar::SetDisplayable( bool bDisplayable ) } } -VclPtr MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu) +VclPtr MenuBar::ImplCreate(vcl::Window* pParent, MenuBarWindow* pWindow, MenuBar* pMenu) { - VclPtr pMenuBarWindow = dynamic_cast(pWindow); + VclPtr pMenuBarWindow = pWindow; if (!pMenuBarWindow) { pMenuBarWindow = VclPtr::Create(pParent); diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index d4e1f9e51997..e92806e739fe 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -19,6 +19,8 @@ #include +#include "menubarwindow.hxx" + #include #include #include @@ -844,14 +846,14 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar) return; MenuBar* pOldMenuBar = mpMenuBar; - vcl::Window* pOldWindow = nullptr; - VclPtr pNewWindow; + MenuBarWindow* pOldWindow = nullptr; + VclPtr pNewWindow; mpMenuBar = pMenuBar; if ( mpWindowImpl->mpBorderWindow && (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) ) { if ( pOldMenuBar ) - pOldWindow = pOldMenuBar->GetWindow(); + pOldWindow = pOldMenuBar->getMenuBarWindow(); else pOldWindow = nullptr; if ( pOldWindow ) @@ -888,9 +890,9 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar) else { if( pMenuBar ) - pNewWindow = pMenuBar->GetWindow(); + pNewWindow = pMenuBar->getMenuBarWindow(); if( pOldMenuBar ) - pOldWindow = pOldMenuBar->GetWindow(); + pOldWindow = pOldMenuBar->getMenuBarWindow(); } // update taskpane list to make menubar accessible From 228f40c5f6c9f5c707f92bbfddb128eacdaf2a8b Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 14:25:45 +0100 Subject: [PATCH 024/155] vcl: Drop unnecessary null check pMenuBarWindow is non-null and was already dereferenced earlier anyway. Change-Id: Ieaeda4129d5c819fefa37dd3a186f76e035961b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177698 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menu.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 6bc427ba28f3..1a9bb0deff38 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2494,7 +2494,7 @@ VclPtr MenuBar::ImplCreate(vcl::Window* pParent, MenuBarWindow* p pMenu->pStartedFrom = nullptr; pMenu->m_pWindow = pMenuBarWindow; pMenuBarWindow->SetMenu(pMenu); - tools::Long nHeight = pMenuBarWindow ? pMenu->ImplCalcSize(pMenuBarWindow).Height() : 0; + tools::Long nHeight = pMenu->ImplCalcSize(pMenuBarWindow).Height(); // depending on the native implementation or the displayable flag // the menubar windows is suppressed (ie, height=0) From 6c48547069afa15b0f0dfedb5ac6b87fe54d160f Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 2 Dec 2024 14:28:47 +0100 Subject: [PATCH 025/155] vcl: Simplify MenuBar::ImplDestroy a bit MenuBar::GetWindow() and MenuBar::getMenuBarWindow return a pointer to the same object, so there's no need to use + check both for null. Change-Id: I1b7065e4cd04a24e6215118a8dc71f147ed75132 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177699 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menu.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 1a9bb0deff38..40a946bbdf8a 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2509,13 +2509,11 @@ VclPtr MenuBar::ImplCreate(vcl::Window* pParent, MenuBarWindow* p void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete ) { - vcl::Window *pWindow = pMenu->GetWindow(); - if (pWindow && bDelete) + MenuBarWindow* pMenuWin = pMenu->getMenuBarWindow(); + if (pMenuWin && bDelete) { - MenuBarWindow* pMenuWin = pMenu->getMenuBarWindow(); - if (pMenuWin) - pMenuWin->KillActivePopup(); - pWindow->disposeOnce(); + pMenuWin->KillActivePopup(); + pMenuWin->disposeOnce(); } pMenu->m_pWindow = nullptr; if (pMenu->mpSalMenu) { From 94afced0195ef824e575176e33c79ca57484cd5c Mon Sep 17 00:00:00 2001 From: Jonathan Clark Date: Mon, 2 Dec 2024 12:42:27 -0700 Subject: [PATCH 026/155] tdf#164098 sw: Fix word overflow kashida justification crash This change fixes an infinite recursion crash while updating kashida insertion positions. This crash could occur if a word is too long to fit on a page and is broken onto another line, with the best-fit valid kashida insertion position on the previous line, and the following line also containing valid kashida insertion positions. Change-Id: Ifc3320765f35ccdc49bbf179446bc03654e2596d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177709 Tested-by: Jenkins Reviewed-by: Jonathan Clark --- sw/qa/extras/layout/data/tdf164098.fodt | 116 ++++++++++++++++++++++++ sw/qa/extras/layout/layout4.cxx | 12 +++ sw/source/core/text/itradj.cxx | 9 +- 3 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/layout/data/tdf164098.fodt diff --git a/sw/qa/extras/layout/data/tdf164098.fodt b/sw/qa/extras/layout/data/tdf164098.fodt new file mode 100644 index 000000000000..2ce8c7dff3c2 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf164098.fodt @@ -0,0 +1,116 @@ + + + 2024-11-29T22:06:13.3429325682024-12-02T12:01:13.042657312PT22M9S16LibreOfficeDev/25.2.0.0.alpha1$Linux_X86_64 LibreOffice_project/654e3134adbf48c61aaa29dcd9f52ce236694535 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + متن مـــــــــتــــــــن متن + + + \ No newline at end of file diff --git a/sw/qa/extras/layout/layout4.cxx b/sw/qa/extras/layout/layout4.cxx index d1527e503961..36af7e749aae 100644 --- a/sw/qa/extras/layout/layout4.cxx +++ b/sw/qa/extras/layout/layout4.cxx @@ -1886,6 +1886,18 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf152839_firstRows) CPPUNIT_ASSERT_EQUAL(sal_Int32(223), nHeight); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf164098) +{ + createSwDoc("tdf164098.fodt"); + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + + pWrtShell->StartOfSection(false); + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect*/ false, 6, /*bBasicCall*/ false); + + // Without the fix, this line will cause a freeze: + pWrtShell->Insert(u"ـ"_ustr); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx index 893f08392ef9..05f62d9ebefa 100644 --- a/sw/source/core/text/itradj.cxx +++ b/sw/source/core/text/itradj.cxx @@ -185,7 +185,14 @@ static bool lcl_CheckKashidaPositions(SwScriptInfo& rSI, SwTextSizeInfo& rInf, S if (stKashidaPos.has_value()) { TextFrameIndex nNewKashidaPos{ aScanner.GetBegin() + stKashidaPos->nIndex }; - aNewKashidaPositions.push_back(nNewKashidaPos); + + // tdf#164098: The above algorithm can return out-of-range kashida positions. This + // can happen if, for example, a single word is split across multiple lines, and + // the best kashida candidate position is on the first line. + if (nNewKashidaPos >= nIdx && nNewKashidaPos < nEnd) + { + aNewKashidaPositions.push_back(nNewKashidaPos); + } } } } From 9a14a0fd8b4227b5d08b3154cddca46f82ec2a03 Mon Sep 17 00:00:00 2001 From: Jonathan Clark Date: Mon, 2 Dec 2024 16:03:43 -0700 Subject: [PATCH 027/155] tdf#162912 i18npool: Updated CJK BreakIterator to use custom rules Regression from commit 14c6cde779d64596eab0f4d3f32f181ce2243929: "tdf#49885 Updated CJK BreakIterator to use ICU" Previously, languages requiring dictionary-based break iterators were handled by instantiating a stock ICU break iterator as a special case. tdf#49885 upgraded our custom rules to support passthrough for dictionary-based breaking, so this special case is no longer necessary. Change-Id: Iebb06de82eb511946e5b220e5dc414440838b03c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177713 Tested-by: Jenkins Reviewed-by: Jonathan Clark --- i18npool/qa/cppunit/test_breakiterator.cxx | 249 +++++++++++++++++- .../breakiterator/breakiterator_unicode.cxx | 12 +- 2 files changed, 249 insertions(+), 12 deletions(-) diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 24666ca4ac80..80bdeb15c7be 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -49,6 +49,7 @@ public: void testHebrewGereshGershaim(); void testLegacySurrogatePairs(); void testWordCount(); + void testDictionaryIteratorLanguages(); CPPUNIT_TEST_SUITE(TestBreakIterator); CPPUNIT_TEST(testLineBreaking); @@ -70,6 +71,7 @@ public: CPPUNIT_TEST(testHebrewGereshGershaim); CPPUNIT_TEST(testLegacySurrogatePairs); CPPUNIT_TEST(testWordCount); + CPPUNIT_TEST(testDictionaryIteratorLanguages); CPPUNIT_TEST_SUITE_END(); private: @@ -1612,6 +1614,25 @@ void TestBreakIterator::doTestJapanese(uno::Reference< i18n::XBreakIterator > co CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.startPos); CPPUNIT_ASSERT_EQUAL(sal_Int32(6), aBounds.endPos); } + + { + // tdf#162912: Double-clicking should only select one Basic identifier + static constexpr OUString aTest = u"ThisComponent.CurrentSelection"_ustr; + + aBounds = xBreak->getWordBoundary(aTest, 5, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(30), aBounds.endPos); + + aBounds = xBreak->getWordBoundary(aTest, 5, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(13), aBounds.endPos); + + aBounds = xBreak->getWordBoundary(aTest, 15, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(14), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(30), aBounds.endPos); + } } void TestBreakIterator::testJapanese() @@ -1914,7 +1935,7 @@ void TestBreakIterator::testWordCount() const OUString aStr = u"Wordの様にワード数をするのにTest\n植松町"_ustr; - CPPUNIT_ASSERT_EQUAL(7, fnCountWords(aStr, aLocale)); + CPPUNIT_ASSERT_EQUAL(8, fnCountWords(aStr, aLocale)); } // tdf#150621 Korean words should be counted individually, rather than by syllable. @@ -1941,6 +1962,232 @@ void TestBreakIterator::testWordCount() } } +void TestBreakIterator::testDictionaryIteratorLanguages() +{ + // Thai + { + lang::Locale aLocale{ "th", "TH", "" }; + + const OUString aStr = u"รอนานหรือเปล่า"_ustr; + + i18n::Boundary aBounds; + + aBounds + = m_xBreak->getWordBoundary(aStr, 1, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 3, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 6, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 10, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(14), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 1, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 3, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 6, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 10, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(14), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 1, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 3, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 6, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 10, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(14), aBounds.endPos); + } + + // Japanese + { + lang::Locale aLocale{ "ja", "JP", "" }; + + const OUString aStr = u"通産省工業技術院北海道"_ustr; + + i18n::Boundary aBounds; + + aBounds + = m_xBreak->getWordBoundary(aStr, 1, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 2, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 4, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 6, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 7, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 9, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 1, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 2, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 4, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 6, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 7, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 9, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 1, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 2, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 4, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 6, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 7, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(7), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 9, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(8), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aBounds.endPos); + } + + // Chinese + { + lang::Locale aLocale{ "zh", "CN", "" }; + + const OUString aStr = u"很高兴认识你"_ustr; + + i18n::Boundary aBounds; + + aBounds + = m_xBreak->getWordBoundary(aStr, 0, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 1, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 3, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); + + aBounds + = m_xBreak->getWordBoundary(aStr, 5, aLocale, i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(6), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 0, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 1, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 3, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 5, aLocale, i18n::WordType::ANY_WORD, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(6), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 0, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 1, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 3, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); + + aBounds = m_xBreak->getWordBoundary(aStr, 5, aLocale, + i18n::WordType::ANYWORD_IGNOREWHITESPACES, true); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); + CPPUNIT_ASSERT_EQUAL(sal_Int32(6), aBounds.endPos); + } +} + void TestBreakIterator::setUp() { BootstrapFixtureBase::setUp(); diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 5992b6144b0b..4e5df75d2701 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -74,16 +74,6 @@ class OOoRuleBasedBreakIterator : public icu::RuleBasedBreakIterator }; -bool locale_requires_dictionary_iterator(const css::lang::Locale& rLocale) -{ - return rLocale.Language == "bo" || // Tibetan - rLocale.Language == "dz" || // Dzongkha - rLocale.Language == "ja" || // Japanese - rLocale.Language == "km" || // Khmer - rLocale.Language == "lo" || // Lao - rLocale.Language == "th" || // Thai - rLocale.Language == "zh"; // Chinese -} } // loading ICU breakiterator on demand. @@ -189,7 +179,7 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal rbi.reset(); } } - else if(!locale_requires_dictionary_iterator(rLocale)) + else { // language;rule (not langtag, unless we'd actually load such) OString aLanguage( LanguageTag( rLocale).getLanguage().toUtf8()); From c480e9ffb7092dd006e7ac61a46a11765251338a Mon Sep 17 00:00:00 2001 From: Mohamed Ali Date: Mon, 2 Dec 2024 22:35:12 +0200 Subject: [PATCH 028/155] tdf#130924 use SAL_WARN instead of fprintf Change-Id: Iefac2a4e58248c9fcead2bcf97817488097fb20d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177711 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas --- extensions/source/scanner/sane.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index 731355e59db4..e1fde5e5213c 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -110,8 +110,7 @@ inline oslGenericFunction Sane::LoadSymbol( const char* pSymbolname ) oslGenericFunction pFunction = osl_getAsciiFunctionSymbol( pSaneLib, pSymbolname ); if( ! pFunction ) { - fprintf( stderr, "Could not load symbol %s\n", - pSymbolname ); + SAL_WARN( "extensions.scanner", "Could not load symbol " << pSymbolname ); bSaneSymbolLoadFailed = true; } return pFunction; @@ -269,11 +268,11 @@ void Sane::ReloadOptions() SANE_Status nStatus = p_control_option( maHandle, 0, SANE_ACTION_GET_VALUE, static_cast(pOptions), nullptr ); if( nStatus != SANE_STATUS_GOOD ) - fprintf( stderr, "Error: sane driver returned %s while reading number of options !\n", p_strstatus( nStatus ) ); + SAL_WARN( "extensions.scanner", "Error: sane driver returned " << p_strstatus( nStatus ) << " while reading number of options !" ); mnOptions = pOptions[ 0 ]; if( o3tl::make_unsigned(pZero->size) > sizeof( SANE_Word ) ) - fprintf( stderr, "driver returned number of options with larger size than SANE_Word!!!\n" ); + SAL_WARN( "extensions.scanner", "driver returned number of options with larger size than SANE_Word!!!" ); mppOptions.reset(new const SANE_Option_Descriptor*[ mnOptions ]); mppOptions[ 0 ] = pZero; for( int i = 1; i < mnOptions; i++ ) @@ -668,7 +667,7 @@ bool Sane::Start( BitmapTransporter& rBitmap ) eType = FrameStyle_Separated; break; default: - fprintf( stderr, "Warning: unknown frame style !!!\n" ); + SAL_WARN( "extensions.scanner", "Unknown frame style" ); } bool bSynchronousRead = true; @@ -717,7 +716,7 @@ bool Sane::Start( BitmapTransporter& rBitmap ) tv.tv_sec = 5; tv.tv_usec = 0; if( select( fd+1, &fdset, nullptr, nullptr, &tv ) == 0 ) - fprintf( stderr, "Timeout on sane_read descriptor\n" ); + SAL_WARN( "extensions.scanner", "Timeout on sane_read descriptor" ); } nLen = 0; nStatus = p_read( maHandle, pBuffer.get(), BYTE_BUFFER_SIZE, &nLen ); From a6690210229572ff1f0be611997cd44f7ff35992 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Fri, 29 Nov 2024 17:28:33 +0100 Subject: [PATCH 029/155] tdf#163902 sc: fix the size of available fields box of pivot dialog Similarly to Filters, Column Fields, Row Fields, Data Fields boxes the Available Fields box should be enabled to expand horizontally. Change-Id: I36a6322ef528a18e2c37eb8f3397cf1aeeedc759 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177680 Tested-by: Jenkins Reviewed-by: Balazs Varga --- sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui index 293500c868aa..0340ffea71be 100644 --- a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui +++ b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui @@ -1,5 +1,5 @@ - + @@ -504,6 +504,7 @@ True False + True True vertical 6 From 890c03d39059685735f5ada62e706204eab81f0d Mon Sep 17 00:00:00 2001 From: Christopher Sherlock Date: Wed, 13 Nov 2024 23:40:10 +1100 Subject: [PATCH 030/155] vcl: flatten functions in bitmapex.cxx Change-Id: I82c470705add539fa425b084805a5da12eefa0ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176535 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/outdev/bitmapex.cxx | 195 +++++++++++++++++---------------- 1 file changed, 99 insertions(+), 96 deletions(-) diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx index 45408ac5cba6..3024b7ba86ed 100644 --- a/vcl/source/outdev/bitmapex.cxx +++ b/vcl/source/outdev/bitmapex.cxx @@ -40,13 +40,13 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, if( !rBitmapEx.IsAlpha() ) { - DrawBitmap( rDestPt, rBitmapEx.GetBitmap() ); - } - else - { - const Size aSizePix( rBitmapEx.GetSizePixel() ); - DrawBitmapEx( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmapEx, MetaActionType::BMPEX ); + DrawBitmap(rDestPt, rBitmapEx.GetBitmap()); + return; } + + const Size& rSizePx = rBitmapEx.GetSizePixel(); + DrawBitmapEx(rDestPt, PixelToLogic(rSizePx), Point(), rSizePx, rBitmapEx, + MetaActionType::BMPEX); } void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, @@ -59,12 +59,12 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, if ( !rBitmapEx.IsAlpha() ) { - DrawBitmap( rDestPt, rDestSize, rBitmapEx.GetBitmap() ); - } - else - { - DrawBitmapEx( rDestPt, rDestSize, Point(), rBitmapEx.GetSizePixel(), rBitmapEx, MetaActionType::BMPEXSCALE ); + DrawBitmap(rDestPt, rDestSize, rBitmapEx.GetBitmap()); + return; } + + DrawBitmapEx(rDestPt, rDestSize, Point(), rBitmapEx.GetSizePixel(), + rBitmapEx, MetaActionType::BMPEXSCALE); } void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, @@ -78,12 +78,13 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, if ( !rBitmapEx.IsAlpha() ) { - DrawBitmap( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, rBitmapEx.GetBitmap() ); - } - else - { - DrawBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, rBitmapEx, MetaActionType::BMPEXSCALEPART ); + DrawBitmap(rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, + rBitmapEx.GetBitmap()); + return; } + + DrawBitmapEx(rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, rBitmapEx, + MetaActionType::BMPEXSCALEPART); } void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, @@ -97,71 +98,68 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, if( !rBitmapEx.IsAlpha() ) { - DrawBitmap( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, rBitmapEx.GetBitmap() ); + DrawBitmap(rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, + rBitmapEx.GetBitmap()); + return; } - else + + if (RasterOp::Invert == meRasterOp) { - if ( RasterOp::Invert == meRasterOp ) - { - DrawRect( tools::Rectangle( rDestPt, rDestSize ) ); - return; - } - - BitmapEx aBmpEx(vcl::drawmode::GetBitmapEx(rBitmapEx, GetDrawMode())); - - if ( mpMetaFile ) - { - switch( nAction ) - { - case MetaActionType::BMPEX: - mpMetaFile->AddAction( new MetaBmpExAction( rDestPt, aBmpEx ) ); - break; - - case MetaActionType::BMPEXSCALE: - mpMetaFile->AddAction( new MetaBmpExScaleAction( rDestPt, rDestSize, aBmpEx ) ); - break; - - case MetaActionType::BMPEXSCALEPART: - mpMetaFile->AddAction( new MetaBmpExScalePartAction( rDestPt, rDestSize, - rSrcPtPixel, rSrcSizePixel, aBmpEx ) ); - break; - - default: break; - } - } - - if ( !IsDeviceOutputNecessary() ) - return; - - if ( !mpGraphics && !AcquireGraphics() ) - return; - - if ( mbInitClipRegion ) - InitClipRegion(); - - if ( mbOutputClipped ) - return; - - DrawDeviceBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, aBmpEx ); + DrawRect(tools::Rectangle(rDestPt, rDestSize)); + return; } + + BitmapEx aBmpEx(vcl::drawmode::GetBitmapEx(rBitmapEx, GetDrawMode())); + + if (mpMetaFile) + { + switch(nAction) + { + case MetaActionType::BMPEX: + mpMetaFile->AddAction(new MetaBmpExAction(rDestPt, aBmpEx)); + break; + + case MetaActionType::BMPEXSCALE: + mpMetaFile->AddAction(new MetaBmpExScaleAction(rDestPt, rDestSize, aBmpEx)); + break; + + case MetaActionType::BMPEXSCALEPART: + mpMetaFile->AddAction(new MetaBmpExScalePartAction(rDestPt, rDestSize, + rSrcPtPixel, rSrcSizePixel, aBmpEx)); + break; + + default: + break; + } + } + + if (!IsDeviceOutputNecessary()) + return; + + if (!mpGraphics && !AcquireGraphics()) + return; + + if (mbInitClipRegion) + InitClipRegion(); + + if (mbOutputClipped) + return; + + DrawDeviceBitmapEx(rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, aBmpEx); } BitmapEx OutputDevice::GetBitmapEx( const Point& rSrcPt, const Size& rSize ) const { + if (!mpAlphaVDev) + return BitmapEx(GetBitmap(rSrcPt, rSize)); // #110958# Extract alpha value from VDev, if any - if( mpAlphaVDev ) - { - Bitmap aAlphaBitmap( mpAlphaVDev->GetBitmap( rSrcPt, rSize ) ); + Bitmap aAlphaBitmap(mpAlphaVDev->GetBitmap(rSrcPt, rSize)); - // ensure 8 bit alpha - if (aAlphaBitmap.getPixelFormat() > vcl::PixelFormat::N8_BPP) - aAlphaBitmap.Convert( BmpConversion::N8BitNoConversion ); + if (aAlphaBitmap.getPixelFormat() > vcl::PixelFormat::N8_BPP) + aAlphaBitmap.Convert(BmpConversion::N8BitNoConversion); - return BitmapEx(GetBitmap( rSrcPt, rSize ), AlphaMask( aAlphaBitmap ) ); - } - - return BitmapEx(GetBitmap( rSrcPt, rSize )); + return BitmapEx(GetBitmap(rSrcPt, rSize), AlphaMask(aAlphaBitmap)); } void OutputDevice::DrawDeviceBitmapEx( const Point& rDestPt, const Size& rDestSize, @@ -172,34 +170,39 @@ void OutputDevice::DrawDeviceBitmapEx( const Point& rDestPt, const Size& rDestSi if (rBitmapEx.IsAlpha()) { - DrawDeviceAlphaBitmap(rBitmapEx.GetBitmap(), rBitmapEx.GetAlphaMask(), rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel); + DrawDeviceAlphaBitmap(rBitmapEx.GetBitmap(), rBitmapEx.GetAlphaMask(), + rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel); + return; } - else if (!rBitmapEx.IsEmpty()) + + if (rBitmapEx.IsEmpty()) + return; + + SalTwoRect aPosAry(rSrcPtPixel.X(), rSrcPtPixel.Y(), rSrcSizePixel.Width(), + rSrcSizePixel.Height(), ImplLogicXToDevicePixel(rDestPt.X()), + ImplLogicYToDevicePixel(rDestPt.Y()), + ImplLogicWidthToDevicePixel(rDestSize.Width()), + ImplLogicHeightToDevicePixel(rDestSize.Height())); + + const BmpMirrorFlags nMirrFlags = AdjustTwoRect(aPosAry, rBitmapEx.GetSizePixel()); + + if (!(aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight)) + return; + + if (nMirrFlags != BmpMirrorFlags::NONE) + rBitmapEx.Mirror(nMirrFlags); + + const SalBitmap* pSalSrcBmp = rBitmapEx.ImplGetBitmapSalBitmap().get(); + + assert(!rBitmapEx.maAlphaMask.GetBitmap().ImplGetSalBitmap() + && "I removed some code here that will need to be restored"); + + mpGraphics->DrawBitmap(aPosAry, *pSalSrcBmp, *this); + + if (mpAlphaVDev) { - SalTwoRect aPosAry(rSrcPtPixel.X(), rSrcPtPixel.Y(), rSrcSizePixel.Width(), rSrcSizePixel.Height(), - ImplLogicXToDevicePixel(rDestPt.X()), ImplLogicYToDevicePixel(rDestPt.Y()), - ImplLogicWidthToDevicePixel(rDestSize.Width()), - ImplLogicHeightToDevicePixel(rDestSize.Height())); - - const BmpMirrorFlags nMirrFlags = AdjustTwoRect(aPosAry, rBitmapEx.GetSizePixel()); - - if (aPosAry.mnSrcWidth && aPosAry.mnSrcHeight && aPosAry.mnDestWidth && aPosAry.mnDestHeight) - { - - if (nMirrFlags != BmpMirrorFlags::NONE) - rBitmapEx.Mirror(nMirrFlags); - - const SalBitmap* pSalSrcBmp = rBitmapEx.ImplGetBitmapSalBitmap().get(); - assert(!rBitmapEx.maAlphaMask.GetBitmap().ImplGetSalBitmap() && "I removed some code here that will need to be restored"); - - mpGraphics->DrawBitmap(aPosAry, *pSalSrcBmp, *this); - - if (mpAlphaVDev) - { - // #i32109#: Make bitmap area opaque - mpAlphaVDev->ImplFillOpaqueRectangle( tools::Rectangle(rDestPt, rDestSize) ); - } - } + // #i32109#: Make bitmap area opaque + mpAlphaVDev->ImplFillOpaqueRectangle(tools::Rectangle(rDestPt, rDestSize)); } } From 15f4b64379e53170f20c146a30ac99228c560f48 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 3 Dec 2024 10:49:17 +0500 Subject: [PATCH 031/155] Simplify ImplStyleData Change-Id: I4b6bb9e3250a0f88f4fb99f3c9c8195c3c7a8f15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177714 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- vcl/inc/IconThemeScanner.hxx | 18 +- vcl/inc/IconThemeSelector.hxx | 5 +- vcl/source/app/IconThemeScanner.cxx | 13 +- vcl/source/app/IconThemeSelector.cxx | 24 - vcl/source/app/settings.cxx | 936 +++++++++++---------------- 5 files changed, 377 insertions(+), 619 deletions(-) diff --git a/vcl/inc/IconThemeScanner.hxx b/vcl/inc/IconThemeScanner.hxx index e95adf417fdd..60841eeddaab 100644 --- a/vcl/inc/IconThemeScanner.hxx +++ b/vcl/inc/IconThemeScanner.hxx @@ -27,10 +27,13 @@ namespace vcl class VCL_DLLPUBLIC IconThemeScanner { public: - /** Factory method to create the object. - * Provide a path to search for IconThemes. + /** Provide a semicolon-separated list of paths to search for IconThemes. + * + * There are several cases when scan will fail: + * - The directory does not exist + * - There are no files which match the pattern images_xxx.zip */ - static std::shared_ptr Create(std::u16string_view path); + explicit IconThemeScanner(std::u16string_view paths); /** This method will return the standard path where icon themes are located. */ @@ -52,15 +55,6 @@ public: private: IconThemeScanner(); - /** Scan a directory for icon themes. - * - * @return - * There are several cases when this method will fail: - * - The directory does not exist - * - There are no files which match the pattern images_xxx.zip - */ - void ScanDirectoryForIconThemes(std::u16string_view path); - /** Adds the provided icon theme by path. */ bool AddIconThemeByPath(const OUString& path); diff --git a/vcl/inc/IconThemeSelector.hxx b/vcl/inc/IconThemeSelector.hxx index 9f2fbb0c3dce..3f25beba27a2 100644 --- a/vcl/inc/IconThemeSelector.hxx +++ b/vcl/inc/IconThemeSelector.hxx @@ -66,10 +66,7 @@ public: SetPreferredIconTheme(const OUString&, bool bDarkIconTheme); bool - operator==(const vcl::IconThemeSelector&) const; - - bool - operator!=(const vcl::IconThemeSelector&) const; + operator==(const vcl::IconThemeSelector&) const = default; static OUString GetIconThemeForDesktopEnvironment(const OUString& desktopEnvironment, bool bPreferDarkIconTheme); diff --git a/vcl/source/app/IconThemeScanner.cxx b/vcl/source/app/IconThemeScanner.cxx index c8f6a1ac7e8d..9cc5fc83d54d 100644 --- a/vcl/source/app/IconThemeScanner.cxx +++ b/vcl/source/app/IconThemeScanner.cxx @@ -57,10 +57,9 @@ OUString convert_to_absolute_path(const OUString& path) } -IconThemeScanner::IconThemeScanner() -{} +IconThemeScanner::IconThemeScanner() = default; -void IconThemeScanner::ScanDirectoryForIconThemes(std::u16string_view paths) +IconThemeScanner::IconThemeScanner(std::u16string_view paths) { mFoundIconThemes.clear(); @@ -168,14 +167,6 @@ IconThemeScanner::IconThemeIsInstalled(const OUString& themeId) const return IconThemeInfo::IconThemeIsInVector(mFoundIconThemes, themeId); } -/*static*/ std::shared_ptr -IconThemeScanner::Create(std::u16string_view path) -{ - std::shared_ptr retval(new IconThemeScanner); - retval->ScanDirectoryForIconThemes(path); - return retval; -} - /*static*/ OUString IconThemeScanner::GetStandardIconThemePath() { diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx index eeea0227e603..7c621aa930a5 100644 --- a/vcl/source/app/IconThemeSelector.cxx +++ b/vcl/source/app/IconThemeSelector.cxx @@ -163,30 +163,6 @@ IconThemeSelector::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTh return bChanged; } -bool -IconThemeSelector::operator==(const vcl::IconThemeSelector& other) const -{ - if (this == &other) { - return true; - } - if (mPreferredIconTheme != other.mPreferredIconTheme) { - return false; - } - if (mPreferDarkIconTheme != other.mPreferDarkIconTheme) { - return false; - } - if (mUseHighContrastTheme != other.mUseHighContrastTheme) { - return false; - } - return true; -} - -bool -IconThemeSelector::operator!=(const vcl::IconThemeSelector& other) const -{ - return !(*this == other); -} - /*static*/ OUString IconThemeSelector::ReturnFallback(const std::vector& installedThemes) { diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index ad15bd3e68a3..cacb278077ae 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -72,13 +72,23 @@ struct ImplMouseData MouseWheelBehaviour mnWheelBehavior = MouseWheelBehaviour::FocusOnly; }; -struct ImplStyleData +namespace { - ImplStyleData(); - ImplStyleData( const ImplStyleData& rData ); +constexpr Size getInitListBoxPreviewDefaultLogicSize() +{ +#ifdef IOS + return Size(30, 30); +#else + return Size(15, 7); +#endif +} - void SetStandardStyles(); +// Structures simplifying comparison in StyleSettings::operator ==, where for some reason +// not all members of ImplStyleData are compared. Adding elements here would automatically +// participate in the default comparison methods. +struct ColorSet +{ Color maActiveBorderColor; Color maActiveColor; Color maActiveTextColor; @@ -151,6 +161,12 @@ struct ImplStyleData Color maTabTextColor; Color maTabRolloverTextColor; Color maTabHighlightTextColor; + + bool operator==(const ColorSet&) const = default; +}; + +struct FontSet +{ vcl::Font maAppFont; vcl::Font maHelpFont; vcl::Font maTitleFont; @@ -164,55 +180,73 @@ struct ImplStyleData vcl::Font maIconFont; vcl::Font maTabFont; vcl::Font maGroupFont; + + bool operator==(const FontSet&) const = default; +}; +} + +struct ImplStyleData +{ + ImplStyleData(); + + void SetStandardStyles(); + + ColorSet maColors; + FontSet maFonts; sal_Int32 mnTitleHeight; sal_Int32 mnFloatTitleHeight; - sal_Int32 mnScrollBarSize; - sal_Int32 mnSpinSize; - sal_Int32 mnCursorSize; - sal_Int32 mnAntialiasedMin; - sal_uInt64 mnCursorBlinkTime; - DragFullOptions mnDragFullOptions; - SelectionOptions mnSelectionOptions; - DisplayOptions mnDisplayOptions; - ToolbarIconSize mnToolbarIconSize; - bool mnUseFlatMenus; - StyleSettingsOptions mnOptions; - bool mbHighContrast; - bool mbUseSystemUIFonts; + sal_Int32 mnScrollBarSize = 16; + sal_Int32 mnSpinSize = 16; + sal_Int32 mnCursorSize = 2; + sal_Int32 mnAntialiasedMin = 0; + sal_uInt64 mnCursorBlinkTime = STYLE_CURSOR_NOBLINKTIME; + DragFullOptions mnDragFullOptions = DragFullOptions::All; + SelectionOptions mnSelectionOptions = SelectionOptions::NONE; + DisplayOptions mnDisplayOptions = DisplayOptions::NONE; + ToolbarIconSize mnToolbarIconSize = ToolbarIconSize::Unknown; + StyleSettingsOptions mnOptions = StyleSettingsOptions::NONE; + TriState meUseImagesInMenus = TRISTATE_INDET; + std::optional + mIconThemeScanner; + vcl::IconThemeSelector mIconThemeSelector; + + OUString mIconTheme; + sal_Int32 mnMinThumbSize = 16; + TriState meContextMenuShortcuts = TRISTATE_INDET; + DialogStyle maDialogStyle; + + bool mnUseFlatMenus : 1; + bool mbHighContrast : 1; + bool mbUseSystemUIFonts : 1; /** * Disabling AA doesn't actually disable AA of fonts, instead it is taken * from system settings. */ - bool mbUseFontAAFromSystem; - bool mbAutoMnemonic; - TriState meUseImagesInMenus; - bool mnUseFlatBorders; - bool mbPreferredUseImagesInMenus; - sal_Int32 mnMinThumbSize; - std::shared_ptr - mIconThemeScanner; - std::shared_ptr - mIconThemeSelector; - - OUString mIconTheme; - bool mbSkipDisabledInMenus; - bool mbHideDisabledMenuItems; - bool mbPreferredContextMenuShortcuts; - TriState meContextMenuShortcuts; + bool mbUseFontAAFromSystem : 1; + bool mbAutoMnemonic : 1 = true; + bool mnUseFlatBorders : 1; + bool mbPreferredUseImagesInMenus : 1; + bool mbSkipDisabledInMenus : 1; + bool mbHideDisabledMenuItems : 1; + bool mbPreferredContextMenuShortcuts : 1; //mbPrimaryButtonWarpsSlider == true for "jump to here" behavior for primary button, otherwise //primary means scroll by single page. Secondary button takes the alternative behaviour - bool mbPrimaryButtonWarpsSlider; - DialogStyle maDialogStyle; + bool mbPrimaryButtonWarpsSlider : 1; + bool mbPreviewUsesCheckeredBackground : 1 = true; - sal_uInt16 mnEdgeBlending; - Color maEdgeBlendingTopLeftColor; - Color maEdgeBlendingBottomRightColor; - sal_uInt16 mnListBoxMaximumLineCount; - sal_uInt16 mnColorValueSetColumnCount; - Size maListBoxPreviewDefaultLogicSize; + sal_uInt16 mnEdgeBlending = 35; + Color maEdgeBlendingTopLeftColor = Color(0xC0, 0xC0, 0xC0); + Color maEdgeBlendingBottomRightColor = Color(0x40, 0x40, 0x40); + sal_uInt16 mnListBoxMaximumLineCount = 25; + + // For some reason this isn't actually the column count that gets used, at least on iOS, but + // instead what SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() in + // svtools/source/config/accessibilityoptions.cxx returns. + sal_uInt16 mnColorValueSetColumnCount = 12; + ComboBoxTextSelectionMode meComboBoxTextSelectionMode = ComboBoxTextSelectionMode::SelectText; + Size maListBoxPreviewDefaultLogicSize = getInitListBoxPreviewDefaultLogicSize(); + // on-demand calculated in GetListBoxPreviewDefaultPixelSize() Size maListBoxPreviewDefaultPixelSize; - ComboBoxTextSelectionMode meComboBoxTextSelectionMode; - bool mbPreviewUsesCheckeredBackground; OUString maPersonaHeaderFooter; ///< Cache the settings to detect changes. @@ -471,175 +505,11 @@ bool MouseSettings::operator ==( const MouseSettings& rSet ) const (mxData->mnWheelBehavior == rSet.mxData->mnWheelBehavior ); } -ImplStyleData::ImplStyleData() : - mnScrollBarSize(16), - mnSpinSize(16), - mnCursorSize(2), - mnAntialiasedMin(0), - mnCursorBlinkTime(STYLE_CURSOR_NOBLINKTIME), - mnDragFullOptions(DragFullOptions::All), - mnSelectionOptions(SelectionOptions::NONE), - mnDisplayOptions(DisplayOptions::NONE), - mnToolbarIconSize(ToolbarIconSize::Unknown), - mnOptions(StyleSettingsOptions::NONE), - mbAutoMnemonic(true), - meUseImagesInMenus(TRISTATE_INDET), - mnMinThumbSize(16), - mIconThemeSelector(std::make_shared()), - meContextMenuShortcuts(TRISTATE_INDET), - mnEdgeBlending(35), - maEdgeBlendingTopLeftColor(Color(0xC0, 0xC0, 0xC0)), - maEdgeBlendingBottomRightColor(Color(0x40, 0x40, 0x40)), - mnListBoxMaximumLineCount(25), - // For some reason this isn't actually the column count that gets used, at least on iOS, but - // instead what SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() in - // svtools/source/config/accessibilityoptions.cxx returns. - mnColorValueSetColumnCount(12), -#ifdef IOS - maListBoxPreviewDefaultLogicSize(Size(30, 30)), -#else - maListBoxPreviewDefaultLogicSize(Size(15, 7)), -#endif - maListBoxPreviewDefaultPixelSize(Size(0, 0)), // on-demand calculated in GetListBoxPreviewDefaultPixelSize(), - meComboBoxTextSelectionMode(ComboBoxTextSelectionMode::SelectText), - mbPreviewUsesCheckeredBackground(true) +ImplStyleData::ImplStyleData() { SetStandardStyles(); } -ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : - maActiveBorderColor( rData.maActiveBorderColor ), - maActiveColor( rData.maActiveColor ), - maActiveTextColor( rData.maActiveTextColor ), - maAlternatingRowColor( rData.maAlternatingRowColor ), - maDefaultButtonTextColor( rData.maDefaultButtonTextColor ), - maButtonTextColor( rData.maButtonTextColor ), - maDefaultActionButtonTextColor( rData.maDefaultActionButtonTextColor ), - maActionButtonTextColor( rData.maActionButtonTextColor ), - maFlatButtonTextColor( rData.maFlatButtonTextColor ), - maDefaultButtonRolloverTextColor( rData.maDefaultButtonRolloverTextColor ), - maButtonRolloverTextColor( rData.maButtonRolloverTextColor ), - maDefaultActionButtonRolloverTextColor( rData.maDefaultActionButtonRolloverTextColor ), - maActionButtonRolloverTextColor( rData.maActionButtonRolloverTextColor ), - maFlatButtonRolloverTextColor( rData.maFlatButtonRolloverTextColor ), - maDefaultButtonPressedRolloverTextColor( rData.maDefaultButtonPressedRolloverTextColor ), - maButtonPressedRolloverTextColor( rData.maButtonPressedRolloverTextColor ), - maDefaultActionButtonPressedRolloverTextColor( rData.maDefaultActionButtonPressedRolloverTextColor ), - maActionButtonPressedRolloverTextColor( rData.maActionButtonPressedRolloverTextColor ), - maFlatButtonPressedRolloverTextColor( rData.maFlatButtonPressedRolloverTextColor ), - maCheckedColor( rData.maCheckedColor ), - maDarkShadowColor( rData.maDarkShadowColor ), - maDeactiveBorderColor( rData.maDeactiveBorderColor ), - maDeactiveColor( rData.maDeactiveColor ), - maDeactiveTextColor( rData.maDeactiveTextColor ), - maDialogColor( rData.maDialogColor ), - maDialogTextColor( rData.maDialogTextColor ), - maDisableColor( rData.maDisableColor ), - maFaceColor( rData.maFaceColor ), - maFieldColor( rData.maFieldColor ), - maFieldTextColor( rData.maFieldTextColor ), - maFieldRolloverTextColor( rData.maFieldRolloverTextColor ), - maGroupTextColor( rData.maGroupTextColor ), - maHelpColor( rData.maHelpColor ), - maHelpTextColor( rData.maHelpTextColor ), - maAccentColor( rData.maAccentColor ), - maHighlightColor( rData.maHighlightColor ), - maHighlightTextColor( rData.maHighlightTextColor ), - maLabelTextColor( rData.maLabelTextColor ), - maLightBorderColor( rData.maLightBorderColor ), - maLightColor( rData.maLightColor ), - maLinkColor( rData.maLinkColor ), - maMenuBarColor( rData.maMenuBarColor ), - maMenuBarRolloverColor( rData.maMenuBarRolloverColor ), - maMenuBorderColor( rData.maMenuBorderColor ), - maMenuColor( rData.maMenuColor ), - maMenuHighlightColor( rData.maMenuHighlightColor ), - maMenuHighlightTextColor( rData.maMenuHighlightTextColor ), - maMenuTextColor( rData.maMenuTextColor ), - maListBoxWindowBackgroundColor( rData.maListBoxWindowBackgroundColor ), - maListBoxWindowTextColor( rData.maListBoxWindowTextColor ), - maListBoxWindowHighlightColor( rData.maListBoxWindowHighlightColor ), - maListBoxWindowHighlightTextColor( rData.maListBoxWindowHighlightTextColor ), - maMenuBarTextColor( rData.maMenuBarTextColor ), - maMenuBarRolloverTextColor( rData.maMenuBarRolloverTextColor ), - maMenuBarHighlightTextColor( rData.maMenuBarHighlightTextColor ), - maMonoColor( rData.maMonoColor ), - maRadioCheckTextColor( rData.maRadioCheckTextColor ), - maShadowColor( rData.maShadowColor ), - maWarningColor( rData.maWarningColor ), - maWarningTextColor( rData.maWarningTextColor ), - maErrorColor( rData.maErrorColor ), - maErrorTextColor( rData.maErrorTextColor ), - maVisitedLinkColor( rData.maVisitedLinkColor ), - maToolTextColor( rData.maToolTextColor ), - maWindowColor( rData.maWindowColor ), - maWindowTextColor( rData.maWindowTextColor ), - maWorkspaceColor( rData.maWorkspaceColor ), - maActiveTabColor( rData.maActiveTabColor ), - maInactiveTabColor( rData.maInactiveTabColor ), - maTabTextColor( rData.maTabTextColor ), - maTabRolloverTextColor( rData.maTabRolloverTextColor ), - maTabHighlightTextColor( rData.maTabHighlightTextColor ), - maAppFont( rData.maAppFont ), - maHelpFont( rData.maAppFont ), - maTitleFont( rData.maTitleFont ), - maFloatTitleFont( rData.maFloatTitleFont ), - maMenuFont( rData.maMenuFont ), - maToolFont( rData.maToolFont ), - maLabelFont( rData.maLabelFont ), - maRadioCheckFont( rData.maRadioCheckFont ), - maPushButtonFont( rData.maPushButtonFont ), - maFieldFont( rData.maFieldFont ), - maIconFont( rData.maIconFont ), - maTabFont( rData.maTabFont ), - maGroupFont( rData.maGroupFont ), - mnTitleHeight(rData.mnTitleHeight), - mnFloatTitleHeight(rData.mnFloatTitleHeight), - mnScrollBarSize(rData.mnScrollBarSize), - mnSpinSize(rData.mnSpinSize), - mnCursorSize(rData.mnCursorSize), - mnAntialiasedMin(rData.mnAntialiasedMin), - mnCursorBlinkTime(rData.mnCursorBlinkTime), - mnDragFullOptions(rData.mnDragFullOptions), - mnSelectionOptions(rData.mnSelectionOptions), - mnDisplayOptions(rData.mnDisplayOptions), - mnToolbarIconSize(rData.mnToolbarIconSize), - mnUseFlatMenus(rData.mnUseFlatMenus), - mnOptions(rData.mnOptions), - mbHighContrast(rData.mbHighContrast), - mbUseSystemUIFonts(rData.mbUseSystemUIFonts), - mbUseFontAAFromSystem(rData.mbUseFontAAFromSystem), - mbAutoMnemonic(rData.mbAutoMnemonic), - meUseImagesInMenus(rData.meUseImagesInMenus), - mnUseFlatBorders(rData.mnUseFlatBorders), - mbPreferredUseImagesInMenus(rData.mbPreferredUseImagesInMenus), - mnMinThumbSize(rData.mnMinThumbSize), - mIconThemeSelector(std::make_shared(*rData.mIconThemeSelector)), - mIconTheme(rData.mIconTheme), - mbSkipDisabledInMenus(rData.mbSkipDisabledInMenus), - mbHideDisabledMenuItems(rData.mbHideDisabledMenuItems), - mbPreferredContextMenuShortcuts(rData.mbPreferredContextMenuShortcuts), - meContextMenuShortcuts(rData.meContextMenuShortcuts), - mbPrimaryButtonWarpsSlider(rData.mbPrimaryButtonWarpsSlider), - maDialogStyle( rData.maDialogStyle ), - mnEdgeBlending(rData.mnEdgeBlending), - maEdgeBlendingTopLeftColor(rData.maEdgeBlendingTopLeftColor), - maEdgeBlendingBottomRightColor(rData.maEdgeBlendingBottomRightColor), - mnListBoxMaximumLineCount(rData.mnListBoxMaximumLineCount), - mnColorValueSetColumnCount(rData.mnColorValueSetColumnCount), - maListBoxPreviewDefaultLogicSize(rData.maListBoxPreviewDefaultLogicSize), - maListBoxPreviewDefaultPixelSize(rData.maListBoxPreviewDefaultPixelSize), - meComboBoxTextSelectionMode(rData.meComboBoxTextSelectionMode), - mbPreviewUsesCheckeredBackground(rData.mbPreviewUsesCheckeredBackground), - maPersonaHeaderFooter( rData.maPersonaHeaderFooter ), - maPersonaHeaderBitmap( rData.maPersonaHeaderBitmap ), - maPersonaFooterBitmap( rData.maPersonaFooterBitmap ), - maPersonaMenuBarTextColor( rData.maPersonaMenuBarTextColor ) -{ - if (rData.mIconThemeScanner) - mIconThemeScanner = std::make_shared(*rData.mIconThemeScanner); -} - void ImplStyleData::SetStandardStyles() { vcl::Font aStdFont( FAMILY_SWISS, Size( 0, 8 ) ); @@ -649,98 +519,98 @@ void ImplStyleData::SetStandardStyles() aStdFont.SetFamilyName(utl::DefaultFontConfiguration::get().getUserInterfaceFont(LanguageTag(u"en"_ustr))); else aStdFont.SetFamilyName(u"Liberation Sans"_ustr); - maAppFont = aStdFont; - maHelpFont = aStdFont; - maMenuFont = aStdFont; - maToolFont = aStdFont; - maGroupFont = aStdFont; - maLabelFont = aStdFont; - maRadioCheckFont = aStdFont; - maPushButtonFont = aStdFont; - maFieldFont = aStdFont; - maIconFont = aStdFont; - maTabFont = aStdFont; + maFonts.maAppFont = aStdFont; + maFonts.maHelpFont = aStdFont; + maFonts.maMenuFont = aStdFont; + maFonts.maToolFont = aStdFont; + maFonts.maGroupFont = aStdFont; + maFonts.maLabelFont = aStdFont; + maFonts.maRadioCheckFont = aStdFont; + maFonts.maPushButtonFont = aStdFont; + maFonts.maFieldFont = aStdFont; + maFonts.maIconFont = aStdFont; + maFonts.maTabFont = aStdFont; aStdFont.SetWeight( WEIGHT_BOLD ); - maFloatTitleFont = maTitleFont = std::move(aStdFont); + maFonts.maFloatTitleFont = maFonts.maTitleFont = std::move(aStdFont); - maFaceColor = COL_LIGHTGRAY; - maCheckedColor = Color( 0xCC, 0xCC, 0xCC ); - maLightColor = COL_WHITE; - maLightBorderColor = COL_LIGHTGRAY; - maShadowColor = COL_GRAY; - maDarkShadowColor = COL_BLACK; + maColors.maFaceColor = COL_LIGHTGRAY; + maColors.maCheckedColor = Color( 0xCC, 0xCC, 0xCC ); + maColors.maLightColor = COL_WHITE; + maColors.maLightBorderColor = COL_LIGHTGRAY; + maColors.maShadowColor = COL_GRAY; + maColors.maDarkShadowColor = COL_BLACK; - maWarningColor = Color(0xFE, 0xEF, 0xB3); // tdf#105829 - maWarningTextColor = Color(0x70, 0x43, 0x00); - maErrorColor = Color(0xFF, 0xBA, 0xBA); - maErrorTextColor = Color(0x7A, 0x00, 0x06); + maColors.maWarningColor = Color(0xFE, 0xEF, 0xB3); // tdf#105829 + maColors.maWarningTextColor = Color(0x70, 0x43, 0x00); + maColors.maErrorColor = Color(0xFF, 0xBA, 0xBA); + maColors.maErrorTextColor = Color(0x7A, 0x00, 0x06); - maDefaultButtonTextColor = COL_BLACK; - maButtonTextColor = COL_BLACK; - maDefaultActionButtonTextColor = COL_BLACK; - maActionButtonTextColor = COL_BLACK; - maFlatButtonTextColor = COL_BLACK; - maDefaultButtonRolloverTextColor = COL_BLACK; - maButtonRolloverTextColor = COL_BLACK; - maDefaultActionButtonRolloverTextColor = COL_BLACK; - maActionButtonRolloverTextColor = COL_BLACK; - maFlatButtonRolloverTextColor = COL_BLACK; - maDefaultButtonPressedRolloverTextColor = COL_BLACK; - maButtonPressedRolloverTextColor = COL_BLACK; - maDefaultActionButtonPressedRolloverTextColor = COL_BLACK; - maActionButtonPressedRolloverTextColor = COL_BLACK; - maFlatButtonPressedRolloverTextColor = COL_BLACK; + maColors.maDefaultButtonTextColor = COL_BLACK; + maColors.maButtonTextColor = COL_BLACK; + maColors.maDefaultActionButtonTextColor = COL_BLACK; + maColors.maActionButtonTextColor = COL_BLACK; + maColors.maFlatButtonTextColor = COL_BLACK; + maColors.maDefaultButtonRolloverTextColor = COL_BLACK; + maColors.maButtonRolloverTextColor = COL_BLACK; + maColors.maDefaultActionButtonRolloverTextColor = COL_BLACK; + maColors.maActionButtonRolloverTextColor = COL_BLACK; + maColors.maFlatButtonRolloverTextColor = COL_BLACK; + maColors.maDefaultButtonPressedRolloverTextColor = COL_BLACK; + maColors.maButtonPressedRolloverTextColor = COL_BLACK; + maColors.maDefaultActionButtonPressedRolloverTextColor = COL_BLACK; + maColors.maActionButtonPressedRolloverTextColor = COL_BLACK; + maColors.maFlatButtonPressedRolloverTextColor = COL_BLACK; - maRadioCheckTextColor = COL_BLACK; - maGroupTextColor = COL_BLACK; - maLabelTextColor = COL_BLACK; - maWindowColor = COL_WHITE; - maWindowTextColor = COL_BLACK; - maDialogColor = COL_LIGHTGRAY; - maDialogTextColor = COL_BLACK; - maWorkspaceColor = Color( 0xDF, 0xDF, 0xDE ); - maMonoColor = COL_BLACK; - maFieldColor = COL_WHITE; - maFieldTextColor = COL_BLACK; - maFieldRolloverTextColor = COL_BLACK; - maActiveBorderColor = COL_LIGHTGRAY; - maDeactiveColor = COL_GRAY; - maDeactiveTextColor = COL_LIGHTGRAY; - maDeactiveBorderColor = COL_LIGHTGRAY; - maMenuColor = COL_LIGHTGRAY; - maMenuBarColor = COL_LIGHTGRAY; - maMenuBarRolloverColor = COL_BLUE; - maMenuBorderColor = COL_LIGHTGRAY; - maMenuTextColor = COL_BLACK; - maListBoxWindowBackgroundColor = COL_WHITE; - maListBoxWindowTextColor = COL_BLACK; - maListBoxWindowHighlightColor = COL_BLUE; - maListBoxWindowHighlightTextColor = COL_WHITE; - maMenuBarTextColor = COL_BLACK; - maMenuBarRolloverTextColor = COL_WHITE; - maMenuBarHighlightTextColor = COL_WHITE; - maMenuHighlightColor = COL_BLUE; - maMenuHighlightTextColor = COL_WHITE; - maAccentColor = COL_RED; - maHighlightColor = COL_BLUE; - maHighlightTextColor = COL_WHITE; + maColors.maRadioCheckTextColor = COL_BLACK; + maColors.maGroupTextColor = COL_BLACK; + maColors.maLabelTextColor = COL_BLACK; + maColors.maWindowColor = COL_WHITE; + maColors.maWindowTextColor = COL_BLACK; + maColors.maDialogColor = COL_LIGHTGRAY; + maColors.maDialogTextColor = COL_BLACK; + maColors.maWorkspaceColor = Color( 0xDF, 0xDF, 0xDE ); + maColors.maMonoColor = COL_BLACK; + maColors.maFieldColor = COL_WHITE; + maColors.maFieldTextColor = COL_BLACK; + maColors.maFieldRolloverTextColor = COL_BLACK; + maColors.maActiveBorderColor = COL_LIGHTGRAY; + maColors.maDeactiveColor = COL_GRAY; + maColors.maDeactiveTextColor = COL_LIGHTGRAY; + maColors.maDeactiveBorderColor = COL_LIGHTGRAY; + maColors.maMenuColor = COL_LIGHTGRAY; + maColors.maMenuBarColor = COL_LIGHTGRAY; + maColors.maMenuBarRolloverColor = COL_BLUE; + maColors.maMenuBorderColor = COL_LIGHTGRAY; + maColors.maMenuTextColor = COL_BLACK; + maColors.maListBoxWindowBackgroundColor = COL_WHITE; + maColors.maListBoxWindowTextColor = COL_BLACK; + maColors.maListBoxWindowHighlightColor = COL_BLUE; + maColors.maListBoxWindowHighlightTextColor = COL_WHITE; + maColors.maMenuBarTextColor = COL_BLACK; + maColors.maMenuBarRolloverTextColor = COL_WHITE; + maColors.maMenuBarHighlightTextColor = COL_WHITE; + maColors.maMenuHighlightColor = COL_BLUE; + maColors.maMenuHighlightTextColor = COL_WHITE; + maColors.maAccentColor = COL_RED; + maColors.maHighlightColor = COL_BLUE; + maColors.maHighlightTextColor = COL_WHITE; // make active like highlight, except with a small contrast - maActiveColor = maHighlightColor; - maActiveColor.IncreaseLuminance(32); - maActiveTextColor = maHighlightTextColor; - maActiveTabColor = COL_WHITE; - maInactiveTabColor = COL_LIGHTGRAY; - maTabTextColor = COL_BLACK; - maTabRolloverTextColor = COL_BLACK; - maTabHighlightTextColor = COL_BLACK; - maDisableColor = COL_GRAY; - maHelpColor = Color( 0xFF, 0xFF, 0xE0 ); - maHelpTextColor = COL_BLACK; - maLinkColor = COL_BLUE; - maVisitedLinkColor = Color( 0x00, 0x00, 0xCC ); - maToolTextColor = COL_BLACK; - maAlternatingRowColor = Color( 0xEE, 0xEE, 0xEE ); + maColors.maActiveColor = maColors.maHighlightColor; + maColors.maActiveColor.IncreaseLuminance(32); + maColors.maActiveTextColor = maColors.maHighlightTextColor; + maColors.maActiveTabColor = COL_WHITE; + maColors.maInactiveTabColor = COL_LIGHTGRAY; + maColors.maTabTextColor = COL_BLACK; + maColors.maTabRolloverTextColor = COL_BLACK; + maColors.maTabHighlightTextColor = COL_BLACK; + maColors.maDisableColor = COL_GRAY; + maColors.maHelpColor = Color( 0xFF, 0xFF, 0xE0 ); + maColors.maHelpTextColor = COL_BLACK; + maColors.maLinkColor = COL_BLUE; + maColors.maVisitedLinkColor = Color( 0x00, 0x00, 0xCC ); + maColors.maToolTextColor = COL_BLACK; + maColors.maAlternatingRowColor = Color( 0xEE, 0xEE, 0xEE ); mnTitleHeight = 18; mnFloatTitleHeight = 13; @@ -765,935 +635,935 @@ void StyleSettings::SetFaceColor( const Color& rColor ) { CopyData(); - mxData->maFaceColor = rColor; + mxData->maColors.maFaceColor = rColor; } const Color& StyleSettings::GetFaceColor() const { - return mxData->maFaceColor; + return mxData->maColors.maFaceColor; } void StyleSettings::SetCheckedColor( const Color& rColor ) { CopyData(); - mxData->maCheckedColor = rColor; + mxData->maColors.maCheckedColor = rColor; } const Color& StyleSettings::GetCheckedColor() const { - return mxData->maCheckedColor; + return mxData->maColors.maCheckedColor; } void StyleSettings::SetLightColor( const Color& rColor ) { CopyData(); - mxData->maLightColor = rColor; + mxData->maColors.maLightColor = rColor; } const Color& StyleSettings::GetLightColor() const { - return mxData->maLightColor; + return mxData->maColors.maLightColor; } void StyleSettings::SetLightBorderColor( const Color& rColor ) { CopyData(); - mxData->maLightBorderColor = rColor; + mxData->maColors.maLightBorderColor = rColor; } const Color& StyleSettings::GetLightBorderColor() const { - return mxData->maLightBorderColor; + return mxData->maColors.maLightBorderColor; } void StyleSettings::SetWarningColor( const Color& rColor ) { CopyData(); - mxData->maWarningColor = rColor; + mxData->maColors.maWarningColor = rColor; } const Color& StyleSettings::GetWarningColor() const { - return mxData->maWarningColor; + return mxData->maColors.maWarningColor; } void StyleSettings::SetWarningTextColor( const Color& rColor ) { CopyData(); - mxData->maWarningTextColor = rColor; + mxData->maColors.maWarningTextColor = rColor; } const Color& StyleSettings::GetWarningTextColor() const { - return mxData->maWarningTextColor; + return mxData->maColors.maWarningTextColor; } void StyleSettings::SetErrorColor( const Color& rColor ) { CopyData(); - mxData->maErrorColor = rColor; + mxData->maColors.maErrorColor = rColor; } const Color& StyleSettings::GetErrorColor() const { - return mxData->maErrorColor; + return mxData->maColors.maErrorColor; } void StyleSettings::SetErrorTextColor( const Color& rColor ) { CopyData(); - mxData->maErrorTextColor = rColor; + mxData->maColors.maErrorTextColor = rColor; } const Color& StyleSettings::GetErrorTextColor() const { - return mxData->maErrorTextColor; + return mxData->maColors.maErrorTextColor; } void StyleSettings::SetShadowColor( const Color& rColor ) { CopyData(); - mxData->maShadowColor = rColor; + mxData->maColors.maShadowColor = rColor; } const Color& StyleSettings::GetShadowColor() const { - return mxData->maShadowColor; + return mxData->maColors.maShadowColor; } void StyleSettings::SetDarkShadowColor( const Color& rColor ) { CopyData(); - mxData->maDarkShadowColor = rColor; + mxData->maColors.maDarkShadowColor = rColor; } const Color& StyleSettings::GetDarkShadowColor() const { - return mxData->maDarkShadowColor; + return mxData->maColors.maDarkShadowColor; } void StyleSettings::SetDefaultButtonTextColor( const Color& rColor ) { CopyData(); - mxData->maDefaultButtonTextColor = rColor; + mxData->maColors.maDefaultButtonTextColor = rColor; } const Color& StyleSettings::GetDefaultButtonTextColor() const { - return mxData->maDefaultButtonTextColor; + return mxData->maColors.maDefaultButtonTextColor; } void StyleSettings::SetButtonTextColor( const Color& rColor ) { CopyData(); - mxData->maButtonTextColor = rColor; + mxData->maColors.maButtonTextColor = rColor; } const Color& StyleSettings::GetButtonTextColor() const { - return mxData->maButtonTextColor; + return mxData->maColors.maButtonTextColor; } void StyleSettings::SetDefaultActionButtonTextColor( const Color& rColor ) { CopyData(); - mxData->maDefaultActionButtonTextColor = rColor; + mxData->maColors.maDefaultActionButtonTextColor = rColor; } const Color& StyleSettings::GetDefaultActionButtonTextColor() const { - return mxData->maDefaultActionButtonTextColor; + return mxData->maColors.maDefaultActionButtonTextColor; } void StyleSettings::SetActionButtonTextColor( const Color& rColor ) { CopyData(); - mxData->maActionButtonTextColor = rColor; + mxData->maColors.maActionButtonTextColor = rColor; } const Color& StyleSettings::GetActionButtonTextColor() const { - return mxData->maActionButtonTextColor; + return mxData->maColors.maActionButtonTextColor; } void StyleSettings::SetFlatButtonTextColor( const Color& rColor ) { CopyData(); - mxData->maFlatButtonTextColor = rColor; + mxData->maColors.maFlatButtonTextColor = rColor; } const Color& StyleSettings::GetFlatButtonTextColor() const { - return mxData->maFlatButtonTextColor; + return mxData->maColors.maFlatButtonTextColor; } void StyleSettings::SetDefaultButtonRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maDefaultButtonRolloverTextColor = rColor; + mxData->maColors.maDefaultButtonRolloverTextColor = rColor; } const Color& StyleSettings::GetDefaultButtonRolloverTextColor() const { - return mxData->maDefaultButtonRolloverTextColor; + return mxData->maColors.maDefaultButtonRolloverTextColor; } void StyleSettings::SetButtonRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maButtonRolloverTextColor = rColor; + mxData->maColors.maButtonRolloverTextColor = rColor; } const Color& StyleSettings::GetButtonRolloverTextColor() const { - return mxData->maButtonRolloverTextColor; + return mxData->maColors.maButtonRolloverTextColor; } void StyleSettings::SetDefaultActionButtonRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maDefaultActionButtonRolloverTextColor = rColor; + mxData->maColors.maDefaultActionButtonRolloverTextColor = rColor; } const Color& StyleSettings::GetDefaultActionButtonRolloverTextColor() const { - return mxData->maDefaultActionButtonRolloverTextColor; + return mxData->maColors.maDefaultActionButtonRolloverTextColor; } void StyleSettings::SetActionButtonRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maActionButtonRolloverTextColor = rColor; + mxData->maColors.maActionButtonRolloverTextColor = rColor; } const Color& StyleSettings::GetActionButtonRolloverTextColor() const { - return mxData->maActionButtonRolloverTextColor; + return mxData->maColors.maActionButtonRolloverTextColor; } void StyleSettings::SetFlatButtonRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maFlatButtonRolloverTextColor = rColor; + mxData->maColors.maFlatButtonRolloverTextColor = rColor; } const Color& StyleSettings::GetFlatButtonRolloverTextColor() const { - return mxData->maFlatButtonRolloverTextColor; + return mxData->maColors.maFlatButtonRolloverTextColor; } void StyleSettings::SetDefaultButtonPressedRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maDefaultButtonPressedRolloverTextColor = rColor; + mxData->maColors.maDefaultButtonPressedRolloverTextColor = rColor; } const Color& StyleSettings::GetDefaultButtonPressedRolloverTextColor() const { - return mxData->maDefaultButtonPressedRolloverTextColor; + return mxData->maColors.maDefaultButtonPressedRolloverTextColor; } void StyleSettings::SetButtonPressedRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maButtonPressedRolloverTextColor = rColor; + mxData->maColors.maButtonPressedRolloverTextColor = rColor; } const Color& StyleSettings::GetButtonPressedRolloverTextColor() const { - return mxData->maButtonPressedRolloverTextColor; + return mxData->maColors.maButtonPressedRolloverTextColor; } void StyleSettings::SetDefaultActionButtonPressedRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maDefaultActionButtonPressedRolloverTextColor = rColor; + mxData->maColors.maDefaultActionButtonPressedRolloverTextColor = rColor; } const Color& StyleSettings::GetDefaultActionButtonPressedRolloverTextColor() const { - return mxData->maDefaultActionButtonPressedRolloverTextColor; + return mxData->maColors.maDefaultActionButtonPressedRolloverTextColor; } void StyleSettings::SetActionButtonPressedRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maActionButtonPressedRolloverTextColor = rColor; + mxData->maColors.maActionButtonPressedRolloverTextColor = rColor; } const Color& StyleSettings::GetActionButtonPressedRolloverTextColor() const { - return mxData->maActionButtonPressedRolloverTextColor; + return mxData->maColors.maActionButtonPressedRolloverTextColor; } void StyleSettings::SetFlatButtonPressedRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maFlatButtonPressedRolloverTextColor = rColor; + mxData->maColors.maFlatButtonPressedRolloverTextColor = rColor; } const Color& StyleSettings::GetFlatButtonPressedRolloverTextColor() const { - return mxData->maFlatButtonPressedRolloverTextColor; + return mxData->maColors.maFlatButtonPressedRolloverTextColor; } void StyleSettings::SetRadioCheckTextColor( const Color& rColor ) { CopyData(); - mxData->maRadioCheckTextColor = rColor; + mxData->maColors.maRadioCheckTextColor = rColor; } const Color& StyleSettings::GetRadioCheckTextColor() const { - return mxData->maRadioCheckTextColor; + return mxData->maColors.maRadioCheckTextColor; } void StyleSettings::SetGroupTextColor( const Color& rColor ) { CopyData(); - mxData->maGroupTextColor = rColor; + mxData->maColors.maGroupTextColor = rColor; } const Color& StyleSettings::GetGroupTextColor() const { - return mxData->maGroupTextColor; + return mxData->maColors.maGroupTextColor; } void StyleSettings::SetLabelTextColor( const Color& rColor ) { CopyData(); - mxData->maLabelTextColor = rColor; + mxData->maColors.maLabelTextColor = rColor; } const Color& StyleSettings::GetLabelTextColor() const { - return mxData->maLabelTextColor; + return mxData->maColors.maLabelTextColor; } void StyleSettings::SetWindowColor( const Color& rColor ) { CopyData(); - mxData->maWindowColor = rColor; + mxData->maColors.maWindowColor = rColor; } const Color& StyleSettings::GetWindowColor() const { - return mxData->maWindowColor; + return mxData->maColors.maWindowColor; } void StyleSettings::SetWindowTextColor( const Color& rColor ) { CopyData(); - mxData->maWindowTextColor = rColor; + mxData->maColors.maWindowTextColor = rColor; } const Color& StyleSettings::GetWindowTextColor() const { - return mxData->maWindowTextColor; + return mxData->maColors.maWindowTextColor; } void StyleSettings::SetDialogColor( const Color& rColor ) { CopyData(); - mxData->maDialogColor = rColor; + mxData->maColors.maDialogColor = rColor; } const Color& StyleSettings::GetDialogColor() const { - return mxData->maDialogColor; + return mxData->maColors.maDialogColor; } void StyleSettings::SetDialogTextColor( const Color& rColor ) { CopyData(); - mxData->maDialogTextColor = rColor; + mxData->maColors.maDialogTextColor = rColor; } const Color& StyleSettings::GetDialogTextColor() const { - return mxData->maDialogTextColor; + return mxData->maColors.maDialogTextColor; } void StyleSettings::SetWorkspaceColor( const Color& rColor ) { CopyData(); - mxData->maWorkspaceColor = rColor; + mxData->maColors.maWorkspaceColor = rColor; } const Color& StyleSettings::GetWorkspaceColor() const { - return mxData->maWorkspaceColor; + return mxData->maColors.maWorkspaceColor; } void StyleSettings::SetFieldColor( const Color& rColor ) { CopyData(); - mxData->maFieldColor = rColor; + mxData->maColors.maFieldColor = rColor; } const Color& StyleSettings::GetFieldColor() const { - return mxData->maFieldColor; + return mxData->maColors.maFieldColor; } void StyleSettings::SetFieldTextColor( const Color& rColor ) { CopyData(); - mxData->maFieldTextColor = rColor; + mxData->maColors.maFieldTextColor = rColor; } const Color& StyleSettings::GetFieldTextColor() const { - return mxData->maFieldTextColor; + return mxData->maColors.maFieldTextColor; } void StyleSettings::SetFieldRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maFieldRolloverTextColor = rColor; + mxData->maColors.maFieldRolloverTextColor = rColor; } const Color& StyleSettings::GetFieldRolloverTextColor() const { - return mxData->maFieldRolloverTextColor; + return mxData->maColors.maFieldRolloverTextColor; } void StyleSettings::SetActiveColor( const Color& rColor ) { CopyData(); - mxData->maActiveColor = rColor; + mxData->maColors.maActiveColor = rColor; } const Color& StyleSettings::GetActiveColor() const { - return mxData->maActiveColor; + return mxData->maColors.maActiveColor; } void StyleSettings::SetActiveTextColor( const Color& rColor ) { CopyData(); - mxData->maActiveTextColor = rColor; + mxData->maColors.maActiveTextColor = rColor; } const Color& StyleSettings::GetActiveTextColor() const { - return mxData->maActiveTextColor; + return mxData->maColors.maActiveTextColor; } void StyleSettings::SetActiveBorderColor( const Color& rColor ) { CopyData(); - mxData->maActiveBorderColor = rColor; + mxData->maColors.maActiveBorderColor = rColor; } const Color& StyleSettings::GetActiveBorderColor() const { - return mxData->maActiveBorderColor; + return mxData->maColors.maActiveBorderColor; } void StyleSettings::SetDeactiveColor( const Color& rColor ) { CopyData(); - mxData->maDeactiveColor = rColor; + mxData->maColors.maDeactiveColor = rColor; } const Color& StyleSettings::GetDeactiveColor() const { - return mxData->maDeactiveColor; + return mxData->maColors.maDeactiveColor; } void StyleSettings::SetDeactiveTextColor( const Color& rColor ) { CopyData(); - mxData->maDeactiveTextColor = rColor; + mxData->maColors.maDeactiveTextColor = rColor; } const Color& StyleSettings::GetDeactiveTextColor() const { - return mxData->maDeactiveTextColor; + return mxData->maColors.maDeactiveTextColor; } void StyleSettings::SetDeactiveBorderColor( const Color& rColor ) { CopyData(); - mxData->maDeactiveBorderColor = rColor; + mxData->maColors.maDeactiveBorderColor = rColor; } const Color& StyleSettings::GetDeactiveBorderColor() const { - return mxData->maDeactiveBorderColor; + return mxData->maColors.maDeactiveBorderColor; } void StyleSettings::SetAccentColor( const Color& rColor ) { CopyData(); - mxData->maAccentColor = rColor; + mxData->maColors.maAccentColor = rColor; } const Color& StyleSettings::GetAccentColor() const { - return mxData->maAccentColor; + return mxData->maColors.maAccentColor; } void StyleSettings::SetHighlightColor( const Color& rColor ) { CopyData(); - mxData->maHighlightColor = rColor; + mxData->maColors.maHighlightColor = rColor; } const Color& StyleSettings::GetHighlightColor() const { - return mxData->maHighlightColor; + return mxData->maColors.maHighlightColor; } void StyleSettings::SetHighlightTextColor( const Color& rColor ) { CopyData(); - mxData->maHighlightTextColor = rColor; + mxData->maColors.maHighlightTextColor = rColor; } const Color& StyleSettings::GetHighlightTextColor() const { - return mxData->maHighlightTextColor; + return mxData->maColors.maHighlightTextColor; } void StyleSettings::SetDisableColor( const Color& rColor ) { CopyData(); - mxData->maDisableColor = rColor; + mxData->maColors.maDisableColor = rColor; } const Color& StyleSettings::GetDisableColor() const { - return mxData->maDisableColor; + return mxData->maColors.maDisableColor; } void StyleSettings::SetHelpColor( const Color& rColor ) { CopyData(); - mxData->maHelpColor = rColor; + mxData->maColors.maHelpColor = rColor; } const Color& StyleSettings::GetHelpColor() const { - return mxData->maHelpColor; + return mxData->maColors.maHelpColor; } void StyleSettings::SetHelpTextColor( const Color& rColor ) { CopyData(); - mxData->maHelpTextColor = rColor; + mxData->maColors.maHelpTextColor = rColor; } const Color& StyleSettings::GetHelpTextColor() const { - return mxData->maHelpTextColor; + return mxData->maColors.maHelpTextColor; } void StyleSettings::SetMenuColor( const Color& rColor ) { CopyData(); - mxData->maMenuColor = rColor; + mxData->maColors.maMenuColor = rColor; } const Color& StyleSettings::GetMenuColor() const { - return mxData->maMenuColor; + return mxData->maColors.maMenuColor; } void StyleSettings::SetMenuBarColor( const Color& rColor ) { CopyData(); - mxData->maMenuBarColor = rColor; + mxData->maColors.maMenuBarColor = rColor; } const Color& StyleSettings::GetMenuBarColor() const { - return mxData->maMenuBarColor; + return mxData->maColors.maMenuBarColor; } void StyleSettings::SetMenuBarRolloverColor( const Color& rColor ) { CopyData(); - mxData->maMenuBarRolloverColor = rColor; + mxData->maColors.maMenuBarRolloverColor = rColor; } const Color& StyleSettings::GetMenuBarRolloverColor() const { - return mxData->maMenuBarRolloverColor; + return mxData->maColors.maMenuBarRolloverColor; } void StyleSettings::SetMenuBorderColor( const Color& rColor ) { CopyData(); - mxData->maMenuBorderColor = rColor; + mxData->maColors.maMenuBorderColor = rColor; } const Color& StyleSettings::GetMenuBorderColor() const { - return mxData->maMenuBorderColor; + return mxData->maColors.maMenuBorderColor; } void StyleSettings::SetMenuTextColor( const Color& rColor ) { CopyData(); - mxData->maMenuTextColor = rColor; + mxData->maColors.maMenuTextColor = rColor; } const Color& StyleSettings::GetMenuTextColor() const { - return mxData->maMenuTextColor; + return mxData->maColors.maMenuTextColor; } void StyleSettings::SetMenuBarTextColor( const Color& rColor ) { CopyData(); - mxData->maMenuBarTextColor = rColor; + mxData->maColors.maMenuBarTextColor = rColor; } const Color& StyleSettings::GetMenuBarTextColor() const { - return mxData->maMenuBarTextColor; + return mxData->maColors.maMenuBarTextColor; } void StyleSettings::SetMenuBarRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maMenuBarRolloverTextColor = rColor; + mxData->maColors.maMenuBarRolloverTextColor = rColor; } const Color& StyleSettings::GetMenuBarRolloverTextColor() const { - return mxData->maMenuBarRolloverTextColor; + return mxData->maColors.maMenuBarRolloverTextColor; } void StyleSettings::SetMenuBarHighlightTextColor( const Color& rColor ) { CopyData(); - mxData->maMenuBarHighlightTextColor = rColor; + mxData->maColors.maMenuBarHighlightTextColor = rColor; } const Color& StyleSettings::GetMenuBarHighlightTextColor() const { - return mxData->maMenuBarHighlightTextColor; + return mxData->maColors.maMenuBarHighlightTextColor; } void StyleSettings::SetMenuHighlightColor( const Color& rColor ) { CopyData(); - mxData->maMenuHighlightColor = rColor; + mxData->maColors.maMenuHighlightColor = rColor; } const Color& StyleSettings::GetMenuHighlightColor() const { - return mxData->maMenuHighlightColor; + return mxData->maColors.maMenuHighlightColor; } void StyleSettings::SetMenuHighlightTextColor( const Color& rColor ) { CopyData(); - mxData->maMenuHighlightTextColor = rColor; + mxData->maColors.maMenuHighlightTextColor = rColor; } const Color& StyleSettings::GetMenuHighlightTextColor() const { - return mxData->maMenuHighlightTextColor; + return mxData->maColors.maMenuHighlightTextColor; } void StyleSettings::SetListBoxWindowBackgroundColor( const Color& rColor ) { CopyData(); - mxData->maListBoxWindowBackgroundColor = rColor; + mxData->maColors.maListBoxWindowBackgroundColor = rColor; } const Color& StyleSettings::GetListBoxWindowBackgroundColor() const { - return mxData->maListBoxWindowBackgroundColor; + return mxData->maColors.maListBoxWindowBackgroundColor; } void StyleSettings::SetListBoxWindowTextColor( const Color& rColor ) { CopyData(); - mxData->maListBoxWindowTextColor = rColor; + mxData->maColors.maListBoxWindowTextColor = rColor; } const Color& StyleSettings::GetListBoxWindowTextColor() const { - return mxData->maListBoxWindowTextColor; + return mxData->maColors.maListBoxWindowTextColor; } void StyleSettings::SetListBoxWindowHighlightColor( const Color& rColor ) { CopyData(); - mxData->maListBoxWindowHighlightColor = rColor; + mxData->maColors.maListBoxWindowHighlightColor = rColor; } const Color& StyleSettings::GetListBoxWindowHighlightColor() const { - return mxData->maListBoxWindowHighlightColor; + return mxData->maColors.maListBoxWindowHighlightColor; } void StyleSettings::SetListBoxWindowHighlightTextColor( const Color& rColor ) { CopyData(); - mxData->maListBoxWindowHighlightTextColor = rColor; + mxData->maColors.maListBoxWindowHighlightTextColor = rColor; } const Color& StyleSettings::GetListBoxWindowHighlightTextColor() const { - return mxData->maListBoxWindowHighlightTextColor; + return mxData->maColors.maListBoxWindowHighlightTextColor; } void StyleSettings::SetTabTextColor( const Color& rColor ) { CopyData(); - mxData->maTabTextColor = rColor; + mxData->maColors.maTabTextColor = rColor; } const Color& StyleSettings::GetTabTextColor() const { - return mxData->maTabTextColor; + return mxData->maColors.maTabTextColor; } void StyleSettings::SetTabRolloverTextColor( const Color& rColor ) { CopyData(); - mxData->maTabRolloverTextColor = rColor; + mxData->maColors.maTabRolloverTextColor = rColor; } const Color& StyleSettings::GetTabRolloverTextColor() const { - return mxData->maTabRolloverTextColor; + return mxData->maColors.maTabRolloverTextColor; } void StyleSettings::SetTabHighlightTextColor( const Color& rColor ) { CopyData(); - mxData->maTabHighlightTextColor = rColor; + mxData->maColors.maTabHighlightTextColor = rColor; } const Color& StyleSettings::GetTabHighlightTextColor() const { - return mxData->maTabHighlightTextColor; + return mxData->maColors.maTabHighlightTextColor; } void StyleSettings::SetLinkColor( const Color& rColor ) { CopyData(); - mxData->maLinkColor = rColor; + mxData->maColors.maLinkColor = rColor; } const Color& StyleSettings::GetLinkColor() const { - return mxData->maLinkColor; + return mxData->maColors.maLinkColor; } void StyleSettings::SetVisitedLinkColor( const Color& rColor ) { CopyData(); - mxData->maVisitedLinkColor = rColor; + mxData->maColors.maVisitedLinkColor = rColor; } const Color& StyleSettings::GetVisitedLinkColor() const { - return mxData->maVisitedLinkColor; + return mxData->maColors.maVisitedLinkColor; } void StyleSettings::SetToolTextColor( const Color& rColor ) { CopyData(); - mxData->maToolTextColor = rColor; + mxData->maColors.maToolTextColor = rColor; } const Color& StyleSettings::GetToolTextColor() const { - return mxData->maToolTextColor; + return mxData->maColors.maToolTextColor; } void StyleSettings::SetMonoColor( const Color& rColor ) { CopyData(); - mxData->maMonoColor = rColor; + mxData->maColors.maMonoColor = rColor; } const Color& StyleSettings::GetMonoColor() const { - return mxData->maMonoColor; + return mxData->maColors.maMonoColor; } void StyleSettings::SetActiveTabColor( const Color& rColor ) { CopyData(); - mxData->maActiveTabColor = rColor; + mxData->maColors.maActiveTabColor = rColor; } const Color& StyleSettings::GetActiveTabColor() const { - return mxData->maActiveTabColor; + return mxData->maColors.maActiveTabColor; } void StyleSettings::SetInactiveTabColor( const Color& rColor ) { CopyData(); - mxData->maInactiveTabColor = rColor; + mxData->maColors.maInactiveTabColor = rColor; } const Color& StyleSettings::GetInactiveTabColor() const { - return mxData->maInactiveTabColor; + return mxData->maColors.maInactiveTabColor; } void StyleSettings::SetAlternatingRowColor(const Color& rColor) { CopyData(); - mxData->maAlternatingRowColor = rColor; + mxData->maColors.maAlternatingRowColor = rColor; } const Color& StyleSettings::GetAlternatingRowColor() const { - return mxData->maAlternatingRowColor; + return mxData->maColors.maAlternatingRowColor; } void @@ -1843,169 +1713,169 @@ void StyleSettings::SetAppFont( const vcl::Font& rFont ) { CopyData(); - mxData->maAppFont = rFont; + mxData->maFonts.maAppFont = rFont; } const vcl::Font& StyleSettings::GetAppFont() const { - return mxData->maAppFont; + return mxData->maFonts.maAppFont; } void StyleSettings::SetHelpFont( const vcl::Font& rFont ) { CopyData(); - mxData->maHelpFont = rFont; + mxData->maFonts.maHelpFont = rFont; } const vcl::Font& StyleSettings::GetHelpFont() const { - return mxData->maHelpFont; + return mxData->maFonts.maHelpFont; } void StyleSettings::SetTitleFont( const vcl::Font& rFont ) { CopyData(); - mxData->maTitleFont = rFont; + mxData->maFonts.maTitleFont = rFont; } const vcl::Font& StyleSettings::GetTitleFont() const { - return mxData->maTitleFont; + return mxData->maFonts.maTitleFont; } void StyleSettings::SetFloatTitleFont( const vcl::Font& rFont ) { CopyData(); - mxData->maFloatTitleFont = rFont; + mxData->maFonts.maFloatTitleFont = rFont; } const vcl::Font& StyleSettings::GetFloatTitleFont() const { - return mxData->maFloatTitleFont; + return mxData->maFonts.maFloatTitleFont; } void StyleSettings::SetMenuFont( const vcl::Font& rFont ) { CopyData(); - mxData->maMenuFont = rFont; + mxData->maFonts.maMenuFont = rFont; } const vcl::Font& StyleSettings::GetMenuFont() const { - return mxData->maMenuFont; + return mxData->maFonts.maMenuFont; } void StyleSettings::SetToolFont( const vcl::Font& rFont ) { CopyData(); - mxData->maToolFont = rFont; + mxData->maFonts.maToolFont = rFont; } const vcl::Font& StyleSettings::GetToolFont() const { - return mxData->maToolFont; + return mxData->maFonts.maToolFont; } void StyleSettings::SetGroupFont( const vcl::Font& rFont ) { CopyData(); - mxData->maGroupFont = rFont; + mxData->maFonts.maGroupFont = rFont; } const vcl::Font& StyleSettings::GetGroupFont() const { - return mxData->maGroupFont; + return mxData->maFonts.maGroupFont; } void StyleSettings::SetLabelFont( const vcl::Font& rFont ) { CopyData(); - mxData->maLabelFont = rFont; + mxData->maFonts.maLabelFont = rFont; } const vcl::Font& StyleSettings::GetLabelFont() const { - return mxData->maLabelFont; + return mxData->maFonts.maLabelFont; } void StyleSettings::SetRadioCheckFont( const vcl::Font& rFont ) { CopyData(); - mxData->maRadioCheckFont = rFont; + mxData->maFonts.maRadioCheckFont = rFont; } const vcl::Font& StyleSettings::GetRadioCheckFont() const { - return mxData->maRadioCheckFont; + return mxData->maFonts.maRadioCheckFont; } void StyleSettings::SetPushButtonFont( const vcl::Font& rFont ) { CopyData(); - mxData->maPushButtonFont = rFont; + mxData->maFonts.maPushButtonFont = rFont; } const vcl::Font& StyleSettings::GetPushButtonFont() const { - return mxData->maPushButtonFont; + return mxData->maFonts.maPushButtonFont; } void StyleSettings::SetFieldFont( const vcl::Font& rFont ) { CopyData(); - mxData->maFieldFont = rFont; + mxData->maFonts.maFieldFont = rFont; } const vcl::Font& StyleSettings::GetFieldFont() const { - return mxData->maFieldFont; + return mxData->maFonts.maFieldFont; } void StyleSettings::SetIconFont( const vcl::Font& rFont ) { CopyData(); - mxData->maIconFont = rFont; + mxData->maFonts.maIconFont = rFont; } const vcl::Font& StyleSettings::GetIconFont() const { - return mxData->maIconFont; + return mxData->maFonts.maIconFont; } void StyleSettings::SetTabFont( const vcl::Font& rFont ) { CopyData(); - mxData->maTabFont = rFont; + mxData->maFonts.maTabFont = rFont; } const vcl::Font& StyleSettings::GetTabFont() const { - return mxData->maTabFont; + return mxData->maFonts.maTabFont; } sal_Int32 @@ -2329,39 +2199,39 @@ const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const void StyleSettings::Set3DColors( const Color& rColor ) { CopyData(); - mxData->maFaceColor = rColor; - mxData->maLightBorderColor = rColor; - mxData->maMenuBorderColor = rColor; - mxData->maDarkShadowColor = COL_BLACK; + mxData->maColors.maFaceColor = rColor; + mxData->maColors.maLightBorderColor = rColor; + mxData->maColors.maMenuBorderColor = rColor; + mxData->maColors.maDarkShadowColor = COL_BLACK; if ( rColor != COL_LIGHTGRAY ) { - mxData->maLightColor = rColor; - mxData->maShadowColor = rColor; - mxData->maDarkShadowColor = rColor; + mxData->maColors.maLightColor = rColor; + mxData->maColors.maShadowColor = rColor; + mxData->maColors.maDarkShadowColor = rColor; if (!rColor.IsDark()) { - mxData->maLightColor.IncreaseLuminance(64); - mxData->maShadowColor.DecreaseLuminance(64); - mxData->maDarkShadowColor.DecreaseLuminance(100); + mxData->maColors.maLightColor.IncreaseLuminance(64); + mxData->maColors.maShadowColor.DecreaseLuminance(64); + mxData->maColors.maDarkShadowColor.DecreaseLuminance(100); } else { - mxData->maLightColor.DecreaseLuminance(64); - mxData->maShadowColor.IncreaseLuminance(64); - mxData->maDarkShadowColor.IncreaseLuminance(100); + mxData->maColors.maLightColor.DecreaseLuminance(64); + mxData->maColors.maShadowColor.IncreaseLuminance(64); + mxData->maColors.maDarkShadowColor.IncreaseLuminance(100); } - sal_uInt8 nRed = (mxData->maLightColor.GetRed() + mxData->maShadowColor.GetRed()) / 2; - sal_uInt8 nGreen = (mxData->maLightColor.GetGreen() + mxData->maShadowColor.GetGreen()) / 2; - sal_uInt8 nBlue = (mxData->maLightColor.GetBlue() + mxData->maShadowColor.GetBlue()) / 2; - mxData->maCheckedColor = Color(nRed, nGreen, nBlue); + sal_uInt8 nRed = (mxData->maColors.maLightColor.GetRed() + mxData->maColors.maShadowColor.GetRed()) / 2; + sal_uInt8 nGreen = (mxData->maColors.maLightColor.GetGreen() + mxData->maColors.maShadowColor.GetGreen()) / 2; + sal_uInt8 nBlue = (mxData->maColors.maLightColor.GetBlue() + mxData->maColors.maShadowColor.GetBlue()) / 2; + mxData->maColors.maCheckedColor = Color(nRed, nGreen, nBlue); } else { - mxData->maCheckedColor = Color( 0x99, 0x99, 0x99 ); - mxData->maLightColor = COL_WHITE; - mxData->maShadowColor = COL_GRAY; + mxData->maColors.maCheckedColor = Color( 0x99, 0x99, 0x99 ); + mxData->maColors.maLightColor = COL_WHITE; + mxData->maColors.maShadowColor = COL_GRAY; } } @@ -2370,13 +2240,13 @@ void StyleSettings::SetCheckedColorSpecialCase( ) CopyData(); // Light gray checked color special case if ( GetFaceColor() == COL_LIGHTGRAY ) - mxData->maCheckedColor = Color( 0xCC, 0xCC, 0xCC ); + mxData->maColors.maCheckedColor = Color(0xCC, 0xCC, 0xCC); else { - sal_uInt8 nRed = static_cast((static_cast(mxData->maFaceColor.GetRed()) + static_cast(mxData->maLightColor.GetRed()))/2); - sal_uInt8 nGreen = static_cast((static_cast(mxData->maFaceColor.GetGreen()) + static_cast(mxData->maLightColor.GetGreen()))/2); - sal_uInt8 nBlue = static_cast((static_cast(mxData->maFaceColor.GetBlue()) + static_cast(mxData->maLightColor.GetBlue()))/2); - mxData->maCheckedColor = Color( nRed, nGreen, nBlue ); + sal_uInt8 nRed = static_cast((static_cast(mxData->maColors.maFaceColor.GetRed()) + static_cast(mxData->maColors.maLightColor.GetRed()))/2); + sal_uInt8 nGreen = static_cast((static_cast(mxData->maColors.maFaceColor.GetGreen()) + static_cast(mxData->maColors.maLightColor.GetGreen()))/2); + sal_uInt8 nBlue = static_cast((static_cast(mxData->maColors.maFaceColor.GetBlue()) + static_cast(mxData->maColors.maLightColor.GetBlue()))/2); + mxData->maColors.maCheckedColor = Color(nRed, nGreen, nBlue); } } @@ -2553,7 +2423,7 @@ bool StyleSettings::operator ==( const StyleSettings& rSet ) const return false; } - if (*mxData->mIconThemeSelector != *rSet.mxData->mIconThemeSelector) { + if (mxData->mIconThemeSelector != rSet.mxData->mIconThemeSelector) { return false; } @@ -2575,78 +2445,8 @@ bool StyleSettings::operator ==( const StyleSettings& rSet ) const (mxData->mbUseFontAAFromSystem == rSet.mxData->mbUseFontAAFromSystem) && (mxData->mnUseFlatBorders == rSet.mxData->mnUseFlatBorders) && (mxData->mnUseFlatMenus == rSet.mxData->mnUseFlatMenus) && - (mxData->maFaceColor == rSet.mxData->maFaceColor) && - (mxData->maCheckedColor == rSet.mxData->maCheckedColor) && - (mxData->maLightColor == rSet.mxData->maLightColor) && - (mxData->maLightBorderColor == rSet.mxData->maLightBorderColor) && - (mxData->maShadowColor == rSet.mxData->maShadowColor) && - (mxData->maDarkShadowColor == rSet.mxData->maDarkShadowColor) && - (mxData->maWarningColor == rSet.mxData->maWarningColor) && - (mxData->maWarningTextColor == rSet.mxData->maWarningTextColor) && - (mxData->maErrorColor == rSet.mxData->maErrorColor) && - (mxData->maErrorTextColor == rSet.mxData->maErrorTextColor) && - (mxData->maButtonTextColor == rSet.mxData->maButtonTextColor) && - (mxData->maDefaultActionButtonTextColor == rSet.mxData->maDefaultActionButtonTextColor) && - (mxData->maActionButtonTextColor == rSet.mxData->maActionButtonTextColor) && - (mxData->maButtonRolloverTextColor == rSet.mxData->maButtonRolloverTextColor) && - (mxData->maActionButtonRolloverTextColor == rSet.mxData->maActionButtonRolloverTextColor) && - (mxData->maRadioCheckTextColor == rSet.mxData->maRadioCheckTextColor) && - (mxData->maGroupTextColor == rSet.mxData->maGroupTextColor) && - (mxData->maLabelTextColor == rSet.mxData->maLabelTextColor) && - (mxData->maWindowColor == rSet.mxData->maWindowColor) && - (mxData->maWindowTextColor == rSet.mxData->maWindowTextColor) && - (mxData->maDialogColor == rSet.mxData->maDialogColor) && - (mxData->maDialogTextColor == rSet.mxData->maDialogTextColor) && - (mxData->maWorkspaceColor == rSet.mxData->maWorkspaceColor) && - (mxData->maMonoColor == rSet.mxData->maMonoColor) && - (mxData->maFieldColor == rSet.mxData->maFieldColor) && - (mxData->maFieldTextColor == rSet.mxData->maFieldTextColor) && - (mxData->maActiveColor == rSet.mxData->maActiveColor) && - (mxData->maActiveTextColor == rSet.mxData->maActiveTextColor) && - (mxData->maActiveBorderColor == rSet.mxData->maActiveBorderColor) && - (mxData->maDeactiveColor == rSet.mxData->maDeactiveColor) && - (mxData->maDeactiveTextColor == rSet.mxData->maDeactiveTextColor) && - (mxData->maDeactiveBorderColor == rSet.mxData->maDeactiveBorderColor) && - (mxData->maMenuColor == rSet.mxData->maMenuColor) && - (mxData->maMenuBarColor == rSet.mxData->maMenuBarColor) && - (mxData->maMenuBarRolloverColor == rSet.mxData->maMenuBarRolloverColor) && - (mxData->maMenuBorderColor == rSet.mxData->maMenuBorderColor) && - (mxData->maMenuTextColor == rSet.mxData->maMenuTextColor) && - (mxData->maListBoxWindowBackgroundColor == rSet.mxData->maListBoxWindowBackgroundColor) && - (mxData->maListBoxWindowTextColor == rSet.mxData->maListBoxWindowTextColor) && - (mxData->maListBoxWindowHighlightColor == rSet.mxData->maListBoxWindowHighlightColor) && - (mxData->maListBoxWindowHighlightTextColor == rSet.mxData->maListBoxWindowHighlightTextColor) && - (mxData->maMenuBarTextColor == rSet.mxData->maMenuBarTextColor) && - (mxData->maMenuBarRolloverTextColor == rSet.mxData->maMenuBarRolloverTextColor) && - (mxData->maMenuHighlightColor == rSet.mxData->maMenuHighlightColor) && - (mxData->maMenuHighlightTextColor == rSet.mxData->maMenuHighlightTextColor) && - (mxData->maAccentColor == rSet.mxData->maAccentColor) && - (mxData->maHighlightColor == rSet.mxData->maHighlightColor) && - (mxData->maHighlightTextColor == rSet.mxData->maHighlightTextColor) && - (mxData->maTabTextColor == rSet.mxData->maTabTextColor) && - (mxData->maTabRolloverTextColor == rSet.mxData->maTabRolloverTextColor) && - (mxData->maTabHighlightTextColor == rSet.mxData->maTabHighlightTextColor) && - (mxData->maActiveTabColor == rSet.mxData->maActiveTabColor) && - (mxData->maInactiveTabColor == rSet.mxData->maInactiveTabColor) && - (mxData->maDisableColor == rSet.mxData->maDisableColor) && - (mxData->maHelpColor == rSet.mxData->maHelpColor) && - (mxData->maHelpTextColor == rSet.mxData->maHelpTextColor) && - (mxData->maLinkColor == rSet.mxData->maLinkColor) && - (mxData->maVisitedLinkColor == rSet.mxData->maVisitedLinkColor) && - (mxData->maToolTextColor == rSet.mxData->maToolTextColor) && - (mxData->maAppFont == rSet.mxData->maAppFont) && - (mxData->maHelpFont == rSet.mxData->maHelpFont) && - (mxData->maTitleFont == rSet.mxData->maTitleFont) && - (mxData->maFloatTitleFont == rSet.mxData->maFloatTitleFont) && - (mxData->maMenuFont == rSet.mxData->maMenuFont) && - (mxData->maToolFont == rSet.mxData->maToolFont) && - (mxData->maGroupFont == rSet.mxData->maGroupFont) && - (mxData->maLabelFont == rSet.mxData->maLabelFont) && - (mxData->maRadioCheckFont == rSet.mxData->maRadioCheckFont) && - (mxData->maPushButtonFont == rSet.mxData->maPushButtonFont) && - (mxData->maFieldFont == rSet.mxData->maFieldFont) && - (mxData->maIconFont == rSet.mxData->maIconFont) && - (mxData->maTabFont == rSet.mxData->maTabFont) && + (mxData->maColors == rSet.mxData->maColors) && + (mxData->maFonts == rSet.mxData->maFonts) && (mxData->meUseImagesInMenus == rSet.mxData->meUseImagesInMenus) && (mxData->mbPreferredUseImagesInMenus == rSet.mxData->mbPreferredUseImagesInMenus) && (mxData->mbSkipDisabledInMenus == rSet.mxData->mbSkipDisabledInMenus) && @@ -3226,7 +3026,7 @@ std::vector const & StyleSettings::GetInstalledIconThemes() const { if (!mxData->mIconThemeScanner) { - const_cast(this)->mxData->mIconThemeScanner = vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath()); + const_cast(this)->mxData->mIconThemeScanner.emplace(vcl::IconThemeScanner::GetStandardIconThemePath()); } return mxData->mIconThemeScanner->GetFoundIconThemes(); } @@ -3236,9 +3036,9 @@ StyleSettings::GetAutomaticallyChosenIconTheme() const { OUString desktopEnvironment = Application::GetDesktopEnvironment(); if (!mxData->mIconThemeScanner) { - const_cast(this)->mxData->mIconThemeScanner = vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath()); + const_cast(this)->mxData->mIconThemeScanner.emplace(vcl::IconThemeScanner::GetStandardIconThemePath()); } - OUString themeName = mxData->mIconThemeSelector->SelectIconThemeForDesktopEnvironment( + OUString themeName = mxData->mIconThemeSelector.SelectIconThemeForDesktopEnvironment( mxData->mIconThemeScanner->GetFoundIconThemes(), desktopEnvironment ); @@ -3271,9 +3071,9 @@ StyleSettings::DetermineIconTheme() const } if (!mxData->mIconThemeScanner) { - const_cast(this)->mxData->mIconThemeScanner = vcl::IconThemeScanner::Create(vcl::IconThemeScanner::GetStandardIconThemePath()); + const_cast(this)->mxData->mIconThemeScanner.emplace(vcl::IconThemeScanner::GetStandardIconThemePath()); } - OUString r = mxData->mIconThemeSelector->SelectIconTheme( + OUString r = mxData->mIconThemeSelector.SelectIconTheme( mxData->mIconThemeScanner->GetFoundIconThemes(), sTheme); return r; @@ -3288,7 +3088,7 @@ StyleSettings::SetHighContrastMode(bool bHighContrast ) CopyData(); mxData->mbHighContrast = bHighContrast; - mxData->mIconThemeSelector->SetUseHighContrastTheme(bHighContrast); + mxData->mIconThemeSelector.SetUseHighContrastTheme(bHighContrast); } bool @@ -3300,7 +3100,7 @@ StyleSettings::GetHighContrastMode() const void StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme) { - const bool bChanged = mxData->mIconThemeSelector->SetPreferredIconTheme(theme, bDarkIconTheme); + const bool bChanged = mxData->mIconThemeSelector.SetPreferredIconTheme(theme, bDarkIconTheme); if (bChanged) { // clear this so it is recalculated if it was selected as the automatic theme From 6e93419f46924876da1f0c52d27c03968becf046 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Fri, 29 Nov 2024 18:53:20 +0100 Subject: [PATCH 032/155] wsl-as-helper: look for perl modules in the perl that's actually used i.e. strawberry-perl-portable for the installsets and openssl The only module that needs to be installed (and only when building installation sets) is Font::TTF::Font - but only on the windows side, not in the wsl-container. in the wsl-as-helper case there are three different versions of perl involved: * one inside wsl, since autogen.sh is a perl script * one provided by git-bash - used for the majority of the build whenever a recipe uses perl * and strawberry-perl-portable for building openssl (since that is picky and needs one that handles the windows-paths a certain way) and for building the installation sets (because of similar assumptions in path mangling) Change-Id: I8374749f21c7862f2e9e77d760077e836a6e9166 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177560 Tested-by: Jenkins Reviewed-by: Christian Lohmaier Reviewed-by: Ilmari Lauhakangas --- configure.ac | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2a1063232fa4..f3ee46436bdf 100644 --- a/configure.ac +++ b/configure.ac @@ -335,6 +335,7 @@ if test -n "$WSL_DISTRO_NAME" && $(echo $PATH |grep -q mingw64); then fi STRAWBERRY_TOOLS="$formatted_path/c/bin" STRAWBERRY_PERL="$formatted_path/perl/bin/perl.exe" + STRAWBERRY_PERL_UNIX="$formatted_path_unix/perl/bin/perl.exe" AC_ARG_WITH([wsl-command], [AS_HELP_STRING([--with-wsl-command], [Specify your wsl distro command if it isn't the default/the one used with just wsl.exe – @@ -6834,14 +6835,22 @@ dnl Testing for required Perl modules dnl =================================================================== AC_MSG_CHECKING([for required Perl modules]) +dnl Digest::MD5 seems only be used for packaging, but is basically a given perl_use_string="use Cwd ; use Digest::MD5" +perl_use_string_spp="use Cwd ; use Digest::MD5" if test "$_os" = "WINNT"; then if test -n "$PKGFORMAT"; then for i in $PKGFORMAT; do case "$i" in msi) # for getting fonts versions to use in MSI - perl_use_string="$perl_use_string ; use Font::TTF::Font" + if test -n "$WSL_ONLY_AS_HELPER"; then + # in case of a wsl-as-helper build, the packaging is done using strawberry-perl + # and not the perl provided by git-bash + perl_use_string_spp="$perl_use_string_spp ; use Font::TTF::Font" + else + perl_use_string="$perl_use_string ; use Font::TTF::Font" + fi ;; esac done @@ -6852,10 +6861,38 @@ if test "$with_system_hsqldb" = "yes"; then fi if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then # OpenSSL needs that to build - perl_use_string="$perl_use_string ; use FindBin" + if test -n "$WSL_ONLY_AS_HELPER"; then + # OpenSSL is built via spp, FindBin is provided by default, but deps might change in future + perl_use_string_spp="$perl_use_string_spp ; use FindBin" + else + perl_use_string="$perl_use_string ; use FindBin" + fi fi +dnl in WSL_ONLY_AS_HELPER case the test should be done with git-bash-provided-perl and not perl from +dnl the wsl container, but that can wait until we require a module that's not provided by default if $PERL -e "$perl_use_string">/dev/null 2>&1; then AC_MSG_RESULT([all modules found]) + if test -n "$WSL_ONLY_AS_HELPER"; then + AC_MSG_CHECKING([for required Perl modules in Strawberry Perl]) + if $STRAWBERRY_PERL_UNIX -e "$perl_use_string_spp">/dev/null 2>&1; then + AC_MSG_RESULT([all modules found]) + else + AC_MSG_RESULT([failed to find some modules]) + # Find out which modules are missing. + for i in $perl_use_string_spp; do + if test "$i" != "use" -a "$i" != ";"; then + if ! $STRAWBERRY_PERL_UNIX -e "use $i;">/dev/null 2>&1; then + missing_perl_modules="$missing_perl_modules $i" + fi + fi + done + PathFormat "$(dirname $STRAWBERRY_PERL_UNIX)" + spp_cpan_command='PATH="$(cygpath.exe -up "'$STRAWBERRY_TOOLS';'$formatted_path'"):$PATH" cpanm' + AC_MSG_ERROR([ + The missing Perl modules are: $missing_perl_modules + Install them with »$spp_cpan_command $missing_perl_modules«]) + fi + fi else AC_MSG_RESULT([failed to find some modules]) # Find out which modules are missing. @@ -15788,6 +15825,7 @@ if test -n "$WSL_ONLY_AS_HELPER"; then WGET= GNUTAR="tar.exe" SHA256SUM="sha256sum.exe" + COMPRESSIONTOOL="/usr/bin/gzip" # TODO: maybe switch to strawberry-perl right away? # only openssl seems to actually require it (for Pod/Usage.pm and maybe more) PERL="perl.exe" From 2d5f8af346dfbd6b534a6dade13a92512014db00 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Fri, 29 Nov 2024 19:11:28 +0100 Subject: [PATCH 033/155] don't require pkg-config in wsl-as-helper build windows build doesn't make use of system libraries, so we only need to make autoconf/configure happy (allow it to use PKG_CHECK_MODULES macro) but for that adding the m4/mac path is enough (there's nothing mac specific, just the pkg-config macros have been added for mac initially) Change-Id: Ia5db12833c26d89b7e0dbd7009562836885d8055 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177562 Reviewed-by: Ilmari Lauhakangas Tested-by: Jenkins Reviewed-by: Christian Lohmaier --- autogen.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index 889bb463b830..7fe3e05eea0d 100755 --- a/autogen.sh +++ b/autogen.sh @@ -45,7 +45,10 @@ sub sanity_checks($) $autoconf => "autoconf is required", $aclocal => "$aclocal is required", ); - + if ($ENV{WSL_DISTRO_NAME} && $ENV{PATH} =~ /mingw64/) { + # for wsl-as-helper build we only need the m4 macros like for macOS + delete $required{'pkg-config'}; + } for my $elem (@path) { for my $app (keys %required) { if (-f "$elem/$app") { @@ -160,7 +163,8 @@ if (defined $ENV{LODE_HOME}) my $aclocal_flags = $ENV{ACLOCAL_FLAGS}; $aclocal_flags .= " -I $src_path/m4"; -$aclocal_flags .= " -I $src_path/m4/mac" if ($system eq 'Darwin'); +# the m4/mac directory provides the pkg-config macros used in configure +$aclocal_flags .= " -I $src_path/m4/mac" if ($system eq 'Darwin' || ($ENV{WSL_DISTRO_NAME} && $ENV{PATH} =~ /mingw64/)); $ENV{AUTOMAKE_EXTRA_FLAGS} = '--warnings=no-portability' if (!($system eq 'Darwin')); From 24032fea95e84111ad60da7a8401eb1672c5f10d Mon Sep 17 00:00:00 2001 From: Patrick Luby Date: Sat, 30 Nov 2024 15:34:58 -0500 Subject: [PATCH 034/155] tdf#164047 Don't include libicuuc in libraptor2-lo link list on macOS For some unkown reason (maybe due to the macOS two-level namespace?) including the $(ICU_LIBS) link flags causes a crash on startup in the macOS dynamic library loader on some versions of macOS running on Intel machines. LibreOffice 24.8.3 and earlier did not have this bug since libraptor2-lo was not linked against libicuuc. So, revert back to the LibreOffice 24.8.3 macOS build behavior. On macOS, libraptor2-lo still links successfully even without libicuuc and the bundled JavaScript HelloWorld macro still runs. So it appears that libraptor2-lo does not need any symbols in libicuuc or, if it does, libicuuc has already been loaded by the time libraptor2-lo is loaded. Change-Id: I2e09ce57b5f7aea631a522f5d33f3a4b1ebfd419 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177594 Tested-by: Jenkins Reviewed-by: Christian Lohmaier Reviewed-by: Patrick Luby --- external/redland/ExternalProject_raptor.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/external/redland/ExternalProject_raptor.mk b/external/redland/ExternalProject_raptor.mk index 259f87d2dc11..80fe12117be1 100644 --- a/external/redland/ExternalProject_raptor.mk +++ b/external/redland/ExternalProject_raptor.mk @@ -35,6 +35,7 @@ $(call gb_ExternalProject_get_state_target,raptor,build): $(if $(filter LINUX FREEBSD,$(OS)),$(strip -Wl,-z,origin -Wl,-rpath,\$$$$ORIGIN -Wl,-rpath-link,$(INSTROOT)/$(LIBO_URE_LIB_FOLDER))) \ $(if $(SYSBASE),$(if $(filter LINUX SOLARIS,$(OS)),-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -lpthread -ldl)))' \ CPPFLAGS="$(if $(SYSBASE),-I$(SYSBASE)/usr/include) $(gb_EMSCRIPTEN_CPPFLAGS)" \ + ICU_LIBS='$(if $(filter-out MACOSX,$(OS)),$(ICU_LIBS))' \ $(gb_RUN_CONFIGURE) ./configure --disable-gtk-doc \ --enable-parsers="rdfxml ntriples turtle trig guess rss-tag-soup" \ --without-www \ From e99ef8f347870b42eeef5ff94672d1f32e8c0af9 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Tue, 3 Dec 2024 09:21:16 +0100 Subject: [PATCH 035/155] Related: tdf#163902 fix version number typo in the ui file Version number was accidentally downgrade after re-saving with glade. Change-Id: I266280884739dba65e97804d542f358a20e575f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177717 Reviewed-by: Balazs Varga Tested-by: Jenkins --- sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui index 0340ffea71be..40a929fefd09 100644 --- a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui +++ b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui @@ -1,5 +1,5 @@ - + From a0db0bd2e8558bfd1b2f7491a90221280f4a38d0 Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Wed, 27 Nov 2024 14:33:49 +0100 Subject: [PATCH 036/155] Resolves tdf#127937 - Feedback for AutoCalculate Shows an icon in the statusbar if autocalc is off; clicking the icon toggles autocalc on Change-Id: I7fb3296281647583f6f761427d35dcd79282f06c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177418 Tested-by: Jenkins Reviewed-by: Heiko Tietze Reviewed-by: Mike Kaganski --- icon-themes/colibre/sc/res/calculator_red.png | Bin 0 -> 448 bytes .../colibre_svg/sc/res/calculator_red.svg | 1 + sc/Library_sc.mk | 1 + sc/inc/bitmaps.hlst | 2 + sc/inc/strings.hrc | 1 + sc/source/ui/app/acctrl.cxx | 83 ++++++++++++++++++ sc/source/ui/app/scdll.cxx | 2 + sc/source/ui/inc/acctrl.hxx | 41 +++++++++ sc/source/ui/view/preview.cxx | 1 + sc/uiconfig/scalc/statusbar/statusbar.xml | 1 + 10 files changed, 133 insertions(+) create mode 100644 icon-themes/colibre/sc/res/calculator_red.png create mode 100644 icon-themes/colibre_svg/sc/res/calculator_red.svg create mode 100644 sc/source/ui/app/acctrl.cxx create mode 100644 sc/source/ui/inc/acctrl.hxx diff --git a/icon-themes/colibre/sc/res/calculator_red.png b/icon-themes/colibre/sc/res/calculator_red.png new file mode 100644 index 0000000000000000000000000000000000000000..8580bbfa792f3c767b890149ce1d1242de224e00 GIT binary patch literal 448 zcmV;x0YCnUP)+KQEhjdp4E7uZ+^R4g=#orNI&0nHskF4&1h@;^+G z-da#>j7i$4xgCp;c)2qd2L|3ecHX|3T~Sp4@M{;KCx9V4BG5a^hvxw9FR!Qc7MIAk z3wX{ZR-B18<(oO%#F!p^K7gbEF8Ou=*J+{hh*6smaQTt|`CNlstSKIjSx2PB@xjiY z=KX35bywrmq<}bGuqy<$ZIFZm>w+v}+%7hnB2eCM5`_1lXQ-Xr0Wtu&;%M&~KOD2^ zjaz*J2`C?Kp;QoaGsJp}@RmI8rUXPD7{2ZNRGcXQyBMQ0aK;EwM5E#ioGDO3r8EO) zj1cJt-as>PrUQot)_cVd6-QpMUOmRw|1m=11A)f)lmk?Cn3ZZr!_XVo)AF*B(@M27 qs^dEd>FYawn7$<*3q%Olqw)u!%&>2Yp;TM|0000 diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 824b02714f4d..5a0aa6107562 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -378,6 +378,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/Accessibility/AccessibleTableBase \ sc/source/ui/Accessibility/AccessibleText \ sc/source/ui/Accessibility/DrawModelBroadcaster \ + sc/source/ui/app/acctrl \ sc/source/ui/app/client \ sc/source/ui/app/drwtrans \ sc/source/ui/app/inputhdl \ diff --git a/sc/inc/bitmaps.hlst b/sc/inc/bitmaps.hlst index 540e44bd0bf1..34cf808d8754 100644 --- a/sc/inc/bitmaps.hlst +++ b/sc/inc/bitmaps.hlst @@ -124,4 +124,6 @@ inline constexpr OUString RID_SVXBMP_SLIDERBUTTON = u"svx/res/slidezoombutton_10 inline constexpr OUString RID_SVXBMP_SLIDERDECREASE = u"svx/res/slidezoomout_10.png"_ustr; inline constexpr OUString RID_SVXBMP_SLIDERINCREASE = u"svx/res/slidezoomin_10.png"_ustr; +inline constexpr OUString RID_BMP_CALCULATOR_RED = u"sc/res/calculator_red.png"_ustr; + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sc/inc/strings.hrc b/sc/inc/strings.hrc index faaa5e64998b..193061581938 100644 --- a/sc/inc/strings.hrc +++ b/sc/inc/strings.hrc @@ -447,5 +447,6 @@ #define STR_CONTENT_WITH_UNKNOWN_ENCRYPTION NC_("STR_CONTENT_WITH_UNKNOWN_ENCRYPTION", "Document contains DRM content that is encrypted with an unknown encryption method. Only the un-encrypted content will be shown.") +#define STR_AUTOCALC_OFF NC_("STR_AUTOCALC_OFF", "AutoCalculate: Off\nClick to enable.") /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/app/acctrl.cxx b/sc/source/ui/app/acctrl.cxx new file mode 100644 index 000000000000..4f3ac234c3dc --- /dev/null +++ b/sc/source/ui/app/acctrl.cxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +SFX_IMPL_STATUSBAR_CONTROL(ScAutoCalculateControl, SfxBoolItem); + +ScAutoCalculateControl::ScAutoCalculateControl(sal_uInt16 _nSlotId, sal_uInt16 _nId, + StatusBar& rStb) + : SfxStatusBarControl(_nSlotId, _nId, rStb) +{ +} + +ScAutoCalculateControl::~ScAutoCalculateControl() {} + +void ScAutoCalculateControl::StateChangedAtStatusBarControl(sal_uInt16, SfxItemState eState, + const SfxPoolItem* pState) +{ + if (eState != SfxItemState::DEFAULT || SfxItemState::DISABLED == eState) + return; + + auto pItem = static_cast(pState); + if (!pItem) + { + SAL_WARN("sc", "Item wasn't a SfxBoolItem"); + return; + } + m_bIsActive = pItem->GetValue(); + + GetStatusBar().SetQuickHelpText(GetId(), m_bIsActive ? "" : ScResId(STR_AUTOCALC_OFF)); + GetStatusBar().Invalidate(); +} + +void ScAutoCalculateControl::Paint(const UserDrawEvent& rUsrEvt) +{ + vcl::RenderContext* pDev = rUsrEvt.GetRenderContext(); + tools::Rectangle aRect(rUsrEvt.GetRect()); + pDev->Erase(); + + if (!m_bIsActive) + { + const Image aImage(StockImage::Yes, RID_BMP_CALCULATOR_RED); + + Point aPt = aRect.TopLeft(); + aPt += Point((aRect.GetSize().getWidth() - aImage.GetSizePixel().getWidth()) / 2, + (aRect.GetSize().getHeight() - aImage.GetSizePixel().getHeight()) / 2); + + pDev->DrawImage(aPt, aImage); + } +} + +void ScAutoCalculateControl::Click() +{ + if (!m_bIsActive) + SfxStatusBarControl::Click(); // exec FID_AUTO_CALC and toggle AutoCalc on +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 694e7afdb666..c08e6a47c5f8 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -86,6 +86,7 @@ #include #include +#include OUString ScResId(TranslateId aId) { @@ -173,6 +174,7 @@ void ScDLL::Init() SvxZoomSliderControl ::RegisterControl(SID_ATTR_ZOOMSLIDER, pMod); SvxModifyControl ::RegisterControl(SID_DOC_MODIFIED, pMod); XmlSecStatusBarControl ::RegisterControl( SID_SIGNATURE, pMod ); + ScAutoCalculateControl ::RegisterControl(FID_AUTO_CALC, pMod); SvxPosSizeStatusBarControl ::RegisterControl(SID_ATTR_SIZE, pMod); diff --git a/sc/source/ui/inc/acctrl.hxx b/sc/source/ui/inc/acctrl.hxx new file mode 100644 index 000000000000..cfc8338286ac --- /dev/null +++ b/sc/source/ui/inc/acctrl.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include + +class ScAutoCalculateControl final : public SfxStatusBarControl +{ +public: + ScAutoCalculateControl(sal_uInt16 nSlotId, sal_uInt16 nId, StatusBar& rStb); + virtual ~ScAutoCalculateControl() override; + + virtual void StateChangedAtStatusBarControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; + virtual void Paint(const UserDrawEvent& rUsrEvt) override; + virtual void Click() override; + + SFX_DECL_STATUSBAR_CONTROL(); + +private: + bool m_bIsActive; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 51699f6aa4c7..4a96b4c61d6f 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -896,6 +896,7 @@ void ScPreview::StaticInvalidate() SfxBindings& rBindings = pViewFrm->GetBindings(); rBindings.Invalidate(SID_STATUS_DOCPOS); + rBindings.Invalidate(FID_AUTO_CALC); rBindings.Invalidate(SID_ROWCOL_SELCOUNT); rBindings.Invalidate(SID_STATUS_PAGESTYLE); rBindings.Invalidate(SID_PREVIEW_PREVIOUS); diff --git a/sc/uiconfig/scalc/statusbar/statusbar.xml b/sc/uiconfig/scalc/statusbar/statusbar.xml index fe4994249b62..e148b28628d1 100644 --- a/sc/uiconfig/scalc/statusbar/statusbar.xml +++ b/sc/uiconfig/scalc/statusbar/statusbar.xml @@ -25,6 +25,7 @@ + From 02b2dce99c50d2f48de454a5aba1defc7f67ac78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Mon, 2 Dec 2024 12:14:06 +0000 Subject: [PATCH 037/155] cid#1636522 Missing move assignment operator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2d5f4e69b5cb9205743484c23443df2084da4fad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177721 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- filter/source/msfilter/svdfppt.cxx | 18 ------------------ include/filter/msfilter/svdfppt.hxx | 7 +------ 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 472a1e106f40..20d3e5d9bc96 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -4413,24 +4413,6 @@ PPTParaPropSet::PPTParaPropSet() mxParaSet->mnHasAnm = 1; } -PPTParaPropSet::PPTParaPropSet( PPTParaPropSet const & rParaPropSet ) -{ - mxParaSet = rParaPropSet.mxParaSet; -} - -PPTParaPropSet::~PPTParaPropSet() -{ -} - -PPTParaPropSet& PPTParaPropSet::operator=( const PPTParaPropSet& rParaPropSet ) -{ - if ( this != &rParaPropSet ) - { - mxParaSet = rParaPropSet.mxParaSet; - } - return *this; -} - PPTCharPropSet::PPTCharPropSet(sal_uInt32 nParagraph) : mnOriginalTextPos(0) , mnParagraph(nParagraph) diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index 094c22a5918f..f1dfa6332c7e 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -904,12 +904,7 @@ struct ImplPPTParaPropSet final : public salhelper::SimpleReferenceObject struct PPTParaPropSet { rtl::Reference mxParaSet; - - PPTParaPropSet(); - PPTParaPropSet( PPTParaPropSet const & rParaPropSet ); - ~PPTParaPropSet(); - - PPTParaPropSet& operator=( const PPTParaPropSet& rParaPropSet ); + PPTParaPropSet(); }; struct ImplPPTCharPropSet From 1699d29fca758944a5e477b05e61b5f42cc8907c Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Tue, 3 Dec 2024 10:39:36 +0100 Subject: [PATCH 038/155] tdf#164137 - Fix Accessibility sidebar gives no warnings We need to check rather the update button is visible instead of the expanders. Regression from commit: 13ac356a32f279a3fd542d62c12e58abe3d3ad30 (tdf#164048 sw a11y: improve error/warning levels with...) Change-Id: I63fb5906ad2f7bb13bc5822c284861a419897c4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177723 Tested-by: Jenkins Reviewed-by: Gabor Kelemen Tested-by: Gabor Kelemen --- sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx index d5f5f264d657..3446176bdbbe 100644 --- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx +++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx @@ -307,7 +307,7 @@ void A11yCheckIssuesPanel::addEntryForGroup(AccessibilityCheckGroups eGroup, void A11yCheckIssuesPanel::populateIssues() { - if (!mpDoc || !(m_xLevelExpanders[0]->is_visible() || m_xLevelExpanders[1]->is_visible())) + if (!mpDoc || mxUpdateBox->is_visible()) return; SfxViewShell* pViewShell = SfxViewShell::Current(); From e3dd37ce0ce4251dd0f166659c5bd94a9e3008b9 Mon Sep 17 00:00:00 2001 From: Mohit Marathe Date: Sat, 30 Nov 2024 10:59:45 +0530 Subject: [PATCH 039/155] tdf#163403 fix comments not showing in generic backend Change-Id: I21345049d8137e43cc3e50b0b1bcc8d41a123458 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177582 Tested-by: Jenkins Reviewed-by: Sarper Akdemir --- sw/uiconfig/swriter/ui/commentwidget.ui | 1 - 1 file changed, 1 deletion(-) diff --git a/sw/uiconfig/swriter/ui/commentwidget.ui b/sw/uiconfig/swriter/ui/commentwidget.ui index 2bac595252fe..53044de84baa 100644 --- a/sw/uiconfig/swriter/ui/commentwidget.ui +++ b/sw/uiconfig/swriter/ui/commentwidget.ui @@ -9,7 +9,6 @@ - 10 True False 5 From b83387a55410a0f7701b3cb7898ef15a36668e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Wed, 11 Sep 2024 17:27:28 +0200 Subject: [PATCH 040/155] add OpenGL transitions even when OpenGL is not available This is needed for online, so the sidebar fills all the available transitions. Change-Id: Id3af1ed0272305fe7f1ab2d5dddd967276bbbb3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177727 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- postprocess/CustomTarget_registry.mk | 2 -- 1 file changed, 2 deletions(-) diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk index 4be442c49ae4..6b96ef28c36d 100644 --- a/postprocess/CustomTarget_registry.mk +++ b/postprocess/CustomTarget_registry.mk @@ -408,12 +408,10 @@ postprocess_FILES_onlineupdate := \ $(call gb_XcuModuleTarget_get_target,extensions/source/update/check)/org/openoffice/Office/Jobs-onlineupdate.xcu endif -ifeq ($(ENABLE_OPENGL_TRANSITIONS),TRUE) postprocess_XCDS += ogltrans.xcd postprocess_DEPS_ogltrans := main postprocess_FILES_ogltrans := \ $(postprocess_MOD)/org/openoffice/Office/Impress-ogltrans.xcu -endif ifeq ($(ENABLE_PDFIMPORT),TRUE) postprocess_XCDS += pdfimport.xcd From db40f96f617f579486328ce4ed11f4c0a9540789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 3 Dec 2024 10:49:49 +0000 Subject: [PATCH 041/155] Resolves: tdf#139700 use WB_FLATVALUESET to get tracking highlights MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit a problem since: commit 53d2a0390473319555f244f0ac3cf9a44b5ac7a0 CommitDate: Tue Jan 14 13:45:44 2020 +0100 weld PageSizePopup Change-Id: I5e55d1972a205b7bf1ec6f6bdfd2d8cd22e13eca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177728 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/uibase/sidebar/PageSizeControl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index 33785c007832..c8be134350bb 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -90,7 +90,7 @@ PageSizeControl::PageSizeControl(PageSizePopup* pControl, weld::Widget* pParent) maPaperList.push_back( PAPER_LETTER ); maPaperList.push_back( PAPER_LEGAL ); - mxSizeValueSet->SetStyle( mxSizeValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT ); + mxSizeValueSet->SetStyle( mxSizeValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_FLATVALUESET ); mxSizeValueSet->SetColor( Application::GetSettings().GetStyleSettings().GetMenuColor() ); sal_uInt16 nSelectedItem = 0; From 63594c62024b894251e1c88d5f65980c553dec4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 3 Dec 2024 12:54:24 +0000 Subject: [PATCH 042/155] crashtesting: fix failure of forum-en-13617.odt to reload from .doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I907e282c9e7b75abca9a4c91ba12a2c57fc45f40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177733 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- starmath/source/mathtype.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index d84a11e52ceb..7a32c0be86fe 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -3120,6 +3120,7 @@ void MathType::HandleMath(SmNode *pNode) void MathType::HandleAttributes(SmNode *pNode,int nLevel) { + sal_uInt64 nOldInsertion = nInsertion; int nOldPending = 0; SmNode *pTemp = nullptr; SmTextNode *pIsText = nullptr; @@ -3193,8 +3194,7 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel) if ((nInsertion != 0) && nullptr != (pTemp = pNode->GetSubNode(0))) { auto nPos = pS->Tell(); - nInsertion--; - pS->Seek(nInsertion); + pS->Seek(nInsertion - 1); switch(pTemp->GetToken().eType) { case TACUTE: //Not Exportable @@ -3247,6 +3247,7 @@ void MathType::HandleAttributes(SmNode *pNode,int nLevel) pS->Seek(nPos); } } + nInsertion = nOldInsertion; } void MathType::HandleText(SmNode *pNode) From 3e6ad944ac6a7ccd465ed7a862157c467730f86b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 3 Dec 2024 11:07:23 +0000 Subject: [PATCH 043/155] don't bother passing const std::[u16]string_view by reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I49477c20849dd99118d5935c0f1576429648bfca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177734 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- cui/source/options/optcolor.cxx | 8 ++++---- desktop/source/app/updater.cxx | 4 ++-- filter/source/pdf/pdfexport.cxx | 2 +- filter/source/pdf/pdfexport.hxx | 2 +- include/vbahelper/vbahelper.hxx | 2 +- include/vcl/themecolors.hxx | 2 +- sc/inc/compiler.hxx | 2 +- sc/qa/unit/helper/qahelper.cxx | 6 +++--- sc/qa/unit/helper/qahelper.hxx | 6 +++--- sc/source/core/tool/compiler.cxx | 2 +- sd/qa/unit/uiimpress.cxx | 9 ++++----- sw/qa/inc/swmodeltestbase.hxx | 2 +- sw/qa/unit/swmodeltestbase.cxx | 2 +- test/source/a11y/accessibletestbase.cxx | 2 +- vbahelper/source/vbahelper/vbahelper.cxx | 2 +- xmloff/source/draw/shapeexport.cxx | 2 +- xmlsecurity/source/helper/ooxmlsecexporter.cxx | 7 +++---- 17 files changed, 30 insertions(+), 32 deletions(-) diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index 8e008e2c8069..1f2d455a1cf0 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -278,9 +278,9 @@ private: void SetLinks(Link const&, Link const&, Link const&); - void Update (ColorConfigValue const&, const std::u16string_view&, + void Update (ColorConfigValue const&, std::u16string_view, css::uno::Reference const&); - void Update (ExtendedColorConfigValue const&, const std::u16string_view&, + void Update (ExtendedColorConfigValue const&, std::u16string_view, css::uno::Reference const&); void ColorChanged (ColorConfigValue&); void ColorChanged (ExtendedColorConfigValue&); @@ -387,7 +387,7 @@ void ColorConfigWindow_Impl::Entry::SetLinks(Link const& } // updates a default color config entry -void ColorConfigWindow_Impl::Entry::Update(ColorConfigValue const& rValue, const std::u16string_view& rConfigPath, +void ColorConfigWindow_Impl::Entry::Update(ColorConfigValue const& rValue, std::u16string_view rConfigPath, css::uno::Reference const& xReadWriteAccess) { Color aColor(rValue.nColor); @@ -418,7 +418,7 @@ void ColorConfigWindow_Impl::Entry::Update(ColorConfigValue const& rValue, const } // updates an extended color config entry -void ColorConfigWindow_Impl::Entry::Update(ExtendedColorConfigValue const& rValue, const std::u16string_view& rConfigPath, +void ColorConfigWindow_Impl::Entry::Update(ExtendedColorConfigValue const& rValue, std::u16string_view rConfigPath, css::uno::Reference const& xReadWriteAccess) { Color aColor(rValue.getColor()); diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx index 39699b90dec5..a82743627d4a 100644 --- a/desktop/source/app/updater.cxx +++ b/desktop/source/app/updater.cxx @@ -403,9 +403,9 @@ public: } }; -OUString toOUString(const std::string_view& rStr) +OUString toOUString(std::string_view str) { - return OUString::fromUtf8(rStr); + return OUString::fromUtf8(str); } update_file parse_update_file(orcus::json::node& rNode) diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 8c42ebb7a5fa..5956933154c6 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -361,7 +361,7 @@ static OUString getMimetypeForDocument( const Reference< XComponentContext >& xC } uno::Reference -PDFExport::GetCertificateFromSubjectName(const std::u16string_view& rSubjectName) const +PDFExport::GetCertificateFromSubjectName(std::u16string_view rSubjectName) const { uno::Reference xSEInitializer = xml::crypto::SEInitializer::create(mxContext); diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx index 8bfd1c363038..0e8e7fc429bc 100644 --- a/filter/source/pdf/pdfexport.hxx +++ b/filter/source/pdf/pdfexport.hxx @@ -66,7 +66,7 @@ private: void ImplWriteWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize ); void ImplWriteTiledWatermark( vcl::PDFWriter& rWriter, const Size& rPageSize ); - css::uno::Reference GetCertificateFromSubjectName(const std::u16string_view& rSubjectName) const; + css::uno::Reference GetCertificateFromSubjectName(std::u16string_view rSubjectName) const; public: diff --git a/include/vbahelper/vbahelper.hxx b/include/vbahelper/vbahelper.hxx index 5dd3e00dbdc1..82c676710263 100644 --- a/include/vbahelper/vbahelper.hxx +++ b/include/vbahelper/vbahelper.hxx @@ -131,7 +131,7 @@ namespace ooo::vba VBAHELPER_DLLPUBLIC bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue ); VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const OUString& aName, const css::uno::Any& aValue ); - VBAHELPER_DLLPUBLIC bool executeRunTimeLibrary(const std::u16string_view& rSbRtl_command, + VBAHELPER_DLLPUBLIC bool executeRunTimeLibrary(std::u16string_view rSbRtl_command, SbxArray* pParameters); class VBAHELPER_DLLPUBLIC Millimeter diff --git a/include/vcl/themecolors.hxx b/include/vcl/themecolors.hxx index 8cadf21f552d..fec422adbac9 100644 --- a/include/vcl/themecolors.hxx +++ b/include/vcl/themecolors.hxx @@ -23,7 +23,7 @@ public: static bool IsThemeLoaded() { return m_bIsThemeLoaded; } static void SetThemeLoaded(bool bLoaded) { m_bIsThemeLoaded = bLoaded; } - static bool IsAutomaticTheme(const std::u16string_view& rThemeName) + static bool IsAutomaticTheme(std::u16string_view rThemeName) { return rThemeName == svtools::AUTOMATIC_COLOR_SCHEME; } diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 04aa7ea18d2d..046761650847 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -331,7 +331,7 @@ private: bool NextNewToken(bool bInArray); bool ToUpperAsciiOrI18nIsAscii( OUString& rUpper, const OUString& rOrg ) const; - short GetPossibleParaCount( const std::u16string_view& rLambdaFormula ) const; + short GetPossibleParaCount( std::u16string_view rLambdaFormula ) const; virtual void SetError(FormulaError nError) override; diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index b24072714cb5..b58bee67cb88 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -290,7 +290,7 @@ void ScModelTestBase::goToCell(const OUString& rCell) dispatchCommand(mxComponent, u".uno:GoToCell"_ustr, aArgs); } -void ScModelTestBase::typeString(const std::u16string_view& rStr) +void ScModelTestBase::typeString(std::u16string_view rStr) { ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); for (const char16_t c : rStr) @@ -301,7 +301,7 @@ void ScModelTestBase::typeString(const std::u16string_view& rStr) } } -void ScModelTestBase::insertStringToCell(const OUString& rCell, const std::u16string_view& rStr) +void ScModelTestBase::insertStringToCell(const OUString& rCell, std::u16string_view rStr) { goToCell(rCell); @@ -313,7 +313,7 @@ void ScModelTestBase::insertStringToCell(const OUString& rCell, const std::u16st Scheduler::ProcessEventsToIdle(); } -void ScModelTestBase::insertArrayToCell(const OUString& rCell, const std::u16string_view& rStr) +void ScModelTestBase::insertArrayToCell(const OUString& rCell, std::u16string_view rStr) { goToCell(rCell); diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 6eeb111ad25b..a2d46916a521 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -179,9 +179,9 @@ public: void testFormats(ScDocument* pDoc,std::u16string_view sFormat); void goToCell(const OUString& rCell); - void typeString(const std::u16string_view& rStr); - void insertStringToCell(const OUString& rCell, const std::u16string_view& rStr); - void insertArrayToCell(const OUString& rCell, const std::u16string_view& rStr); + void typeString(std::u16string_view rStr); + void insertStringToCell(const OUString& rCell, std::u16string_view rStr); + void insertArrayToCell(const OUString& rCell, std::u16string_view rStr); void insertNewSheet(ScDocument& rDoc); void executeAutoSum(); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 2425b311844c..8b5c948e9779 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -4412,7 +4412,7 @@ bool ScCompiler::ToUpperAsciiOrI18nIsAscii( OUString& rUpper, const OUString& rO } } -short ScCompiler::GetPossibleParaCount( const std::u16string_view& rLambdaFormula ) const +short ScCompiler::GetPossibleParaCount( std::u16string_view rLambdaFormula ) const { sal_Unicode cSep = mxSymbols->getSymbolChar(ocSep); sal_Unicode cOpen = mxSymbols->getSymbolChar(ocOpen); diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index d99098edd6fb..a66c008f4db4 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -72,9 +72,9 @@ public: } void checkCurrentPageNumber(sal_uInt16 nNum); - void typeString(SdXImpressDocument* rImpressDocument, const std::u16string_view& rStr); + void typeString(SdXImpressDocument* rImpressDocument, std::u16string_view rStr); void typeKey(SdXImpressDocument* rImpressDocument, const sal_uInt16 nKey); - void insertStringToObject(sal_uInt16 nObj, const std::u16string_view& rStr, bool bUseEscape); + void insertStringToObject(sal_uInt16 nObj, std::u16string_view rStr, bool bUseEscape); sd::slidesorter::SlideSorterViewShell* getSlideSorterViewShell(); void lcl_search(const OUString& rKey, bool bFindAll = false, bool bBackwards = false); }; @@ -98,8 +98,7 @@ void SdUiImpressTest::typeKey(SdXImpressDocument* rImpressDocument, const sal_uI Scheduler::ProcessEventsToIdle(); } -void SdUiImpressTest::typeString(SdXImpressDocument* rImpressDocument, - const std::u16string_view& rStr) +void SdUiImpressTest::typeString(SdXImpressDocument* rImpressDocument, std::u16string_view rStr) { for (const char16_t c : rStr) { @@ -109,7 +108,7 @@ void SdUiImpressTest::typeString(SdXImpressDocument* rImpressDocument, } } -void SdUiImpressTest::insertStringToObject(sal_uInt16 nObj, const std::u16string_view& rStr, +void SdUiImpressTest::insertStringToObject(sal_uInt16 nObj, std::u16string_view rStr, bool bUseEscape) { auto pImpressDocument = dynamic_cast(mxComponent.get()); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 3ff243c2c11c..e3d1a895a8b4 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -251,7 +251,7 @@ protected: */ xmlDocUniquePtr WrapReqifFromTempFile(); - void emulateTyping(const std::u16string_view& rStr); + void emulateTyping(std::u16string_view rStr); private: void loadURL(OUString const& rURL, const char* pPassword = nullptr); diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 88156bb58eb0..69aab12a38ba 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -488,7 +488,7 @@ xmlDocUniquePtr SwModelTestBase::WrapReqifFromTempFile() return pXmlDoc; } -void SwModelTestBase::emulateTyping(const std::u16string_view& rStr) +void SwModelTestBase::emulateTyping(std::u16string_view rStr) { SwXTextDocument* pTextDoc = getSwTextDoc(); for (const char16_t c : rStr) diff --git a/test/source/a11y/accessibletestbase.cxx b/test/source/a11y/accessibletestbase.cxx index dc34855a3935..692f72a474fc 100644 --- a/test/source/a11y/accessibletestbase.cxx +++ b/test/source/a11y/accessibletestbase.cxx @@ -530,7 +530,7 @@ test::AccessibleTestBase::awaitDialog(const std::u16string_view name, maIdleHandler.Stop(); } - ListenerHelper(const std::u16string_view& name, std::function callback, + ListenerHelper(std::u16string_view name, std::function callback, bool bAutoClose) : mbWaitingForDialog(true) , msName(name) diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index 04ee85e3c2bf..5a39f691eeea 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -747,7 +747,7 @@ void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, con pProp[ nLength ].Value = aValue; } -bool executeRunTimeLibrary(const std::u16string_view& rSbRtl_command, SbxArray* pParameters) +bool executeRunTimeLibrary(std::u16string_view rSbRtl_command, SbxArray* pParameters) { StarBASIC* pBasic = dynamic_cast< StarBASIC* >(StarBASIC::GetActiveModule()->GetParent()); if (!pBasic) diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 1cebc8631334..9d9cb7506b14 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -3411,7 +3411,7 @@ lcl_StoreMediaAndGetURL(SvXMLExport & rExport, namespace { -void ExportGraphicPreview(const uno::Reference& xGraphic, SvXMLExport& rExport, const std::u16string_view& rPrefix, const std::u16string_view& rExtension, const OUString& rMimeType) +void ExportGraphicPreview(const uno::Reference& xGraphic, SvXMLExport& rExport, std::u16string_view rPrefix, std::u16string_view rExtension, const OUString& rMimeType) { const bool bExportEmbedded(rExport.getExportFlags() & SvXMLExportFlags::EMBEDDED); diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx b/xmlsecurity/source/helper/ooxmlsecexporter.cxx index 874fc4079c28..f8a870d16860 100644 --- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx +++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx @@ -94,10 +94,9 @@ bool OOXMLSecExporter::Impl::isOOXMLDenylist(std::u16string_view rStreamName) // Don't attempt to sign other signatures for now. u"/_xmlsignatures" }; // Just check the prefix, as we don't care about the content type part of the stream name. - return std::any_of(vDenylist.begin(), vDenylist.end(), - [&](const std::u16string_view& rLiteral) { - return o3tl::starts_with(rStreamName, rLiteral); - }); + return std::any_of(vDenylist.begin(), vDenylist.end(), [&](std::u16string_view rLiteral) { + return o3tl::starts_with(rStreamName, rLiteral); + }); } bool OOXMLSecExporter::Impl::isOOXMLRelationDenylist(const OUString& rRelationName) From d7736eb6aebbbd27d6aa5ec7b7631826e3c22f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 3 Dec 2024 13:17:29 +0000 Subject: [PATCH 044/155] fix --disable-scripting build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0b0113d5e3a1652280e0d84c1beba7c572ded191 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177736 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- cui/Library_cui.mk | 5 +++-- cui/source/factory/dlgfact.cxx | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 4942d1548524..5745cf821341 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -32,7 +32,7 @@ $(eval $(call gb_Library_use_sdk_api,cui)) $(eval $(call gb_Library_use_libraries,cui,\ $(call gb_Helper_optional,AVMEDIA,avmedia) \ - basctl \ + $(call gb_Helper_optional,SCRIPTING,basctl) \ basegfx \ comphelper \ cppu \ @@ -148,7 +148,8 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/dialogs/GraphicTestsDialog \ cui/source/dialogs/ImageViewerDialog \ cui/source/dialogs/scriptdlg \ - cui/source/dialogs/MacroManagerDialog \ + $(call gb_Helper_optional,SCRIPTING, \ + cui/source/dialogs/MacroManagerDialog) \ cui/source/dialogs/SignatureLineDialogBase \ cui/source/dialogs/SignatureLineDialog \ cui/source/dialogs/SignSignatureLineDialog \ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 2018878eaefa..bb1561f4803c 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1003,13 +1003,31 @@ VclPtr AbstractDialogFactory_Impl::CreateMacroManagerDialog(weld::Window* pParent, const Reference& rxFrame) { +#if HAVE_FEATURE_SCRIPTING return VclPtr::Create( std::make_shared(pParent, rxFrame)); +#else + (void)pParent; + (void)rxFrame; + return nullptr; +#endif } -OUString AbstractMacroManagerDialog_Impl::GetScriptURL() const { return m_xDlg->GetScriptURL(); } +OUString AbstractMacroManagerDialog_Impl::GetScriptURL() const +{ +#if HAVE_FEATURE_SCRIPTING + return m_xDlg->GetScriptURL(); +#else + return OUString(); +#endif +} -void AbstractMacroManagerDialog_Impl::LoadLastUsedMacro() const { m_xDlg->LoadLastUsedMacro(); } +void AbstractMacroManagerDialog_Impl::LoadLastUsedMacro() const +{ +#if HAVE_FEATURE_SCRIPTING + m_xDlg->LoadLastUsedMacro(); +#endif +} VclPtr AbstractDialogFactory_Impl::CreateSvxScriptOrgDialog(weld::Window* pParent, const OUString& rLanguage) From 6d96021511629812fe1d0af67b09c330c749ff3c Mon Sep 17 00:00:00 2001 From: Martin Srebotnjak Date: Tue, 3 Dec 2024 15:36:28 +0100 Subject: [PATCH 045/155] Update git submodules * Update translations from branch 'master' to 93f61b8759efdb510d3e24eac33e10c8231aedf8 - Updated Slovenian translation Change-Id: I0f24e5a42d5d8650fec3dc21d199882691bbdbba --- translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations b/translations index 685db476dad2..93f61b8759ef 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit 685db476dad288f6635917ae0ca05d5369c64c15 +Subproject commit 93f61b8759efdb510d3e24eac33e10c8231aedf8 From 0b42fcdb3733f6919e9d221380c0fe27554a0d57 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 3 Dec 2024 10:06:27 +0100 Subject: [PATCH 046/155] external/boost: Avoid some -Wdeprecated-variadic-comma-omission MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...new with GCC 15 trunk -std=c++26 since "c++: Implement C++26 P3176R1 - The Oxford variadic comma", > In file included from workdir/UnpackedTarball/boost/boost/rational.hpp:82, > from source/external/boost/include/boost/rational.hpp:30, > from source/tools/source/generic/fract.cxx:32: > workdir/UnpackedTarball/boost/boost/integer/common_factor_rt.hpp:66:56: error: omission of ‘,’ before varargs ‘...’ is deprecated in C++26 [-Werror=deprecated-variadic-comma-omission] > 66 | inline constexpr void constexpr_swap(T&a, U& b...) BOOST_GCD_NOEXCEPT(T) > | ^~~ > | , and > In file included from workdir/UnpackedTarball/boost/boost/move/unique_ptr.hpp:24, > from workdir/UnpackedTarball/boost/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp:18, > from workdir/UnpackedTarball/boost/boost/spirit/home/classic/core/non_terminal/grammar.hpp:21, > from workdir/UnpackedTarball/boost/boost/spirit/home/classic/core.hpp:42, > from workdir/UnpackedTarball/boost/boost/spirit/home/classic.hpp:24, > from workdir/UnpackedTarball/boost/boost/spirit/include/classic.hpp:11, > from source/external/boost/include/boost/spirit/include/classic.hpp:30, > from sdext/source/pdfimport/pdfparse/pdfparse.cxx:23: > workdir/UnpackedTarball/boost/boost/move/detail/unique_ptr_meta_utils.hpp:500:39: error: omission of ‘,’ before varargs ‘...’ is deprecated in C++26 [-Werror=deprecated-variadic-comma-omission] > 500 | struct is_unary_function_impl > | ^~~ > | , Change-Id: I56856e274a7c577c53d96343992bb79d4c3d602e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177730 Reviewed-by: Stephan Bergmann Tested-by: Jenkins --- ...-before-ellipsis-in-constexpr_swap.patch.2 | 28 ++++++++++++++ ...variadic-comma-omission-with-GCC-1.patch.2 | 38 +++++++++++++++++++ external/boost/UnpackedTarball_boost.mk | 6 +++ 3 files changed, 72 insertions(+) create mode 100644 external/boost/0001-Add-a-comma-before-ellipsis-in-constexpr_swap.patch.2 create mode 100644 external/boost/0001-Avoid-Wdeprecated-variadic-comma-omission-with-GCC-1.patch.2 diff --git a/external/boost/0001-Add-a-comma-before-ellipsis-in-constexpr_swap.patch.2 b/external/boost/0001-Add-a-comma-before-ellipsis-in-constexpr_swap.patch.2 new file mode 100644 index 000000000000..3c3c8755fbfa --- /dev/null +++ b/external/boost/0001-Add-a-comma-before-ellipsis-in-constexpr_swap.patch.2 @@ -0,0 +1,28 @@ +From 2dfe66886d71b9a341433ea8b6ff225cc07da80b Mon Sep 17 00:00:00 2001 +From: Andrey Semashev +Date: Mon, 2 Dec 2024 19:22:20 +0300 +Subject: Add a comma before ellipsis in constexpr_swap. + +gcc 15 complains that the comma is required before vararg ellipsis. + +Fixes https://github.com/boostorg/integer/issues/35. +--- + include/boost/integer/common_factor_rt.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/boost/integer/common_factor_rt.hpp b/include/boost/integer/common_factor_rt.hpp +index d6765d4..817682f 100644 +--- a/include/boost/integer/common_factor_rt.hpp ++++ b/include/boost/integer/common_factor_rt.hpp +@@ -64,7 +64,7 @@ namespace boost { + return a.swap(b); + } + template +- inline constexpr void constexpr_swap(T&a, U& b...) BOOST_GCD_NOEXCEPT(T) ++ inline constexpr void constexpr_swap(T& a, U& b, ...) BOOST_GCD_NOEXCEPT(T) + { + T t(static_cast(a)); + a = static_cast(b); +-- +2.47.1 + diff --git a/external/boost/0001-Avoid-Wdeprecated-variadic-comma-omission-with-GCC-1.patch.2 b/external/boost/0001-Avoid-Wdeprecated-variadic-comma-omission-with-GCC-1.patch.2 new file mode 100644 index 000000000000..e7ebc6e18b62 --- /dev/null +++ b/external/boost/0001-Avoid-Wdeprecated-variadic-comma-omission-with-GCC-1.patch.2 @@ -0,0 +1,38 @@ +From aa25af1928cc275537276c1a50e6ba49333a3aec Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Mon, 2 Dec 2024 19:06:25 +0100 +Subject: Avoid -Wdeprecated-variadic-comma-omission with GCC 15 trunk + -std=c++26 + +...since + +"c++: Implement C++26 P3176R1 - The Oxford variadic comma" +--- + include/boost/move/detail/unique_ptr_meta_utils.hpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/boost/move/detail/unique_ptr_meta_utils.hpp b/include/boost/move/detail/unique_ptr_meta_utils.hpp +index 4c6aeb5..27154e0 100644 +--- a/include/boost/move/detail/unique_ptr_meta_utils.hpp ++++ b/include/boost/move/detail/unique_ptr_meta_utils.hpp +@@ -497,7 +497,7 @@ struct is_unary_function_impl + { static const bool value = true; }; + + template +-struct is_unary_function_impl ++struct is_unary_function_impl + { static const bool value = true; }; + + #else // BOOST_MOVE_TT_TEST_MSC_FUNC_SIGS +@@ -519,7 +519,7 @@ struct is_unary_function_impl + { static const bool value = true; }; + + template +-struct is_unary_function_impl ++struct is_unary_function_impl + { static const bool value = true; }; + + #endif +-- +2.47.1 + diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk index 23b9a3c23dc8..3a8033bbea1e 100644 --- a/external/boost/UnpackedTarball_boost.mk +++ b/external/boost/UnpackedTarball_boost.mk @@ -36,6 +36,12 @@ boost_patches += Wundef.patch.0 boost_patches += boost.spirit.noreturn.patch +boost_patches += 0001-Add-a-comma-before-ellipsis-in-constexpr_swap.patch.2 + +# Sent upstream as "Avoid +# -Wdeprecated-variadic-comma-omission with GCC 15 trunk -std=c++26": +boost_patches += 0001-Avoid-Wdeprecated-variadic-comma-omission-with-GCC-1.patch.2 + $(eval $(call gb_UnpackedTarball_UnpackedTarball,boost)) $(eval $(call gb_UnpackedTarball_set_tarball,boost,$(BOOST_TARBALL))) From dcf48b9d2dab74412b024ec1a3c12a6348f0c5f1 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Mon, 25 Nov 2024 19:41:37 +0530 Subject: [PATCH 047/155] Revert "sc: prefill easy condition dialog with editing condition data" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 598e93b1b11f4cdff96f6117c2a7d35f3698fd23. Change-Id: Ifdbc8920f232d388eac2a07cd6e2e2dece204a7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177283 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177334 Tested-by: Jenkins --- sc/source/ui/condformat/condformateasydlg.cxx | 29 ++----------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 677d10c3b9d5..372db3791df5 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -283,35 +283,10 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, aRange.Format(sRangeString, ScRefFlags::VALID, mrDocument, mrDocument.GetAddressConvention()); mxRangeEntry->SetText(sRangeString); - OUString sStyleName; - if (format) - { - const ScFormatEntry* entry = format->GetEntry(mnEntryIndex); - if (!entry) - return; - ScFormatEntry::Type type = entry->GetType(); - if (type == ScFormatEntry::Type::Condition) - { - const ScCondFormatEntry* condEntry = static_cast(entry); - sStyleName = condEntry->GetStyle(); - if (mxNumberEntry->get_visible()) - mxNumberEntry->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 0)); - if (mxNumberEntry2->get_visible()) - mxNumberEntry2->set_text(condEntry->GetExpression(aRange.GetTopLeftCorner(), 1)); - } - else if (type == ScFormatEntry::Type::Date) - { - const ScCondDateFormatEntry* dateEntry - = static_cast(entry); - sStyleName = dateEntry->GetStyleName(); - } - } - - StartListening(*mrDocument.GetStyleSheetPool(), DuplicateHandling::Prevent); + StartListening(*(mrDocument.GetStyleSheetPool()), DuplicateHandling::Prevent); ScCondFormatHelper::FillStyleListBox(mrDocument, *mxStyles); - mxStyles->set_active_text(sStyleName); - StyleSelectHdl(*mxStyles); + mxStyles->set_active(1); mxWdPreviewWin->show(); } From 36108acc124efd73a5e69f5780e8e8220cf0875c Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Mon, 25 Nov 2024 19:42:55 +0530 Subject: [PATCH 048/155] Revert "sc: now conditions can be edited from easy conditional format dialog" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8115c82f1f7f2621e2d99c93e1a3b2196279602a. Change-Id: Ie3f389561ee8f734ac76b3dec352382281f91c30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177284 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177335 Tested-by: Pranam Lashkari --- sc/inc/document.hxx | 7 +-- sc/inc/scabstdlg.hxx | 4 +- sc/qa/uitest/conditional_format/tdf100793.py | 9 ++- sc/qa/uitest/conditional_format/tdf96453.py | 1 + sc/sdi/cellsh.sdi | 4 +- sc/source/core/data/documen2.cxx | 2 - sc/source/ui/attrdlg/scdlgfact.cxx | 9 ++- sc/source/ui/attrdlg/scdlgfact.hxx | 3 +- sc/source/ui/condformat/condformateasydlg.cxx | 20 +------ sc/source/ui/condformat/condformatmgr.cxx | 57 ++++++++----------- sc/source/ui/inc/condformateasydlg.hxx | 2 - sc/source/ui/inc/condformatmgr.hxx | 7 +-- sc/source/ui/view/cellsh1.cxx | 16 +++++- sc/source/ui/view/cellsh3.cxx | 13 +---- 14 files changed, 62 insertions(+), 92 deletions(-) diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index b1e80798410b..e7d67bc7d4b0 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -229,16 +229,11 @@ struct ScConditionEasyDialogData { ScConditionMode* Mode = nullptr; bool IsManaged : 1 = false; - sal_Int32 FormatKey = -1; - sal_Int32 EntryIndex = -1; OUString Formula; - ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged, sal_Int32 formatKey, - sal_Int32 entryIndex, const OUString& formula = "") + ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged, const OUString& formula = "") : Mode(mode) , IsManaged(isManaged) - , FormatKey(formatKey) - , EntryIndex(entryIndex) , Formula(formula) { } diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 1d297a58f22b..eeb1061fa1d2 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -93,9 +93,11 @@ public: virtual std::unique_ptr GetConditionalFormatList() = 0; virtual bool CondFormatsChanged() const = 0; - virtual void ShowEasyConditionalDialog(bool isEdit = false) = 0; + virtual void ShowEasyConditionalDialog() = 0; virtual void SetModified() = 0; + + virtual ScConditionalFormat* GetCondFormatSelected() = 0; }; class AbstractScDataPilotDatabaseDlg :public VclAbstractDialog diff --git a/sc/qa/uitest/conditional_format/tdf100793.py b/sc/qa/uitest/conditional_format/tdf100793.py index b7d253ea2ba4..f0d2c3854db7 100644 --- a/sc/qa/uitest/conditional_format/tdf100793.py +++ b/sc/qa/uitest/conditional_format/tdf100793.py @@ -5,6 +5,7 @@ # 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/. +# from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file @@ -38,7 +39,7 @@ class tdf100793(UITestCase): with self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") as xCondFormatDlg: #modify textbox - xedassign = xCondFormatDlg.getChild("entryRange") + xedassign = xCondFormatDlg.getChild("edassign") #go at the beginning xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "END"})) xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) @@ -66,7 +67,7 @@ class tdf100793(UITestCase): list_state = get_state_as_dict(xList) self.assertEqual(list_state['Children'], '3') - self.assertEqual(conditional_format_list.getLength(), 2) + self.assertEqual(conditional_format_list.getLength(), 1) # close the conditional format manager xOKBtn = xCondFormatMgr.getChild("ok") @@ -74,11 +75,9 @@ class tdf100793(UITestCase): #verify - reopen, check range with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="") as xCondFormatMgr: - xCondFormatMgr.getChild("CONTAINER").executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - xCondFormatMgr.getChild("CONTAINER").executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) xEditBtn = xCondFormatMgr.getChild("edit") with self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") as xCondFormatDlg: - xedassign = xCondFormatDlg.getChild("entryRange") + xedassign = xCondFormatDlg.getChild("edassign") self.assertEqual(get_state_as_dict(xedassign)["Text"], "G18:K29,F18:K33,F20:F29") xCondFormatMgr = self.xUITest.getTopFocusWindow() diff --git a/sc/qa/uitest/conditional_format/tdf96453.py b/sc/qa/uitest/conditional_format/tdf96453.py index bcb602ad3452..50ba86e51eec 100644 --- a/sc/qa/uitest/conditional_format/tdf96453.py +++ b/sc/qa/uitest/conditional_format/tdf96453.py @@ -11,6 +11,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file from libreoffice.calc.document import get_sheet_from_doc from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +import sys class ConditionalFormatDlgTest(UITestCase): diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 6e39cda9a7c3..017e26028376 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -221,9 +221,7 @@ interface CellSelection ( SfxInt16Item FormatRule FN_PARAM_1, SfxBoolItem Managed FN_PARAM_2, - SfxInt32Item FormatKey FN_PARAM_3, - SfxInt32Item EntryIndex FN_PARAM_4, - SfxStringItem Formula FN_PARAM_5 + SfxStringItem Formula FN_PARAM_3 ) [ ExecMethod = Execute; diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 2fe0a63ec09a..aca2b03e0148 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1190,8 +1190,6 @@ void ScDocument::SetEasyConditionalFormatDialogData(const ScConditionEasyDialogD pConditionalFormatDialogData.Mode = data.Mode; pConditionalFormatDialogData.IsManaged = data.IsManaged; pConditionalFormatDialogData.Formula = data.Formula; - pConditionalFormatDialogData.FormatKey = data.FormatKey; - pConditionalFormatDialogData.EntryIndex = data.EntryIndex; } void ScDocument::SetChangeViewSettings(const ScChangeViewSettings& rNew) diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 9f8c1a32bae2..e70283b4b5ce 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -734,9 +734,14 @@ void AbstractScCondFormatManagerDlg_Impl::SetModified() return m_xDlg->SetModified(); } -void AbstractScCondFormatManagerDlg_Impl::ShowEasyConditionalDialog(bool isEdit) +ScConditionalFormat* AbstractScCondFormatManagerDlg_Impl::GetCondFormatSelected() { - m_xDlg->ShowEasyConditionalDialog(isEdit); + return m_xDlg->GetCondFormatSelected(); +} + +void AbstractScCondFormatManagerDlg_Impl::ShowEasyConditionalDialog() +{ + m_xDlg->ShowEasyConditionalDialog(); } int AbstractScMetricInputDlg_Impl::GetInputValue() const diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 77cd3e217cf7..7e9761180ef9 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -115,7 +115,8 @@ public: virtual std::unique_ptr GetConditionalFormatList() override; virtual bool CondFormatsChanged() const override; virtual void SetModified() override; - virtual void ShowEasyConditionalDialog(bool isEdit = false) override; + virtual ScConditionalFormat* GetCondFormatSelected() override; + virtual void ShowEasyConditionalDialog() override; }; class AbstractScDataPilotDatabaseDlg_Impl :public AbstractScDataPilotDatabaseDlg diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 372db3791df5..51f79ff31108 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -73,8 +73,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, , mpViewData(pViewData) , mrDocument(mpViewData->GetDocument()) , mbIsManaged(false) - , mnFormatKey(0) - , mnEntryIndex(0) , mxNumberEntry(m_xBuilder->weld_entry(u"entryNumber"_ustr)) , mxNumberEntry2(m_xBuilder->weld_entry(u"entryNumber2"_ustr)) , mxAllInputs(m_xBuilder->weld_container(u"allInputs"_ustr)) @@ -103,8 +101,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, meMode = *CurrentData.Mode; mbIsManaged = CurrentData.IsManaged; msFormula = CurrentData.Formula; - mnFormatKey = CurrentData.FormatKey; - mnEntryIndex = CurrentData.EntryIndex; } mxNumberEntry2->hide(); switch (meMode) @@ -263,21 +259,12 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, ScRangeList aRange; mpViewData->GetMarkData().FillRangeListWithMarks(&aRange, false); - ScConditionalFormat* format - = mrDocument.GetCondFormList(mpViewData->GetTabNo())->GetFormat(mnFormatKey); - if (aRange.empty() && mnFormatKey != -1 && mnEntryIndex != -1) - { - aRange = format->GetRangeList(); - } - else if (aRange.empty()) + if (aRange.empty()) { ScAddress aPosition(mpViewData->GetCurX(), mpViewData->GetCurY(), mpViewData->GetTabNo()); aRange.push_back(ScRange(aPosition)); } maPosition = aRange.GetTopLeftCorner(); - // FIX me: Tab is always 0 in some cases - // Refer to test tdf100793 - maPosition.SetTab(mpViewData->GetTabNo()); OUString sRangeString; aRange.Format(sRangeString, ScRefFlags::VALID, mrDocument, mrDocument.GetAddressConvention()); @@ -335,11 +322,6 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo { if (&rButton == mxButtonOk.get()) { - if (mnEntryIndex != -1 && mnFormatKey != -1) // isEdit - mrDocument.GetCondFormList(maPosition.Tab()) - ->GetFormat(mnFormatKey) - ->RemoveEntry(mnEntryIndex); - std::unique_ptr pFormat(new ScConditionalFormat(0, &mrDocument)); OUString sExpression1 = (mxNumberEntry->get_visible() && mxAllInputs->get_visible() diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index f5add41fda9d..bf79fc2cf849 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -102,32 +102,17 @@ ScConditionalFormat* ScCondFormatManagerWindow::GetSelection() return mpFormatList->GetFormat(nKey); } -const ScFormatEntry* ScCondFormatManagerWindow::GetSelectedEntry() const +const ScFormatEntry* ScCondFormatManagerWindow::GetSelectedEntry() { - sal_Int32 nKey = GetSelectedFormatKey(); - sal_Int32 nEntryIndex = GetSelectedEntryIndex(); - - if (nKey == -1 || nEntryIndex == -1) + OUString id = mrTreeView.get_selected_id(); + if (id.isEmpty()) return nullptr; + + sal_Int32 nKey = getKeyFromId(id); + sal_Int32 nEntryIndex = getEntryIndexFromId(id); return mpFormatList->GetFormat(nKey)->GetEntry(nEntryIndex); } -sal_Int32 ScCondFormatManagerWindow::GetSelectedFormatKey() const -{ - OUString id = mrTreeView.get_selected_id(); - if (id.isEmpty()) - return -1; - return getKeyFromId(id); -} - -sal_Int32 ScCondFormatManagerWindow::GetSelectedEntryIndex() const -{ - OUString id = mrTreeView.get_selected_id(); - if (id.isEmpty()) - return -1; - return getEntryIndexFromId(id); -} - void ScCondFormatManagerWindow::setColSizes() { std::vector aWidths @@ -163,7 +148,6 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument m_xDialog->set_window_state(aDlgOpt.GetWindowState()); UpdateButtonSensitivity(); - EntryFocus(*m_xTreeView); } ScCondFormatManagerDlg::~ScCondFormatManagerDlg() @@ -185,7 +169,14 @@ void ScCondFormatManagerDlg::UpdateButtonSensitivity() m_xBtnEdit->set_sensitive(bNewSensitivity); } -void ScCondFormatManagerDlg::ShowEasyConditionalDialog(bool isEdit) +// Get the current conditional format selected. +// +ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected() +{ + return m_xCtrlManager->GetSelection(); +} + +void ScCondFormatManagerDlg::ShowEasyConditionalDialog() { SfxViewShell* pViewShell = SfxViewShell::Current(); if (!pViewShell) @@ -193,34 +184,32 @@ void ScCondFormatManagerDlg::ShowEasyConditionalDialog(bool isEdit) auto id = m_xConditionalType->get_active(); SfxBoolItem IsManaged(FN_PARAM_2, true); - SfxInt32Item FormatKey(FN_PARAM_3, isEdit ? m_xCtrlManager->GetSelectedFormatKey() : -1); - SfxInt32Item EntryIndex(FN_PARAM_4, isEdit ? m_xCtrlManager->GetSelectedEntryIndex() : -1); switch (id) { case 0: // Cell value { SfxInt16Item FormatRule(FN_PARAM_1, m_xConditionalCellValue->get_active_id().toUInt32()); - pViewShell->GetDispatcher()->ExecuteList( - SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged, &FormatKey, &EntryIndex }); + pViewShell->GetDispatcher()->ExecuteList(SID_EASY_CONDITIONAL_FORMAT_DIALOG, + SfxCallMode::ASYNCHRON, + { &FormatRule, &IsManaged }); } break; case 1: // Formula { SfxInt16Item FormatRule(FN_PARAM_1, static_cast(ScConditionMode::Formula)); - SfxStringItem Formula(FN_PARAM_5, m_xConditionalFormula->GetText()); - pViewShell->GetDispatcher()->ExecuteList( + SfxStringItem Formula(FN_PARAM_3, m_xConditionalFormula->GetText()); + SfxViewShell::Current()->GetDispatcher()->ExecuteList( SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged, &FormatKey, &EntryIndex, &Formula }); + { &FormatRule, &IsManaged, &Formula }); } break; case 2: // Date { SfxInt16Item FormatRule(FN_PARAM_1, m_xConditionalDate->get_active_id().toUInt32()); - pViewShell->GetDispatcher()->ExecuteList( - SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged, &FormatKey, &EntryIndex }); + pViewShell->GetDispatcher()->ExecuteList(SID_EASY_CONDITIONAL_FORMAT_DIALOG, + SfxCallMode::ASYNCHRON, + { &FormatRule, &IsManaged }); } break; default: diff --git a/sc/source/ui/inc/condformateasydlg.hxx b/sc/source/ui/inc/condformateasydlg.hxx index 6dfa19c37752..e2824539fd5f 100644 --- a/sc/source/ui/inc/condformateasydlg.hxx +++ b/sc/source/ui/inc/condformateasydlg.hxx @@ -46,8 +46,6 @@ private: bool mbIsManaged; OUString msFormula; ScAddress maPosition; - sal_Int32 mnFormatKey; - sal_Int32 mnEntryIndex; SvxFontPrevWindow maWdPreview; std::unique_ptr mxNumberEntry; diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 301f74499063..09b6c571e562 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -32,9 +32,7 @@ public: void DeleteSelection(); ScConditionalFormat* GetSelection(); - const ScFormatEntry* GetSelectedEntry() const; - sal_Int32 GetSelectedFormatKey() const; - sal_Int32 GetSelectedEntryIndex() const; + const ScFormatEntry* GetSelectedEntry(); }; class ScCondFormatManagerDlg : public weld::GenericDialogController @@ -48,7 +46,8 @@ public: bool CondFormatsChanged() const; void SetModified(); - void ShowEasyConditionalDialog(bool isEdit = false); + ScConditionalFormat* GetCondFormatSelected(); + void ShowEasyConditionalDialog(); private: bool m_bModified; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 7593b037020c..331ba8a5efca 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2933,7 +2933,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pDlg->SetModified(); pDlg->StartExecuteAsync( - [pDlg, &rData, pTabViewShell, rDlgItem, aPos](sal_Int32 nRet) + [this, pDlg, &rData, pTabViewShell, rDlgItem, aPos](sal_Int32 nRet) { std::unique_ptr pCondFormatList = pDlg->GetConditionalFormatList(); @@ -2948,7 +2948,19 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } else if (nRet == DLG_RET_EDIT) { - pDlg->ShowEasyConditionalDialog(true); + ScConditionalFormat* pFormat = pDlg->GetCondFormatSelected(); + sal_Int32 nIndex = pFormat ? pFormat->GetKey() : -1; + // Put the xml string parameter to initialize the + // Conditional Format Dialog. ( edit selected conditional format ) + pTabViewShell->setScCondFormatDlgItem( + std::make_shared( + std::shared_ptr( + pCondFormatList.release()), + nIndex, true)); + + // Queue message to open Conditional Format Dialog + GetViewData().GetDispatcher().Execute(SID_OPENDLG_CONDFRMT, + SfxCallMode::ASYNCHRON); } else pCondFormatList.reset(); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 2e36d876bf33..6206ace72f65 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -470,22 +470,13 @@ void ScCellShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pFormula; OUString formula; - if (pReqArgs->HasItem(FN_PARAM_5, &pFormula)) + if (pReqArgs->HasItem(FN_PARAM_3, &pFormula)) { formula = static_cast(pFormula)->GetValue(); } - const SfxPoolItem *pFormatKey, *pEntryIndex; - sal_Int32 nFormatKey = -1, nEntryIndex = -1; - if (pReqArgs->HasItem(FN_PARAM_3, &pFormatKey) - && pReqArgs->HasItem(FN_PARAM_4, &pEntryIndex)) - { - nFormatKey = static_cast(pFormatKey)->GetValue(); - nEntryIndex = static_cast(pEntryIndex)->GetValue(); - } GetViewData().GetDocument().SetEasyConditionalFormatDialogData( - ScConditionEasyDialogData(&nFormat, bManaged, nFormatKey, nEntryIndex, - formula)); + ScConditionEasyDialogData(&nFormat, bManaged, formula)); pScMod->SetRefDialog( nId, pWindow == nullptr ); } From 70b9e65eae31abcc5d88773565059ba8dae44468 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Mon, 25 Nov 2024 19:43:44 +0530 Subject: [PATCH 049/155] Revert "sc: display all the conditions of same ranges MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...in conditional format manager" This reverts commit 399253ca8ca391504ff1f6a3709fb41d438ce2d6. Change-Id: I3c0a79ee0a34364d0a51ab4736810f35efe4bfdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177285 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177336 Tested-by: Jenkins --- sc/qa/uitest/conditional_format/tdf100793.py | 4 +- sc/qa/uitest/conditional_format/tdf105544.py | 4 +- sc/qa/uitest/pasteSpecial/tdf86253.py | 2 +- sc/source/ui/condformat/condformathelper.cxx | 103 +++++++++---------- sc/source/ui/condformat/condformatmgr.cxx | 48 +++------ sc/source/ui/inc/condformathelper.hxx | 2 - sc/source/ui/inc/condformatmgr.hxx | 2 - sc/uiconfig/scalc/ui/condformatmanager.ui | 2 +- 8 files changed, 69 insertions(+), 98 deletions(-) diff --git a/sc/qa/uitest/conditional_format/tdf100793.py b/sc/qa/uitest/conditional_format/tdf100793.py index f0d2c3854db7..692c3c8109b2 100644 --- a/sc/qa/uitest/conditional_format/tdf100793.py +++ b/sc/qa/uitest/conditional_format/tdf100793.py @@ -32,7 +32,7 @@ class tdf100793(UITestCase): # check that we have exactly one conditional formats in the beginning xList = xCondFormatMgr.getChild("CONTAINER") list_state = get_state_as_dict(xList) - self.assertEqual(list_state['Children'], '3') + self.assertEqual(list_state['Children'], '1') #3) Click Edit & try to change to intended one, F18:K33 xEditBtn = xCondFormatMgr.getChild("edit") @@ -65,7 +65,7 @@ class tdf100793(UITestCase): # and still only 1 conditional format in the document xList = xCondFormatMgr.getChild("CONTAINER") list_state = get_state_as_dict(xList) - self.assertEqual(list_state['Children'], '3') + self.assertEqual(list_state['Children'], '1') self.assertEqual(conditional_format_list.getLength(), 1) diff --git a/sc/qa/uitest/conditional_format/tdf105544.py b/sc/qa/uitest/conditional_format/tdf105544.py index 3e5fd6730277..b172d4067a1d 100644 --- a/sc/qa/uitest/conditional_format/tdf105544.py +++ b/sc/qa/uitest/conditional_format/tdf105544.py @@ -27,7 +27,7 @@ class tdf105544(UITestCase): # check that we have exactly four conditional formats in the beginning xList = xCondFormatMgr.getChild("CONTAINER") list_state = get_state_as_dict(xList) - self.assertEqual(list_state['Children'], '5') + self.assertEqual(list_state['Children'], '4') #select B3:B37 range and click edit, then click yes xList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) #2nd position in the list @@ -41,7 +41,7 @@ class tdf105544(UITestCase): # check again that we still have 4 entry in the list xList = xCondFormatMgr.getChild("CONTAINER") list_state = get_state_as_dict(xList) - self.assertEqual(list_state['Children'], '5') + self.assertEqual(list_state['Children'], '4') # close the conditional format manager xOKBtn = xCondFormatMgr.getChild("ok") diff --git a/sc/qa/uitest/pasteSpecial/tdf86253.py b/sc/qa/uitest/pasteSpecial/tdf86253.py index fa39f3bfebfe..6e6e1bcd4983 100644 --- a/sc/qa/uitest/pasteSpecial/tdf86253.py +++ b/sc/qa/uitest/pasteSpecial/tdf86253.py @@ -44,7 +44,7 @@ class tdf86253(UITestCase): # check that we have exactly 1 conditional format and range is C1:C17 xList = xCondFormatMgr.getChild("CONTAINER") list_state = get_state_as_dict(xList) - self.assertEqual(list_state['Children'], '2') # We can now display both condition separate on same range + self.assertEqual(list_state['Children'], '1') xTreeEntry = xList.getChild('0') self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1:A6,C1:C17\tCell value >= 0") diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx index 39e183278666..95d54756bcac 100644 --- a/sc/source/ui/condformat/condformathelper.cxx +++ b/sc/source/ui/condformat/condformathelper.cxx @@ -137,65 +137,62 @@ OUString getDateString(sal_Int32 nIndex) } -OUString ScCondFormatHelper::GetExpression(const ScFormatEntry* rEntry, const ScAddress& rPos) -{ - OUStringBuffer aBuffer; - switch (rEntry->GetType()) - { - case ScFormatEntry::Type::Condition: - case ScFormatEntry::Type::ExtCondition: - { - const ScConditionEntry* pEntry = static_cast(rEntry); - ScConditionMode eMode = pEntry->GetOperation(); - if (eMode == ScConditionMode::Direct) - { - aBuffer.append(getTextForType(FORMULA) + " " + pEntry->GetExpression(rPos, 0)); - } - else - { - aBuffer.append(getTextForType(CONDITION) + " " - + getExpression(static_cast(eMode)) + " "); - if (eMode == ScConditionMode::Between || eMode == ScConditionMode::NotBetween) - { - aBuffer.append(pEntry->GetExpression(rPos, 0) + " " + ScResId(STR_COND_AND) - + " " + pEntry->GetExpression(rPos, 1)); - } - else if (eMode <= ScConditionMode::NotEqual || eMode >= ScConditionMode::BeginsWith) - { - aBuffer.append(pEntry->GetExpression(rPos, 0)); - } - } - } - - break; - case ScFormatEntry::Type::Databar: - aBuffer.append(getTextForType(DATABAR)); - break; - case ScFormatEntry::Type::Colorscale: - aBuffer.append(getTextForType(COLORSCALE)); - break; - case ScFormatEntry::Type::Iconset: - aBuffer.append(getTextForType(ICONSET)); - break; - case ScFormatEntry::Type::Date: - { - sal_Int32 nDateEntry = static_cast( - static_cast(rEntry)->GetDateType()); - aBuffer.append(getTextForType(DATE) + " " + getDateString(nDateEntry)); - } - break; - } - return aBuffer.makeStringAndClear(); -} - OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos) { + OUStringBuffer aBuffer; if (!rFormat.IsEmpty()) { - return ScCondFormatHelper::GetExpression(rFormat.GetEntry(0), rPos); + switch (rFormat.GetEntry(0)->GetType()) + { + case ScFormatEntry::Type::Condition: + case ScFormatEntry::Type::ExtCondition: + { + const ScConditionEntry* pEntry + = static_cast(rFormat.GetEntry(0)); + ScConditionMode eMode = pEntry->GetOperation(); + if (eMode == ScConditionMode::Direct) + { + aBuffer.append(getTextForType(FORMULA) + " " + pEntry->GetExpression(rPos, 0)); + } + else + { + aBuffer.append(getTextForType(CONDITION) + " " + + getExpression(static_cast(eMode)) + " "); + if (eMode == ScConditionMode::Between || eMode == ScConditionMode::NotBetween) + { + aBuffer.append(pEntry->GetExpression(rPos, 0) + " " + ScResId(STR_COND_AND) + + " " + pEntry->GetExpression(rPos, 1)); + } + else if (eMode <= ScConditionMode::NotEqual + || eMode >= ScConditionMode::BeginsWith) + { + aBuffer.append(pEntry->GetExpression(rPos, 0)); + } + } + } + + break; + case ScFormatEntry::Type::Databar: + aBuffer.append(getTextForType(DATABAR)); + break; + case ScFormatEntry::Type::Colorscale: + aBuffer.append(getTextForType(COLORSCALE)); + break; + case ScFormatEntry::Type::Iconset: + aBuffer.append(getTextForType(ICONSET)); + break; + case ScFormatEntry::Type::Date: + { + sal_Int32 nDateEntry = static_cast( + static_cast(rFormat.GetEntry(0)) + ->GetDateType()); + aBuffer.append(getTextForType(DATE) + " " + getDateString(nDateEntry)); + } + break; + } } - return ""; + return aBuffer.makeStringAndClear(); } OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex, diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index bf79fc2cf849..c74087daa5a2 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -22,19 +22,7 @@ #include #include #include -#include - -namespace -{ -OUString generateEntryId(sal_uInt32 key, sal_uInt32 index) -{ - return OUString::number(key) + "_" + OUString::number(index); -} - -sal_Int32 getKeyFromId(std::u16string_view id) { return o3tl::toInt32(o3tl::getToken(id, 0, '_')); } - -sal_Int32 getEntryIndexFromId(std::u16string_view id) { return o3tl::toInt32(o3tl::getToken(id, 1, '_')); } -} +#include ScCondFormatManagerWindow::ScCondFormatManagerWindow(weld::TreeView& rTreeView, ScDocument& rDoc, ScConditionalFormatList* pFormatList) @@ -63,14 +51,10 @@ void ScCondFormatManagerWindow::Init() { const ScRangeList& aRange = rItem->GetRange(); aRange.Format(sRangeStr, ScRefFlags::VALID, mrDoc, mrDoc.GetAddressConvention()); - for (size_t i = 0; i < rItem->size(); i++) - { - mrTreeView.append(generateEntryId(rItem->GetKey(), i), sRangeStr); - mrTreeView.set_text(nRow++, - ScCondFormatHelper::GetExpression(rItem->GetEntry(i), - aRange.GetTopLeftCorner()), - 1); - } + mrTreeView.append(OUString::number(rItem->GetKey()), sRangeStr); + mrTreeView.set_text( + nRow, ScCondFormatHelper::GetExpression(*rItem, aRange.GetTopLeftCorner()), 1); + ++nRow; } } @@ -98,19 +82,8 @@ ScConditionalFormat* ScCondFormatManagerWindow::GetSelection() if (nEntry == -1) return nullptr; - sal_Int32 nKey = getKeyFromId(mrTreeView.get_id(nEntry)); - return mpFormatList->GetFormat(nKey); -} - -const ScFormatEntry* ScCondFormatManagerWindow::GetSelectedEntry() -{ - OUString id = mrTreeView.get_selected_id(); - if (id.isEmpty()) - return nullptr; - - sal_Int32 nKey = getKeyFromId(id); - sal_Int32 nEntryIndex = getEntryIndexFromId(id); - return mpFormatList->GetFormat(nKey)->GetEntry(nEntryIndex); + sal_Int32 nIndex = mrTreeView.get_id(nEntry).toInt32(); + return mpFormatList->GetFormat(nIndex); } void ScCondFormatManagerWindow::setColSizes() @@ -281,7 +254,12 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, ComboHdl, weld::ComboBox&, void) IMPL_LINK_NOARG(ScCondFormatManagerDlg, EntryFocus, weld::TreeView&, void) { - const ScFormatEntry* entry = m_xCtrlManager->GetSelectedEntry(); + ScConditionalFormat* conditionFrmt = m_xCtrlManager->GetSelection(); + + if (!conditionFrmt) + return; + + const ScFormatEntry* entry = conditionFrmt->GetEntry(0); if (!entry) return; auto type = entry->GetType(); diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx index 1098b56e4663..1a2379ad2d57 100644 --- a/sc/source/ui/inc/condformathelper.hxx +++ b/sc/source/ui/inc/condformathelper.hxx @@ -14,7 +14,6 @@ #include class ScConditionalFormat; -class ScFormatEntry; enum ScCondFormatEntryType { @@ -29,7 +28,6 @@ enum ScCondFormatEntryType class ScCondFormatHelper { public: - static SC_DLLPUBLIC OUString GetExpression(const ScFormatEntry* rEntry, const ScAddress& rPos); static SC_DLLPUBLIC OUString GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos); static SC_DLLPUBLIC OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex, diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 09b6c571e562..26345d55894a 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -15,7 +15,6 @@ class ScDocument; class ScConditionalFormat; class ScConditionalFormatList; -class ScFormatEntry; class ScCondFormatManagerWindow { @@ -32,7 +31,6 @@ public: void DeleteSelection(); ScConditionalFormat* GetSelection(); - const ScFormatEntry* GetSelectedEntry(); }; class ScCondFormatManagerDlg : public weld::GenericDialogController diff --git a/sc/uiconfig/scalc/ui/condformatmanager.ui b/sc/uiconfig/scalc/ui/condformatmanager.ui index 57a8b03ae3c1..a0160fa8aa67 100644 --- a/sc/uiconfig/scalc/ui/condformatmanager.ui +++ b/sc/uiconfig/scalc/ui/condformatmanager.ui @@ -139,7 +139,7 @@ True 6 - Condition + First Condition From 904b5157824f3d3920c8422dba277824e0d2bd88 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Mon, 25 Nov 2024 19:44:34 +0530 Subject: [PATCH 050/155] Revert "sc: give warning about condition input in easy condition dialog" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2a6dc9dfd84b278352608f475a600e866846af2e. Change-Id: I061f8ebfbf0115dd55d357c325a3905c5a774a57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177286 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177337 Tested-by: Jenkins --- .../ui/condformat/condformatdlgentry.cxx | 45 +++++++++++++++++- sc/source/ui/condformat/condformateasydlg.cxx | 13 ----- sc/source/ui/condformat/condformathelper.cxx | 47 ------------------- sc/source/ui/inc/condformateasydlg.hxx | 2 - sc/source/ui/inc/condformathelper.hxx | 1 - sc/uiconfig/scalc/ui/conditionaleasydialog.ui | 15 +----- 6 files changed, 46 insertions(+), 77 deletions(-) diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 6906d4fb5316..4582c6b62508 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -248,7 +248,50 @@ ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, formula::RefEdit&, rRefEdit, void) { weld::Entry& rEdit = *rRefEdit.GetWidget(); - ScCondFormatHelper::ValidateInputField(rEdit, *mxFtVal, mrDoc, maPos); + OUString aFormula = rEdit.get_text(); + + if (aFormula.isEmpty()) + { + mxFtVal->set_label(ScResId(STR_ENTER_VALUE)); + return; + } + + ScCompiler aComp(mrDoc, maPos, mrDoc.GetGrammar()); + aComp.SetExtendedErrorDetection( + ScCompiler::ExtendedErrorDetection::EXTENDED_ERROR_DETECTION_NAME_BREAK); + std::unique_ptr ta(aComp.CompileString(aFormula)); + + // Error, warn the user if it is not an unknown name. + if (ta->GetCodeError() != FormulaError::NoName + && (ta->GetCodeError() != FormulaError::NONE || ta->GetLen() == 0)) + { + rEdit.set_message_type(weld::EntryMessageType::Error); + mxFtVal->set_label(ScResId(STR_VALID_DEFERROR)); + return; + } + + // Unrecognized name, warn the user; i.e. happens when starting to type and + // will go away once a valid name is completed. + if (ta->GetCodeError() == FormulaError::NoName) + { + rEdit.set_message_type(weld::EntryMessageType::Warning); + mxFtVal->set_label(ScResId(STR_UNQUOTED_STRING)); + return; + } + + // Generate RPN to detect further errors. + if (ta->GetLen() > 0) + aComp.CompileTokenArray(); + // Error, warn the user. + if (ta->GetCodeError() != FormulaError::NONE || (ta->GetCodeLen() == 0)) + { + rEdit.set_message_type(weld::EntryMessageType::Error); + mxFtVal->set_label(ScResId(STR_VALID_DEFERROR)); + return; + } + + rEdit.set_message_type(weld::EntryMessageType::Normal); + mxFtVal->set_label(""); } void ScConditionFrmtEntry::Select() diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 51f79ff31108..1e0323af7ca3 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -76,7 +76,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, , mxNumberEntry(m_xBuilder->weld_entry(u"entryNumber"_ustr)) , mxNumberEntry2(m_xBuilder->weld_entry(u"entryNumber2"_ustr)) , mxAllInputs(m_xBuilder->weld_container(u"allInputs"_ustr)) - , mxWarningLabel(m_xBuilder->weld_label(u"warning"_ustr)) , mxRangeEntry(new formula::RefEdit(m_xBuilder->weld_entry(u"entryRange"_ustr))) , mxButtonRangeEdit(new formula::RefButton(m_xBuilder->weld_button(u"rbassign"_ustr))) , mxStyles(m_xBuilder->weld_combo_box(u"themeCombo"_ustr)) @@ -254,8 +253,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, mxButtonOk->connect_clicked(LINK(this, ConditionalFormatEasyDialog, ButtonPressed)); mxButtonCancel->connect_clicked(LINK(this, ConditionalFormatEasyDialog, ButtonPressed)); mxStyles->connect_changed(LINK(this, ConditionalFormatEasyDialog, StyleSelectHdl)); - mxNumberEntry->connect_changed(LINK(this, ConditionalFormatEasyDialog, OnEdChanged)); - mxNumberEntry2->connect_changed(LINK(this, ConditionalFormatEasyDialog, OnEdChanged)); ScRangeList aRange; mpViewData->GetMarkData().FillRangeListWithMarks(&aRange, false); @@ -392,16 +389,6 @@ IMPL_LINK_NOARG(ConditionalFormatEasyDialog, StyleSelectHdl, weld::ComboBox&, vo ScCondFormatHelper::StyleSelect(mpParent, *mxStyles, mpViewData->GetDocument(), maWdPreview); } -IMPL_LINK(ConditionalFormatEasyDialog, OnEdChanged, weld::Entry&, rEntry, void) -{ - ScCondFormatHelper::ValidateInputField(rEntry, *mxWarningLabel, mrDocument, maPosition); - - if (!mxWarningLabel->get_label().isEmpty()) - mxWarningLabel->show(); - else - mxWarningLabel->hide(); -} - } // namespace sc /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx index 95d54756bcac..3092d5f74aee 100644 --- a/sc/source/ui/condformat/condformathelper.cxx +++ b/sc/source/ui/condformat/condformathelper.cxx @@ -23,7 +23,6 @@ #include #include #include -#include namespace { @@ -321,50 +320,4 @@ void ScCondFormatHelper::UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocum rLbStyle.set_active_text(aSelectedStyle); } -void ScCondFormatHelper::ValidateInputField(weld::Entry& rEntry, weld::Label& rLabel, ScDocument& rDoc, ScAddress& rPos) -{ - OUString aFormula = rEntry.get_text(); - - if( aFormula.isEmpty() ) - { - rLabel.set_label(ScResId(STR_ENTER_VALUE)); - return; - } - - ScCompiler aComp( rDoc, rPos, rDoc.GetGrammar() ); - aComp.SetExtendedErrorDetection( ScCompiler::ExtendedErrorDetection::EXTENDED_ERROR_DETECTION_NAME_BREAK); - std::unique_ptr ta(aComp.CompileString(aFormula)); - - // Error, warn the user if it is not an unknown name. - if (ta->GetCodeError() != FormulaError::NoName && (ta->GetCodeError() != FormulaError::NONE || ta->GetLen() == 0)) - { - rEntry.set_message_type(weld::EntryMessageType::Error); - rLabel.set_label(ScResId(STR_VALID_DEFERROR)); - return; - } - - // Unrecognized name, warn the user; i.e. happens when starting to type and - // will go away once a valid name is completed. - if (ta->GetCodeError() == FormulaError::NoName) - { - rEntry.set_message_type(weld::EntryMessageType::Warning); - rLabel.set_label(ScResId(STR_UNQUOTED_STRING)); - return; - } - - // Generate RPN to detect further errors. - if (ta->GetLen() > 0) - aComp.CompileTokenArray(); - // Error, warn the user. - if (ta->GetCodeError() != FormulaError::NONE || (ta->GetCodeLen() == 0)) - { - rEntry.set_message_type(weld::EntryMessageType::Error); - rLabel.set_label(ScResId(STR_VALID_DEFERROR)); - return; - } - - rEntry.set_message_type(weld::EntryMessageType::Normal); - rLabel.set_label(u""_ustr); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/condformateasydlg.hxx b/sc/source/ui/inc/condformateasydlg.hxx index e2824539fd5f..7880862d8535 100644 --- a/sc/source/ui/inc/condformateasydlg.hxx +++ b/sc/source/ui/inc/condformateasydlg.hxx @@ -34,7 +34,6 @@ public: DECL_LINK(ButtonPressed, weld::Button&, void); DECL_LINK(StyleSelectHdl, weld::ComboBox&, void); - DECL_LINK(OnEdChanged, weld::Entry&, void); private: void SetDescription(std::u16string_view rCondition); @@ -51,7 +50,6 @@ private: std::unique_ptr mxNumberEntry; std::unique_ptr mxNumberEntry2; std::unique_ptr mxAllInputs; - std::unique_ptr mxWarningLabel; std::unique_ptr mxRangeEntry; std::unique_ptr mxButtonRangeEdit; std::unique_ptr mxStyles; diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx index 1a2379ad2d57..daf91a7a7276 100644 --- a/sc/source/ui/inc/condformathelper.hxx +++ b/sc/source/ui/inc/condformathelper.hxx @@ -36,7 +36,6 @@ public: const ScDocument& rDoc, SvxFontPrevWindow& rWdPreview); static SC_DLLPUBLIC void FillStyleListBox(const ScDocument& rDocument, weld::ComboBox& rCombo); static SC_DLLPUBLIC void UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument& rDoc); - static SC_DLLPUBLIC void ValidateInputField(weld::Entry& rEntry, weld::Label& label, ScDocument& rDoc, ScAddress& rPos); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui index ac5a056eba35..0f3348bc5c8e 100644 --- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui +++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui @@ -221,17 +221,6 @@ 0 - - - False - False - - - False - True - 1 - - True @@ -301,7 +290,7 @@ False True - 2 + 1 @@ -328,7 +317,7 @@ False True - 3 + 2 From eb933099a537da8d667c5921d73196401ac23b89 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Mon, 25 Nov 2024 19:44:43 +0530 Subject: [PATCH 051/155] Revert "sc: preview style in easy format dialog" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 2661be5f8fb28ada80b4f5336d59f54b520bf614. Change-Id: Ie3482641cbbb34baa866a679c782221d2d513df1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177287 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177338 Tested-by: Jenkins --- .../ui/condformat/condformatdlgentry.cxx | 127 ++++++++++++++++-- sc/source/ui/condformat/condformateasydlg.cxx | 38 ++++-- sc/source/ui/condformat/condformathelper.cxx | 102 -------------- sc/source/ui/inc/condformateasydlg.hxx | 6 - sc/source/ui/inc/condformathelper.hxx | 10 +- sc/uiconfig/scalc/ui/conditionaleasydialog.ui | 30 ----- 6 files changed, 147 insertions(+), 166 deletions(-) diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 4582c6b62508..1f8ad16a42bb 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -108,6 +108,27 @@ void ScCondFrmtEntry::Deselect() mbActive = false; } +//condition + +namespace +{ + +void FillStyleListBox(const ScDocument* pDoc, weld::ComboBox& rLbStyle) +{ + std::set aStyleNames; + SfxStyleSheetIterator aStyleIter(pDoc->GetStyleSheetPool(), SfxStyleFamily::Para); + for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next()) + { + aStyleNames.insert(pStyle->GetName()); + } + for (const auto& rStyleName : aStyleNames) + { + rLbStyle.append_text(rStyleName); + } +} + +} + const ScConditionMode ScConditionFrmtEntry::mpEntryToCond[ScConditionFrmtEntry::NUM_COND_ENTRIES] = { ScConditionMode::Equal, ScConditionMode::Less, @@ -221,7 +242,7 @@ void ScConditionFrmtEntry::Init(ScCondFormatDlg* pDialogParent) mxEdVal1->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); mxEdVal2->SetModifyHdl( LINK( this, ScConditionFrmtEntry, OnEdChanged ) ); - ScCondFormatHelper::FillStyleListBox(mrDoc, *mxLbStyle); + FillStyleListBox(&mrDoc, *mxLbStyle); mxLbStyle->connect_changed( LINK( this, ScConditionFrmtEntry, StyleSelectHdl ) ); mxLbCondType->connect_changed( LINK( this, ScConditionFrmtEntry, ConditionTypeSelectHdl ) ); @@ -419,19 +440,109 @@ void ScConditionFrmtEntry::SetInactive() Deselect(); } +namespace +{ + +void UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument* pDoc) +{ + OUString aSelectedStyle = rLbStyle.get_active_text(); + for (sal_Int32 i = rLbStyle.get_count(); i > 1; --i) + rLbStyle.remove(i - 1); + FillStyleListBox(pDoc, rLbStyle); + rLbStyle.set_active_text(aSelectedStyle); +} + +} + void ScConditionFrmtEntry::Notify(SfxBroadcaster&, const SfxHint& rHint) { if(rHint.GetId() == SfxHintId::StyleSheetModified || rHint.GetId() == SfxHintId::StyleSheetModifiedExtended) { if(!mbIsInStyleCreate) - ScCondFormatHelper::UpdateStyleList(*mxLbStyle, mrDoc); + UpdateStyleList(*mxLbStyle, &mrDoc); } } +namespace +{ + +void StyleSelect(weld::Window* pDialogParent, weld::ComboBox& rLbStyle, const ScDocument* pDoc, + SvxFontPrevWindow& rWdPreview) +{ + if (rLbStyle.get_active() == 0) + { + // call new style dialog + SfxUInt16Item aFamilyItem(SID_STYLE_FAMILY, sal_uInt16(SfxStyleFamily::Para)); + SfxStringItem aRefItem(SID_STYLE_REFERENCE, ScResId(STR_STYLENAME_STANDARD)); + css::uno::Any aAny(pDialogParent->GetXWindow()); + SfxUnoAnyItem aDialogParent(SID_DIALOG_PARENT, aAny); + + // unlock the dispatcher so SID_STYLE_NEW can be executed + // (SetDispatcherLock would affect all Calc documents) + if (ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell()) + { + if (SfxDispatcher* pDisp = pViewShell->GetDispatcher()) + { + bool bLocked = pDisp->IsLocked(); + if (bLocked) + pDisp->Lock(false); + + // Execute the "new style" slot, complete with undo and all necessary updates. + // The return value (SfxUInt16Item) is ignored, look for new styles instead. + pDisp->ExecuteList(SID_STYLE_NEW, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, + { &aFamilyItem, &aRefItem }, { &aDialogParent }); + + if (bLocked) + pDisp->Lock(true); + + // Find the new style and add it into the style list boxes + SfxStyleSheetIterator aStyleIter(pDoc->GetStyleSheetPool(), SfxStyleFamily::Para); + bool bFound = false; + for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle && !bFound; + pStyle = aStyleIter.Next()) + { + const OUString& aName = pStyle->GetName(); + if (rLbStyle.find_text(aName) == -1) // all lists contain the same entries + { + for (sal_Int32 i = 1, n = rLbStyle.get_count(); i <= n && !bFound; ++i) + { + OUString aStyleName + = ScGlobal::getCharClass().uppercase(rLbStyle.get_text(i)); + if (i == n) + { + rLbStyle.append_text(aName); + rLbStyle.set_active_text(aName); + bFound = true; + } + else if (aStyleName > ScGlobal::getCharClass().uppercase(aName)) + { + rLbStyle.insert_text(i, aName); + rLbStyle.set_active_text(aName); + bFound = true; + } + } + } + } + } + } + } + + OUString aStyleName = rLbStyle.get_active_text(); + SfxStyleSheetBase* pStyleSheet + = pDoc->GetStyleSheetPool()->Find(aStyleName, SfxStyleFamily::Para); + if (pStyleSheet) + { + const SfxItemSet& rSet = pStyleSheet->GetItemSet(); + rWdPreview.SetFromItemSet(rSet, false); + } +} + +} + IMPL_LINK_NOARG(ScConditionFrmtEntry, StyleSelectHdl, weld::ComboBox&, void) { mbIsInStyleCreate = true; - ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mrDoc, maWdPreview); + StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, &mrDoc, maWdPreview); mbIsInStyleCreate = false; } @@ -473,13 +584,13 @@ void ScFormulaFrmtEntry::Init(ScCondFormatDlg* pDialogParent) { mxEdFormula->SetGetFocusHdl( LINK( pDialogParent, ScCondFormatDlg, RangeGetFocusHdl ) ); - ScCondFormatHelper::FillStyleListBox(mrDoc, *mxLbStyle); + FillStyleListBox(&mrDoc, *mxLbStyle); mxLbStyle->connect_changed( LINK( this, ScFormulaFrmtEntry, StyleSelectHdl ) ); } IMPL_LINK_NOARG(ScFormulaFrmtEntry, StyleSelectHdl, weld::ComboBox&, void) { - ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mrDoc, maWdPreview); + StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, &mrDoc, maWdPreview); } ScFormatEntry* ScFormulaFrmtEntry::createFormulaEntry() const @@ -1186,7 +1297,7 @@ void ScDateFrmtEntry::Init() mxLbDateEntry->set_active(0); mxLbType->set_active(3); - ScCondFormatHelper::FillStyleListBox(mrDoc, *mxLbStyle); + FillStyleListBox(&mrDoc, *mxLbStyle); mxLbStyle->connect_changed( LINK( this, ScDateFrmtEntry, StyleSelectHdl ) ); mxLbStyle->set_active(1); } @@ -1216,7 +1327,7 @@ void ScDateFrmtEntry::Notify( SfxBroadcaster&, const SfxHint& rHint ) if(rHint.GetId() == SfxHintId::StyleSheetModified || rHint.GetId() == SfxHintId::StyleSheetModifiedExtended) { if(!mbIsInStyleCreate) - ScCondFormatHelper::UpdateStyleList(*mxLbStyle, mrDoc); + UpdateStyleList(*mxLbStyle, &mrDoc); } } @@ -1238,7 +1349,7 @@ OUString ScDateFrmtEntry::GetExpressionString() IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl, weld::ComboBox&, void ) { mbIsInStyleCreate = true; - ScCondFormatHelper::StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, mrDoc, maWdPreview); + StyleSelect(mpParent->GetFrameWeld(), *mxLbStyle, &mrDoc, maWdPreview); mbIsInStyleCreate = false; } diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index 1e0323af7ca3..faef213042ef 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -15,10 +15,32 @@ #include #include #include -#include namespace { +void FillStyleListBox(const ScDocument* pDocument, weld::ComboBox& rCombo) +{ + std::set aStyleNames; + SfxStyleSheetIterator aStyleIter(pDocument->GetStyleSheetPool(), SfxStyleFamily::Para); + for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next()) + { + aStyleNames.insert(pStyle->GetName()); + } + for (const auto& rStyleName : aStyleNames) + { + rCombo.append_text(rStyleName); + } +} + +void UpdateStyleList(const ScDocument* pDocument, weld::ComboBox& rCombo) +{ + OUString sSelectedStyle = rCombo.get_active_text(); + for (sal_Int32 i = rCombo.get_count(); i > 1; --i) + rCombo.remove(i - 1); + FillStyleListBox(pDocument, rCombo); + rCombo.set_active_text(sSelectedStyle); +} + condformat::ScCondFormatDateType GetScCondFormatDateType(ScConditionMode mode) { switch (mode) @@ -69,7 +91,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, : ScAnyRefDlgController(pBindings, pChildWindow, pParent, u"modules/scalc/ui/conditionaleasydialog.ui"_ustr, u"CondFormatEasyDlg"_ustr) - , mpParent(pParent) , mpViewData(pViewData) , mrDocument(mpViewData->GetDocument()) , mbIsManaged(false) @@ -79,8 +100,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, , mxRangeEntry(new formula::RefEdit(m_xBuilder->weld_entry(u"entryRange"_ustr))) , mxButtonRangeEdit(new formula::RefButton(m_xBuilder->weld_button(u"rbassign"_ustr))) , mxStyles(m_xBuilder->weld_combo_box(u"themeCombo"_ustr)) - , mxWdPreviewWin(m_xBuilder->weld_widget(u"previewwin"_ustr)) - , mxWdPreview(new weld::CustomWeld(*m_xBuilder, "preview", maWdPreview)) , mxDescription(m_xBuilder->weld_label(u"description"_ustr)) , mxButtonOk(m_xBuilder->weld_button(u"ok"_ustr)) , mxButtonCancel(m_xBuilder->weld_button(u"cancel"_ustr)) @@ -252,7 +271,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, mxButtonOk->connect_clicked(LINK(this, ConditionalFormatEasyDialog, ButtonPressed)); mxButtonCancel->connect_clicked(LINK(this, ConditionalFormatEasyDialog, ButtonPressed)); - mxStyles->connect_changed(LINK(this, ConditionalFormatEasyDialog, StyleSelectHdl)); ScRangeList aRange; mpViewData->GetMarkData().FillRangeListWithMarks(&aRange, false); @@ -268,10 +286,9 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, mxRangeEntry->SetText(sRangeString); StartListening(*(mrDocument.GetStyleSheetPool()), DuplicateHandling::Prevent); - ScCondFormatHelper::FillStyleListBox(mrDocument, *mxStyles); + FillStyleListBox(&mrDocument, *mxStyles); mxStyles->set_active(1); - mxWdPreviewWin->show(); } ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog() @@ -287,7 +304,7 @@ void ConditionalFormatEasyDialog::Notify(SfxBroadcaster&, const SfxHint& rHint) { if (rHint.GetId() == SfxHintId::StyleSheetModified || rHint.GetId() == SfxHintId::StyleSheetModifiedExtended) - ScCondFormatHelper::UpdateStyleList(*mxStyles, mrDocument); + UpdateStyleList(&mrDocument, *mxStyles); } void ConditionalFormatEasyDialog::SetReference(const ScRange& rRange, ScDocument&) @@ -384,11 +401,6 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo m_xDialog->response(RET_CANCEL); } -IMPL_LINK_NOARG(ConditionalFormatEasyDialog, StyleSelectHdl, weld::ComboBox&, void) -{ - ScCondFormatHelper::StyleSelect(mpParent, *mxStyles, mpViewData->GetDocument(), maWdPreview); -} - } // namespace sc /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx index 3092d5f74aee..2bee433a7295 100644 --- a/sc/source/ui/condformat/condformathelper.cxx +++ b/sc/source/ui/condformat/condformathelper.cxx @@ -15,14 +15,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include namespace { @@ -226,98 +218,4 @@ OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int return aBuffer.makeStringAndClear(); } -void ScCondFormatHelper::StyleSelect(weld::Window* pDialogParent, weld::ComboBox& rLbStyle, - const ScDocument& rDoc, SvxFontPrevWindow& rWdPreview) -{ - if (rLbStyle.get_active() == 0) - { - // call new style dialog - SfxUInt16Item aFamilyItem(SID_STYLE_FAMILY, sal_uInt16(SfxStyleFamily::Para)); - SfxStringItem aRefItem(SID_STYLE_REFERENCE, ScResId(STR_STYLENAME_STANDARD)); - css::uno::Any aAny(pDialogParent->GetXWindow()); - SfxUnoAnyItem aDialogParent(SID_DIALOG_PARENT, aAny); - - // unlock the dispatcher so SID_STYLE_NEW can be executed - // (SetDispatcherLock would affect all Calc documents) - if (ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell()) - { - if (SfxDispatcher* pDisp = pViewShell->GetDispatcher()) - { - bool bLocked = pDisp->IsLocked(); - if (bLocked) - pDisp->Lock(false); - - // Execute the "new style" slot, complete with undo and all necessary updates. - // The return value (SfxUInt16Item) is ignored, look for new styles instead. - pDisp->ExecuteList(SID_STYLE_NEW, SfxCallMode::SYNCHRON | SfxCallMode::RECORD, - { &aFamilyItem, &aRefItem }, { &aDialogParent }); - - if (bLocked) - pDisp->Lock(true); - - // Find the new style and add it into the style list boxes - SfxStyleSheetIterator aStyleIter(rDoc.GetStyleSheetPool(), SfxStyleFamily::Para); - bool bFound = false; - for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle && !bFound; - pStyle = aStyleIter.Next()) - { - const OUString& aName = pStyle->GetName(); - if (rLbStyle.find_text(aName) == -1) // all lists contain the same entries - { - for (sal_Int32 i = 1, n = rLbStyle.get_count(); i <= n && !bFound; ++i) - { - OUString aStyleName - = ScGlobal::getCharClass().uppercase(rLbStyle.get_text(i)); - if (i == n) - { - rLbStyle.append_text(aName); - rLbStyle.set_active_text(aName); - bFound = true; - } - else if (aStyleName > ScGlobal::getCharClass().uppercase(aName)) - { - rLbStyle.insert_text(i, aName); - rLbStyle.set_active_text(aName); - bFound = true; - } - } - } - } - } - } - } - - OUString aStyleName = rLbStyle.get_active_text(); - SfxStyleSheetBase* pStyleSheet - = rDoc.GetStyleSheetPool()->Find(aStyleName, SfxStyleFamily::Para); - if (pStyleSheet) - { - const SfxItemSet& rSet = pStyleSheet->GetItemSet(); - rWdPreview.SetFromItemSet(rSet, false); - } -} - -void ScCondFormatHelper::FillStyleListBox(const ScDocument& rDocument, weld::ComboBox& rCombo) -{ - std::set aStyleNames; - SfxStyleSheetIterator aStyleIter(rDocument.GetStyleSheetPool(), SfxStyleFamily::Para); - for (SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next()) - { - aStyleNames.insert(pStyle->GetName()); - } - for (const auto& rStyleName : aStyleNames) - { - rCombo.append_text(rStyleName); - } -} - -void ScCondFormatHelper::UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument& rDoc) -{ - OUString aSelectedStyle = rLbStyle.get_active_text(); - for (sal_Int32 i = rLbStyle.get_count(); i > 1; --i) - rLbStyle.remove(i - 1); - ScCondFormatHelper::FillStyleListBox(rDoc, rLbStyle); - rLbStyle.set_active_text(aSelectedStyle); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/condformateasydlg.hxx b/sc/source/ui/inc/condformateasydlg.hxx index 7880862d8535..2b34a15fefee 100644 --- a/sc/source/ui/inc/condformateasydlg.hxx +++ b/sc/source/ui/inc/condformateasydlg.hxx @@ -12,7 +12,6 @@ #include "anyrefdg.hxx" #include #include -#include class ScViewData; class ScConditionalFormat; @@ -33,12 +32,10 @@ public: virtual void Notify(SfxBroadcaster&, const SfxHint&) override; DECL_LINK(ButtonPressed, weld::Button&, void); - DECL_LINK(StyleSelectHdl, weld::ComboBox&, void); private: void SetDescription(std::u16string_view rCondition); - weld::Window* mpParent; ScViewData* mpViewData; ScDocument& mrDocument; ScConditionMode meMode; @@ -46,15 +43,12 @@ private: OUString msFormula; ScAddress maPosition; - SvxFontPrevWindow maWdPreview; std::unique_ptr mxNumberEntry; std::unique_ptr mxNumberEntry2; std::unique_ptr mxAllInputs; std::unique_ptr mxRangeEntry; std::unique_ptr mxButtonRangeEdit; std::unique_ptr mxStyles; - std::unique_ptr mxWdPreviewWin; - std::unique_ptr mxWdPreview; std::unique_ptr mxDescription; std::unique_ptr mxButtonOk; std::unique_ptr mxButtonCancel; diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx index daf91a7a7276..29baf8d9ec44 100644 --- a/sc/source/ui/inc/condformathelper.hxx +++ b/sc/source/ui/inc/condformathelper.hxx @@ -11,7 +11,6 @@ #include #include -#include class ScConditionalFormat; @@ -30,12 +29,9 @@ class ScCondFormatHelper public: static SC_DLLPUBLIC OUString GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos); - static SC_DLLPUBLIC OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex, - std::u16string_view aStr1 = std::u16string_view(), std::u16string_view aStr2 = std::u16string_view() ); - static SC_DLLPUBLIC void StyleSelect(weld::Window* pDialogParent, weld::ComboBox& rLbStyle, - const ScDocument& rDoc, SvxFontPrevWindow& rWdPreview); - static SC_DLLPUBLIC void FillStyleListBox(const ScDocument& rDocument, weld::ComboBox& rCombo); - static SC_DLLPUBLIC void UpdateStyleList(weld::ComboBox& rLbStyle, const ScDocument& rDoc); + static SC_DLLPUBLIC OUString GetExpression(ScCondFormatEntryType eType, sal_Int32 nIndex, + std::u16string_view aStr1 = std::u16string_view(), + std::u16string_view aStr2 = std::u16string_view()); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui index 0f3348bc5c8e..3939d49f613b 100644 --- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui +++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui @@ -176,9 +176,6 @@ True False - - New Style... - @@ -293,33 +290,6 @@ 1 - - - True - True - never - never - in - - - True - False - - - True - False - Example - - - - - - - False - True - 2 - - False From ec1b094127765333d7720aa7bc97832ab84babc6 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Mon, 25 Nov 2024 19:45:06 +0530 Subject: [PATCH 052/155] Revert "sc: now formula conditions can be managed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ...from condition format manager" This reverts commit 8374dd472cb4a2e2edab969a73ca88ffeaadbcd8. Change-Id: I532c17596adccfa5c88baaf2df897f3ffbee0fe6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177288 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177339 Tested-by: Pranam Lashkari --- sc/inc/document.hxx | 4 +- sc/sdi/cellsh.sdi | 3 +- sc/source/core/data/documen2.cxx | 1 - sc/source/ui/condformat/condformateasydlg.cxx | 6 +-- sc/source/ui/condformat/condformatmgr.cxx | 37 +++++++------------ sc/source/ui/inc/condformateasydlg.hxx | 1 - sc/source/ui/inc/condformatmgr.hxx | 3 +- sc/source/ui/view/cellsh3.cxx | 9 +---- sc/uiconfig/scalc/ui/condformatmanager.ui | 1 + 9 files changed, 20 insertions(+), 45 deletions(-) diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index e7d67bc7d4b0..678652e47fe7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -229,12 +229,10 @@ struct ScConditionEasyDialogData { ScConditionMode* Mode = nullptr; bool IsManaged : 1 = false; - OUString Formula; - ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged, const OUString& formula = "") + ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged) : Mode(mode) , IsManaged(isManaged) - , Formula(formula) { } diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 017e26028376..8908dc424e23 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -220,8 +220,7 @@ interface CellSelection SfxVoidItem ConditionalFormatEasy SID_EASY_CONDITIONAL_FORMAT_DIALOG ( SfxInt16Item FormatRule FN_PARAM_1, - SfxBoolItem Managed FN_PARAM_2, - SfxStringItem Formula FN_PARAM_3 + SfxBoolItem Managed FN_PARAM_2 ) [ ExecMethod = Execute; diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index aca2b03e0148..bab0668a38e9 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1189,7 +1189,6 @@ void ScDocument::SetEasyConditionalFormatDialogData(const ScConditionEasyDialogD { pConditionalFormatDialogData.Mode = data.Mode; pConditionalFormatDialogData.IsManaged = data.IsManaged; - pConditionalFormatDialogData.Formula = data.Formula; } void ScDocument::SetChangeViewSettings(const ScChangeViewSettings& rNew) diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index faef213042ef..67a51f42ea9b 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -118,7 +118,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, { meMode = *CurrentData.Mode; mbIsManaged = CurrentData.IsManaged; - msFormula = CurrentData.Formula; } mxNumberEntry2->hide(); switch (meMode) @@ -373,9 +372,8 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo } else if (meMode == ScConditionMode::Formula) { - xEntry.reset(new ScCondFormatEntry(ScConditionMode::Direct, msFormula, OUString(), - mrDocument, maPosition, - mxStyles->get_active_text())); + xEntry.reset(new ScCondFormatEntry(ScConditionMode::Direct, "", OUString(), mrDocument, + maPosition, mxStyles->get_active_text())); } else { diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index c74087daa5a2..4aaf1b32932c 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -95,13 +94,15 @@ void ScCondFormatManagerWindow::setColSizes() mrTreeView.set_column_fixed_widths(aWidths); } -ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument& rDoc, const ScConditionalFormatList* pFormatList) - : GenericDialogController(pParent, u"modules/scalc/ui/condformatmanager.ui"_ustr, u"CondFormatManager"_ustr) +ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument& rDoc, + const ScConditionalFormatList* pFormatList) + : GenericDialogController(pParent, u"modules/scalc/ui/condformatmanager.ui"_ustr, + u"CondFormatManager"_ustr) , m_bModified(false) - , m_xFormatList( pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr) + , m_xFormatList(pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr) , m_xConditionalType(m_xBuilder->weld_combo_box("type")) , m_xConditionalCellValue(m_xBuilder->weld_combo_box("typeis")) - , m_xConditionalFormula(new formula::RefEdit(m_xBuilder->weld_entry("formula"))) + , m_xConditionalFormula(m_xBuilder->weld_entry("formula")) , m_xConditionalDate(m_xBuilder->weld_combo_box("datetype")) , m_xBtnAdd(m_xBuilder->weld_button(u"add"_ustr)) , m_xBtnRemove(m_xBuilder->weld_button(u"remove"_ustr)) @@ -171,10 +172,9 @@ void ScCondFormatManagerDlg::ShowEasyConditionalDialog() case 1: // Formula { SfxInt16Item FormatRule(FN_PARAM_1, static_cast(ScConditionMode::Formula)); - SfxStringItem Formula(FN_PARAM_3, m_xConditionalFormula->GetText()); SfxViewShell::Current()->GetDispatcher()->ExecuteList( SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged, &Formula }); + { &FormatRule, &IsManaged }); } break; case 2: // Date @@ -229,21 +229,21 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, ComboHdl, weld::ComboBox&, void) case 0: { m_xConditionalCellValue->set_visible(true); - m_xConditionalFormula->GetWidget()->set_visible(false); + m_xConditionalFormula->set_visible(false); m_xConditionalDate->set_visible(false); } break; case 1: { m_xConditionalCellValue->set_visible(false); - m_xConditionalFormula->GetWidget()->set_visible(true); + m_xConditionalFormula->set_visible(true); m_xConditionalDate->set_visible(false); } break; case 2: { m_xConditionalCellValue->set_visible(false); - m_xConditionalFormula->GetWidget()->set_visible(false); + m_xConditionalFormula->set_visible(false); m_xConditionalDate->set_visible(true); } break; @@ -268,20 +268,9 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EntryFocus, weld::TreeView&, void) { const ScCondFormatEntry* conditionEntry = dynamic_cast(entry); auto conditionType = conditionEntry->GetOperation(); - - if (conditionType == ScConditionMode::Direct) // Formula conditions - { - m_xConditionalType->set_active(1); - ComboHdl(*m_xConditionalType); - m_xConditionalFormula->SetText( - conditionEntry->GetExpression(conditionEntry->GetSrcPos(), 0)); - } - else - { - m_xConditionalType->set_active(0); - ComboHdl(*m_xConditionalType); - m_xConditionalCellValue->set_active(static_cast(conditionType)); - } + m_xConditionalType->set_active(0); + ComboHdl(*m_xConditionalType); + m_xConditionalCellValue->set_active(static_cast(conditionType)); } else if (type == ScFormatEntry::Type::Date) { diff --git a/sc/source/ui/inc/condformateasydlg.hxx b/sc/source/ui/inc/condformateasydlg.hxx index 2b34a15fefee..772312040c88 100644 --- a/sc/source/ui/inc/condformateasydlg.hxx +++ b/sc/source/ui/inc/condformateasydlg.hxx @@ -40,7 +40,6 @@ private: ScDocument& mrDocument; ScConditionMode meMode; bool mbIsManaged; - OUString msFormula; ScAddress maPosition; std::unique_ptr mxNumberEntry; diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 26345d55894a..7361fb6830c7 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -10,7 +10,6 @@ #pragma once #include -#include class ScDocument; class ScConditionalFormat; @@ -53,7 +52,7 @@ private: std::unique_ptr m_xConditionalType; std::unique_ptr m_xConditionalCellValue; - std::unique_ptr m_xConditionalFormula; + std::unique_ptr m_xConditionalFormula; std::unique_ptr m_xConditionalDate; std::unique_ptr m_xBtnAdd; std::unique_ptr m_xBtnRemove; diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 6206ace72f65..98a67f26e32a 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -468,15 +468,8 @@ void ScCellShell::Execute( SfxRequest& rReq ) bManaged = static_cast(pManaged)->GetValue(); } - const SfxPoolItem* pFormula; - OUString formula; - if (pReqArgs->HasItem(FN_PARAM_3, &pFormula)) - { - formula = static_cast(pFormula)->GetValue(); - } - GetViewData().GetDocument().SetEasyConditionalFormatDialogData( - ScConditionEasyDialogData(&nFormat, bManaged, formula)); + ScConditionEasyDialogData(&nFormat, bManaged)); pScMod->SetRefDialog( nId, pWindow == nullptr ); } diff --git a/sc/uiconfig/scalc/ui/condformatmanager.ui b/sc/uiconfig/scalc/ui/condformatmanager.ui index a0160fa8aa67..ae6904641090 100644 --- a/sc/uiconfig/scalc/ui/condformatmanager.ui +++ b/sc/uiconfig/scalc/ui/condformatmanager.ui @@ -229,6 +229,7 @@ True True True + False True From acc8b8c49da3a0f2a1cc25e4425a56ed87edff4b Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Mon, 25 Nov 2024 19:47:16 +0530 Subject: [PATCH 053/155] Revert "sc: added date condition option in conditional format manage dialog" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9928f1fa147d4ff838cbf6fcfe0d976ecef97cef. Change-Id: Ieb7dfdeccaffed4ad81ff9b5b0eb3b3b49fd8d05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177289 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177340 Tested-by: Pranam Lashkari --- sc/inc/conditio.hxx | 56 --------- sc/source/core/data/conditio.cxx | 16 --- .../ui/condformat/condformatdlgentry.cxx | 30 +---- sc/source/ui/condformat/condformateasydlg.cxx | 119 +----------------- sc/source/ui/condformat/condformatmgr.cxx | 84 +------------ sc/source/ui/inc/condformatdlgentry.hxx | 2 +- sc/source/ui/inc/condformatmgr.hxx | 4 - sc/uiconfig/scalc/ui/condformatmanager.ui | 54 +------- sc/uiconfig/scalc/ui/conditionaleasydialog.ui | 2 +- 9 files changed, 11 insertions(+), 356 deletions(-) diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index a179d8d8d875..fe708bc6e356 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -85,20 +85,6 @@ enum class ScConditionMode EndsWith, ContainsText, NotContainsText, - Formula, - Today, - Yesterday, - Tomorrow, - Last7days, - ThisWeek, - LastWeek, - NextWeek, - ThisMonth, - LastMonth, - NextMonth, - ThisYear, - LastYear, - NextYear, NONE }; @@ -183,48 +169,6 @@ inline std::basic_ostream & operator <<(std::basic_ostreamhide(); - break; - case ScConditionMode::Today: - SetDescription(ScResId(STR_CONDITION_TODAY)); - mxAllInputs->hide(); - break; - case ScConditionMode::Yesterday: - SetDescription(ScResId(STR_CONDITION_YESTERDAY)); - mxAllInputs->hide(); - break; - case ScConditionMode::Tomorrow: - SetDescription(ScResId(STR_CONDITION_TOMORROW)); - mxAllInputs->hide(); - break; - case ScConditionMode::Last7days: - SetDescription(ScResId(STR_CONDITION_LAST7DAYS)); - mxAllInputs->hide(); - break; - case ScConditionMode::ThisWeek: - SetDescription(ScResId(STR_CONDITION_THISWEEK)); - mxAllInputs->hide(); - break; - case ScConditionMode::LastWeek: - SetDescription(ScResId(STR_CONDITION_LASTWEEK)); - mxAllInputs->hide(); - break; - case ScConditionMode::NextWeek: - SetDescription(ScResId(STR_CONDITION_NEXTWEEK)); - mxAllInputs->hide(); - break; - case ScConditionMode::ThisMonth: - SetDescription(ScResId(STR_CONDITION_THISMONTH)); - mxAllInputs->hide(); - break; - case ScConditionMode::LastMonth: - SetDescription(ScResId(STR_CONDITION_LASTMONTH)); - mxAllInputs->hide(); - break; - case ScConditionMode::NextMonth: - SetDescription(ScResId(STR_CONDITION_NEXTMONTH)); - mxAllInputs->hide(); - break; - case ScConditionMode::ThisYear: - SetDescription(ScResId(STR_CONDITION_THISYEAR)); - mxAllInputs->hide(); - break; - case ScConditionMode::LastYear: - SetDescription(ScResId(STR_CONDITION_LASTYEAR)); - mxAllInputs->hide(); - break; - case ScConditionMode::NextYear: - SetDescription(ScResId(STR_CONDITION_NEXTYEAR)); - mxAllInputs->hide(); - break; default: SAL_WARN("sc", "ConditionalFormatEasyDialog::ConditionalFormatEasyDialog: invalid format"); @@ -357,29 +266,9 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo break; } - std::unique_ptr xEntry; - if (meMode < ScConditionMode::Formula) - { - xEntry.reset(new ScCondFormatEntry(meMode, sExpression1, sExpression2, mrDocument, - maPosition, mxStyles->get_active_text())); - } - else if (meMode >= ScConditionMode::Today && meMode < ScConditionMode::NONE) - { - ScCondDateFormatEntry entry(&mrDocument); - entry.SetDateType(GetScCondFormatDateType(meMode)); - entry.SetStyleName(mxStyles->get_active_text()); - xEntry.reset(new ScCondDateFormatEntry(&mrDocument, entry)); - } - else if (meMode == ScConditionMode::Formula) - { - xEntry.reset(new ScCondFormatEntry(ScConditionMode::Direct, "", OUString(), mrDocument, - maPosition, mxStyles->get_active_text())); - } - else - { - DBG_ASSERT(false, "Invalid condition type selected."); - return; - } + std::unique_ptr pEntry + = std::make_unique(meMode, sExpression1, sExpression2, mrDocument, + maPosition, mxStyles->get_active_text()); ScRangeList aRange; ScRefFlags nFlags @@ -387,7 +276,7 @@ IMPL_LINK(ConditionalFormatEasyDialog, ButtonPressed, weld::Button&, rButton, vo mpViewData->GetDocument().GetAddressConvention(), maPosition.Tab()); if ((nFlags & ScRefFlags::VALID) && !aRange.empty()) { - pFormat->AddEntry(xEntry.release()); + pFormat->AddEntry(pEntry.release()); pFormat->SetRange(aRange); auto& rRangeList = pFormat->GetRange(); mpViewData->GetDocShell()->GetDocFunc().ReplaceConditionalFormat( diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 4aaf1b32932c..9ddae34551a3 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -21,7 +21,6 @@ #include #include #include -#include ScCondFormatManagerWindow::ScCondFormatManagerWindow(weld::TreeView& rTreeView, ScDocument& rDoc, ScConditionalFormatList* pFormatList) @@ -102,8 +101,6 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument , m_xFormatList(pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr) , m_xConditionalType(m_xBuilder->weld_combo_box("type")) , m_xConditionalCellValue(m_xBuilder->weld_combo_box("typeis")) - , m_xConditionalFormula(m_xBuilder->weld_entry("formula")) - , m_xConditionalDate(m_xBuilder->weld_combo_box("datetype")) , m_xBtnAdd(m_xBuilder->weld_button(u"add"_ustr)) , m_xBtnRemove(m_xBuilder->weld_button(u"remove"_ustr)) , m_xBtnEdit(m_xBuilder->weld_button(u"edit"_ustr)) @@ -114,8 +111,6 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument m_xBtnEdit->connect_clicked(LINK(this, ScCondFormatManagerDlg, EditBtnClickHdl)); m_xBtnAdd->connect_clicked(LINK(this, ScCondFormatManagerDlg, AddBtnHdl)); m_xTreeView->connect_row_activated(LINK(this, ScCondFormatManagerDlg, EditBtnHdl)); - m_xTreeView->connect_changed(LINK(this, ScCondFormatManagerDlg, EntryFocus)); - m_xConditionalType->connect_changed(LINK(this, ScCondFormatManagerDlg, ComboHdl)); SvtViewOptions aDlgOpt(EViewType::Dialog, u"CondFormatDialog"_ustr); if (aDlgOpt.Exists()) @@ -157,34 +152,18 @@ void ScCondFormatManagerDlg::ShowEasyConditionalDialog() return; auto id = m_xConditionalType->get_active(); - SfxBoolItem IsManaged(FN_PARAM_2, true); switch (id) { case 0: // Cell value { SfxInt16Item FormatRule(FN_PARAM_1, m_xConditionalCellValue->get_active_id().toUInt32()); - pViewShell->GetDispatcher()->ExecuteList(SID_EASY_CONDITIONAL_FORMAT_DIALOG, - SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged }); - } - break; - case 1: // Formula - { - SfxInt16Item FormatRule(FN_PARAM_1, static_cast(ScConditionMode::Formula)); + SfxBoolItem IsManaged(FN_PARAM_2, true); SfxViewShell::Current()->GetDispatcher()->ExecuteList( SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, { &FormatRule, &IsManaged }); } break; - case 2: // Date - { - SfxInt16Item FormatRule(FN_PARAM_1, m_xConditionalDate->get_active_id().toUInt32()); - pViewShell->GetDispatcher()->ExecuteList(SID_EASY_CONDITIONAL_FORMAT_DIALOG, - SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged }); - } - break; default: break; } @@ -221,67 +200,6 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl, weld::Button&, void) m_xDialog->response( DLG_RET_ADD ); } -IMPL_LINK_NOARG(ScCondFormatManagerDlg, ComboHdl, weld::ComboBox&, void) -{ - auto id = m_xConditionalType->get_active(); - switch (id) - { - case 0: - { - m_xConditionalCellValue->set_visible(true); - m_xConditionalFormula->set_visible(false); - m_xConditionalDate->set_visible(false); - } - break; - case 1: - { - m_xConditionalCellValue->set_visible(false); - m_xConditionalFormula->set_visible(true); - m_xConditionalDate->set_visible(false); - } - break; - case 2: - { - m_xConditionalCellValue->set_visible(false); - m_xConditionalFormula->set_visible(false); - m_xConditionalDate->set_visible(true); - } - break; - default: - break; - } -} - -IMPL_LINK_NOARG(ScCondFormatManagerDlg, EntryFocus, weld::TreeView&, void) -{ - ScConditionalFormat* conditionFrmt = m_xCtrlManager->GetSelection(); - - if (!conditionFrmt) - return; - - const ScFormatEntry* entry = conditionFrmt->GetEntry(0); - if (!entry) - return; - auto type = entry->GetType(); - - if (type == ScFormatEntry::Type::Condition) - { - const ScCondFormatEntry* conditionEntry = dynamic_cast(entry); - auto conditionType = conditionEntry->GetOperation(); - m_xConditionalType->set_active(0); - ComboHdl(*m_xConditionalType); - m_xConditionalCellValue->set_active(static_cast(conditionType)); - } - else if (type == ScFormatEntry::Type::Date) - { - const ScCondDateFormatEntry* dateEntry = dynamic_cast(entry); - auto dateType = dateEntry->GetDateType(); - m_xConditionalType->set_active(2); - ComboHdl(*m_xConditionalType); - m_xConditionalDate->set_active(dateType); - } -} - void ScCondFormatManagerDlg::SetModified() { m_bModified = true; diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx index 05cb252e9b68..33b218b181e6 100644 --- a/sc/source/ui/inc/condformatdlgentry.hxx +++ b/sc/source/ui/inc/condformatdlgentry.hxx @@ -103,7 +103,7 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener std::unique_ptr mxWdPreview; bool mbIsInStyleCreate; - static const sal_Int32 NUM_COND_ENTRIES = 38; + static const sal_Int32 NUM_COND_ENTRIES = 24; // Lookup table from positions in maLbCondType to the condition mode enum static const ScConditionMode mpEntryToCond[NUM_COND_ENTRIES]; diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 7361fb6830c7..51a251416b27 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -52,8 +52,6 @@ private: std::unique_ptr m_xConditionalType; std::unique_ptr m_xConditionalCellValue; - std::unique_ptr m_xConditionalFormula; - std::unique_ptr m_xConditionalDate; std::unique_ptr m_xBtnAdd; std::unique_ptr m_xBtnRemove; std::unique_ptr m_xBtnEdit; @@ -66,8 +64,6 @@ private: DECL_LINK(EditBtnClickHdl, weld::Button&, void); DECL_LINK(AddBtnHdl, weld::Button&, void); DECL_LINK(EditBtnHdl, weld::TreeView&, bool); - DECL_LINK(ComboHdl, weld::ComboBox&, void); - DECL_LINK(EntryFocus, weld::TreeView&, void); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/uiconfig/scalc/ui/condformatmanager.ui b/sc/uiconfig/scalc/ui/condformatmanager.ui index ae6904641090..74ea3d33bda9 100644 --- a/sc/uiconfig/scalc/ui/condformatmanager.ui +++ b/sc/uiconfig/scalc/ui/condformatmanager.ui @@ -224,54 +224,6 @@ 1 - - - True - True - True - False - True - - - Here you can add formula for conditional formatting. - - - - - False - True - 2 - - - - - False - False - False - True - 0 - - Today - Yesterday - Tomorrow - Last 7 days - This week - Last week - Next week - This month - Last month - Next month - This year - Last year - Next year - - - - False - True - 3 - - Add @@ -287,7 +239,7 @@ False True - 4 + 2 @@ -305,7 +257,7 @@ False True - 5 + 3 @@ -323,7 +275,7 @@ False True - 6 + 4 diff --git a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui index 3939d49f613b..d2a32c99023a 100644 --- a/sc/uiconfig/scalc/ui/conditionaleasydialog.ui +++ b/sc/uiconfig/scalc/ui/conditionaleasydialog.ui @@ -204,7 +204,7 @@ True False - Highlight cells if %1 + Highlight cells with values %1 From f643a98b2b60ccad63f7b4647ff6bc0141df0718 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Mon, 25 Nov 2024 19:47:26 +0530 Subject: [PATCH 054/155] Revert "sc: manage conditional format with simpler dialog" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 58c3f70c514ef4ce0de5419ab7daa3bebfb96f37. Change-Id: I500a96508684547c158cdd1814540a4b24f667d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177290 Reviewed-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177341 Tested-by: Jenkins --- sc/inc/document.hxx | 22 ++----- sc/inc/scabstdlg.hxx | 1 - sc/qa/uitest/conditional_format/tdf96453.py | 5 +- sc/sdi/cellsh.sdi | 3 +- sc/source/core/data/documen2.cxx | 5 +- sc/source/ui/attrdlg/scdlgfact.cxx | 5 -- sc/source/ui/attrdlg/scdlgfact.hxx | 1 - sc/source/ui/condformat/condformateasydlg.cxx | 17 ++--- sc/source/ui/condformat/condformatmgr.cxx | 33 ---------- sc/source/ui/inc/condformateasydlg.hxx | 1 - sc/source/ui/inc/condformatmgr.hxx | 3 - sc/source/ui/view/cellsh1.cxx | 12 +++- sc/source/ui/view/cellsh3.cxx | 15 ++--- sc/uiconfig/scalc/ui/condformatmanager.ui | 66 ++----------------- 14 files changed, 32 insertions(+), 157 deletions(-) diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 678652e47fe7..7908be80dcc7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -225,20 +225,6 @@ struct ScSheetLimits; struct ScDataAreaExtras; enum class ScConditionMode; -struct ScConditionEasyDialogData -{ - ScConditionMode* Mode = nullptr; - bool IsManaged : 1 = false; - - ScConditionEasyDialogData(ScConditionMode* mode, bool isManaged) - : Mode(mode) - , IsManaged(isManaged) - { - } - - ScConditionEasyDialogData() {} -}; - namespace sc { typedef std::map IconSetBitmapMap; @@ -479,7 +465,7 @@ private: std::unique_ptr pExtDocOptions; // for import etc. std::unique_ptr mpClipOptions; // clipboard options std::unique_ptr pConsolidateDlgData; - ScConditionEasyDialogData pConditionalFormatDialogData; + std::unique_ptr pConditionalFormatDialogMode; std::unique_ptr pAutoNameCache; // for automatic name lookup during CompileXML @@ -727,10 +713,10 @@ public: void SetConsolidateDlgData( std::unique_ptr pData ); const ScConsolidateParam* GetConsolidateDlgData() const { return pConsolidateDlgData.get(); } - void SetEasyConditionalFormatDialogData(const ScConditionEasyDialogData& data); - const ScConditionEasyDialogData & GetEasyConditionalFormatDialogData() const + void SetEasyConditionalFormatDialogData(std::unique_ptr pMode); + const ScConditionMode* GetEasyConditionalFormatDialogData() const { - return pConditionalFormatDialogData; + return pConditionalFormatDialogMode.get(); } void Clear( bool bFromDestructor = false ); diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index eeb1061fa1d2..245869363f2e 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -93,7 +93,6 @@ public: virtual std::unique_ptr GetConditionalFormatList() = 0; virtual bool CondFormatsChanged() const = 0; - virtual void ShowEasyConditionalDialog() = 0; virtual void SetModified() = 0; diff --git a/sc/qa/uitest/conditional_format/tdf96453.py b/sc/qa/uitest/conditional_format/tdf96453.py index 50ba86e51eec..453a9ff48eb5 100644 --- a/sc/qa/uitest/conditional_format/tdf96453.py +++ b/sc/qa/uitest/conditional_format/tdf96453.py @@ -11,7 +11,6 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file from libreoffice.calc.document import get_sheet_from_doc from libreoffice.calc.conditional_format import get_conditional_format_from_sheet -import sys class ConditionalFormatDlgTest(UITestCase): @@ -54,9 +53,9 @@ class ConditionalFormatDlgTest(UITestCase): # and still only 2 conditional formats in the document xList = xCondFormatMgr.getChild("CONTAINER") list_state = get_state_as_dict(xList) - self.assertEqual(list_state['Children'], '3') + self.assertEqual(list_state['Children'], '2') - self.assertEqual(conditional_format_list.getLength(), 3) + self.assertEqual(conditional_format_list.getLength(), 2) # close the conditional format manager xCancelBtn = xCondFormatMgr.getChild("cancel") diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 8908dc424e23..44e87cd69119 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -219,8 +219,7 @@ interface CellSelection SID_POPUP_EASY_CONDITIONAL_FORMAT [] SfxVoidItem ConditionalFormatEasy SID_EASY_CONDITIONAL_FORMAT_DIALOG ( - SfxInt16Item FormatRule FN_PARAM_1, - SfxBoolItem Managed FN_PARAM_2 + SfxInt16Item FormatRule FN_PARAM_1 ) [ ExecMethod = Execute; diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index bab0668a38e9..3890a5194e85 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1185,10 +1185,9 @@ void ScDocument::SetConsolidateDlgData( std::unique_ptr pDat pConsolidateDlgData = std::move(pData); } -void ScDocument::SetEasyConditionalFormatDialogData(const ScConditionEasyDialogData& data) +void ScDocument::SetEasyConditionalFormatDialogData(std::unique_ptr pMode) { - pConditionalFormatDialogData.Mode = data.Mode; - pConditionalFormatDialogData.IsManaged = data.IsManaged; + pConditionalFormatDialogMode = std::move(pMode); } void ScDocument::SetChangeViewSettings(const ScChangeViewSettings& rNew) diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index e70283b4b5ce..c088322f01a2 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -739,11 +739,6 @@ ScConditionalFormat* AbstractScCondFormatManagerDlg_Impl::GetCondFormatSelected( return m_xDlg->GetCondFormatSelected(); } -void AbstractScCondFormatManagerDlg_Impl::ShowEasyConditionalDialog() -{ - m_xDlg->ShowEasyConditionalDialog(); -} - int AbstractScMetricInputDlg_Impl::GetInputValue() const { return m_xDlg->GetInputValue(); diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 7e9761180ef9..fe60d59bc8e6 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -116,7 +116,6 @@ public: virtual bool CondFormatsChanged() const override; virtual void SetModified() override; virtual ScConditionalFormat* GetCondFormatSelected() override; - virtual void ShowEasyConditionalDialog() override; }; class AbstractScDataPilotDatabaseDlg_Impl :public AbstractScDataPilotDatabaseDlg diff --git a/sc/source/ui/condformat/condformateasydlg.cxx b/sc/source/ui/condformat/condformateasydlg.cxx index bf745747fee4..71ae8745df53 100644 --- a/sc/source/ui/condformat/condformateasydlg.cxx +++ b/sc/source/ui/condformat/condformateasydlg.cxx @@ -58,7 +58,6 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, u"CondFormatEasyDlg"_ustr) , mpViewData(pViewData) , mrDocument(mpViewData->GetDocument()) - , mbIsManaged(false) , mxNumberEntry(m_xBuilder->weld_entry(u"entryNumber"_ustr)) , mxNumberEntry2(m_xBuilder->weld_entry(u"entryNumber2"_ustr)) , mxAllInputs(m_xBuilder->weld_container(u"allInputs"_ustr)) @@ -70,9 +69,9 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, , mxButtonCancel(m_xBuilder->weld_button(u"cancel"_ustr)) { mxButtonRangeEdit->SetReferences(this, mxRangeEntry.get()); - const ScConditionEasyDialogData CurrentData + const ScConditionMode* pCurrentMode = pViewData->GetDocument().GetEasyConditionalFormatDialogData(); - if (!CurrentData.Mode) + if (!pCurrentMode) { SAL_WARN( "sc", @@ -81,8 +80,7 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, } else { - meMode = *CurrentData.Mode; - mbIsManaged = CurrentData.IsManaged; + meMode = *pCurrentMode; } mxNumberEntry2->hide(); switch (meMode) @@ -199,14 +197,7 @@ ConditionalFormatEasyDialog::ConditionalFormatEasyDialog(SfxBindings* pBindings, mxStyles->set_active(1); } -ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog() -{ - if (mbIsManaged) - { - GetBindings().GetDispatcher()->Execute(SID_OPENDLG_CONDFRMT_MANAGER, - SfxCallMode::ASYNCHRON); - } -} +ConditionalFormatEasyDialog::~ConditionalFormatEasyDialog() {} void ConditionalFormatEasyDialog::Notify(SfxBroadcaster&, const SfxHint& rHint) { diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index 9ddae34551a3..2e5cef3a01a0 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -8,18 +8,11 @@ */ #include -#include #include #include #include #include -#include #include -#include -#include -#include -#include -#include #include ScCondFormatManagerWindow::ScCondFormatManagerWindow(weld::TreeView& rTreeView, @@ -99,8 +92,6 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(weld::Window* pParent, ScDocument u"CondFormatManager"_ustr) , m_bModified(false) , m_xFormatList(pFormatList ? new ScConditionalFormatList(*pFormatList) : nullptr) - , m_xConditionalType(m_xBuilder->weld_combo_box("type")) - , m_xConditionalCellValue(m_xBuilder->weld_combo_box("typeis")) , m_xBtnAdd(m_xBuilder->weld_button(u"add"_ustr)) , m_xBtnRemove(m_xBuilder->weld_button(u"remove"_ustr)) , m_xBtnEdit(m_xBuilder->weld_button(u"edit"_ustr)) @@ -145,30 +136,6 @@ ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected() return m_xCtrlManager->GetSelection(); } -void ScCondFormatManagerDlg::ShowEasyConditionalDialog() -{ - SfxViewShell* pViewShell = SfxViewShell::Current(); - if (!pViewShell) - return; - - auto id = m_xConditionalType->get_active(); - switch (id) - { - case 0: // Cell value - { - SfxInt16Item FormatRule(FN_PARAM_1, - m_xConditionalCellValue->get_active_id().toUInt32()); - SfxBoolItem IsManaged(FN_PARAM_2, true); - SfxViewShell::Current()->GetDispatcher()->ExecuteList( - SID_EASY_CONDITIONAL_FORMAT_DIALOG, SfxCallMode::ASYNCHRON, - { &FormatRule, &IsManaged }); - } - break; - default: - break; - } -} - IMPL_LINK_NOARG(ScCondFormatManagerDlg, RemoveBtnHdl, weld::Button&, void) { m_xCtrlManager->DeleteSelection(); diff --git a/sc/source/ui/inc/condformateasydlg.hxx b/sc/source/ui/inc/condformateasydlg.hxx index 772312040c88..933d2e51e207 100644 --- a/sc/source/ui/inc/condformateasydlg.hxx +++ b/sc/source/ui/inc/condformateasydlg.hxx @@ -39,7 +39,6 @@ private: ScViewData* mpViewData; ScDocument& mrDocument; ScConditionMode meMode; - bool mbIsManaged; ScAddress maPosition; std::unique_ptr mxNumberEntry; diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 51a251416b27..ca9f16e8a55f 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -44,14 +44,11 @@ public: void SetModified(); ScConditionalFormat* GetCondFormatSelected(); - void ShowEasyConditionalDialog(); private: bool m_bModified; std::unique_ptr m_xFormatList; - std::unique_ptr m_xConditionalType; - std::unique_ptr m_xConditionalCellValue; std::unique_ptr m_xBtnAdd; std::unique_ptr m_xBtnRemove; std::unique_ptr m_xBtnEdit; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 331ba8a5efca..4b94a67eed1a 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2944,7 +2944,16 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } else if (nRet == DLG_RET_ADD) { - pDlg->ShowEasyConditionalDialog(); + // Put the xml string parameter to initialize the + // Conditional Format Dialog. ( add new ) + pTabViewShell->setScCondFormatDlgItem( + std::make_shared( + std::shared_ptr( + pCondFormatList.release()), + -1, true)); + // Queue message to open Conditional Format Dialog + GetViewData().GetDispatcher().Execute(SID_OPENDLG_CONDFRMT, + SfxCallMode::ASYNCHRON); } else if (nRet == DLG_RET_EDIT) { @@ -2957,7 +2966,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) std::shared_ptr( pCondFormatList.release()), nIndex, true)); - // Queue message to open Conditional Format Dialog GetViewData().GetDispatcher().Execute(SID_OPENDLG_CONDFRMT, SfxCallMode::ASYNCHRON); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 98a67f26e32a..033ecf8982cb 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -456,20 +456,13 @@ void ScCellShell::Execute( SfxRequest& rReq ) const SfxPoolItem* pFormat; if (pReqArgs->HasItem( FN_PARAM_1, &pFormat)) { - ScConditionMode nFormat = static_cast( - static_cast(pFormat)->GetValue()); + sal_Int16 nFormat = static_cast(pFormat)->GetValue(); sal_uInt16 nId = sc::ConditionalFormatEasyDialogWrapper::GetChildWindowId(); SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame(); - SfxChildWindow* pWindow = rViewFrame.GetChildWindow( nId ); - const SfxPoolItem* pManaged; - bool bManaged = false; - if (pReqArgs->HasItem(FN_PARAM_2, &pManaged)) - { - bManaged = static_cast(pManaged)->GetValue(); - } - + SfxChildWindow* pWindow = rViewFrame.GetChildWindow(nId); GetViewData().GetDocument().SetEasyConditionalFormatDialogData( - ScConditionEasyDialogData(&nFormat, bManaged)); + std::make_unique( + static_cast(nFormat))); pScMod->SetRefDialog( nId, pWindow == nullptr ); } diff --git a/sc/uiconfig/scalc/ui/condformatmanager.ui b/sc/uiconfig/scalc/ui/condformatmanager.ui index 74ea3d33bda9..c9aead73ba61 100644 --- a/sc/uiconfig/scalc/ui/condformatmanager.ui +++ b/sc/uiconfig/scalc/ui/condformatmanager.ui @@ -163,67 +163,11 @@ - + True False 12 - - - True - False - 0 - - Cell value - Formula is - Date is - - - - True - True - 0 - - - - - False - True - True - 0 - - is equal to - is less than - is greater than - is less than or equal to - is greater than or equal to - is not equal to - is between - is not between - is duplicate - is not duplicate - - is in top N elements - is in bottom N elements - is in top N percent - is in bottom N percent - is above average - is below average - is above or equal average - is below or equal average - is error - is not error - begins with - ends with - contains - does not contain - - - - True - True - 1 - - + start Add @@ -239,7 +183,7 @@ False True - 2 + 0 @@ -257,7 +201,7 @@ False True - 3 + 1 @@ -275,7 +219,7 @@ False True - 4 + 2 From 7f927322d9b030ceb3b04ae09ea5641e98916f62 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 3 Dec 2024 14:18:21 +0100 Subject: [PATCH 055/155] configmgr: Better handling of finalized vs. non-finalized in the same layer When there are multiple competing configuration settings for the same configuration layer (e.g., in xcu files of two different extensions from the same extension layer), then the setting that is read last always won, even if any of the settings read earlier is marked as finalized. (The reason for originally doing it that way was that it kept the code logic somewhat simple.) However, esp. for a scenario of multiple extensions in one extension layer (bundled, shared, or user), it can be unexpected by a user that a non-finalized setting (that comes from the extension that happens to be read last) can win over a finalized one. Therefore, change the logic accordingly. Now, if any of the competing settings are finalized, the first finalized one that is read wins. Change-Id: I22aeade543a5b26d95d49cfcb561f974cd7a5081 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177737 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- configmgr/source/xcuparser.cxx | 49 ++++++++++++++++++---------------- configmgr/source/xcuparser.hxx | 2 ++ 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index 6b38219eacde..15e218f55fc0 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -219,6 +219,10 @@ XcuParser::Operation XcuParser::parseOperation(xmlreader::Span const & text) { "invalid op " + text.convertFromUtf8()); } +bool XcuParser::isAlreadyFinalized(int finalizedLayer) const { + return finalizedLayer != Data::NO_LAYER && finalizedLayer <= valueParser_.getLayer(); +} + void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { OStringBuffer buf(256); buf.append('.'); @@ -301,14 +305,13 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { throw css::uno::RuntimeException( "invalid operation on root node in " + reader.getUrl()); } - int finalizedLayer = std::min( - finalized ? valueParser_.getLayer() : Data::NO_LAYER, - node->getFinalized()); - node->setFinalized(finalizedLayer); - if (finalizedLayer < valueParser_.getLayer()) { + if (isAlreadyFinalized(node->getFinalized())) { state_.push(State::Ignore(true)); return; } + if (finalized) { + node->setFinalized(valueParser_.getLayer()); + } state_.push(State::Modify(node)); } @@ -367,7 +370,7 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) { default: break; } - if (finalizedLayer < valueParser_.getLayer()) { + if (isAlreadyFinalized(finalizedLayer)) { state_.push(State::Ignore(true)); return; } @@ -660,14 +663,13 @@ void XcuParser::handlePlainGroupProp( state_.push(State::Ignore(true)); return; } - int finalizedLayer = std::min( - finalized ? valueParser_.getLayer() : Data::NO_LAYER, - property->getFinalized()); - property->setFinalized(finalizedLayer); - if (finalizedLayer < valueParser_.getLayer()) { + if (isAlreadyFinalized(property->getFinalized())) { state_.push(State::Ignore(true)); return; } + if (finalized) { + property->setFinalized(valueParser_.getLayer()); + } if (type != TYPE_ERROR && property->getStaticType() != TYPE_ANY && type != property->getStaticType()) { @@ -703,14 +705,13 @@ void XcuParser::handleLocalizedGroupProp( state_.push(State::Ignore(true)); return; } - int finalizedLayer = std::min( - finalized ? valueParser_.getLayer() : Data::NO_LAYER, - property->getFinalized()); - property->setFinalized(finalizedLayer); - if (finalizedLayer < valueParser_.getLayer()) { + if (isAlreadyFinalized(property->getFinalized())) { state_.push(State::Ignore(true)); return; } + if (finalized) { + property->setFinalized(valueParser_.getLayer()); + } if (type != TYPE_ERROR && property->getStaticType() != TYPE_ANY && type != property->getStaticType()) { @@ -798,14 +799,13 @@ void XcuParser::handleGroupNode( throw css::uno::RuntimeException( "invalid operation on group node in " + reader.getUrl()); } - int finalizedLayer = std::min( - finalized ? valueParser_.getLayer() : Data::NO_LAYER, - child->getFinalized()); - child->setFinalized(finalizedLayer); - if (finalizedLayer < valueParser_.getLayer()) { + if (isAlreadyFinalized(child->getFinalized())) { state_.push(State::Ignore(true)); return; } + if (finalized) { + child->setFinalized(valueParser_.getLayer()); + } state_.push(State::Modify(child)); } @@ -877,12 +877,15 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { "set member node " + name + " references undefined template " + templateName + " in " + reader.getUrl()); } + bool alreadyFinalized = false; int finalizedLayer = finalized ? valueParser_.getLayer() : Data::NO_LAYER; int mandatoryLayer = mandatory ? valueParser_.getLayer() : Data::NO_LAYER; NodeMap & members = set->getMembers(); NodeMap::iterator i(members.find(name)); if (i != members.end()) { - finalizedLayer = std::min(finalizedLayer, i->second->getFinalized()); + auto const fin = i->second->getFinalized(); + alreadyFinalized = isAlreadyFinalized(fin); + finalizedLayer = std::min(finalizedLayer, fin); i->second->setFinalized(finalizedLayer); mandatoryLayer = std::min(mandatoryLayer, i->second->getMandatory()); i->second->setMandatory(mandatoryLayer); @@ -891,7 +894,7 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { return; } } - if (finalizedLayer < valueParser_.getLayer()) { + if (alreadyFinalized) { state_.push(State::Ignore(true)); return; } diff --git a/configmgr/source/xcuparser.hxx b/configmgr/source/xcuparser.hxx index e50b7b5a0fc8..680b294bd6b3 100644 --- a/configmgr/source/xcuparser.hxx +++ b/configmgr/source/xcuparser.hxx @@ -73,6 +73,8 @@ private: static Operation parseOperation(xmlreader::Span const & text); + bool isAlreadyFinalized(int finalizedLayer) const; + void handleComponentData(xmlreader::XmlReader & reader); void handleItem(xmlreader::XmlReader & reader); From 863f5d26f96609b408794e02d3ef7e238a8c5e4d Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Mon, 2 Dec 2024 16:19:52 +0100 Subject: [PATCH 056/155] Fix typo Change-Id: I7066a328fa54c062d1a12582d4f270e70f466c32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177702 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins --- wizards/source/scriptforge/SF_Array.xba | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba index 53b72b72b225..386b405bd89a 100644 --- a/wizards/source/scriptforge/SF_Array.xba +++ b/wizards/source/scriptforge/SF_Array.xba @@ -446,7 +446,7 @@ Public Function ConvertToDataArray(Optional ByRef Data As Variant _ ''' If bigger than Data, fill with zero-length strings ''' If smaller than Data, truncate ''' If Rows = 1 and the input array is a vector, the data array is aligned horizontally -''' By defauly, vectors are aligned vertically. +''' By default, vectors are aligned vertically. ''' When absent, the size of the output is determined by the input array. ''' Returns: ''' The output is always an array of nested arrays. Array and nested arrays are zero-based. @@ -2978,4 +2978,4 @@ Dim iCompare As Integer, iVarType1 As Integer, iVarType2 As Integer End Function ' ScriptForge.SF_Array._ValCompare REM ================================================= END OF SCRIPTFORGE.SF_ARRAY - \ No newline at end of file + From 16b2cae80e3c112b44143cf0dabcd9d59322630c Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Thu, 28 Nov 2024 15:35:28 +0100 Subject: [PATCH 057/155] tdf#164090: a11y sw: add new warning for non numbered empty paragraph Add new warning for empty paragraph between numbering paragraphs. Change-Id: Ib85b376da77a72a87ab05a3e8271be43e223f129 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177493 Tested-by: Gabor Kelemen Reviewed-by: Balazs Varga Tested-by: Jenkins --- cui/inc/strings.hrc | 1 + cui/source/options/optaccessibility.cxx | 39 +++++- include/sfx2/AccessibilityIssue.hxx | 5 +- .../schema/org/openoffice/Office/Common.xcs | 38 +++++- sw/inc/AccessibilityCheckStrings.hrc | 1 + .../AccessibilityCheckTest.cxx | 46 ++++--- .../accessibilitycheck/data/EmptyNumSpace.odt | Bin 0 -> 11759 bytes sw/source/core/access/AccessibilityCheck.cxx | 126 +++++++++++++++++- .../uibase/sidebar/A11yCheckIssuesPanel.cxx | 5 +- 9 files changed, 226 insertions(+), 35 deletions(-) create mode 100644 sw/qa/core/accessibilitycheck/data/EmptyNumSpace.odt diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index 0b5068b6fcae..96ab2285b4ee 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -421,6 +421,7 @@ #define STR_AVOID_NEWLINES_SPACE NC_("STR_AVOID_NEWLINES_SPACE", "Check if document contains new lines to create space.") #define STR_AVOID_SPACES_SPACE NC_("STR_AVOID_SPACES_SPACE", "Check if document contains extra spaces to create space.") #define STR_AVOID_TABS_FORMATTING NC_("STR_AVOID_TABS_FORMATTING", "Check if document contains tabs for formatting.") +#define STR_AVOID_EMPTY_NUM_PARA NC_("STR_AVOID_EMPTY_NUM_PARA", "Check if document contains new empty lines between numbered paragraphs.") #define STR_HEADINGS_NOT_IN_ORDER NC_("STR_HEADINGS_NOT_IN_ORDER", "Check if the outline levels of all headings are in sequential order.") #define STR_TEXT_FORMATTING_CONVEYS_MEAN NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "Check if the document contains direct formatting.") #define STR_NON_INTERACTIVE_FORMS NC_("STR_NON_INTERACTIVE_FORMS", "Check if the document contains interactive input fields.") diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx index 41cb13f358ac..27971df71360 100644 --- a/cui/source/options/optaccessibility.cxx +++ b/cui/source/options/optaccessibility.cxx @@ -37,10 +37,13 @@ namespace { u"NoAltOleObj"_ustr, { sfx::AccessibilityIssueID::NO_ALT_OLE, STR_NO_ALT_OLE } }, { u"NoAltGraphicObj"_ustr, { sfx::AccessibilityIssueID::NO_ALT_GRAPHIC, STR_NO_ALT_GRAPHIC } }, { u"NoAltShapeObj"_ustr, { sfx::AccessibilityIssueID::NO_ALT_SHAPE, STR_NO_ALT_SHAPE } }, - { u"TextFormattings"_ustr, { sfx::AccessibilityIssueID::TEXT_FORMATTING, STR_AVOID_NEWLINES_SPACE } }, + { u"TableMergeSplit"_ustr, { sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, STR_TABLE_MERGE_SPLIT } }, + { u"TextNewLines"_ustr, { sfx::AccessibilityIssueID::TEXT_NEW_LINES, STR_AVOID_NEWLINES_SPACE } }, + { u"TextSpaces"_ustr, { sfx::AccessibilityIssueID::TEXT_SPACES, STR_AVOID_SPACES_SPACE } }, + { u"TextTabs"_ustr, { sfx::AccessibilityIssueID::TEXT_TABS, STR_AVOID_TABS_FORMATTING } }, + { u"TextEmptyNums"_ustr, { sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA, STR_AVOID_EMPTY_NUM_PARA } }, { u"DirectFormattings"_ustr, { sfx::AccessibilityIssueID::DIRECT_FORMATTING, STR_TEXT_FORMATTING_CONVEYS_MEAN } }, { u"TableFormattings"_ustr, { sfx::AccessibilityIssueID::TABLE_FORMATTING, STR_TABLE_FORMATTING } }, - { u"TableMergeSplit"_ustr, { sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, STR_TABLE_MERGE_SPLIT } }, { u"HyperlinkText"_ustr, { sfx::AccessibilityIssueID::HYPERLINK_IS_TEXT, STR_HYPERLINK_TEXT_IS_LINK } }, { u"HyperlinkShort"_ustr, { sfx::AccessibilityIssueID::HYPERLINK_SHORT, STR_HYPERLINK_TEXT_IS_SHORT } }, { u"HyperlinkNoName"_ustr, { sfx::AccessibilityIssueID::HYPERLINK_NO_NAME, STR_HYPERLINK_NO_NAME } }, @@ -198,8 +201,20 @@ bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* ) officecfg::Office::Common::AccessibilityIssues::NoAltShapeObj::set(bChecked, batch); break; - case sfx::AccessibilityIssueID::TEXT_FORMATTING: - officecfg::Office::Common::AccessibilityIssues::TextFormattings::set(bChecked, batch); + case sfx::AccessibilityIssueID::TEXT_NEW_LINES: + officecfg::Office::Common::AccessibilityIssues::TextNewLines::set(bChecked, batch); + break; + + case sfx::AccessibilityIssueID::TEXT_SPACES: + officecfg::Office::Common::AccessibilityIssues::TextSpaces::set(bChecked, batch); + break; + + case sfx::AccessibilityIssueID::TEXT_TABS: + officecfg::Office::Common::AccessibilityIssues::TextTabs::set(bChecked, batch); + break; + + case sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA: + officecfg::Office::Common::AccessibilityIssues::TextEmptyNums::set(bChecked, batch); break; case sfx::AccessibilityIssueID::DIRECT_FORMATTING: @@ -394,8 +409,20 @@ void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet* ) bChecked = officecfg::Office::Common::AccessibilityIssues::NoAltShapeObj::get(); break; - case sfx::AccessibilityIssueID::TEXT_FORMATTING: - bChecked = officecfg::Office::Common::AccessibilityIssues::TextFormattings::get(); + case sfx::AccessibilityIssueID::TEXT_NEW_LINES: + bChecked = officecfg::Office::Common::AccessibilityIssues::TextNewLines::get(); + break; + + case sfx::AccessibilityIssueID::TEXT_SPACES: + bChecked = officecfg::Office::Common::AccessibilityIssues::TextSpaces::get(); + break; + + case sfx::AccessibilityIssueID::TEXT_TABS: + bChecked = officecfg::Office::Common::AccessibilityIssues::TextTabs::get(); + break; + + case sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA: + bChecked = officecfg::Office::Common::AccessibilityIssues::TextEmptyNums::get(); break; case sfx::AccessibilityIssueID::DIRECT_FORMATTING: diff --git a/include/sfx2/AccessibilityIssue.hxx b/include/sfx2/AccessibilityIssue.hxx index abb7a1318f05..65174e0fdfdb 100644 --- a/include/sfx2/AccessibilityIssue.hxx +++ b/include/sfx2/AccessibilityIssue.hxx @@ -31,7 +31,10 @@ enum class AccessibilityIssueID NO_ALT_GRAPHIC, NO_ALT_SHAPE, TABLE_MERGE_SPLIT, - TEXT_FORMATTING, + TEXT_NEW_LINES, + TEXT_SPACES, + TEXT_TABS, + TEXT_EMPTY_NUM_PARA, DIRECT_FORMATTING, TABLE_FORMATTING, HYPERLINK_IS_TEXT, diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 4ed3683d2fc3..67e62985321c 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -6340,13 +6340,43 @@ true - + - Enables accessibility check of Text formattings, inside the document structure - while the user edits the document. + Enables accessibility check of empty new line text formattings, inside the document + structure while the user edits the document. - + + + true + + + + + Enables accessibility check of extra spaces for formattings, inside the document + structure while the user edits the document. + + + + true + + + + + Enables accessibility check of extra tabs for formattings, inside the document + structure while the user edits the document. + + + + true + + + + + Enables accessibility check of empty new line between numberings, inside the document + structure while the user edits the document. + + true diff --git a/sw/inc/AccessibilityCheckStrings.hrc b/sw/inc/AccessibilityCheckStrings.hrc index 11a5b5299ab1..6acfa0761157 100644 --- a/sw/inc/AccessibilityCheckStrings.hrc +++ b/sw/inc/AccessibilityCheckStrings.hrc @@ -30,6 +30,7 @@ #define STR_AVOID_NEWLINES_SPACE NC_("STR_AVOID_NEWLINES_SPACE", "Avoid newlines to create space.") #define STR_AVOID_SPACES_SPACE NC_("STR_AVOID_SPACES_SPACE", "Avoid spaces to create space.") #define STR_AVOID_TABS_FORMATTING NC_("STR_AVOID_TABS_FORMATTING", "Avoid using tabs for formatting.") +#define STR_AVOID_EMPTY_NUM_PARA NC_("STR_AVOID_EMPTY_NUM_PARA", "Avoid new empty lines between numbered paragraphs.") #define STR_HEADINGS_NOT_IN_ORDER NC_("STR_HEADINGS_NOT_IN_ORDER", "Outline levels of headings not in sequential order.") #define STR_TEXT_FORMATTING_CONVEYS_MEANING NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys additional meaning.") #define STR_NON_INTERACTIVE_FORMS NC_("STR_NON_INTERACTIVE_FORMS", "Use interactive input fields.") diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx index 6bdba45e753c..1f820b47ed02 100644 --- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx +++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx @@ -106,12 +106,24 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace) auto& aIssues = aCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(4), aIssues.size()); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[1]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[2]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[3]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[3]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueLevel::WARNLEV, aIssues[3]->m_eIssueLvl); } +CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testEmptyLineBetweenNumberings) +{ + createSwDoc("EmptyNumSpace.odt"); + SwDoc* pDoc = getSwDoc(); + sw::AccessibilityCheck aCheck(pDoc); + aCheck.check(); + auto& aIssues = aCheck.getIssueCollection().getIssues(); + CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size()); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueLevel::WARNLEV, aIssues[0]->m_eIssueLvl); +} + CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) { createSwDoc("SpaceTest.odt"); @@ -121,7 +133,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) auto& aIssues = aCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(3), aIssues.size()); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_SPACES, aIssues[1]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[2]->m_eIssueID); } @@ -223,15 +235,15 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsFormatting) aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(10), aIssues.size()); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[0]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[1]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[2]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[2]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[3]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[4]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[4]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[5]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[6]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[6]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[7]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[8]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[8]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[9]->m_eIssueID); } @@ -261,13 +273,13 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testDeleteHeader) CPPUNIT_ASSERT_EQUAL(size_t(8), aIssues.size()); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DOCUMENT_TITLE, aIssues[0]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueLevel::ERRORLEV, aIssues[0]->m_eIssueLvl); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[2]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[3]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[4]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[5]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[6]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[7]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[2]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[3]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[4]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[5]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[6]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[7]->m_eIssueID); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -285,8 +297,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testDeleteHeader) aResultIssues = aReCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(3), aResultIssues.size()); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DOCUMENT_TITLE, aResultIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aResultIssues[1]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aResultIssues[2]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aResultIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aResultIssues[2]->m_eIssueID); } CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testStylesWithHeader) diff --git a/sw/qa/core/accessibilitycheck/data/EmptyNumSpace.odt b/sw/qa/core/accessibilitycheck/data/EmptyNumSpace.odt new file mode 100644 index 0000000000000000000000000000000000000000..8f55e670075398ae5f8e09bba66105b89458e53d GIT binary patch literal 11759 zcmb_?1yo$wvNjSNf_soa2o4Dnf`tTkcPG%e)400?3GVLh?(Pna1$TD{{=?jxo0+-E zytm%^tJhhp`t+{v)VAu{r#?v$$Y&T}V6b3d0CguN^)3cPaxgHkr|a<+n2CW20BCOx z&@wkSHqh1r8km{V+nDOmnQ2)WSkal8159ww+S&kPz~g+H{dgiQEbJfa=&@h_5yVH$M9b7b7hnaXv((WY3?DT0e1qb3 z$l(nbn*K-+1!YOmS8JHu!tA36MSl{9w$KzDE-#glx05`vTEx$|7+ev*ul1tmOIc2< zER!}RS)ZVOVRm7q0 zAA{gT`@DdjFY3faIvJx*rC3{2_gA_#8^=Ae=ldHt*?%A8=QSD{Od;KMtkqU4PxII3bb~D3%m~fvvdI zAAChm%qbSPKK3kC zKNKQ-FHMN(T6P4@#7Y1SDhw~=bk|WZbV3cJS{JX&3=R>qNjki|eD%EeVvdL~-0s2+ zmz=55+N1Vxz#MPPFT+=5vwE1To@EI6@cuaJ;PO?+oS%=qhs?62Mey6?PwNq82+M`x ztG?$8ZI=q_$1^FHz=A9R z!g|LYAEw@~#Pu~sKm}l-gRx5dnNd*l^b? zfy2@-a7I&M7GkwF20#^ou)a$L7SfbX*3qCtl9pWH3{jwih!7LI48s)tGV{v(Xw#1; zqooGaGMu z_`Hn=!xzMyK+lIw{o!FpD3+SE8=8GSgq-tCQ_5=j%`Qt4gi?J=7emubt8Nf;?S%CnOOG0xrQ2@ zS){AWw*zEH$PgB^q3>RVL@VZ?ifQL&e(X8$P22>c9^oT(S^(x8yPEh$!+Urj6r%-qN~~pIYxVIebs7 zg)!OGm%$IuR`#|po{7~mp;KvOOhhJIW4iF7a@K0ncDFe~qrZ$J#3Cs*~N{OC!JH z2hbL50eMOz358@TG4D=BDFw=-*t*ux*>8t5DLfA;J@v(|3dOA_4<%X=mX8@!O&d?KL3PS`L$!YZpCaub$!6h+)Ax|_u!!KL zH&`@1|?Binvp~G{am|5p|1XB8-!~Vg<#+n4(N>;4zXKLC?)z#=&ql-Zd zgk~+6kUyc+|xxjJe!z~L{>}G!3aiCeBVA$~MU50f+@Hme@RND`|JN}0{6lNIe)fbnf((!8why+I%JQAWaZ1l~q0QvY)DGc*$;JcLDR2M`n?k)$3xCFyjSSV!8q&8XpF4{ITou?%bv14Jys;C0bKx3TvV4U zCR#Rl;4x${a{~^%5*QsbwJQ#$!iKtnx)gB?+`=;(bV@+hbZ|2S_TW3n6soj@ocU+G z5yFJiFM?7D{9dLY=Qb>F8CHRhn&h`}8Y6GP2^<`#isF_O6$c7un-K3?^$P0IUME(@ zButuv$`+OSdzFy%3LkI8J>95VRN8&Ip?1!`YiKFot~7NwRG0Mhi&%5H>1#dagvxDO zkglb?mDCP$f$-e}x$PvM98s36=JT5{pv3dq54{x-3Ww7d5%5>F{o3ve;g~EN$P`2C zg(Y-Mn6>8-O&NJ0p~0xm$o<%AVVe+!KJEm5XXr3fNU_r~(o85dLx<|rPIgFZ{l=My z?iXqcqd^hse#h$ixI#QxNnL$pa50&OvmuhYZPn9Zn8r+ z1Bd%XgAJ`mlNtuR^~yBEm&)fCJ7zgavekB3b@Gkk|!Z?(9~+Y;#|`?dPs8`x=p0vKBOpiPSag4l_a21!4vPjw`MyYLHbFi{|C$U~s=-uK}jv6M=phJ3xbL*T#D#XIF+gs#@iP)Aq4mAB%svfDA` zU#x+zp&*gD{<SxG19Adw9S9P{&~Xs1=b;N;t0$z1Feaa~#O=x?T^pVHU`;sVDR zaJbYinv|3ESw~N(v)3o5g!>IJZwg0F@Bu^TGO_7bqbosx2_sr2@*OAYiCEnVLiN0d z-N3-IlN-!yzMT6(Tm`j(*$CeaWkiPgQ#>qQ$KM#>}7Ed@Nmt)F~BE^tgeJ-$nQ(m^&Isj za$FG7U^;oeVm!_7Ut_$olKc9eiqeo-qoVxzA(QMUI+Z%7yi8_nHKw!dGjKH3cgF2I zGoK#QwTC|NoBQ(H{TTPGso_oT)kXomQ-xvE`|NA&AO+LAqJ(3Z*=9oh#a(d;^~>VA z#vAmf{8lg)CNJkPeZ>_2r~LMhVDVOVDZ#MM^G3Q$Uj&Z^icpQI}fT>af?>0o3}h| zVu%xWT-pn|o%g%20!7Pv?(s`*4WpN?#ZHTtE=0jJLgN@gqfoS0eU*A@A+o)w6K^KQ zU#_56l<;sp%(b;Fyp!B6DJ7>_t4KgSf6PVyt#$Jn9*Y-hPg~Ib+8;)e=a? zVdTTn@@Wlq1!|776{DM}tdd+Pffud|*I}tgSp2ZCHwgs~J-|QN2le@WDF`aQjGHph z*{+yl_qgbG?!$N9p6E9&N#zYB2SK;U#i{+C*k?2n#!zSlO53;P6iiM8j;_eq7#%K4 z+K!6zNjUbGJk!0G^UHc=ti~jpJ|8NS?;uQ3sM9=5dfx%SD22vWtBB*hI_wY%0u?>R zU+ENZ44vPKa1M0C%JAGT_r+EDSYU)RMAjBL=ox1xqJG1*ZV$lYC>k2uQ>}+gr@)hM zM3Z|v@m<=)Ot8!_PA;x8n+#>xU47fqyIpCG{EHQ&LnezA@9gHGMBB$H2GjBe2uSR8 z+&UGOv#qJ22Z*PYQa6Fib@q4?!g=;jE9L1RX$1fR4NUd^I14qZEL!2QBDyp;r?oo@ z>xbQI#sRU=q>Em?`50H*6src_gyYzK;d8W@yr!lf{81QtB3o2bp-g9coP5UV{)9=! zjIfo>;LJYr;-cmR8fc7`OTHOdueH0Sz24uckvwQeqn$(kdPq0rE)??c81)ibW2z|0 z)mgo_pa_3CBj4yPq{5}ed`3!i@nkZW8ggHNL?COiXrsjLBvs>Au4B-&(E0rFu>tdg z>(yC!*tORAtd)5?fTNN`0)?yL#6E?bfLaoXv^FUkiP*H; zndz#W9#$kA5p@mtP#AJfXLVgS9_5f?y*?F7FN;+l-sW~NaHYv)3ABH&DBXM}BGR!i zO>4wOw;f-F@8&VhGgkH;ynU=0Ji~c8Q|l|iHqO4U4y;7emr45qM3O$<4g_dG?Gktz zVH+5hU(~3J=^mtKUe+j{e)ZuC#0tTi@5r8U7rg10c#2{~X{9iZ;gs~b7nQGatXmfO zmVJ3iu6g1 z{+hTTVj<#M4D~=S&qgn1Mk5QEsIslY7M*u=^r(z0%XDI1iycN6Jku0H4s8LcEoF>? ze1X&fw=D?u%;bIH6i6_67K{|?b0x<%)MK)Ex-Fx?5^3>5 zl+#yU`2OX9bSFgl%QOoGC*9?-0DIfB;@urW)91dQp8Jis^U(?(L@iwjyU+3{E$MlB zx6|h^F2Qa?q|XUP8>kEQqT>zIrpHoNJqY+YO`nC$0FLWO`Ahob3GZ8mC5w_qER=Je z`+0e%e5-NPM$cnrkw%x_gzW1|%X}Xvg}7fNERPZSiHGHM0^Vi`b%Luyo*=u*4Z*nu zjF=AB-i#oN&M-suvyrpP7#r2ck>@iLpoG`_!m;*(%guv1lt4tpb89Gjok{xX@AnDK zl5d#YZ&^N3`qWM9Q9AC&iu1_AGOnqor z;G}qgBkyWd#D|x~A5+6uJdpC*7`QlK5YR)qa1Ndu%nLHI#L#?y45!IcN0P`C@v-d- zDnIx<2GtOT0z$;@9Ths$m)X?C5#XqY3qob-kG8@%kIpvX~+7JH(07xej} z$qz}1lS6$7`}pNe3&h{s1u#@j-14+}#{>vJGa)eRQ^oR|PTte$tzBXfRrc^h%&fS1 zvEO;s6SO0jKwp9Ab3hAg*_!PvZa|iel1=hVeC1D8$3jW&S-=XZ~5_{PX8>u=b zr*8_BG`Y*Wuam-vrDI&on=^~tc?2+lgCUI23_Ia$V7R2V%*Tn~d=a(yh?QvoFC@`5 zfnfDaj;8||-H3tUJNi`sn`xH2jlOFw-Xd{BetS-kf)Gr88exZg*1a6(Iw^Gy+^K{v zbBt4Ty7`bBBG?NFG-xAO5=@TLSs9(1pc3@n)=2m(r=0f{#7-^_2^u^-!)gSBP18QL zu}D|VdoXRH5$OaOZ@&j@EE94{!jRpLn7^BtX3ZR~Yipetqp+VGXT2E2b zjOqRG{x!*%)ZsWm2qm|jUbNVNQZ8e7Ep?*)-lknvbn0lP3Ik&x3O^?J+50tDwG5e& zwsy7Vb`m1WQ+Q9jkJUI|MBpev{gp(oazXnXjW~+BJH*DFU$drhr zmzeCnQ17+J8xL7FagghC`$K04R2Dks+K7tPFjX=H~5R(u=l*qiJ&I_7+B( zFr)TP33aQ;q<=)RqIDEne7Wq@M0;eF?Xq=&(Pe3+Db)>K zB&GLe;r}E_wf8JIN-6uo}B-)jW?nxZ4BcLp><{(S67lM-BgF& zN-#K6@~@pd!&K1Ylm-kukV)b=)3MN_Vs(4G1xaUp6Bb-%3SL3OTuosBioY8U8@*#9 z$b{%5YxbwmLh7CoL?L2}nlyG7f^(NbeuNv50=qDw_Zz_ za0rRXQYA=*wMb-B16qW+p2Ui%9c+kq;~|`p*N20u&!DeTzbk6` z9;;?Ohm1mh5BZcc2xUa+T*H8YwY~qRoB`o6XV5k?1wK_Mo?f4-sD!M%!*Dq){+L^3 z)>_+wIHGltsa!cWU?`U*eN(~U4=JDczLEgv-Z{hy8B%o2*Z`{G4f+lHW7<2dxV*e- z)B}xA@@jqbTZwPfTjJ1eXS~9VE;IV%0srIU<9ZmvXA`81$&NyTBmf5v=_6aPvCsrS zxfLnuXrQ*xI!)WlP{#E^JJB?5LwSK=X_YJ3O)Kp}Sq>gS1RcMZ*wkx^AXvaK6x)&s zZKJR*^os-}?Sic^=D;QfygQ}1dDH6l!uYs~>~TtAJ%pUY$eQ=4G<;WtB!T+cXfr(c znA2Y=zJa)c3hQ4@23Lw}!xxEApXANL8yTy~ckDca)P5y6;7xV<@~EniEXcc4mSqEB z%8dTtItar=z7V}ai6C`BMSGM@j@W(7G9oOV+l~dyd)nl z(m|q^V~jo7dwq?rrEnQ}nHD|@`Npoev2wAp%oP{h=&)qi()3>prsm_yB2k+NC%ydHF8I3lkv2 z<{*i*sY@XSPoR8cCm&vvk5H;i1&&lOO;&g#D zOJcWjH(bq-m=DJ>PEI{|@~j*^Nz7_itNz@VBGj5CEvOkdbwF?=%DKTHBJ+Xu5XTzh z5gaC2qlQ`%)FWghansxgBwo=-7$YZ7C^1Jk!$Z6rMCGe2ciIGWjt(jMO|+2f?}-U= zF`z3$Gtj-fjjeQOi3D9zE_uzGJKn9k>+7=|4ab`D?-%x;+WF83j&kF+jfe=S8=PK{ z!$-xZCB^PgQZw8c+ud~1nXIdKDK15}9M{FTfjcir5DkbLf*1C8x3R!?)=kE|txzGs zAhVRTiN|F^*-DH8(0XPvGZ->vzO+J4hb*{qY_rdfK4tZint8@C^I)xd(2O2!l~pr# zh!uII%Qf0t2!{AhS>7&|Fc4-YgV5KxyN7UB%Sl}8C}<^L+gWX|jZAL@wR{{c=Z#FG zLvwctyGscd;uo(iq1cZc=3)AXSW5wyab}e?`}IikUOQqfULElaAZr{;B2^tbxbc`# zxr|{l--&}ymh;=1Ex4;HEAb+l>R(zuP3PeH3iRNFh}<~1+8l7|mQu>X_Ki*qXQv#@>%;|7Hifpe2|U|O26R^ZXj3z~`TV6Z++czE zoB^_-uC*MN@brAmF@o7kg8VX+#}=y#s=>ux{r>ZjeX=XYq6_D`CkIq9FOUS%gXNU` z5`y|~7E~8BprTh(nYZ}?bQbSklQ+gDsKSL`+H~j9@D6pYSFl8n=P#X@ZrNloM8C%m zubO-aXsJV^%MKsX(Is)7DG;l!C9yPB;H{=ko5LL457;`XZBRp1gAaeaA+mB}!w19_ zT`2OS^X-59dHs!jJxLt~otXk}bjSL`Rsbx4b1ZGLqNS_C2mNCwF~JiB?zElEnrcra zEGH^$AKTXw80n~QPuHajqKp%7+Z0LUF3Pf>mqnLFuRt}qC@(E82)p#TM2@Nqlh+CJ zUP!MTuXUU49wNy0B7{<5e~}=ODx6(}xKO7|5AY(dVC~XYx`C``2zhR}RWQn$T8g)Y zUN}ysTzwFKLz`xz|DrMwi#ZR286Jn=%3x-7@hMPKu%Hc@LxF+CzxxrWe^i@k#50%c`RL@^hTmT6k@2L`oBqYcy4F(2o2nGfL2K!hz z150oRnLmD6krb8XqbI>;VtB*MB_z&HBPu2;C?X>+t|~4mCMu~WBg!WuDySwXDk(0l zBqJ&-B`YhfD6g)eA}y<^pr)!Q$0zq$TpA#&sw1Ups;*(Irm3g$*+@;-(o9|2T1`z$ zOT|c2(OO&90U+t1qwZ*=q6IM2Gt$#FG&0gN($%%r)VI_#ay2jnTI=aKnCjSA7&}`T zT3A`z*jZaSx;OxVPPUHD&dwS(0oulH084Le`yeBGUsDG^BiC>%7e6zPXeUo^dyg+b z&lp?3cqhMbyWn&Wlh3}+Ku;H^FRqr}9`-@rj-lR8VF502J~qkzz|2s`yf9aPe_xNl z2#=6BkFUx85s6X3UQu7&>CB%ou$Hluv=J>|u_{U@iB$h_Tr-moz z$Hu3}#1|)|Bm|~Zgk;plre;QFRflHPMdmjrXO+g~mLwF^6~wrwB}SzuC+Ea}Eluz( zPyUjbl8~DcUXmJ8ml<4{6~$&KhJjqj;UY;7tWtWF!Q%j{?EZY^qWZSL);n(D0> z?`ithT|PHhvpQVg(%RA5+1K7P*x%JM*wfX~H`*~c-7`4aKMEQgn;xE?8tLzz80rI! z^v{iUErJH-=Le@ilOv$HiRr1SnYmfe$m}fW+uU5o#LCdjYXAK1=(mlr`K_7xmBppC z`PJ?5ox7EZ_SJ>y?ZwHhg_-mD-j$Vadn@BRt8*92eP>(qx0@sPJ7cSlvbDFfxwN;t zvAw;sx_7#EaJ_wSynb}Mes#ZdbhdMLyLWZAd-rg*zkag6_5EP&{CM~F;_%^a_ww@c z`26bp_Wt_(=>G2X{{H@PsXshCpvE0Of7Ia21(mG8z!1=%E^x58gvadzO)A9uN!D(5 zf9@fC!1_gt1*UK(Fqi49(VXWxE9?~>QW#q-tA9-G*wknb1|w!@n)hVbm$gXvlr#0iY54IaLQoYKun(4bU%($CMxS#ySlJJww)=|0UgDn3?~M## z6UBn)9r}CV90ibv%qmnUWw@#{@70|J5bNM^`U*_9)F7j^v*@ zah+-AIbHS4x`J;;u6dHP4Tv!Ouy%04-0Ck7vp4U|!+bn19A4)j+5By*ppNScqs=qw z=O#Ugstk3&fenjhANAas_j&r;9(ixcv~7ZJaf@!nX^*iOBLoovxR|_f2tD_khyaqg2at)+c3vGMsRe^~T z@Au8DJz2jd60`v}Z<8vU=SReO4&fJF?&3+g@2q@6*y(3Y*VNcyR2wN^^9cJ$6W&>S zZf7msUj*@+nwl^k=63W9-bk!1NIK_v5|=j_FA^2aFHBm>yc^QYORtWtrieC! zt#q-Ku%}J#nBildMej(hJ4E5OtL_}|f_O0K8;yzK+H03p8Hb6%;BQ{>c(rgz&7S77 zFoMFQEcm*YFCYD6BxRY8!>i3ryht~*o}G9!Ix{p})3t3T%qHSZAhbRuWpU(A<$CyF ziT+Fg3uWjGFx(U5_;XwQ*YJkTmKi3f7$+NgZ>xDzXHXt zBgS7G_@6=k9b|spoj>>Dk5KU&PyW{+{|^rKo|`xVwlJ#E9{ zu~e-U)1o<)6dt+ka$g_HL!>HgVvCI65XPlbkUiDg7{##V@zAahzNq+%9i9g<{?Qu8^WWC*%xOGj!3jP7j&zSD4zfQ=9N-WbV83TwK26R~ z`N6@I6#1*w&lX@{Pwc#(BKD~MGuiU@NKbkAPw{*O{sqc^kvD%2_E(ouegXEA%=vqi zzYa9$7bt%wcm5vduM6lo#D5RaU&)^TLi)j1{4@#1Rs(96F45ppFbAy56eH- zh@Z}PKgIX)aQBn<_;bZ&rp=V))xP6`R7CI z(>ukV()l=%+CSeg{xJOA8TY55DdF!=ygyKW4AY;Z$5T-LDUcMu3DJ@wP|#1!P#-^l M$DjkGeERnP0M#+op#T5? literal 0 HcmV?d00001 diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 39a4999f1965..42936d33bc4b 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -134,9 +134,27 @@ void lcl_SetHiddenIssues(std::shared_ptr& pIssue) pIssue->setHidden(true); } break; - case sfx::AccessibilityIssueID::TEXT_FORMATTING: + case sfx::AccessibilityIssueID::TEXT_NEW_LINES: { - if (!officecfg::Office::Common::AccessibilityIssues::TextFormattings::get()) + if (!officecfg::Office::Common::AccessibilityIssues::TextNewLines::get()) + pIssue->setHidden(true); + } + break; + case sfx::AccessibilityIssueID::TEXT_SPACES: + { + if (!officecfg::Office::Common::AccessibilityIssues::TextSpaces::get()) + pIssue->setHidden(true); + } + break; + case sfx::AccessibilityIssueID::TEXT_TABS: + { + if (!officecfg::Office::Common::AccessibilityIssues::TextTabs::get()) + pIssue->setHidden(true); + } + break; + case sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA: + { + if (!officecfg::Office::Common::AccessibilityIssues::TextEmptyNums::get()) pIssue->setHidden(true); } break; @@ -1699,7 +1717,7 @@ public: if (pPrevTextNode->GetText().getLength() == 0) { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_NEWLINES_SPACE), - sfx::AccessibilityIssueID::TEXT_FORMATTING, + sfx::AccessibilityIssueID::TEXT_NEW_LINES, sfx::AccessibilityIssueLevel::WARNLEV); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); @@ -1726,7 +1744,7 @@ public: { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_NEWLINES_SPACE), - sfx::AccessibilityIssueID::TEXT_FORMATTING, + sfx::AccessibilityIssueID::TEXT_NEW_LINES, sfx::AccessibilityIssueLevel::WARNLEV); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); @@ -1800,7 +1818,7 @@ public: { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_TABS_FORMATTING), - sfx::AccessibilityIssueID::TEXT_FORMATTING, + sfx::AccessibilityIssueID::TEXT_TABS, sfx::AccessibilityIssueLevel::WARNLEV); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); @@ -1818,7 +1836,7 @@ public: { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_SPACES_SPACE), - sfx::AccessibilityIssueID::TEXT_FORMATTING, + sfx::AccessibilityIssueID::TEXT_SPACES, sfx::AccessibilityIssueLevel::WARNLEV); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); @@ -2310,6 +2328,101 @@ public: } }; +class EmptyLineBetweenNumberingCheck : public NodeCheck +{ +private: + static SwTextNode* getPrevTextNode(SwNode* pCurrent) + { + SwTextNode* pTextNode = nullptr; + + auto nIndex = pCurrent->GetIndex(); + + nIndex--; // go to previous node + + while (pTextNode == nullptr && nIndex >= SwNodeOffset(0)) + { + auto pNode = pCurrent->GetNodes()[nIndex]; + if (pNode->IsTextNode()) + pTextNode = pNode->GetTextNode(); + nIndex--; + } + + return pTextNode; + } + + static SwTextNode* getNextTextNode(SwNode* pCurrent) + { + SwTextNode* pTextNode = nullptr; + + auto nIndex = pCurrent->GetIndex(); + + nIndex++; // go to next node + + while (pTextNode == nullptr && nIndex < pCurrent->GetNodes().Count()) + { + auto pNode = pCurrent->GetNodes()[nIndex]; + if (pNode->IsTextNode()) + pTextNode = pNode->GetTextNode(); + nIndex++; + } + + return pTextNode; + } + +public: + EmptyLineBetweenNumberingCheck(sfx::AccessibilityIssueCollection& rIssueCollection) + : NodeCheck(rIssueCollection) + { + } + void check(SwNode* pCurrent) override + { + if (!pCurrent->IsTextNode()) + return; + + // Don't count empty table box text nodes + if (pCurrent->GetTableBox()) + return; + + SwTextNode* pTextNode = pCurrent->GetTextNode(); + SwDoc& rDocument = pTextNode->GetDoc(); + SwDocShell* pDocShell = rDocument.GetDocShell(); + if (!pDocShell) + return; + + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + if (!pWrtShell) + return; + + auto nParagraphLength = pTextNode->GetText().getLength(); + if (nParagraphLength == 0 && !pTextNode->GetNumRule()) + { + SwTextNode* pPrevTextNode = getPrevTextNode(pCurrent); + if (!pPrevTextNode) + return; + + SwTextNode* pNextTextNode = getNextTextNode(pCurrent); + if (!pNextTextNode) + return; + + if (pPrevTextNode->getLayoutFrame(pWrtShell->GetLayout()) + && pNextTextNode->getLayoutFrame(pWrtShell->GetLayout())) + { + const SwNumRule* pPrevRule = pPrevTextNode->GetNumRule(); + const SwNumRule* pNextRule = pNextTextNode->GetNumRule(); + if (pPrevRule && pNextRule) + { + auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_EMPTY_NUM_PARA), + sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA, + sfx::AccessibilityIssueLevel::WARNLEV); + pIssue->setIssueObject(IssueObject::TEXT); + pIssue->setNode(pTextNode); + pIssue->setDoc(rDocument); + } + } + } + } +}; + class DocumentCheck : public BaseCheck { public: @@ -2564,6 +2677,7 @@ void AccessibilityCheck::init() m_aNodeChecks.emplace_back(new FakeFootnoteCheck(m_aIssueCollection)); m_aNodeChecks.emplace_back(new FakeCaptionCheck(m_aIssueCollection)); m_aNodeChecks.emplace_back(new ContentControlCheck(m_aIssueCollection)); + m_aNodeChecks.emplace_back(new EmptyLineBetweenNumberingCheck(m_aIssueCollection)); } } diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx index 3446176bdbbe..a898f9c5384d 100644 --- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx +++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx @@ -363,7 +363,10 @@ void A11yCheckIssuesPanel::populateIssues() addEntryForGroup(AccessibilityCheckGroups::Table, nIndices, pIssue); } break; - case sfx::AccessibilityIssueID::TEXT_FORMATTING: + case sfx::AccessibilityIssueID::TEXT_NEW_LINES: + case sfx::AccessibilityIssueID::TEXT_SPACES: + case sfx::AccessibilityIssueID::TEXT_TABS: + case sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA: case sfx::AccessibilityIssueID::TABLE_FORMATTING: { if (!pIssue->getHidden()) From c3ed6e5a2cb7823f131d733c2014c9ea41126559 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Tue, 3 Dec 2024 16:38:49 +0100 Subject: [PATCH 058/155] windows: use jom instead of nmake to build openssl if available jom (https://wiki.qt.io/Jom) is a parallel version of nmake that especially helps with building openssl since everything is compiled individually/the compiler cannot use parallelism either. Also in a LibreOffice build there's not much else that can be done in parallel/other stuff requires openssl to be built to continue. Change-Id: Ib16b0f947991a1d3255aeae7dc5d9bdee0b157a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177743 Reviewed-by: Christian Lohmaier Tested-by: Jenkins --- config_host.mk.in | 1 + configure.ac | 16 ++++++++++++++++ external/openssl/ExternalProject_openssl.mk | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/config_host.mk.in b/config_host.mk.in index 4b7bf923a4b9..7ce742cf3987 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -383,6 +383,7 @@ export JDK_FOR_BUILD=@JDK_FOR_BUILD@ export JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD=@JDK_SECURITYMANAGER_DISALLOWED_FOR_BUILD@ export JFREEREPORT_JAR=@JFREEREPORT_JAR@ export JITC_PROCESSOR_TYPE=@JITC_PROCESSOR_TYPE@ +JOM=@JOM@ export JQ=@JQ@ export JVM_ONE_PATH_CHECK=@JVM_ONE_PATH_CHECK@ export KF5_CFLAGS=$(gb_SPACE)@KF5_CFLAGS@ diff --git a/configure.ac b/configure.ac index f3ee46436bdf..3af3e6373b35 100644 --- a/configure.ac +++ b/configure.ac @@ -15646,6 +15646,22 @@ else fi AC_SUBST(KEEP_AWAKE_CMD) +dnl ========================================= +dnl Check for Jom (parallel nmake) +dnl ========================================= +if test "$_os" = "WINNT"; then + AC_MSG_CHECKING([for jom (parallel nmake)]) + AC_PATH_PROG([JOM], [jom.exe]) + if test -z "$JOM"; then + AC_MSG_NOTICE([jom can help accelerate your build, but is completely optional. Get it from https://wiki.qt.io/Jom]) + AC_MSG_NOTICE([and put it in PATH or add JOM=/unix/style/path/to/jom.exe to your autogen.input to use it]) + else + PathFormat "$JOM" + JOM="$formatted_path" + fi + AC_SUBST(JOM) +fi + dnl =================================================================== dnl Setting up the environment. dnl =================================================================== diff --git a/external/openssl/ExternalProject_openssl.mk b/external/openssl/ExternalProject_openssl.mk index 910c957484c4..a31945fab0db 100644 --- a/external/openssl/ExternalProject_openssl.mk +++ b/external/openssl/ExternalProject_openssl.mk @@ -64,11 +64,12 @@ $(eval $(call gb_ExternalProject_use_nmake,openssl,build)) $(call gb_ExternalProject_get_state_target,openssl,build): export PERL:=$(if $(MSYSTEM),$(STRAWBERRY_PERL),$(shell cygpath -m $(PERL))) +# PARALLELISM_OPTION might be -j 16 -l 24, for jom ignore the load limit/only use the job limit $(call gb_ExternalProject_get_state_target,openssl,build): $(call gb_Trace_StartRange,openssl,EXTERNAL) $(call gb_ExternalProject_run,build,\ CONFIGURE_INSIST=1 $(PERL) Configure $(OPENSSL_PLATFORM) no-tests no-multilib \ - && nmake -f makefile \ + && $(if $(JOM),$(JOM) $(wordlist 1,2,$(PARALLELISM_OPTION)),nmake) -f makefile \ $(if $(call gb_Module__symbols_enabled,openssl),DEBUG_FLAGS_VALUE="$(gb_DEBUGINFO_FLAGS)") \ ) $(call gb_Trace_EndRange,openssl,EXTERNAL) From 6420c3df6c08afa2bad4add1dc4826feef851279 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Tue, 3 Dec 2024 18:44:23 +0100 Subject: [PATCH 059/155] Update git submodules * Update translations from branch 'master' to 9a24d35bd2100d7686503528bfce2cb2d6d18ca4 - update translations for master/25.2 and force-fix errors using pocheck Change-Id: I8cd66ba0ada8029d2c300d43b6c37ff7da3c3584 --- translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations b/translations index 93f61b8759ef..9a24d35bd210 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit 93f61b8759efdb510d3e24eac33e10c8231aedf8 +Subproject commit 9a24d35bd2100d7686503528bfce2cb2d6d18ca4 From 1b4bf7effc4784cf9f0c135e70434993103e1475 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 3 Dec 2024 13:01:30 +0100 Subject: [PATCH 060/155] sw: HTML import: apply hard formatting at insert position ... ... even if there is a character format hint there - in this case, a RES_TXTATR_AUTOFMT attribute will not be converted to the SwTextNode's item set. Also add a test that uses the XDocumentInsertable interface to insert the HTML, which is closer to the real use case. (follow-up to commit f45d2fa85ba89eb7d71b51c3324f5938509b3201) Change-Id: Idbf7efceabca8d43d3e32d0b29fb37a9322c184c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177740 Reviewed-by: Michael Stahl Tested-by: Jenkins --- .../uiwriter/data/placeholder-bold-cs.fodt | 115 ++++++++++++++++++ sw/qa/extras/uiwriter/uiwriter3.cxx | 44 +++++++ sw/source/filter/html/swhtml.cxx | 8 +- 3 files changed, 163 insertions(+), 4 deletions(-) create mode 100644 sw/qa/extras/uiwriter/data/placeholder-bold-cs.fodt diff --git a/sw/qa/extras/uiwriter/data/placeholder-bold-cs.fodt b/sw/qa/extras/uiwriter/data/placeholder-bold-cs.fodt new file mode 100644 index 000000000000..25f610ad92e0 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/placeholder-bold-cs.fodt @@ -0,0 +1,115 @@ + + + 2024-08-08T18:32:28.4200828172024-08-08T18:33:51.021911316PT1M27S1ZetaOffice/7.4.8.0.0$Linux_X86_64 LibreOffice_project/ab7057b1137e2241f51e62b58a0c605ec9a4b29c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test <replaceme>test + + + diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index a030ad9c10f8..d169f76dbe09 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include #include @@ -86,6 +88,48 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testPlaceholderHTMLPaste) getProperty(getRun(getParagraph(4), 1, u" test"_ustr), u"CharWeight"_ustr)); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testPlaceholderHTMLInsert) +{ + createSwDoc("placeholder-bold-cs.fodt"); + + // select placeholder field + uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xCursor{ xTextDocument->getText()->createTextCursor() }; + xCursor->gotoStart(false); + xCursor->goRight(5, false); + xCursor->goRight(1, true); + + sal_Int8 const html[] = "

AAA

BBB

CCC

"; + uno::Reference xStream{ new comphelper::MemoryInputStream{ html, + sizeof(html) } }; + + // insert HTML file + uno::Sequence aPropertyValues = comphelper::InitPropertySequence( + { { "InputStream", uno::Any(xStream) }, + { "Hidden", uno::Any(true) }, + { "FilterName", uno::Any(u"HTML (StarWriter)"_ustr) } }); + + uno::Reference xDocInsert{ xCursor, uno::UNO_QUERY }; + xDocInsert->insertDocumentFromURL("private:stream", aPropertyValues); + + CPPUNIT_ASSERT_EQUAL(int(4), getParagraphs()); + + CPPUNIT_ASSERT_EQUAL( + awt::FontWeight::NORMAL, + getProperty(getRun(getParagraph(1), 1, u"Test "_ustr), u"CharWeight"_ustr)); + CPPUNIT_ASSERT_EQUAL( + awt::FontWeight::BOLD, + getProperty(getRun(getParagraph(1), 2, u"AAA"_ustr), u"CharWeight"_ustr)); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, + getProperty(getParagraph(2), u"CharWeight"_ustr)); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, + getProperty(getParagraph(3), u"CharWeight"_ustr)); + CPPUNIT_ASSERT_EQUAL( + awt::FontWeight::NORMAL, + getProperty(getRun(getParagraph(4), 1, u" test"_ustr), u"CharWeight"_ustr)); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf151974) { createSwDoc("tdf151974.odt"); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index e838e2868fa8..fb0ed452336f 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -580,11 +580,11 @@ SvParserState SwHTMLParser::CallParser() aInsertionRangePam.Move( fnMoveBackward ); m_xDoc->getIDocumentRedlineAccess().SplitRedline( aInsertionRangePam ); - if (SwAttrSet const*const pAttrs = pPos->GetNode().GetTextNode()->GetpSwAttrSet()) + ::std::unique_ptr pSet{new SfxItemSet(m_xDoc->GetAttrPool(), + svl::Items)}; + if (pPos->GetNode().GetTextNode()->GetParaAttr(*pSet, 0, 0, false, false)) { - m_pTargetCharAttrs.reset(new SfxItemSet(*pAttrs->GetPool(), - svl::Items)); - m_pTargetCharAttrs->Put(*pAttrs); + m_pTargetCharAttrs = std::move(pSet); } m_xDoc->SetTextFormatColl( *m_pPam, From 7a12424df2b46385897b48c304bca867415b3f88 Mon Sep 17 00:00:00 2001 From: anonymotter Date: Fri, 29 Nov 2024 20:23:27 -0800 Subject: [PATCH 061/155] tdf#158068 Replace string literals with OUString literals in canvas Change-Id: I7bbcc08786843d6d289b3170248ce2696e57f3b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177602 Reviewed-by: Ilmari Lauhakangas Tested-by: Jenkins --- canvas/source/directx/dx_canvas.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/canvas/source/directx/dx_canvas.cxx b/canvas/source/directx/dx_canvas.cxx index c19ea1ea9017..c2ef4d311f10 100644 --- a/canvas/source/directx/dx_canvas.cxx +++ b/canvas/source/directx/dx_canvas.cxx @@ -122,17 +122,17 @@ namespace dxcanvas OUString SAL_CALL Canvas::getServiceName( ) { - return "com.sun.star.rendering.Canvas.GDI+"; + return u"com.sun.star.rendering.Canvas.GDI+"_ustr; } // XServiceInfo css::uno::Sequence Canvas::getSupportedServiceNames( ) { - return { "com.sun.star.rendering.Canvas.GDI+" }; + return { u"com.sun.star.rendering.Canvas.GDI+"_ustr }; } OUString Canvas::getImplementationName( ) { - return "com.sun.star.comp.rendering.Canvas.GDI+"; + return u"com.sun.star.comp.rendering.Canvas.GDI+"_ustr; } sal_Bool Canvas::supportsService( const OUString& sServiceName ) { @@ -212,17 +212,17 @@ namespace dxcanvas OUString SAL_CALL BitmapCanvas::getServiceName( ) { - return "com.sun.star.rendering.BitmapCanvas.GDI+"; + return u"com.sun.star.rendering.BitmapCanvas.GDI+"_ustr; } // XServiceInfo css::uno::Sequence BitmapCanvas::getSupportedServiceNames( ) { - return { "com.sun.star.rendering.BitmapCanvas.GDI+" }; + return { u"com.sun.star.rendering.BitmapCanvas.GDI+"_ustr }; } OUString BitmapCanvas::getImplementationName( ) { - return "com.sun.star.comp.rendering.BitmapCanvas.GDI+"; + return u"com.sun.star.comp.rendering.BitmapCanvas.GDI+"_ustr; } sal_Bool BitmapCanvas::supportsService( const OUString& sServiceName ) { From bfb8f9cae715efb5fe2b0120924aa333ce2bd4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20N=C3=A9meth?= Date: Tue, 3 Dec 2024 14:52:33 +0100 Subject: [PATCH 062/155] tdf#48459 sw inline heading: don't apply inside frames or over 120 chars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't apply inline heading 1) in a text frame 2) or if the selected text is over 120 characters. 1) It would be enough to limit this for inline heading frames, but the recent FN_INSERT_FRAME – which is used for creating the Inline Heading frame, cannot handle the insertion inside a frame: the new frame is anchored outside of the frame, not inside the actual paragraph, resulting bad layout. 2) Increase also the limit of applying the inline heading to 120 characters (very upper limit for a long line) from 75. Follow-up to commit 7a35f3dc7419d833b8f47069c4df63e900ccb880 "tdf#48459 sw inline heading: apply it on the selected words", Change-Id: I05de4be3a08926fdabad2e601d4bbe57ae25f7c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177739 Reviewed-by: László Németh Tested-by: Jenkins --- sw/inc/ndarr.hxx | 2 +- sw/source/core/docnode/ndnum.cxx | 12 +++++++----- sw/source/uibase/app/docst.cxx | 13 +++++++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index 5c423e11378c..fdf0eec7849b 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -81,7 +81,7 @@ public: static constexpr auto npos = std::numeric_limits::max(); bool Seek_Entry(const SwNode* rP, size_type* pnPos) const; - static const SwNode* GetRootNode(const SwNode* pNode); + static const SwNode* GetRootNode(const SwNode* pNode, bool bCheckInlineHeading = true); }; struct CompareSwOutlineNodesInline diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx index 89e8cc186311..095bfaa60b56 100644 --- a/sw/source/core/docnode/ndnum.cxx +++ b/sw/source/core/docnode/ndnum.cxx @@ -27,18 +27,20 @@ #include #include -static const SwNode* getNodeOrAnchorNode(const SwNode* pNode) +static const SwNode* getNodeOrAnchorNode(const SwNode* pNode, bool bCheckInlineHeading = true) { // if pNode is an inline heading in an Inline Heading // text frame, return its anchor node instead of pNode + // if bCheckInlineHeading == false, it's enough to be in an + // arbitrary text frame to return its anchor node if (const auto pFlyFormat = pNode->GetFlyFormat()) { SwFormatAnchor const*const pAnchor = &pFlyFormat->GetAnchor(); SwNode const*const pAnchorNode = pAnchor->GetAnchorNode(); const SwFormat* pParent = pFlyFormat->DerivedFrom(); - if ( pAnchorNode && pParent && + if ( pAnchorNode && pParent && ( !bCheckInlineHeading || ( RndStdIds::FLY_AS_CHAR == pAnchor->GetAnchorId() && - pParent->GetPoolFormatId() == RES_POOLFRM_INLINE_HEADING ) + pParent->GetPoolFormatId() == RES_POOLFRM_INLINE_HEADING ) ) ) { return pAnchorNode; } @@ -58,9 +60,9 @@ bool SwOutlineNodes::Seek_Entry(const SwNode* rP, size_type* pnPos) const return it != end() && rP->GetIndex() == (*it)->GetIndex(); } -const SwNode* SwOutlineNodes::GetRootNode(const SwNode* pNode) +const SwNode* SwOutlineNodes::GetRootNode(const SwNode* pNode, bool bCheckInlineHeading) { - return getNodeOrAnchorNode(pNode); + return getNodeOrAnchorNode(pNode, bCheckInlineHeading); } bool CompareSwOutlineNodesInline::operator()(const SwNode* lhs, const SwNode* rhs) const diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index ecdb14726e37..c9b9a74d730c 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -1174,7 +1174,7 @@ void SwDocShell::Hide(const OUString &rName, SfxStyleFamily nFamily, bool bHidde } } -#define MAX_CHAR_IN_INLINE_HEADING 75 +#define MAX_CHAR_IN_INLINE_HEADING 120 bool SwDocShell::MakeInlineHeading(SwWrtShell *pSh, SwTextFormatColl* pColl, const sal_uInt16 nMode) { // insert an inline heading frame, if only MAX_CHAR_IN_INLINE_HEADING or less @@ -1185,6 +1185,15 @@ bool SwDocShell::MakeInlineHeading(SwWrtShell *pSh, SwTextFormatColl* pColl, con 0 < GetView()->GetSelectionText().getLength() ) { SwTextFormatColl *pLocal = pColl? pColl: (*GetDoc()->GetTextFormatColls())[0]; + // don't put inline heading in a frame (it would be enough to limit for inline heading + // frames, but the recent FN_INSERT_FRAME cannot handle the insertion inside a frame + // correctly) + // TODO: allow to insert inline headings in a (not an Inline Heading) text frame + if ( pSh->GetCursor()->GetPointNode() != + *SwOutlineNodes::GetRootNode( &pSh->GetCursor()->GetPointNode(), /*bInlineHeading=*/false ) ) + { + return false; + } // put inside a single Undo SwRewriter aRewriter; @@ -1271,7 +1280,7 @@ SfxStyleFamily SwDocShell::ApplyStyles(const OUString &rName, SfxStyleFamily nFa // outline node's content is folded. MakeAllOutlineContentTemporarilyVisible a(GetDoc()); - // if the first 75 or less characters are selected, but not the full paragraph, + // if the first 120 or less characters are selected, but not the full paragraph, // create an inline heading from the selected text SwTextFormatColl* pColl = pStyle->GetCollection(); if ( MakeInlineHeading( pSh, pColl, nMode ) ) From f84a4390d945f985c8e0d80c958ee7bd9433aed2 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Tue, 3 Dec 2024 22:37:17 +0100 Subject: [PATCH 063/155] Update git submodules * Update helpcontent2 from branch 'master' to ac15fc2c15fa9e188f0acf1749ca63c2ac228530 - add missing screenshots & files for Tagalog help Change-Id: I078f85931d21441929737105e694e0936fd1531f Reviewed-on: https://gerrit.libreoffice.org/c/help/+/177748 Tested-by: Jenkins Reviewed-by: Christian Lohmaier --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index dc50ebde81a0..ac15fc2c15fa 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit dc50ebde81a0e9266806878b69de81da422ec39c +Subproject commit ac15fc2c15fa9e188f0acf1749ca63c2ac228530 From 92099b161fd1904948441aaed90fa21472647e85 Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Tue, 3 Dec 2024 22:37:25 +0100 Subject: [PATCH 064/155] Update git submodules * Update helpcontent2 from branch 'master' to 0321da3f2b7fca3f7bda1655d64206f28231818e - Reapply "enable help for Tagalog (tl)" This reverts commit dc50ebde81a0e9266806878b69de81da422ec39c. Change-Id: I0795bff471896fba0972f6e8e44cc81b97e66ccd Reviewed-on: https://gerrit.libreoffice.org/c/help/+/177749 Reviewed-by: Christian Lohmaier Tested-by: Jenkins --- helpcontent2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpcontent2 b/helpcontent2 index ac15fc2c15fa..0321da3f2b7f 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit ac15fc2c15fa9e188f0acf1749ca63c2ac228530 +Subproject commit 0321da3f2b7fca3f7bda1655d64206f28231818e From c196546d2454f0994e248d2f6925b70ad6307206 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 3 Dec 2024 22:42:19 +0100 Subject: [PATCH 065/155] python: upgrade to 3.10.16 Downloaded from https://www.python.org/ftp/python/3.10.16/Python-3.10.16.tar.xz Change-Id: I677c1dec6ac1d06596d7ff88269b6cac70d848c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177757 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- configure.ac | 2 +- download.lst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 3af3e6373b35..d58af4af258b 100644 --- a/configure.ac +++ b/configure.ac @@ -10478,7 +10478,7 @@ if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_pyt SYSTEM_PYTHON= PYTHON_VERSION_MAJOR=3 PYTHON_VERSION_MINOR=10 - PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.15 + PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.16 if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst]) fi diff --git a/download.lst b/download.lst index a60c304f5485..fab3ac84243f 100644 --- a/download.lst +++ b/download.lst @@ -590,8 +590,8 @@ POSTGRESQL_TARBALL := postgresql-14.15.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts -PYTHON_SHA256SUM := aab0950817735172601879872d937c1e4928a57c409ae02369ec3d91dccebe79 -PYTHON_TARBALL := Python-3.10.15.tar.xz +PYTHON_SHA256SUM := bfb249609990220491a1b92850a07135ed0831e41738cf681d63cf01b2a8fbd1 +PYTHON_TARBALL := Python-3.10.16.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts From 53110dd25ea16c34c1ead6ef3d58288003a865d2 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 3 Dec 2024 22:58:02 +0100 Subject: [PATCH 066/155] Revert "PVS: V614 Potentially null smart pointer 'pFillData' used" This reverts commit 60df7e1052e4ec0a33978df8af8afd65196dbd8c. Reason for revert: Michael Stahl: "the PVS warning is wrong, checking bChgFillData is already enough" Change-Id: I7d963e2b2ebbb30195af05b70ad36ab8d78e7c25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177760 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/source/core/text/frmcrsr.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index df41204ecac8..a2545c300abf 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -637,12 +637,12 @@ bool SwTextFrame::GetModelPositionForViewPoint_(SwPosition* pPos, const Point& r if ( IsVertical() ) { - if ( bChgFillData && pFillData ) + if ( bChgFillData ) SwitchHorizontalToVertical( pFillData->Fill().aCursor.Pos() ); const_cast(this)->SwapWidthAndHeight(); } - if ( IsRightToLeft() && bChgFillData && pFillData) + if ( IsRightToLeft() && bChgFillData ) { SwitchLTRtoRTL( pFillData->Fill().aCursor.Pos() ); const sal_Int16 eOrient = pFillData->pCMS->m_pFill->eOrient; From 780b41adb47c883f74fe0d2d28ca573377c4be99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Mon, 11 Nov 2024 15:36:13 +0100 Subject: [PATCH 067/155] pdf: introduce IPDFEncryptor interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9cc0413f6c0af3be6ef83f4dbcf8dcf73b992f92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177643 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- vcl/inc/pdf/IPDFEncryptor.hxx | 90 +++++++++++++++++++++++++++++++++ vcl/inc/pdf/PDFEncryptor.hxx | 33 +++--------- vcl/source/pdf/PDFEncryptor.cxx | 4 +- 3 files changed, 99 insertions(+), 28 deletions(-) create mode 100644 vcl/inc/pdf/IPDFEncryptor.hxx diff --git a/vcl/inc/pdf/IPDFEncryptor.hxx b/vcl/inc/pdf/IPDFEncryptor.hxx new file mode 100644 index 000000000000..bcd90dcef4bf --- /dev/null +++ b/vcl/inc/pdf/IPDFEncryptor.hxx @@ -0,0 +1,90 @@ +/* -*- 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 + +namespace vcl +{ +struct PDFEncryptionProperties; +} + +namespace com::sun::star::beans +{ +class XMaterialHolder; +} +namespace com::sun::star::uno +{ +template class Reference; +} + +namespace vcl::pdf +{ +/** Interface for encrypting the PDF content + * + * This interface makes it possible to have multiple versions and + * revisions of PDF encryption, but all using the same interface, + * so the implementation details are hidden from the outside. This + * also makes it easier to add new implementations in the future as + * we only need to write a new implementation of this interface. + */ +class IPDFEncryptor +{ +public: + virtual ~IPDFEncryptor() {} + + /** PDF encryption version */ + virtual sal_Int32 getVersion() = 0; + /** PDF encryption revision */ + virtual sal_Int32 getRevision() = 0; + + /** the numerical value of the access permissions, according to PDF spec, must be signed */ + virtual sal_Int32 getAccessPermissions() = 0; + + /** Encrypted access permission + * + * Depending on the encryption revision this may not be available. In that + * case we can expect empty content. + */ + virtual std::vector getEncryptedAccessPermissions() + { + return std::vector(); + } + + /** Length of the key in bits (i.e. 256 = 256bits) */ + virtual sal_Int32 getKeyLength() = 0; + + /** Prepares the encryption when the password is entered */ + virtual bool prepareEncryption( + const css::uno::Reference& xEncryptionMaterialHolder, + PDFEncryptionProperties& rProperties) + = 0; + + /** Set up the keys and does a sanity check */ + virtual void setupKeysAndCheck(PDFEncryptionProperties& rProperties) = 0; + + /** Setup before we start encrypting - remembers the key */ + virtual void setupEncryption(std::vector const& rEncryptionKey, sal_Int32 nObject) + = 0; + + virtual void enableStreamEncryption() = 0; + virtual void disableStreamEncryption() = 0; + virtual bool isStreamEncryptionEnabled() = 0; + + /** Encrypts the input and stores into the output */ + virtual void encrypt(const void* pInput, sal_uInt64 nInputSize, sal_uInt8* pOutput, + sal_uInt64 nOutputsSize) + = 0; +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/pdf/PDFEncryptor.hxx b/vcl/inc/pdf/PDFEncryptor.hxx index 3547252ceb5e..be4b99f9b7d6 100644 --- a/vcl/inc/pdf/PDFEncryptor.hxx +++ b/vcl/inc/pdf/PDFEncryptor.hxx @@ -10,10 +10,10 @@ #pragma once -#include #include #include #include +#include namespace vcl { @@ -31,30 +31,6 @@ template class Reference; namespace vcl::pdf { -class EncryptionHashTransporter; - -class IPDFEncryptor -{ -public: - virtual ~IPDFEncryptor() {} - virtual sal_Int32 getAccessPermissions() = 0; - virtual sal_Int32 getKeyLength() = 0; - virtual bool prepareEncryption( - const css::uno::Reference& xEncryptionMaterialHolder, - PDFEncryptionProperties& rProperties) - = 0; - virtual void setupKeysAndCheck(PDFEncryptionProperties& rProperties) = 0; - - virtual void setupEncryption(std::vector const& rEncryptionKey, sal_Int32 nObject) - = 0; - virtual void enableStreamEncryption() = 0; - virtual void disableStreamEncryption() = 0; - virtual bool isStreamEncryptionEnabled() = 0; - virtual void encrypt(const void* pInput, sal_uInt64 nInputSize, sal_uInt8* pOutput, - sal_uInt64 nOutputsSize) - = 0; -}; - class PDFEncryptor : public IPDFEncryptor { private: @@ -70,12 +46,15 @@ private: /* set to true if the following stream must be encrypted, used inside writeBuffer() */ bool m_bEncryptThisStream = false; + /* used to cipher the stream data and for password management */ + rtlCipher m_aCipher = nullptr; + public: PDFEncryptor(); ~PDFEncryptor(); - /* used to cipher the stream data and for password management */ - rtlCipher m_aCipher = nullptr; + sal_Int32 getVersion() override { return 2; }; + sal_Int32 getRevision() override { return 3; }; sal_Int32 getAccessPermissions() override { return m_nAccessPermissions; } sal_Int32 getKeyLength() override { return m_nKeyLength; } diff --git a/vcl/source/pdf/PDFEncryptor.cxx b/vcl/source/pdf/PDFEncryptor.cxx index 16b88ec160b0..d97e671247de 100644 --- a/vcl/source/pdf/PDFEncryptor.cxx +++ b/vcl/source/pdf/PDFEncryptor.cxx @@ -364,13 +364,15 @@ bool PDFEncryptor::prepareEncryption( = EncryptionHashTransporter::getEncHashTransporter(xEncryptionMaterialHolder); if (pTransporter) { - sal_Int32 nKeyLength = 0, nRC4KeyLength = 0; + sal_Int32 nKeyLength = 0; + sal_Int32 nRC4KeyLength = 0; sal_Int32 nAccessPermissions = computeAccessPermissions(rProperties, nKeyLength, nRC4KeyLength); rProperties.OValue = pTransporter->getOValue(); bSuccess = computeUDictionaryValue(pTransporter, rProperties, nKeyLength, nAccessPermissions); } + if (!bSuccess) { rProperties.OValue.clear(); From 345d1138c86ea2889a2d137949ecad28b2f2d9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Mon, 11 Nov 2024 19:08:03 +0100 Subject: [PATCH 068/155] pdf: simplify EncryptionHashTransporter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No need for a map to remember the implementation - we can just dynamic_cast to the actual implementation. Change-Id: If590316023be7f749d270c04b7ad3dc5fa1993b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177644 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- vcl/inc/pdf/EncryptionHashTransporter.hxx | 6 ++--- vcl/source/pdf/EncryptionHashTransporter.cxx | 27 +++----------------- 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/vcl/inc/pdf/EncryptionHashTransporter.hxx b/vcl/inc/pdf/EncryptionHashTransporter.hxx index 3ed1aa375561..596b6490570a 100644 --- a/vcl/inc/pdf/EncryptionHashTransporter.hxx +++ b/vcl/inc/pdf/EncryptionHashTransporter.hxx @@ -28,11 +28,9 @@ namespace vcl::pdf */ class EncryptionHashTransporter : public cppu::WeakImplHelper { - ::std::unique_ptr<::comphelper::Hash> m_pDigest; - sal_IntPtr maID; + std::unique_ptr m_pDigest; std::vector maOValue; - - static std::map sTransporters; + sal_IntPtr maID; public: EncryptionHashTransporter(); diff --git a/vcl/source/pdf/EncryptionHashTransporter.cxx b/vcl/source/pdf/EncryptionHashTransporter.cxx index 6ecd43396c3a..057925d57836 100644 --- a/vcl/source/pdf/EncryptionHashTransporter.cxx +++ b/vcl/source/pdf/EncryptionHashTransporter.cxx @@ -16,40 +16,19 @@ namespace vcl::pdf { EncryptionHashTransporter::EncryptionHashTransporter() : m_pDigest(new ::comphelper::Hash(::comphelper::HashType::MD5)) + , maID(reinterpret_cast(this)) { - maID = reinterpret_cast(this); - while (sTransporters.find(maID) != sTransporters.end()) // paranoia mode - maID++; - sTransporters[maID] = this; } -EncryptionHashTransporter::~EncryptionHashTransporter() -{ - sTransporters.erase(maID); - SAL_INFO("vcl", "EncryptionHashTransporter freed"); -} +EncryptionHashTransporter::~EncryptionHashTransporter() {} EncryptionHashTransporter* EncryptionHashTransporter::getEncHashTransporter( const uno::Reference& xReference) { - EncryptionHashTransporter* pResult = nullptr; - if (xReference.is()) - { - uno::Any aMat(xReference->getMaterial()); - sal_Int64 nMat = 0; - if (aMat >>= nMat) - { - std::map::iterator it - = sTransporters.find(static_cast(nMat)); - if (it != sTransporters.end()) - pResult = it->second; - } - } + EncryptionHashTransporter* pResult = dynamic_cast(xReference.get()); return pResult; } -std::map EncryptionHashTransporter::sTransporters; - } // end vcl::pdf /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 171aa32c38569803f7470cf30180b66707e2db41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Tue, 3 Dec 2024 23:32:47 +0900 Subject: [PATCH 069/155] pdf: fix saving external PDF with form fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3d7fdcfe2c4ec0f716425c349b0bf621809fd249 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177741 Reviewed-by: Tomaž Vajngerl Tested-by: Jenkins --- vcl/inc/pdf/pdfwriter_impl.hxx | 14 +- .../cppunit/pdfexport/data/FilledUpForm.pdf | Bin 0 -> 21204 bytes .../pdfexport/data/FilledUpForm_Source.odt | Bin 0 -> 11580 bytes vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 52 +++++ vcl/source/gdi/pdfwriter_impl.cxx | 203 ++++++++++++------ 5 files changed, 196 insertions(+), 73 deletions(-) create mode 100644 vcl/qa/cppunit/pdfexport/data/FilledUpForm.pdf create mode 100644 vcl/qa/cppunit/pdfexport/data/FilledUpForm_Source.odt diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index e7644d7c4884..3f09038068b8 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -483,6 +483,11 @@ struct PDFScreen : public PDFAnnotation } }; +struct PDFWidgetCopy +{ + sal_Int32 m_nObject = -1; +}; + struct PDFWidget : public PDFAnnotation { PDFWriter::WidgetType m_eType; @@ -769,9 +774,10 @@ private: /* structure elements (object ids) that should have ID */ std::unordered_set m_StructElemObjsWithID; - /* contains all widgets used in the PDF - */ - std::vector m_aWidgets; + /* contains all widgets used in the PDF */ + std::vector m_aWidgets; + std::vector m_aCopiedWidgets; + /* maps radio group id to index of radio group control in m_aWidgets */ std::map< sal_Int32, sal_Int32 > m_aRadioGroupWidgets; /* unordered_map for field names, used to ensure unique field names */ @@ -896,6 +902,8 @@ private: /// Writes the form XObject proxy for the image. void writeReferenceXObject(const ReferenceXObjectEmit& rEmit); + void mergeAnnotationsFromExternalPage(filter::PDFObjectElement* pPage, std::map& rCopiedResourcesMap); + /* tries to find the bitmap by its id and returns its emit data if exists, else creates a new emit data block */ const BitmapEmit& createBitmapEmit( const BitmapEx& rBitmapEx, const Graphic& rGraphic, std::list& rBitmaps, ResourceDict& rResourceDict, std::list& rOutputStreams ); diff --git a/vcl/qa/cppunit/pdfexport/data/FilledUpForm.pdf b/vcl/qa/cppunit/pdfexport/data/FilledUpForm.pdf new file mode 100644 index 0000000000000000000000000000000000000000..7032f809941171578f33d0c21dc6978080a4fb65 GIT binary patch literal 21204 zcmc(H2OyQ*|2TyHC)%(7`_xt_-f483doaa1eea89Bb8XR9QrUr$B*3=Rq}No|T&qceq2Wll ztCb^6S{kv3>|#f?hhspEE<(k@nM!s?s5o0v$x38vR~xddEQ~^RCtDtbd7t-)dEmH0 zo1`FJ<2F{mNJqfN@l<3O-b&d{1HU*h;H{wKL!P*KpZ|1nu)kp&)A059xOy z1!V~jq8M@<@;+H03s-j9t5quB!!c&Xv^%1zG$XP~8-_w(x|Ht8y>u^ga-4a8{F7H- zH-wiM7^GcEqZ?zbGCW5IWo>^ENPNN!J%XuP4QepIzSeWxN*&^mu|dv`?+rL)$w~(wda{` zz;~)|%xy`PdD?t>@KMP#hYdc%{x>|&Z!fXiIqjPA_VCfZv2Qc^RI^6mn2Y?j0gM|_ zJBC)UISJCu2-3B0iR4kMzerw1C%FRo0~wQa{`+9cvm@)|#?f-M56JL}&1$A=x<2s{DOieW?Rb%5Wy^mk?-gC95c8xS`wLZAl zAVc0fwaw9(sanG(Jk+LrZ=+=l`v)5SRDRzb! zlcbb*!s+256ONP8hq$t|hqw(%txBGEG;3FCy|_I#a9>)eNBHGQzZ;=ZYo}nrpLLDf zln6K(zbl2U!&@Fp)S7ahuGy_uoa!Cba*ARQ_sp+M|MmEt{bU0|pV`atpvuISrhy?d zReD>>t4I>l1TM@Z(IfP3x!e#m1S-WVYX5`J+MHCqxT1X1{EOmh`wj^TZKU)D zceOMoSxCRj*8HgU;oarNFwiufwW(Qldy>pYo?E+n-TOYjm337;ebY}%^^@4X=}^PB z6Xt}IMePR%?~iK9)e(=r{20NjQ~RnXGbLa}!=AEm#a0#aAxl|-lw{U%5$O#n>xR$T z)%jQr+70LA+EG%8F&jDKbk3XmPp;KuJGymi(%`nr&6y!WLT}D?yuB?Uj(LYvJBc2N zH}MkfD^GU9Uj3*f8_D9XTy{kd-P3tFeIUk%zV1k`ijVEll1foz^UakCRa|Eh%N0zF zQ;k*DH8jG=2GY%hua)0wT1`xz_nvv7=wRZl6l+&U-qf4M9YVNYy6YwXRF@RSf&H!+ zBF5zN1)FpCy0@BSsphSV#_bKecjcsuks=qN=e@vB3%9R^d_VsEoJXXDZ1tX-#X>ZlXEg3J*IeLUzEZvR@|Uo(1Nm-AHfDUeSeFh>PGvU3@|QbK zedOUh?W-?KK6*?y?~&%SBNE-z2E#gUFX0Yer|pQ8voScAOZ@SrE;mm^c*#)8>`We4CdGh!J z2AQ3r%nit_ciOS<51%fcaifa9d?y?xTlFlfGv}E9sPOBLKEu4P&OQI|_&bSSi&Z%M zmemS)mdYgr>K?Ve!ius1ym%$CQtqO$O0~EuSur-^l7rY+&a|wV9*GrIEE$esLGQT6 znYpvft2c@aC8C@4@sE{QS69hd9ni~UmgwPEZ5(+}&KH*E#1&%X2`&h zw*1ZXbrV-N1<()p;o9K@LJgH&XF|HUk#A*wBZ`5EyFusz|4kR)35y9o+++CetA)l_ zG)!b&?_C(2j;mKcArhxD)nx357t#x1y@Gxo&qrvuH?|^iz^iFvT5i0APqs$>U z|BHfjY@VwlY}@-S1j|SsrPip+N(`nZ*=;ah_;K7YT0jYJl#IRtCEXjuPw=>NbaW&1g+UCxpMtA z#EtjiYbcW8705w_>fk0x5lO1fN51vVSF{<|A4or4w5BDmT3Gz5mbk?28*F;}Njruv z-o#v{tG;-1+}EXHs`_h~8LxBczDB%;_0zXQc{3rfbv=*UPYi_J+BH%+Mi|dHEbRU1 z{n&Z2Em239OuJGtXG}f6_ttb=aQouNHuQc?v(pH->VwWBRdO~{=nb}gE7$ZeWd$E& zQ+n=uv)29)o(Si}NbP6KJm*2o8F_Oh#yB~9U&SuNgJ$+}*Xdhu{fSKH9jf*-)NMdM z3V0Y$v58d-Ye8W+&4k7EbG}S+sERwmF1*j=;cI&S%_UDeJnyI%#D8UCx#m*wO!w4G z$ky@pgYs6_`k9h54moi-N@?zKnchzsH)5;&+~jIjMSXo=pGWxihQ7R{BjUP7rO#g8 z4)0F!*FVR5$L_-P$EmDXq0TbD#Ao%lRvVsJv$LsNJh$DkcqAgmxU|vu|m;{QYu{Jm;BdJ-VL~=l|XLVyy3UZbaDC zBsy$^m-MR2jiY&amml&~+Z0{QSGn3@(m8p)s+Ke)5L&fXvwu_1in4pJrS_a}L~YGa zJmq%i-KMg;uLDlGk>0V0Qr7e+=PR_hk3U#5Y#sXb)sZp#sor+Yu{%s!8YwmWCrMTM zX=PW6m8?`Q=RGVi7}+jmgW|M~$Q@|!>Nc9@mJy1w8-1UuH59jtl6w&*uP8Cy;TP6QR&8*^`+v~E%iV}=#+Pn%!dOiC$u=#ZbntS$V z2^v!^9t8$5Bng(c22Qd)CKh}XC!aIf7)30o4_x1&%DD=?byX0KtENIv#V?@^ zu{aa$;gx$MBm#|`4-OJuZEra5Y;7(+dGlNHSmh6`z9Um*LSK_N*K7LwGWAI$YV7(t zfH?Z;`Pj_M+*86cwHqcz#JuSeq~6l$2QvDbCj`84Ozv_nE(#goEwHyTIc1T3>hAVB z$KqCjlYBcS@sB$TzU8pCbVlFrLb}wPU}fAO*{OYPfOKOE9^1v?T&{$&b1sjkyhR;| z^bTjLL~jr>b|oBfda0_nCekUa@qp`(X~q;Ij!N0okL((e6!uHI$8UZ-@TFEzy}0;p zs>OWm$MQF*=fieKIPi(R(Wf@3SM3J%`DwM@9N9-YpP_v$7#otbnU zh#;9gwV5FC4c00c}b$}QeY?g&HdaQ5IJ4A(9 z6=^-c;)ULjY?>_7oIc*xjM&-dcI)lTt+tE(1gXPfZ^*+Nn#Xotm6CXhYmSJ0O92f$ zHf$?XcqkQD+||{Y)f3!@?Ebn^6y5LaiDqioF*mZla`JA;laUSw7Q?idHisM*gBV`x zf~v_Vj*ch?ft`N#qtW$xvS~6-><*KO851@JQ^yTkoLpXZ+Wsh|_6K@th-w@~M;y$^ z*e?5{$_R1cZff?UqgF{R!^H!=kIvT)V+Pj0M}@Z3$H^+3sTnSgy?~f{J$&`$gK#Yh z=aq*N&N)}|@{H??@D-Uia-=vh`ucn$^o`Tj7BU)InVLJ9V(Uj!XWl#yQArQiGdt`g z@vWddHM^-1=(mTQCGTGj=VtI6GWQ$(zAC->==Wj4CNGxpl>8PgbjsvG-{IsKCs9wY zM9-&Y6Fr^u7X{lr0~qIBBF2ClzrjA>f#I_;VKiW1EFA`r)-K zSNJ^mpBY~{pl7$qJH{gNqMZKj2c$AD-^WqdoEoP``~7(aCqvD1pXgrA)z)>X%G)c1 zU1eG}KL(xUVR8KGWjDs2RfyaI zp*O8p?=W4im0Xv9mqkUt9Ohzu>)O{o=3V1v>+%EfhF9;D7F>9%UD+Y#s$*`kEAp~W>oVmL>!ELm__26qh;KZ7 zVztKMpo_!Sn_Z(XVwG+bPwmGec-p$cZx>D5UNc0CY*9-wo;WR&c>E|_Ml#OlenG63 z7K_@M-I;f1-YFCw9p z{?V1#L`m+9%2<)tEPRvf(`riF)e|?Z#i*f+#EC>yjHW7gV)RF4RPx3yEA@smha+FK z1=~oa8cTdJVlX}vF>r~hzv*zTm5#U##>`4y{j_sPcsiyl=&XQ72G=(CJ=>$x^;NZO z(?$4pX}ZL2vf8Xm_pE*UK-q_&97rtkZqnD6&m#WA3B$1kO|H58HH6DVitr z^y<|%?M&u6_4>oMlL8v+^=w3BcC5Q6`UGdAgY84_m{&#$?i^bGW;)1mF&@CP3O{8+4gMhKJzUn24om)kfLN&V$wFwxM~eUsp8tcOXtKy zKEB>x*pEohn(3Ocu|P`G$wY^!sVc60f*bM=J9s4pliGcQ=8Lu@a2R@B%*0 z0!HQ%1x$$?hT~Q6b{k91Ot}>+o<#>szj$Sk?pqv9ze``Y;c9z3Y-NZ(;_Ky-^~|Gz zEFx9x4ACKnqFo+pSR`0ILdtIu9bn!Q$n4X}%BUK!l228aZG|lSwqgC%G~tWdmT`|@ z{`T~{N}lO{?0CIbk)FAU8l%gtm6iSZ^NPUjduAH^IPSHbShqttr=l@2^TzIK_L^7; zg)MP=xU)-HUh-cLu9Z&+SgqPtX*Rq^`GiXNaYq6l-HmilD>1I0fyXWK`@`#LV&EAu}R!i^Z%1?nS>+Owf9G;;gHrPj8wae%sa5<)MiYFbD zju`S4I#PmH7vY@L4^)zxdLA9J&9P$CG|V$p)kz||RPqrs%*i*sXYFy7RD1T;TiQcr zx|FZ0Uj+x6I&QafJLoEoOT6@*r~Os4w(FT(RD5xs+urQ>hP7I)GW0pCrA%9j`aj(8`jZ95s`JXhSNuWEaK9W$!Gq^*0hn zu^hJFu_{|OrKCRS z;}$ypBJcarU3Mo%g?6vz&?BxM0decjP-|pZMJfX$uQEMHg#~v->apH$o%ERgJ8W`2 zjA`XuQf{llgVuP-iM|Vv@1c(xWP8}p7MI2+g``X4)&4B|N)8czr>u32>JM&bQR>6# z~A9I!C(o(6i&S zlw`zrjr!>{x7A*EGKMr_G%#mhXmo4bi@epc&n%O%=wW5FX@W_4c|mzW$;FhZ?!>F8 zqaXHFk^Pz``JYSe^8S9;2mf7wKZPPwuXG`DSJQbPrihmE3#+AT{6B2FJ(Ata)Nw}3 z*?os>;l#?cN^b8kVklrW0*R=s~&Sg6>(c0KancsEI?&tV(OZDsVx7-wMQVbFR_9$ zr0J>UeJb~=SH*+QkvFUp{uQ4O-xU7zrq1_+GvWg4ZQffPw!!b?<&2pL*bvu|=PG&f z4=(dXq-9<_6f4hL3lC=sf1pxlFMzp#6u+7qm{@p;XZS;7&%J{Bwq53h(vJ}%o4xLP zt9!Cb7+L<1H}O&rX+7qpJj`(v@u~lH+ryWmXH7%X+qV8z-TGPXXf`>kEbCV_n zBn2b`+;vV|D2m=>ru{@`;A8NLPc=UnNyalqzsW$*QVUSt0gu8He&!%>Kl4BOK5k@$ zimMA%iA=F}cW|S+g8UD7)U-TEMkvTbABjB?m+7D1ep< z3a;L!J8)PGdc$0Xv>TF}HZks&
{MP>456S zY6R8bb@nlwrR#xX1ka1PrqA+MI|(-*sb2)JpFLoW@KYGmfsm^+12yr z6QZATNRG1KE}I+YkdUn3pCK5)+^iv<-*GzN$&couO&QdiH#D?Xwy28}`*^mjmEJuT z)vEka(l;p_Rq=u{A!MfCx{BJI7PW1N|A@M*veBz&_^;uz{bnBMcjmf#B5QZ$hPRwJ z^4)>mfPJi*X@+G~Z8W6t{j|A@J8Dfmp)dMm!S9%d@DsxeY=Y49u%bddqwnrPrqwD~ zQpgaY{>&{7?i8w`y`?+E1$!*#$|wvBVdP*#wWpXO;dneAjzc2hSinWl1(neR0vwG) zE|l@8MP<<5Y?eQM@-1i$CDLFBeOCh)2Pk_9M?*}qlx>JVftqI<64dB7oU@RB!(h;!+DPo|&|2T$V#`D|Z0*5k)Hx+g@q_A$DKF}ZTY(M1>rZLD5{J#Yn)aQD>S zEy^v=A4GXhalJoP(K3F0YiJa{VMo$k%p3()_hr$&8KJvZ_-1tCed0)f zFXM?G`*ME@M@#Pt-|ODJ?~SePztj){dUw(B(qEL*6uue28T0(dk6Te=1E$^#q#53= zn*ElqR0q`j==sqJ3Iez5TtDotJeJa*^o9Obr0}4J+YI-aFZ{PsD?<*~bUbc*)AF9| z5ui9sJU^U*;GOBoxu2RWG#F#~Tu0BnC1FC+h%Jg`OZlZXbMG;?pwJ1w)_ab&($zIL zWR(1hEbdOFC-$4&h^{OBa^pi;rvWA&!C!aOn$VcQGyJBYI?HJ9R24RqbN>_e?f%=U zH-D`gj$OZoDQo@u_0|HmL0%&p>P2wZ6(?VXGTF~41@&dLVeY&j6y|RI@ctVq!n=cE zmHm&)C1sud&u zKqHxZ)4Kq-%nw|TGmGCkXgKMap7A`V+AJ!3vbHHE!gdxfG|tEX8?9P6VIR1{djg- zC!{j0pHXrDsgP?*0^Rz~C(AGG1*wx$bz7NVe|(&&pngNTHoI|*oYM74>Jnv(Sv&C& zdB;Z2gUo#Jk}Hz%aF=jrF(Rt4>)8{p&82H~`jR?XLchAC7p&ze5r5V6?%pwiD1Kda z6zknp@1of6Vm5Y5WmeuWFjz19-6wM-M|$mn>b)Kkob~c@Q~DwTu-!Kl*)Q;G2!?z$ zdfQhf`z3O^c73mv#`yX;yUia8%gX!o3`Pf>1Ut*5TzYenPy1K|rDGV-#KJT7&QF`X!a(*cq-|(z?#q&wMGh zVr|GHkM$h>7^+AWjOmHj3V}QFlfD5py!t=*`XyO%gc*%%Tki$Z?MCwQ$sX`Op?m)Y zF>W7QQ#ZL~vSVgz?sP1rVRP$LqBBY(@w)TL=9VVC_Iq(d*=c-&8I-(pO#)J`I|^+} zv>P*v6P-_P<&1hOuD<3q6`$1gr18n9L6Q&F`iWz{_DkDhU9@@QI-wTbQ06=J_U(>_ z2OnhdJ@{;r=R(pf(J9Tis8hPTj6qBHmgAF7bW{1QVjk8`J*<f+o4FaLD71v|-`5t>c|V%!PW{t!Jc6G&8pL>BxJ` zn_+f!z&F0&1k49rtk*+qGF_iwUi!L`lZ!p;jI~-<5StMD3O%)RrOB|Sk}KDlDC$m= zTgnV=;tZQUdY&|!SUK+Z)WaT|$j`U8^&Nx2Za((FXa!ES@MGEvYuK2J3v@zOt(R@@ zPg@-#<;UUfrd`K;DWRUFNNm#@1t!Y9ODpgAG+GKB-_G(v`?UAf7BLlhVknPeL3R35 zA7kScid;I}Hg(vddn@@wqpPf^ePas(O2XH*PER$eoi%v22KTuCo%c(mghZ!j z;@SQ5Q5v4Eci(o^+nn8w)d^#ZC(J^dy(hT%w1T2{8#G5- znhbG$^C}2=C0Ljhgu6kv)qqF*QA<5z=Lsvb_7R0u)xiu~b-30uXf}2;togF8+`f8E z!7HQC&z8@10}^ZmNmd0q^6U1J+%3k4(h)ofJ&0=)>&|!TJaCtlZE(xD+Rx}>!Puwut)S|_wi0i3|b9(gYWX|x*Wt$F{n(2u8lcPe7Uwe?o!bTszHQN*9#v|DSXWzJ^ zl+~xyGv~y+a?zMByO(t@Zxz09{8H_h60_6SloTOSm)`eDvhzVyUkqx?W;?REgu8Hw zg(VxSiP~zX%hszU9mN`4PI}!BDs#Q--@{eyNX^;Yb&^{J85ZkjCz~Dp!~CPyNG@;B znDyr(_Yt4`%Hz^w+juvGeJr|;+Hq^p`*z~+G3Cw8DVVY6F$2mqFOJnz{h)K+oY3<- z`vcO;knxHl5`G%5801d{zF?L7Gy;AauZpwAtCkztMbGD;m82&?|GGtyGhC%EQRl#CGHZE_Up zA#-R2dUsvZ=|`fPs*L ze%khE9Bu*2kO_~$0J9!Rq?z)NX-@>t1Yq8yh_mmY_fS0!kD;0T&@f2>L2HK5%5yHwylVs9q56547S;}6gvt02hBZShQ`DKVTJ}{KzAG#1&srP#`+Jg|G57={pZ&?e}~oyl_9tYI0!D>EG&S2 z^L5}o3`2roA;Qt%4qY_75%6#aJME? z;22tb0DUxK8c zsGZe6OJ~rdTDsU+y4ygr(0~Gkg<0gGIkbRg@p1K_BD9??t;q)g6bJ=pS8FGT5MUi( z|I(lbs(cYxU|TQMdP`@Whl>{bSv;eLDdtzW=8(P|uz3S@9uG^W_>TdDjMCphw%qnu zI_*4Uz@`PPu@toVg)R_mj*XTBM(exSWLP@Ie+(HGj-m-6IN+z5 zk@VfkWL;NRXa<_Bgr4CT+KOQ`tnRgR1N59n1VVcb#j`?hDJ-;Zb5m$~90YPgmx7kI{t$hwxW-!!jPw+#T*A}i$W(+1l=Yh3Epu8PB&>7+SxiY7 zNg^;$2?Vqx$hx7BI7t!?Sl~pgB>4FcWQ6G>6sW+g(VkbJ`eL(VZi68V;Rr2TkXKV$ zDCh$2hmtC@RtO*tLP=f>qB0WhZU=`<93(gy2fFUn04){e#faOWM)KOy(lCUkv@{&C zSsA^VMBGdQ7WS+hT&Mx&5p73+4zxacv$KQpJR4)7c^0$r-_aI>k_5&L3MUCc`bX9y z09^eY>v=suG?W&$e)jl8)j?h>rnny(LhC~mmSkWwV*vDJv{sa{2GrG)SrdFoKN!11 z@>?{FQ4|oCM%)$5Y)!u*E=_?ihUgzs7eskxsSC&nQ5T1o1ilK$aRPWD{|YUMnWwIz z{SxAuqXBhPYyqw@v?Qk?Tv|n0MFok(VUS2Xu+Z^}b9eAez(N%M`zBg$R8!d8I9L=C z`SX%ps0NM|mUjKD0yAJ2uAkLdQ2pBrvfmI&f5(GRu6LFR=hzPT_<(O{X7yrbT5co% z9W&vGG(q+^%!K|g$uXJ*^e;FAq%UVVgD8oDI0K881YS1^FbEpr3;+afo-_2lmvRPX zmNT$O5{Mcu5FHEggfhenvwT4SLYc$@9(HgBuD}y<^LCvmn+kMxcz~!pCvM05)Tm>O$1^9I9*stED{hIi zZwUjMz5XwR0SI@}_yh;EJr;^90TG4;wli9i2>1j~Lj6$~KoJEv2nN7WfM5RivH+3~ z;9AfnKqn9&)&jERr<{PwOW5Qe%ZmTi@PET5AOu5PrY>kcAY_CrRu{{C6GcmKj>y#x zcnZLjo(rl#euEu(FF4|XFrbjNJgCkNE|8rKC41zpp_57=IspYn5XL6^;4U7{&a+=g zz(j@)WG}M2wmaFD48k-ZE&~iGB?pR|v!xGkeDoct;J6Y9o{(wA(X6RA@2)I(LwhV; z?8GR}JM`25)%IGtJE^(Yx`J__BH4!49e{+8w{~}htaQkjgB-?x62yVQ%z)~hj}>W> z$u{zCZe&Y$OK7R{BQM6+;^+#r_<8eSPL1I4fE^&Vm@_$OriQ!+)!x;8z9rNG$RtSN zK+FRvAV@A@Ap>QOp=iAn!5;zu=fmdh7${;jC(eHAEC4l#nAvz(ljqyfhJi#LG(6NE zECdVeAlky_rlyHQh-bmH81RLGmH_k|1`?6b9W0A>2k)RZXi$#>7xW$j#=wE`pgXM} z39Ny(RKNyG;4c}7DM_J`XeH=RR;e z4hO7STlj1p3WbM!KSR&XbOZ%cx&?&iPb;w`qKqdz8%(8X>bHCI9oGq`z;(r|vg#k{+^6`Mo`=t(x z|D_HG(yqU>!{L7!4+pqqc{>!E^h;kr;pKP%T=7dgz4_9b8;FKcNX39=D>srv6m5haM)kR!y~c4|Asybdkck! zT&#sUs=FmP3F;0dG4&jL$zZF3K#?mIj7KUGl;rWi6Z+dGP;dsQ1x0(ZwG+kTARIxIM-lM~BoLv;Vz7#M zq5@F?MN&bd2^bX|$Vnj~wLzg;x>IQ)1qGN2{Ndd_Kki zht5NSAOmpkK_GltlmSjNFyMb3W`LW4zWQ(|&;XwgG{6!1@cBps9Evn-CeH^3=Hm@; zNZ~*_Y9ZhNmz4#T^6=k;9N-}205w(wZ;9Jz4fn#Ah*-$}m=m#d@IQXG0r0hkmF+F0@+8lef5Sm$IjD{S6(|5u0uX=%tZ1Bm-84}KnTiuOzK2Ap_+(Rn8xLZ7rP z+1BAyxIjC%vy*G7AYVv&7fWUp8S77Clts@{Bd8*JD&ea#^L7a z^q21EpXjv616{l=fW?mc*VhvA{o`!}bUn?PofnpKz6Z^j{TJk$cR2qGdkp*l<;3`4?XsL)f)j>;Z zfGiXoKm~FRl0c*DAB4lilx9EM;QEd*Wqp_qOc{*v2T*9TY#AcK5xqZyLJJlD*FgCx zmluGcrPaVGH2?|?t{o83z@rUJ%ou$B8C1~DUj`Kk=(4#y9xyPL@dp$dMgAW_wQu3` z&tQXg#xmG|XZmN@W+Qsg54t3wQ(ga<`TxLub9;P&UNq`}m?2@7`An95{t--&;m!&; z90k7SKOl%V8w_9tX8imM6ak9v&3Py^J9Xg=5%n`x0N#Lv;M`y+B95@&rGq!X^j&yE z`sr`8!hl9tctgVA7rZT27?3yk`935flIEL%-R81T2b$AXMO>&uBY~4ntHUpgHF6UZ|Ue5Bf&I0bb_(Fq)#8bHv~XHQ;ZFIni&bLN@xRHJeU87-Bh+xeYEh zC9*r_iZuUs!)ohf|Ms$n+h_#;>9zq2&7JHCjt&4X35@d7g`4#N7W^m(9Rwndb=H$& Gh5Zj^4lpQ=o~notZtD5p3oLR{9C--u_R)z1Kv6 z_U2X=&Q8CS}-!1X~$r9+`?C`MD|KlEwOiavd z&F{+qA=bcE)%KqIi(zghj0pCGUi*!h1rzJJ;q7zniezenZ4%E8Fq%=TZRLh=vM zw6Zg@Fat4(Sb^<~96ZO z%W%aGS9$aD_xEAq$Y68dp&gL0Y+NUbI1(k+%<(qzJmuEfb4T-$E^3&^r0?j^T0w3s z7mIl>h0UXakq0&eg4e3N@*c)zrlbmLXk9CS~Ep z@(?x+waDrrhRx>0T*{6mBFzn`5bh!(6d0;isxJKb;r&96xXDho63+&7i=$b zJonwUFejFj)Qr?z9Fa;Ox^#G1yht*VYUxA>Lyn{yUR!zFckRHfTy~gTmG9lNLvcl8 zsU>aq4sG=`%Unv-C&GoxB&f3aDayMIcHuEcwjN@agmSFGIN0DW$3=OLIO& zr7D#5)u|4&RM}p;t7y8=SAuyuU5351X8hs(7)@*mtf_rq^QKjrlFVDO5DlnCyEH{p(%dDkN4=~GSHVYjkeg$ zTdQ3^8okEY9p5XyiWW6kkr?>gh>1=mJXlnYs7Y867bXCZB-5!?f1Dk`L$@iPQuJ+p zFq$UoX*RP2sW8ivGm>x;=i>n{y2`6>oL)k@lBTD4Do+MFP1ZD#<%X`l?SC{~A|VnO z#U0Qt#1ia97bonw5+W=|XNY_X;aY%?iZ)3PSOia?_iR!wU@pV1bJ3AD_j4zha9=(1 z@W(WdUUppP34clMiv1L8!tE?sjZdP|AQP`->T`y9YgRFNbkrp`ISkO`oA*Iazv zBOw!0y|eT<&3xOb+bDUN%c1F%ATBLFST@{$FE=`kpA`K?`?(@T?sKRmtC~%evrrylt~NSNpdXbb2|DV^dt$Bj$Zx@B zr~|MWBIJC`3DKhbm?genD7(-MsghZvPN5XgUld2jaf2UK1;Iyt>kvSXS=M~?;$;XG zAAn2?@hLrJwoDJXy(sD^Y=KO%3;ZjM^o$|-JelWmk)HaMbQ7LLg|N_)a^p!h%h)n8 z8ol)caqb0~2PTluAcclBl z8~ud})=3pROHO}icLi&MD$5K!cQ#(`R8E@Bv(QA)uvdL#x3xIpi!%Ic=Oc+|m#<#8 zCuPwu436K1UtEly^(GQVnM2Alv~k5tU%U81l%ZJQtjoR$wd}CO$M-hUd&j+eWULuF zJwgiaE8<77+y}=YZl7#3Qu_HiUU|h)SDAF6WhB)I;iw$Q!3p23#;?>T0_MQbM2ZiY zz<-oR#M{ly>p~k#LrE{ns&R#@2Yko8Lr_I0i)aPy{xlq03Z51^U=qF%fsN{Y***>| zMj3WQAsty6+D+R>I@NK4j74OgKEZ@AK~#EfwE7cO8Ya@u%y2RB))C;!F`Mk%o3?CK z3-7QCR&5R{7IRgrGSbab!7br0bk7Sll%fe2wfNN7B>OYwKh|%Z?Vj1piFl62B_@8A z+4je3@OZX_8L=x#*t|KSIY+!RQ$=p8SD0*2hh~czeww?6yRY~HFQ1rw^HwYcEl0sm zT>9ITY-zG$3$?RBT6`9sJBX8=;^gR=Bo`zng%w9ofI>#ogT+VUj#sTrqh3G*esjC# zFa)GoShum%}pXzabsXYS#pQ>?W#AYxEHFHZ?AkCd&< z$Qn0Q-y?%APJBk`1QTrUvT|n|YISKnaRd)lmDFO3oXRKeRy@TXw@gO+Dn~VU}zIQ zzq`Dl2*$}Y7Q6INoz<1-8YIYCTEkK@3cQ`kGTu%^V)%&m(I2+wb7z0eOK7sh_-={W+E-8~;fo6qxfcBNCa5eR}%h~DW#aP?8)J_Isf zjK;Ezrr6&%Cg!L?jlrorKNIE`fJL?vzainRYLYaD-pF#UW1(*@7B!=54@)7C_qYrZAP{tB3)6`DeMdbl5if>t| z$Ip~HKeQdB>eNO>t8SSW*n#~%M8-9*tU;23pti8nM%L${@^2N+(1%S2g!y(dUzU-N zxG|ebV4MU@u6e|VBTsnz2wtvT0)U(xie%t!b|%uX^d@K-LKsPh zby7TN*mqh~I;j^?W>4T?6B}kt6%}tiF^VK?nwBwN_q$o$B68@ z9unj`x^Q#m^7J~jm=ef1tZ|lXEn0mY?2%y&amtXEyoR15-g4%eZGuB`vnEtiz{i~C zvWRcEv3)-HhMbO8Y10oFU75u6L4H)(^%)_dQh(hV=QI0Z0Gix5`!-pExdc!WiF(T^ zG+BMX)MT2QoINg8bo`Y#Dic+}wryl)Lv)d#h#<7SiNWxB`F2nCj-Eg{nxwBj=NP9) zvxK15$;)(@a1z$iceK->o+|QepD#F(*eJ5kGxK>>T&Fl_I~XP!HIA;^+`GE@m92+7 zoHLpy^oWWU4;pW-1fi5<;Snfu#df&v)5$YI0O0qRhJVU8AK&Mjc1HGA=4K!;qm!w5 zN%Wxo8)kI>eZBy*p-CYoI5;Qaw4(2bx_9VwA0_l(e%mdovr-c;EG*>Tvt~OUB#fM4 zi_zE}=CQQ=}H#fI4-U~M|XCb20`c&a5CKe2($ zbYhY3^fVd6k_A*5n1tG!&Z2Iu|1n092VpNxIwQ*&C@JsW`OTG3u-qFRYVAbpTkOFi z2aMsZ&W8)u?C+(ciAO#Z*NKCr{^_xhY%(v%@hy+DcWTpb!NQr0>N~yN%e~*_XzTP zi|sD~aqjA3#Xlho6i~{ew3Cwuz!_!P4F)7*n3!`!(b93{JScz8Iw_$m|YA zG$|+jxc-3&bn;DPYg)HWaa3rpP4z1d70@Qq5T*UpQk3l_M-&0W+EW7aHRuV$wS<8j z=-~h#0kO~CBkhqd`4eW0f|}TC#shF$Wd%)iE_&7#i3H+0HSO%6P`*pkcsfUtkv42J zNq2bcPie~QbSRTOd0X9{P;y>AGFYk2nWFW@yO0~BRhN-Zau=iIa7`<*LVAlCMz*&y z0ewK4$qP*_VvSf#8i_D%nR+m$SWrI_tw!(3W`$r?fGuoSg7k1VS`88#h;o2`=31zo z*}i-4d_&jsAbMtR*Zu7ju~kCX`O{R3zN(234Z?S2YrSmccqF_gvxlEEVB^o%kPxGNrJ{Awn)%PXV6PjF#HBo2&2G-S+ zQcYd{;4mw!3*p8^Hb4B33MDeZV%4fFWu)wjNQ&g2+NH-_yb#$wJ@vLHV-l$fP5FCp zKnO)8Bd_J)Ib+maKs?(5;bOZvAyKf4o2nmRP>MJe<;5D{eG-)#aap;96eo-OC^Wr(f9i04#&@Mk? z`DKNV+jde`1wuNHsJED!>p8;L4oz9Luxh!&;N$e4@U(Nm!=DP6Tz|haN^ka3MQ))8)`jK;*X%`J9uqx{bMzAamuO^KE{A2m~@98 z?dnW0dNmL`;KZ=yqG^)ScDV-o8RZC7XM6MExW3yXhQb>;SKhjOU2Qnq@Lh8b%oq~z z@_mjNufHE`7UP?+W0)x-K@>vDVvdO$p>fx?`bq?Q?c((CUOn5$BA~pH<8j3iqAQH` zG7n>$uFd$mw?C_i?~Z{5Z%Zm2lN}KGn)y9`7~AzUGs^dmfgzZCO62+Rb7XXHExCZB zhic>HkKgg_Vlp3I9QIUd(bjdIM#uETI$pE}L37U5c<39zuE(s3qo}a=N0VsW-Q3>B z3*26QU_!5U`iUE?sU`i|lm}gcPlMnVMyF@Hugx(>gp}?_$!LwNlqi z8_B3}D=&V1J<_M9NxwF%w=uGNWjcm!G1C~*QMOXEjrT?`vscrWEb8v^I4W`^7-M>$ zN#|rDqZQ4rLH2XXSeGb2iJuvj-bKr|#9|Gn{fQ57Aai@9n+)iIWSMzhb|t@pa6 zXUjDqf8be15SnE1Xn8SY)ych+mjL2PavM20w{w9&7~IS_wl_JDA-~6_FUCNsB>m-8 z^xi@F*@jm)W{+Hzen8r;j#3Pz1{Z4tj_aPC@q`l$EV7F9+F)Hs&xnUC0bHav`{2Q$RAXnA1;`wr$It%yH1ygPgZ0E`j*+mrIQa;O>D=;1LL zp(+ndV@7X2(;!Wu!+k8PX+x%hwHjBboGQ~SuKxnkz|K(}w6nIL;bmUg7$k$R$O$x` zC&1-!?U8UVGfZb|I9O&r;{VdFsxlF9cYHzCd((I{+P&kV0w@aK!2g2F_Ij3=Lxxv< zrcfoIRniuZEU1HwkMeyv`+McM=oD2#_XFC+gQ*PG%a!*1V)H=W&7?IHu0X$J?C-OF z&7dh#8$JzVt8o`~ln7d3A>oV_DZ*~kHRAX&pHiBziEVbg4==`XE73i%vKFQ!WV(;r zi52c_j8f(djXebL+?EoL!JcKS<_`4q4sjCjSd!1J#70STh2!{o@WMbfG9C0<&!pew z6rt3|lo!B?h9LEOP97>O2GaLVLeYk(O!&HCAnCgE#&f@sv`4|Gmo$M$)>j|cMax>^ zuNgfZNtG;UT!xhKdG@L7`yY;I9}~dFutnLofK}9>(x;m=uJd!ZcD{Y^@`%hTW4m*t zwh4){Qjv|*g?r;}0)e+8@`##UjB{1kSa&kZ1`k@|Q{%~7rj;HUX+j9gumpW2sY>GU z%bFQd%Ex&I)N5(uhk`;Z4;QUo+7ox5`_wK5?%yujhg=wB1_oQ%Tl`ji?b6W!;nzQX zCD=;d)wsOvXiR&GZHQ6%DRAlO#GcNJ(Z`|eTLtP-zCNu~DCkUq{>;y>OkqT88^#mM z1Va>k22^hL;HGFl_>*NmX)f63-#sw|e= z*^-(wJ!vgwUL3P6Gn6Z17+-=fHLOlms1j&?QN6XDSER3XI3!1R?4_3+Y&yQYya~R1 z<#GFti(8<%p@HW#gOP;l!}uEomvYv-gQ>p0F2_TUlPaI;?RISS%K(O3pVgG({=pG6 z*<+vpgDuT1AuvrUXD%|cSTO^`^r?YgAjqnIv(x?MGqg5QQ~fGJX^Uo zO3Mkh@L)E-f?0(1x{Sz#f*0}(0!raC*-^qX>0Kl_(L^*D%a509ho%V)Z+R{K*Bk4b zu*w+5k?7WKaUd2~z}2slyv=-#mmgba?FyV;IoF?Am*89RdEJvbyrLabbuGK3?xR=q zRE-McarW|Uqc{F{@^PqZQy#{Xh~;s#Qg%r%8Bs>ut-r>4ka>Tm@=4Tx<{_Y|-g+X7 zK~6T`bXvr(H(KF6hKtxOAIR3(-%4uEk1h^nIw8kK*6sHC#by&}6ubOPk`SAq*A(N* zX}mOBP5dWnyyT~XB>FGkgbUY>i-vi_XrX1DPzv}TYlo0^^HA_jbo*UL+bEYFvtw2VrDjDF^Uz0JiA^aS*>p#rGfyf-LD(^v?)1A@ z@HJdSv>X!6SzQk+oJk;-01FuF-Ox3Dk?>i{r@BB!_<~`r+;u%eDcp)am;+EO7aU$R z=WzT;%4~Ao3w?gf{=AHI2Q0YWa7mAW(I*Xr4isXsRk>E)HaN6Ky*GTRnNXjM%81C> zv}q_O%?K%8bl1*(O+hs~RV2bO353Z6CfoE#D4bCi`uX-cg;8*J!MY1#k@c+_y4enICS9iDV=Y0r z5>d0}89Hhr(rx%~QaEyY=mx;cueI)HKtSvxW+(B+4B-`g`_~@n$n01;j`8(o#%xYS z^d``RjkRfOB_I(*18f(5z_Wf>=50nIquEThQLb&tVpd0hfRK`#ID1hWtlF~Z%&MY> zs6WPtW8L2F*qGS)S&i*}@9iv7uHbhgEv)zc3$(}-5$T7M<8K(XRu3$bvTp=b>xdjf zzE{#@dLcS>oGva;*ZMs&tqCK1|3vEGh*ivx*MBW`LlK|7O{}gOY8NQS5ZOu|7AkaQ zK93j0@CdPnG1hPeFCX)q+dovB5S~*6ufQhwo#^UHo0(};Ze-kLN#&3=AHph!=|s^S z3pPH@MlVD7jTludg@i1RE1Z>Jy3d;W*kmpAcC?jGdp}=Ld6|XUEQNM$k0LpVfWFsk zqRlPNHioIx7kt*R7Ap>=Z4%+L7^zHTJf~Qi-K-U1>UU{V!oujdzFm)UXqxb5T`YXR zcGkCg_g|n?%<37F=sPg?jlPA#%8c{OM>lEGb)-SHwUn^ubLg^E!}S}`I`GS2j}Tg5 zM6I3ahqXdQI}Mp!-iCT(@;0_1khu_PW!nn}Nxkt!3yBIa2i>;_`qhPC@}dmB?={J| zKT40QnN(Ictmdo|&wz0>AlBj;j_cNNH_n((eHI!)g%%ov3z$%)gS-=an4Ofwrt}6D z!NNxs(+SidHx=W2uu}L2&!tNdc9G1w1%Npw8S56XZVRc3N9jJl>bMj#TTdXC#*daB z+Mwd|k!YB` zg3v3h&BZl;m0mMtU3~^NTVJawrrz#RtGQXRm@Cm{blV6>^hv=QlpHD#X8bk}ftcTp zAx4(7u**Rs6T?j4lhOl&=TA#eKD>fi3~71-dEEsGYhZ0VPXAWhRo2!YP|})puDS0j z%AITS-OIA0Jp7##uC{4V`zvJq5^00iwGt}HVQ-mwRh~tPz5~)Hu}0}a51YEa5a!67 zL2yKWy`NhL?P%9J|M3}3#g=&bFlRU=y&XSWCAFi!55?%5+^eNBQSjtyhzYiY;+t@_ zLsxd9Q9SQ$mFOw`HT+$Qxg}gDqCLOKX)QyDf0`cg<_ptXj%kWMKLSLRNmxj)I zJ@MCvP9FR8fndx=n~EAe;jjXpc?;PLGJ=yieBn*I7tM`+j@+oaq+Xz|HCW2LeiYe* zK__g#RWCS$=!DuI$4)u})v^!N{ZvR#x&(uC_bovqIW~AHj|>^%eXrLiPK-S!W97sW zesJoo9}KPa&f?8-q!NdtQ=Y}TMIs5~8Mr}`G}4gJFlAHeI!e-}b6b#|i{9oYGaS;k zq#=Id4q{p}-iBLS<`l%@oj;{$NcFidg25v^>f=8D3=aSVa{iGB{L##R*EPbZbpOx8 z^3X32fMqw%jf`B-D`*rQd%GY02$+9fdZtY-TV2d zNLox-)oprrcFJX@23lxX69yg~77F$JPLaWKj?E>-B`0L$>-HXnWI`9;?sHOvm|N8o zv=c-q>oJiC?R@1d><0zETIoT_4|q@{7#-Yarw#sH|k9`jc#yp2Srv>k-ipv(( zWEWg-ZiWs*##UQ~3Jj);mamaUFPasO>vuPB1>Rl~&x|sE_k8S*NYhyrLAPZf?5#K5 zQ^&Ln4x78lKQt@7QqJ?g+#Gvf)^jP-yq{R2P?>_SpF+>TR<8<9y$-I(j)+C3JOL;DqlzR=!Su`X;|!PZ&jdv?^kqzCOcNJ_S2U4% z7atwG<{z6b1V(SCoH`d=95ziXuTDlXjI)eajhpqkyj4unn3(Rl8d+sTgD4pb%7J+K zNCf3ihy!U*M!k{DoT6|2v$~Gasl&aS^H@50T;1KnClehY+}Se~vrc-C-U+roib=5- zL@W4w=0%rNA6UKD@io!2aE{L(ztOp#SSaITMXlX-`ML>HHOkm-5!=^l`IDL)yF#lH z?g?YYr7?i@m_hs+S0d0}Ybgy^AnHhK$u8=4y zYnN$;kFVn9EmZdG7UuK{MS_jT8B63DIIcA6hAqgbrAu4?t7BRZSx(qgFPe(M`uiHS zCVOw6&iU2m$7YXLi96V8xcih!k5vWjiYR(WJ`6Ecr*3f=$R{$l4M~IIFR!<1Emm1_|oI3dv+-18& z;`)fU?p(J(*k@dLANLk!9j=XFCQ11G>$_{Nc+VWxDVKM3_pxU>FA1AO&z*SI+(7zk zQA|pAtNMr9Gb{rQigw;iJDZSVa_18>*%=Ooa%8*J&5CMoW7|B!va5aBx$Ual8m8uy zFfW`F$d`$7`K=lnxzWqjPP+!M36YA%>6hGbyWHA&5d-~c^6mB3;rWn>T{8iDfv*eV z-k%fkjcdob8G%93^@hXXWxAXC%3!xasY#_eR+4L07d~3FTFisQGsukB-hO z_oFtuYdQJ!Yt;&lPnIv7UF(_|mAqfA3;lK%{rz@QMt-=jA};lIr%$4E<^|AC$_YuT zT}Z|f1fM!z^xj#V`CXE12}R(aw94JAYp@aLXUGuE+yJgP`!Lqe*2~^LxnY(^M0(jr?Gn)+D%-&pw4gIsUBKlU=8> zeF|(Z!Z*`5x7f0Qljr_wMFn{!`&y(X1MaWs#D(`<1VYJ z6lLDl&n=y{7Tuop$U9!$Hi*u)Uz~D>*XA96eLcZKaKe z`^rf6IqrHcmBR8BP`DP=(seL@MJ~Uy%zwgi&qw$1`71H~FBs}~+xuw$668PZ_HQ)z zzXti8BLA5ye{$gdEdTf6{KT{W3y|MK@wb@#1oAsa|Kc+Hs{{Wt$PdQ<|34{zK0p49 ziJ);SR13}%xH&ug5BJY9fV8-RSgDAi->+L!Sod4Wi>nGVNGnJ%{n?|sFDRA7%360Y zqX(XG2MpI}%FM_=DX)C~9d;8+)pO;s6a__uALz;$;~66rx~L0&#Q80}Wi3e)odP<> zqr%Rj*-+?wL0i7NKm~UL;N=>MoD2e3Sv-{knQV57VGCA0$ zV9IZ=^c7_$tc3(5sV+NVzSwy2GYj@yoki&|iJ?V*e*?2!X9B!Z6dRE{NsAqJT?9DY<%0`A?F#+6z-*i0syFBA95Zj zXiUJbM;IT@%n$ivpz-fkKeqTiSNgFof3N;}a`ESV|F8l89%dJR$eVlh?1Bm`D0S@*EkQel0O9bzC`!;*!AC!J5vAJ+aK$6pz; literal 0 HcmV?d00001 diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index 214b03b861d9..f1b8d1bb2219 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -5989,6 +5989,58 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf163913LeftRightMarginEm) CPPUNIT_ASSERT_DOUBLES_EQUAL(123.750, aRect.at(8).getMinX(), /*delta*/ 2.0); } +CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormRoundtrip) +{ + // We need to enable PDFium import (and make sure to disable after the test) + bool bResetEnvVar = false; + if (getenv("LO_IMPORT_USE_PDFIUM") == nullptr) + { + bResetEnvVar = true; + osl_setEnvironment(u"LO_IMPORT_USE_PDFIUM"_ustr.pData, u"1"_ustr.pData); + } + comphelper::ScopeGuard aPDFiumEnvVarGuard([&]() { + if (bResetEnvVar) + osl_clearEnvironment(u"LO_IMPORT_USE_PDFIUM"_ustr.pData); + }); + + saveAsPDF(u"FilledUpForm.pdf"); + auto pPdfDocument = parsePDFExport(); + CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount()); + std::unique_ptr pPage = pPdfDocument->openPage(0); + std::unique_ptr pPageObject = pPage->getObject(1); + CPPUNIT_ASSERT_EQUAL(5, pPage->getAnnotationCount()); + + { + std::unique_ptr pAnnotation = pPage->getAnnotation(0); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFFormFieldType::CheckBox, + pAnnotation->getFormFieldType(pPdfDocument.get())); + } + + { + std::unique_ptr pAnnotation = pPage->getAnnotation(1); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFFormFieldType::ComboBox, + pAnnotation->getFormFieldType(pPdfDocument.get())); + } + + { + std::unique_ptr pAnnotation = pPage->getAnnotation(2); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFFormFieldType::TextField, + pAnnotation->getFormFieldType(pPdfDocument.get())); + } + + { + std::unique_ptr pAnnotation = pPage->getAnnotation(3); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFFormFieldType::TextField, + pAnnotation->getFormFieldType(pPdfDocument.get())); + } + + { + std::unique_ptr pAnnotation = pPage->getAnnotation(4); + CPPUNIT_ASSERT_EQUAL(vcl::pdf::PDFFormFieldType::TextField, + pAnnotation->getFormFieldType(pPdfDocument.get())); + } +} + } // end anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index b7ccf81df469..f41309685cc1 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5640,39 +5640,46 @@ bool PDFWriterImpl::emitCatalog() { aLine.append( "/MarkInfo<>\n" ); } - if( !m_aWidgets.empty() ) + + if (!m_aWidgets.empty() || !m_aCopiedWidgets.empty()) { - aLine.append( "/AcroForm< 0 -#if HAVE_FEATURE_NSS - || ( m_nSignatureObject != -1 ) -#endif - ) - aLine.append( ">>\n" ); - else - aLine.append( "/NeedAppearances true>>\n" ); + // NeedAppearances must not be used if PDF is signed, PDF/A is used or + // we have copied widgets (can't guarantee we have appearance streams in this case) + if (m_nPDFA_Version == 0 && !bSigned && m_aCopiedWidgets.empty()) + aLine.append("/NeedAppearances true "); + + aLine.append(">>\n"); } //check if there is a Metadata object @@ -9343,6 +9350,14 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) return; } + // Get the copied resource map, so we can use that to skip objects we already copied + auto& rCopiedResourcesMap = rExternalPDFStream.getCopiedResources(); + + // Add page mapping to the copied resources map. + // Needed if we reference the current page and we want to prevent copying the page + // if it is referenced. + rCopiedResourcesMap.emplace(pPage->GetObjectValue(), m_aPages.back().m_nPageObject); + double aOrigin[2] = { 0.0, 0.0 }; // tdf#160714 use crop box for bounds of embedded PDF object @@ -9389,52 +9404,8 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) return; } - // Merge link annotations from pPage to our page. - std::vector aAnnots; - if (auto pArray = dynamic_cast(pPage->Lookup("Annots"_ostr))) - { - for (const auto pElement : pArray->GetElements()) - { - auto pReference = dynamic_cast(pElement); - if (!pReference) - { - continue; - } - - filter::PDFObjectElement* pObject = pReference->LookupObject(); - if (!pObject) - { - continue; - } - - auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); - if (!pType || pType->GetValue() != "Annot") - { - continue; - } - - auto pSubtype = dynamic_cast(pObject->Lookup("Subtype"_ostr)); - if (!pSubtype || pSubtype->GetValue() != "Link") - { - continue; - } - - // Reference to a link annotation object, remember it. - aAnnots.push_back(pObject); - } - } - if (!aAnnots.empty()) - { - PDFObjectCopier aCopier(*this); - SvMemoryStream& rDocBuffer = pPage->GetDocument().GetEditBuffer(); - std::map aMap; - for (const auto& pAnnot : aAnnots) - { - // Copy over the annotation and refer to its new id. - sal_Int32 nNewId = aCopier.copyExternalResource(rDocBuffer, *pAnnot, aMap); - m_aPages.back().m_aAnnotations.push_back(nNewId); - } - } + // Merge link and widget annotations from pPage to our page. + mergeAnnotationsFromExternalPage(pPage, rCopiedResourcesMap); nWrappedFormObject = createObject(); // Write the form XObject wrapped below. This is a separate object from @@ -9485,8 +9456,7 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) } PDFObjectCopier aCopier(*this); - auto & rResources = rExternalPDFStream.getCopiedResources(); - aCopier.copyPageResources(pPage, aLine, rResources); + aCopier.copyPageResources(pPage, aLine, rCopiedResourcesMap); aLine.append(" /BBox [ "); aLine.append(aOrigin[0]); @@ -9639,6 +9609,99 @@ void PDFWriterImpl::writeReferenceXObject(const ReferenceXObjectEmit& rEmit) return; } +namespace +{ + +sal_Int32 getRootParent(filter::PDFObjectElement* pObject) +{ + auto* pReference = dynamic_cast(pObject->Lookup("Parent"_ostr)); + if (!pReference) + return pObject->GetObjectValue(); + + auto* pParent = pReference->LookupObject(); + return getRootParent(pParent); +} + +} // end anonymous + +void PDFWriterImpl::mergeAnnotationsFromExternalPage(filter::PDFObjectElement* pPage, std::map& rCopiedResourcesMap) +{ + auto* pResult = pPage->Lookup("Annots"_ostr); + filter::PDFArrayElement* pArray = nullptr; + // If the Annots array is a reference - get the array from the referenced object + auto pAnnotsReference = dynamic_cast(pResult); + if (pAnnotsReference) + { + filter::PDFObjectElement* pObject = pAnnotsReference->LookupObject(); + pArray = pObject->GetArray(); + } + else + { + // Not a reference so is it an array + pArray = dynamic_cast(pResult); + } + + // Have we found our /Annots array? + if (!pArray) + return; + + std::unordered_set aAlreadyCopied; + PDFObjectCopier aCopier(*this); + SvMemoryStream& rDocBuffer = pPage->GetDocument().GetEditBuffer(); + + for (const auto pElement : pArray->GetElements()) + { + auto pReference = dynamic_cast(pElement); + if (!pReference) + continue; + + filter::PDFObjectElement* pObject = pReference->LookupObject(); + if (!pObject) + continue; + + // Get the /Type and the /Subtype + auto pType = dynamic_cast(pObject->Lookup("Type"_ostr)); + auto pSubtype = dynamic_cast(pObject->Lookup("Subtype"_ostr)); + + // Is it a /Annot we want to copy? + if (pType && pType->GetValue() == "Annot" && pSubtype) + { + bool bIsLink = pSubtype->GetValue() == "Link"; + bool bIsWidget = pSubtype->GetValue() == "Widget"; + + // is link or widget + if (!bIsLink && !bIsWidget) + continue; + + // Copy over the annotation and refer to its new id. + sal_Int32 nNewId = aCopier.copyExternalResource(rDocBuffer, *pObject, rCopiedResourcesMap); + m_aPages.back().m_aAnnotations.push_back(nNewId); + + if (!bIsWidget) + continue; + + // Find the root + sal_Int32 nRootID = getRootParent(pObject); + + auto aIterator = rCopiedResourcesMap.find(nRootID); + if (aIterator == rCopiedResourcesMap.end()) // Can't find the mapped ID ? + continue; + + nNewId = aIterator->second; + + // Ignore if we added the ID already + if (aAlreadyCopied.find(nNewId) == aAlreadyCopied.end()) + { + // Add new entry into copied widgets vector + auto& rCopiedWidget = m_aCopiedWidgets.emplace_back(); + rCopiedWidget.m_nObject = nNewId; + aAlreadyCopied.emplace(nNewId); + } + } + } + +} + bool PDFWriterImpl::writeBitmapObject( const BitmapEmit& rObject, bool bMask ) { if (rObject.m_aReferenceXObject.hasExternalPDFData() && !m_aContext.UseReferenceXObject) From a36a58933a1e07d3f54bacd5c2fe8ca53063a63a Mon Sep 17 00:00:00 2001 From: Rashesh Date: Mon, 25 Nov 2024 17:07:59 +0530 Subject: [PATCH 070/155] sd: convert sidebar masterpage panels from drawingview to iconview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - also removes unused PreviewValueSet Change-Id: I5e7dacb4f472de526a61366295bc91edca12e9ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177642 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl --- include/vcl/weld.hxx | 7 + sd/Library_sd.mk | 1 - .../ui/sidebar/AllMasterPagesSelector.cxx | 12 +- .../ui/sidebar/CurrentMasterPagesSelector.cxx | 25 +- sd/source/ui/sidebar/MasterPagesSelector.cxx | 269 ++++++++---------- sd/source/ui/sidebar/MasterPagesSelector.hxx | 33 +-- sd/source/ui/sidebar/PreviewValueSet.cxx | 127 --------- sd/source/ui/sidebar/PreviewValueSet.hxx | 59 ---- .../ui/sidebar/RecentMasterPagesSelector.cxx | 28 +- .../ui/sidebar/RecentMasterPagesSelector.hxx | 14 - sd/uiconfig/simpress/ui/masterpagepanel.ui | 41 ++- sd/uiconfig/simpress/ui/masterpagepanelall.ui | 41 ++- .../simpress/ui/masterpagepanelrecent.ui | 41 ++- solenv/clang-format/excludelist | 1 - vcl/inc/salvtables.hxx | 16 ++ vcl/source/app/salvtables.cxx | 94 ++++++ vcl/unx/gtk3/gtkinst.cxx | 101 +++++++ 17 files changed, 483 insertions(+), 427 deletions(-) delete mode 100644 sd/source/ui/sidebar/PreviewValueSet.cxx delete mode 100644 sd/source/ui/sidebar/PreviewValueSet.hxx diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index d68bced12c04..715beb742a4e 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1484,8 +1484,14 @@ public: virtual OUString get_selected_text() const = 0; //by index. Don't select when frozen, select after thaw. Note selection doesn't survive a freeze. + virtual OUString get_id(int pos) const = 0; virtual void select(int pos) = 0; virtual void unselect(int pos) = 0; + virtual void set_image(int pos, VirtualDevice* pDevice) = 0; + virtual void set_text(int pos, const OUString& rText) = 0; + virtual void set_id(int pos, const OUString& rId) = 0; + virtual void remove(int pos) = 0; + virtual tools::Rectangle get_rect(int pos) const = 0; //via iter virtual std::unique_ptr make_iterator(const TreeIter* pOrig = nullptr) const = 0; @@ -1495,6 +1501,7 @@ public: virtual bool get_iter_first(TreeIter& rIter) const = 0; virtual OUString get_id(const TreeIter& rIter) const = 0; virtual OUString get_text(const TreeIter& rIter) const = 0; + virtual bool iter_next_sibling(TreeIter& rIter) const = 0; virtual void scroll_to_item(const TreeIter& rIter) = 0; // call func on each selected element until func returns true or we run out of elements diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index 0a85cd6229ca..df3309c6d78d 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -362,7 +362,6 @@ $(eval $(call gb_Library_add_exception_objects,sd,\ sd/source/ui/sidebar/MasterPagesSelector \ sd/source/ui/sidebar/NavigatorWrapper \ sd/source/ui/sidebar/PanelFactory \ - sd/source/ui/sidebar/PreviewValueSet \ sd/source/ui/sidebar/RecentlyUsedMasterPages \ sd/source/ui/sidebar/RecentMasterPagesSelector \ sd/source/ui/sidebar/SlideBackground \ diff --git a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx index 70251b8cc740..fdd8ea4618f8 100644 --- a/sd/source/ui/sidebar/AllMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/AllMasterPagesSelector.cxx @@ -97,14 +97,14 @@ std::unique_ptr AllMasterPagesSelector::Create ( return xSelector; } -AllMasterPagesSelector::AllMasterPagesSelector ( - weld::Widget* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, +AllMasterPagesSelector::AllMasterPagesSelector( + weld::Widget* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, const std::shared_ptr& rpContainer, const css::uno::Reference& rxSidebar) - : MasterPagesSelector(pParent, rDocument, rBase, rpContainer, rxSidebar, u"modules/simpress/ui/masterpagepanelall.ui"_ustr, u"allvalueset"_ustr), - mpSortedMasterPages(new SortedMasterPageDescriptorList()) + : MasterPagesSelector(pParent, rDocument, rBase, rpContainer, rxSidebar, + u"modules/simpress/ui/masterpagepanelall.ui"_ustr, + u"masterpageall_icons"_ustr) + , mpSortedMasterPages(new SortedMasterPageDescriptorList()) { MasterPagesSelector::Fill(); } diff --git a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx index 2e3bd5a4ede7..c1ac330b7314 100644 --- a/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/CurrentMasterPagesSelector.cxx @@ -18,7 +18,6 @@ */ #include "CurrentMasterPagesSelector.hxx" -#include "PreviewValueSet.hxx" #include #include #include @@ -61,15 +60,16 @@ std::unique_ptr CurrentMasterPagesSelector::Create ( return xSelector; } -CurrentMasterPagesSelector::CurrentMasterPagesSelector ( - weld::Widget* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, +CurrentMasterPagesSelector::CurrentMasterPagesSelector( + weld::Widget* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, const std::shared_ptr& rpContainer, const css::uno::Reference& rxSidebar) - : MasterPagesSelector (pParent, rDocument, rBase, rpContainer, rxSidebar, u"modules/simpress/ui/masterpagepanel.ui"_ustr, u"usedvalueset"_ustr) + : MasterPagesSelector(pParent, rDocument, rBase, rpContainer, rxSidebar, + u"modules/simpress/ui/masterpagepanel.ui"_ustr, + u"masterpagecurrent_icons"_ustr) { - Link aLink (LINK(this,CurrentMasterPagesSelector,EventMultiplexerListener)); + Link aLink( + LINK(this, CurrentMasterPagesSelector, EventMultiplexerListener)); rBase.GetEventMultiplexer()->AddEventListener(aLink); } @@ -176,17 +176,6 @@ void CurrentMasterPagesSelector::UpdateSelection() } } } - - // Find the items for the master pages in the set. - sal_uInt16 nItemCount (mxPreviewValueSet->GetItemCount()); - for (nIndex=1; nIndex<=nItemCount && bLoop; nIndex++) - { - OUString sName (mxPreviewValueSet->GetItemText (nIndex)); - if (aNames.find(sName) != aNames.end()) - { - mxPreviewValueSet->SelectItem (nIndex); - } - } } void CurrentMasterPagesSelector::ExecuteCommand(const OUString &rIdent) diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx index c1417dd538ce..2ee57bca11c3 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx @@ -32,7 +32,7 @@ #include #include -#include "PreviewValueSet.hxx" +#include #include #include #include @@ -40,6 +40,7 @@ #include #include #include +#include namespace sd::sidebar { @@ -48,35 +49,22 @@ namespace sd::sidebar { */ constexpr OUStringLiteral gsDefaultClickAction = u"applyselect"; -MasterPagesSelector::MasterPagesSelector ( - weld::Widget* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, - std::shared_ptr pContainer, - css::uno::Reference xSidebar, - const OUString& rUIFileName, - const OUString& rValueSetName) - : PanelLayout( pParent, u"MasterPagePanel"_ustr, rUIFileName ), - mpContainer(std::move(pContainer)), - mxPreviewValueSet(new PreviewValueSet), - mxPreviewValueSetWin(new weld::CustomWeld(*m_xBuilder, rValueSetName, *mxPreviewValueSet)), - mrDocument(rDocument), - mrBase(rBase), - mxSidebar(std::move(xSidebar)) +MasterPagesSelector::MasterPagesSelector(weld::Widget* pParent, SdDrawDocument& rDocument, + ViewShellBase& rBase, + std::shared_ptr pContainer, + css::uno::Reference xSidebar, + const OUString& rUIFileName, const OUString& rIconViewId) + : PanelLayout(pParent, u"MasterPagePanel"_ustr, rUIFileName) + , mpContainer(std::move(pContainer)) + , mxPreviewIconView(m_xBuilder->weld_icon_view(rIconViewId)) + , mrDocument(rDocument) + , mrBase(rBase) + , mxSidebar(std::move(xSidebar)) + , maIconViewId(rIconViewId) { - mxPreviewValueSet->SetSelectHdl ( - LINK(this, MasterPagesSelector, ClickHandler)); - mxPreviewValueSet->SetContextMenuHandler ( - LINK(this, MasterPagesSelector, ContextMenuHandler)); - mxPreviewValueSet->SetStyle(mxPreviewValueSet->GetStyle() | WB_NO_DIRECTSELECT); - - if (mxPreviewValueSet->GetDrawingArea()->get_ref_device().GetDPIScaleFactor() > 1) - mpContainer->SetPreviewSize(MasterPageContainer::LARGE); - - mxPreviewValueSet->SetPreviewSize(mpContainer->GetPreviewSizePixel()); - mxPreviewValueSet->Show(); - - mxPreviewValueSet->SetColor(sfx2::sidebar::Theme::GetColor(sfx2::sidebar::Theme::Color_PanelBackground)); + mxPreviewIconView->connect_item_activated(LINK(this, MasterPagesSelector, MasterPageSelected)); + mxPreviewIconView->connect_mouse_press(LINK(this, MasterPagesSelector, MousePressHdl)); + mxPreviewIconView->connect_query_tooltip(LINK(this, MasterPagesSelector, QueryTooltipHdl)); Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); mpContainer->AddChangeListener(aChangeListener); @@ -90,21 +78,13 @@ MasterPagesSelector::~MasterPagesSelector() Link aChangeListener (LINK(this,MasterPagesSelector,ContainerChangeListener)); mpContainer->RemoveChangeListener(aChangeListener); mpContainer.reset(); - mxPreviewValueSetWin.reset(); - mxPreviewValueSet.reset(); + mxPreviewIconView.reset(); } void MasterPagesSelector::LateInit() { } -sal_Int32 MasterPagesSelector::GetPreferredHeight (sal_Int32 nWidth) -{ - const ::osl::MutexGuard aGuard (maMutex); - - return mxPreviewValueSet->GetPreferredHeight (nWidth); -} - void MasterPagesSelector::UpdateLocks (const ItemList& rItemList) { ItemList aNewLockList; @@ -144,61 +124,50 @@ OUString MasterPagesSelector::GetContextMenuUIFile() const return u"modules/simpress/ui/mastermenu.ui"_ustr; } -IMPL_LINK_NOARG(MasterPagesSelector, ClickHandler, ValueSet*, void) +IMPL_LINK_NOARG(MasterPagesSelector, MasterPageSelected, weld::IconView&, bool) { - // We use the framework to assign the clicked-on master page because we - // so use the same mechanism as the context menu does (where we do not - // have the option to call the assignment method directly.) ExecuteCommand(gsDefaultClickAction); + return true; } -IMPL_LINK(MasterPagesSelector, ContextMenuHandler, const Point*, pPos, void) +IMPL_LINK(MasterPagesSelector, MousePressHdl, const MouseEvent&, rMEvet, bool) { - if (pPos) + if (!rMEvet.IsRight()) + return false; + + const Point& pPos = rMEvet.GetPosPixel(); + for (int i = 0; i < mxPreviewIconView->n_children(); i++) { - // Here we only prepare the display of the context menu: on right - // click the item under the mouse is selected. - mxPreviewValueSet->GrabFocus(); - mxPreviewValueSet->ReleaseMouse(); - - sal_uInt16 nIndex = mxPreviewValueSet->GetItemId(*pPos); - if (nIndex > 0) - mxPreviewValueSet->SelectItem(nIndex); + const ::tools::Rectangle aRect = mxPreviewIconView->get_rect(i); + if (aRect.Contains(pPos)) + { + mxPreviewIconView->select(i); + ShowContextMenu(pPos); + break; + } } - - // Now do the actual display of the context menu - ShowContextMenu(pPos); + return false; } -void MasterPagesSelector::ShowContextMenu(const Point* pPos) +IMPL_LINK(MasterPagesSelector, QueryTooltipHdl, const weld::TreeIter&, iter, OUString) { - // Use the currently selected item and show the popup menu in its - // center. - const sal_uInt16 nIndex = mxPreviewValueSet->GetSelectedItemId(); - if (nIndex <= 0) - return; + const OUString sId = mxPreviewIconView->get_id(iter); + if (!sId.isEmpty()) + return mpContainer->GetPageNameForToken(sId.toUInt32()); - // The position of the upper left corner of the context menu is - // taken either from the mouse position (when the command was sent - // as reaction to a right click) or in the center of the selected - // item (when the command was sent as reaction to Shift+F10.) - Point aPosition; - if (!pPos) - { - ::tools::Rectangle aBBox (mxPreviewValueSet->GetItemRect(nIndex)); - aPosition = aBBox.Center(); - } - else - aPosition = *pPos; + return OUString(); +} +void MasterPagesSelector::ShowContextMenu(const Point& pPos) +{ // Setup the menu. - weld::Widget* pParent = mxPreviewValueSet->GetDrawingArea(); - std::unique_ptr xBuilder(Application::CreateBuilder(pParent, GetContextMenuUIFile())); + ::tools::Rectangle aRect(pPos, Size(1, 1)); + std::unique_ptr xBuilder( + Application::CreateBuilder(mxPreviewIconView.get(), GetContextMenuUIFile())); std::unique_ptr xMenu(xBuilder->weld_menu(u"menu"_ustr)); ProcessPopupMenu(*xMenu); - ::tools::Rectangle aRect(aPosition, Size(1,1)); // Show the menu. - ExecuteCommand(xMenu->popup_at_rect(pParent, aRect)); + ExecuteCommand(xMenu->popup_at_rect(mxPreviewIconView.get(), aRect)); } void MasterPagesSelector::ProcessPopupMenu(weld::Menu& rMenu) @@ -254,13 +223,12 @@ void MasterPagesSelector::ExecuteCommand(const OUString &rIdent) SfxDispatcher* pDispatcher = rViewFrame.GetDispatcher(); if (pDispatcher != nullptr) { - sal_uInt16 nIndex = mxPreviewValueSet->GetSelectedItemId(); pDispatcher->Execute(SID_MASTERPAGE, SfxCallMode::SYNCHRON); - mxPreviewValueSet->SelectItem (nIndex); mrBase.GetDrawController()->setCurrentPage(xSelectedMaster); } } } + mxPreviewIconView->unselect_all(); } IMPL_LINK(MasterPagesSelector, ContainerChangeListener, MasterPageContainerChangeEvent&, rEvent, void) @@ -273,11 +241,13 @@ SdPage* MasterPagesSelector::GetSelectedMasterPage() const ::osl::MutexGuard aGuard (maMutex); SdPage* pMasterPage = nullptr; - sal_uInt16 nIndex = mxPreviewValueSet->GetSelectedItemId(); - UserData* pData = GetUserData(nIndex); - if (pData != nullptr) + OUString sSelectedId = mxPreviewIconView->get_selected_id(); + + if (!sSelectedId.isEmpty()) { - pMasterPage = mpContainer->GetPageObjectForToken(pData->second, true); + const MasterPageContainer::Token aToken + = static_cast(sSelectedId.toInt32()); + pMasterPage = mpContainer->GetPageObjectForToken(aToken, true); } return pMasterPage; } @@ -354,7 +324,6 @@ void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerC switch (rEvent.meEventType) { case MasterPageContainerChangeEvent::EventType::SIZE_CHANGED: - mxPreviewValueSet->SetPreviewSize(mpContainer->GetPreviewSizePixel()); UpdateAllPreviews(); break; @@ -363,10 +332,12 @@ void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerC int nIndex (GetIndexForToken(rEvent.maChildToken)); if (nIndex >= 0) { - mxPreviewValueSet->SetItemImage ( - static_cast(nIndex), - mpContainer->GetPreviewForToken(rEvent.maChildToken)); - mxPreviewValueSet->Invalidate(mxPreviewValueSet->GetItemRect(static_cast(nIndex))); + Image aPreview(mpContainer->GetPreviewForToken(rEvent.maChildToken)); + if (aPreview.GetSizePixel().Width() > 0) + { + VclPtr aDev = GetVirtualDevice(aPreview); + mxPreviewIconView->set_image(nIndex, aDev); + } } } break; @@ -390,58 +361,50 @@ void MasterPagesSelector::NotifyContainerChangeEvent (const MasterPageContainerC } } -MasterPagesSelector::UserData* MasterPagesSelector::GetUserData (int nIndex) const +std::unique_ptr MasterPagesSelector::GetUserData(int nIndex) const { - const ::osl::MutexGuard aGuard (maMutex); + const ::osl::MutexGuard aGuard(maMutex); - if (nIndex>0 && o3tl::make_unsigned(nIndex)<=mxPreviewValueSet->GetItemCount()) - return static_cast(mxPreviewValueSet->GetItemData(static_cast(nIndex))); + if (nIndex >= 0 && nIndex < mxPreviewIconView->n_children()) + { + const MasterPageContainer::Token aToken + = static_cast(mxPreviewIconView->get_id(nIndex).toInt32()); + return std::make_unique(std::make_pair(nIndex, aToken)); + } else return nullptr; } -void MasterPagesSelector::SetUserData (int nIndex, std::unique_ptr pData) -{ - const ::osl::MutexGuard aGuard (maMutex); - - delete GetUserData(nIndex); - mxPreviewValueSet->SetItemData(static_cast(nIndex), pData.release()); -} - void MasterPagesSelector::SetItem ( sal_uInt16 nIndex, MasterPageContainer::Token aToken) { const ::osl::MutexGuard aGuard (maMutex); - RemoveTokenToIndexEntry(nIndex,aToken); + RemoveTokenToIndexEntry(nIndex, aToken); - if (nIndex <= 0) - return; + mxPreviewIconView->freeze(); if (aToken != MasterPageContainer::NIL_TOKEN) { Image aPreview (mpContainer->GetPreviewForToken(aToken)); MasterPageContainer::PreviewState eState (mpContainer->GetPreviewState(aToken)); - if (aPreview.GetSizePixel().Width()>0) + if (aPreview.GetSizePixel().Width() > 0) { - if (mxPreviewValueSet->GetItemPos(nIndex) != VALUESET_ITEM_NOTFOUND) + VclPtr aVDev = GetVirtualDevice(aPreview); + if (!mxPreviewIconView->get_id(nIndex).isEmpty()) { - mxPreviewValueSet->SetItemImage(nIndex,aPreview); - mxPreviewValueSet->SetItemText(nIndex, mpContainer->GetPageNameForToken(aToken)); + mxPreviewIconView->set_image(nIndex, aVDev); + mxPreviewIconView->set_id(nIndex, OUString::number(aToken)); } else { - mxPreviewValueSet->InsertItem ( - nIndex, - aPreview, - mpContainer->GetPageNameForToken(aToken), - nIndex); + OUString sId = OUString::number(aToken); + mxPreviewIconView->insert(nIndex, nullptr, &sId, aVDev, nullptr); } - SetUserData(nIndex, std::make_unique(nIndex,aToken)); - AddTokenToIndexEntry(nIndex,aToken); + AddTokenToIndexEntry(nIndex, aToken); } if (eState == MasterPageContainer::PS_CREATABLE) @@ -449,9 +412,9 @@ void MasterPagesSelector::SetItem ( } else { - mxPreviewValueSet->RemoveItem(nIndex); + mxPreviewIconView->remove(nIndex); } - + mxPreviewIconView->thaw(); } void MasterPagesSelector::AddTokenToIndexEntry ( @@ -469,7 +432,7 @@ void MasterPagesSelector::RemoveTokenToIndexEntry ( { const ::osl::MutexGuard aGuard (maMutex); - UserData* pData = GetUserData(nIndex); + std::unique_ptr pData = GetUserData(nIndex); if (pData != nullptr) { // Get the token that the index pointed to previously. @@ -478,7 +441,7 @@ void MasterPagesSelector::RemoveTokenToIndexEntry ( if (aNewToken != aOldToken && nIndex == GetIndexForToken(aOldToken)) { - maTokenToValueSetIndex[aOldToken] = 0; + maTokenToValueSetIndex[aOldToken] = -1; } } } @@ -487,9 +450,9 @@ void MasterPagesSelector::InvalidatePreview (const SdPage* pPage) { const ::osl::MutexGuard aGuard (maMutex); - for (size_t nIndex=1; nIndex<=mxPreviewValueSet->GetItemCount(); nIndex++) + for (int nIndex = 0; nIndex < mxPreviewIconView->n_children(); nIndex++) { - UserData* pData = GetUserData(nIndex); + std::unique_ptr pData = GetUserData(nIndex); if (pData != nullptr) { MasterPageContainer::Token aToken (pData->second); @@ -503,43 +466,54 @@ void MasterPagesSelector::InvalidatePreview (const SdPage* pPage) } } +VclPtr MasterPagesSelector::GetVirtualDevice(Image pImage) +{ + BitmapEx aPreviewBitmap = pImage.GetBitmapEx(); + VclPtr pVDev = VclPtr::Create(); + const Point aNull(0, 0); + if (pVDev->GetDPIScaleFactor() > 1) + aPreviewBitmap.Scale(pVDev->GetDPIScaleFactor(), pVDev->GetDPIScaleFactor()); + const Size aSize(aPreviewBitmap.GetSizePixel()); + pVDev->SetOutputSizePixel(aSize); + pVDev->DrawBitmapEx(aNull, aPreviewBitmap); + + return pVDev; +} + void MasterPagesSelector::UpdateAllPreviews() { const ::osl::MutexGuard aGuard (maMutex); - for (size_t nIndex=1; nIndex<=mxPreviewValueSet->GetItemCount(); nIndex++) + mxPreviewIconView->freeze(); + for (int aIndex = 0; aIndex < mxPreviewIconView->n_children(); aIndex++) { - UserData* pData = GetUserData(nIndex); - if (pData != nullptr) + const MasterPageContainer::Token aToken + = static_cast(mxPreviewIconView->get_id(aIndex).toInt32()); + + Image aPreview(mpContainer->GetPreviewForToken(aToken)); + if (aPreview.GetSizePixel().Width() > 0) { - MasterPageContainer::Token aToken (pData->second); - mxPreviewValueSet->SetItemImage( - nIndex, - mpContainer->GetPreviewForToken(aToken)); - if (mpContainer->GetPreviewState(aToken) == MasterPageContainer::PS_CREATABLE) - mpContainer->RequestPreview(aToken); + VclPtr pVDev = GetVirtualDevice(aPreview); + mxPreviewIconView->set_image(aIndex, pVDev); + } + else if (mpContainer->GetPreviewState(aToken) == MasterPageContainer::PS_CREATABLE) + { + mpContainer->RequestPreview(aToken); } } - mxPreviewValueSet->Rearrange(); + mxPreviewIconView->thaw(); } void MasterPagesSelector::ClearPageSet() { const ::osl::MutexGuard aGuard (maMutex); - - for (size_t nIndex=1; nIndex<=mxPreviewValueSet->GetItemCount(); nIndex++) - { - UserData* pData = GetUserData(nIndex); - delete pData; - } - mxPreviewValueSet->Clear(); + mxPreviewIconView->clear(); } void MasterPagesSelector::SetHelpId( const OUString& aId ) { const ::osl::MutexGuard aGuard (maMutex); - - mxPreviewValueSet->SetHelpId( aId ); + mxPreviewIconView->set_help_id(aId); } sal_Int32 MasterPagesSelector::GetIndexForToken (MasterPageContainer::Token aToken) const @@ -577,7 +551,7 @@ void MasterPagesSelector::UpdateItemList (::std::unique_ptr && pNewIte ItemList::const_iterator iCurrentItem (maCurrentItemList.begin()); ItemList::const_iterator iNewEnd (pNewItemList->end()); ItemList::const_iterator iCurrentEnd (maCurrentItemList.end()); - sal_uInt16 nIndex (1); + sal_uInt16 nIndex(0); // Update existing items. for ( ; iNewItem!=iNewEnd && iCurrentItem!=iCurrentEnd; ++iNewItem, ++iCurrentItem,++nIndex) @@ -602,15 +576,22 @@ void MasterPagesSelector::UpdateItemList (::std::unique_ptr && pNewIte maCurrentItemList.swap(*pNewItemList); - mxPreviewValueSet->Rearrange(); if (mxSidebar.is()) mxSidebar->requestLayout(); } -css::ui::LayoutSize MasterPagesSelector::GetHeightForWidth (const sal_Int32 nWidth) +css::ui::LayoutSize MasterPagesSelector::GetHeightForWidth(const sal_Int32 nWidth) { - const sal_Int32 nHeight (GetPreferredHeight(nWidth)); - return css::ui::LayoutSize(nHeight,nHeight,nHeight); + if (maIconViewId == "masterpageall_icons") + return css::ui::LayoutSize(-1, -1, -1); + + const sal_uInt32 nItemWidth = mxPreviewIconView->get_item_width(); + sal_Int32 nMinimumHeight = mxPreviewIconView->get_preferred_size().getHeight(); + const sal_Int32 itemsInRows = floor(nWidth / nItemWidth); + sal_Int32 totalItems = mxPreviewIconView->n_children(); + if (itemsInRows > 0) + nMinimumHeight = ((totalItems / itemsInRows) + 1) * nMinimumHeight; + return css::ui::LayoutSize(nMinimumHeight, nMinimumHeight, nMinimumHeight); } } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/MasterPagesSelector.hxx b/sd/source/ui/sidebar/MasterPagesSelector.hxx index f0a540bade1b..3eaf9851e317 100644 --- a/sd/source/ui/sidebar/MasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/MasterPagesSelector.hxx @@ -22,7 +22,10 @@ #include #include #include "MasterPageContainer.hxx" -#include "PreviewValueSet.hxx" +#include +#include +#include +#include #include #include @@ -46,14 +49,10 @@ class MasterPagesSelector : public PanelLayout , public sfx2::sidebar::ILayoutableWindow { public: - MasterPagesSelector ( - weld::Widget* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, - std::shared_ptr pContainer, - css::uno::Reference xSidebar, - const OUString& rUIFileName, - const OUString& rValueSetName); + MasterPagesSelector(weld::Widget* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, + std::shared_ptr pContainer, + css::uno::Reference xSidebar, + const OUString& rUIFileName, const OUString& rIconViewId); virtual ~MasterPagesSelector() override; virtual void LateInit(); @@ -80,7 +79,7 @@ public: void UpdateAllPreviews(); - void ShowContextMenu(const Point* pPos); + void ShowContextMenu(const Point& pPos); // ILayoutableWindow virtual css::ui::LayoutSize GetHeightForWidth (const sal_Int32 nWidth) override; @@ -89,8 +88,7 @@ protected: mutable ::osl::Mutex maMutex; std::shared_ptr mpContainer; - std::unique_ptr mxPreviewValueSet; - std::unique_ptr mxPreviewValueSetWin; + std::unique_ptr mxPreviewIconView; SdDrawDocument& mrDocument; ViewShellBase& mrBase; @@ -117,8 +115,7 @@ protected: virtual void NotifyContainerChangeEvent (const MasterPageContainerChangeEvent& rEvent); typedef ::std::pair UserData; - UserData* GetUserData (int nIndex) const; - void SetUserData (int nIndex, std::unique_ptr pData); + std::unique_ptr GetUserData(int nIndex) const; sal_Int32 GetIndexForToken (MasterPageContainer::Token aToken) const; typedef ::std::vector ItemList; @@ -155,14 +152,16 @@ protected: private: css::uno::Reference mxSidebar; + OUString maIconViewId; /** The offset between ValueSet index and MasterPageContainer::Token last seen. This value is used heuristically to speed up the lookup of an index for a token. */ - DECL_LINK(ClickHandler, ValueSet*, void); - DECL_LINK(ContextMenuHandler, const Point*, void); + DECL_LINK(MasterPageSelected, weld::IconView&, bool); + DECL_LINK(MousePressHdl, const MouseEvent&, bool); DECL_LINK(ContainerChangeListener, MasterPageContainerChangeEvent&, void); + DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString); void SetItem ( sal_uInt16 nIndex, @@ -173,6 +172,8 @@ private: void RemoveTokenToIndexEntry ( sal_uInt16 nIndex, MasterPageContainer::Token aToken); + + static VclPtr GetVirtualDevice(Image pPreview); }; } // end of namespace sd::sidebar diff --git a/sd/source/ui/sidebar/PreviewValueSet.cxx b/sd/source/ui/sidebar/PreviewValueSet.cxx deleted file mode 100644 index f752d60eb00d..000000000000 --- a/sd/source/ui/sidebar/PreviewValueSet.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "PreviewValueSet.hxx" -#include - -namespace sd::sidebar { - -const int gnBorderWidth(3); -const int gnBorderHeight(3); - -PreviewValueSet::PreviewValueSet() - : ValueSet(nullptr) - , maPreviewSize(10,10) -{ - SetStyle ( - GetStyle() - & ~(WB_ITEMBORDER)// | WB_MENUSTYLEVALUESET) - // | WB_FLATVALUESET); - ); -} - -void PreviewValueSet::SetDrawingArea(weld::DrawingArea* pDrawingArea) -{ - ValueSet::SetDrawingArea(pDrawingArea); - - SetColCount(2); - SetExtraSpacing (2); -} - -PreviewValueSet::~PreviewValueSet() -{ -} - -void PreviewValueSet::SetPreviewSize (const Size& rSize) -{ - maPreviewSize = rSize; -} - -void PreviewValueSet::SetContextMenuHandler(const Link& rLink) -{ - maContextMenuHandler = rLink; -} - -bool PreviewValueSet::Command(const CommandEvent& rEvent) -{ - if (rEvent.GetCommand() != CommandEventId::ContextMenu) - return ValueSet::Command(rEvent); - maContextMenuHandler.Call(rEvent.IsMouseEvent() ? &rEvent.GetMousePosPixel() : nullptr); - return true; -} - -void PreviewValueSet::Resize() -{ - ValueSet::Resize(); - - Size aWindowSize (GetOutputSizePixel()); - if (!aWindowSize.IsEmpty()) - { - Rearrange(); - } -} - -void PreviewValueSet::Rearrange() -{ - sal_uInt16 nNewColumnCount (CalculateColumnCount ( - GetOutputSizePixel().Width())); - sal_uInt16 nNewRowCount (CalculateRowCount (nNewColumnCount)); - - SetFormat(); - SetColCount(nNewColumnCount); - SetLineCount(nNewRowCount); -} - -sal_uInt16 PreviewValueSet::CalculateColumnCount (int nWidth) const -{ - int nColumnCount = 0; - if (nWidth > 0) - { - nColumnCount = nWidth / (maPreviewSize.Width() + 2*gnBorderWidth); - if (nColumnCount < 1) - nColumnCount = 1; - } - return static_cast(nColumnCount); -} - -sal_uInt16 PreviewValueSet::CalculateRowCount (sal_uInt16 nColumnCount) const -{ - int nRowCount = 0; - int nItemCount = GetItemCount(); - if (nColumnCount > 0) - { - nRowCount = (nItemCount+nColumnCount-1) / nColumnCount; - if (nRowCount < 1) - nRowCount = 1; - } - - return static_cast(nRowCount); -} - -sal_Int32 PreviewValueSet::GetPreferredHeight (sal_Int32 nWidth) -{ - int nRowCount (CalculateRowCount(CalculateColumnCount(nWidth))); - int nItemHeight (maPreviewSize.Height()); - - return nRowCount * (nItemHeight + 2*gnBorderHeight); -} - -} // end of namespace sd::sidebar - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/PreviewValueSet.hxx b/sd/source/ui/sidebar/PreviewValueSet.hxx deleted file mode 100644 index adab3c78ad4d..000000000000 --- a/sd/source/ui/sidebar/PreviewValueSet.hxx +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include - -namespace sd::sidebar -{ -/** Adapt the svtools valueset to the needs of the master page controls. -*/ -class PreviewValueSet : public ValueSet -{ -public: - explicit PreviewValueSet(); - virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; - virtual ~PreviewValueSet() override; - - void SetContextMenuHandler(const Link& rLink); - - virtual void Resize() override; - virtual bool Command(const CommandEvent& rEvent) override; - - void SetPreviewSize(const Size& rSize); - - sal_Int32 GetPreferredHeight(sal_Int32 nWidth); - - /** Set the number of rows and columns according to the current number - of items. Call this method when new items have been inserted. - */ - void Rearrange(); - -private: - Link maContextMenuHandler; - Size maPreviewSize; - - sal_uInt16 CalculateColumnCount(int nWidth) const; - sal_uInt16 CalculateRowCount(sal_uInt16 nColumnCount) const; -}; - -} // end of namespace sd::sidebar - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx index ef8e7fca3353..0917a46712c4 100644 --- a/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.cxx @@ -51,13 +51,13 @@ std::unique_ptr RecentMasterPagesSelector::Create ( return xSelector; } -RecentMasterPagesSelector::RecentMasterPagesSelector ( - weld::Widget* pParent, - SdDrawDocument& rDocument, - ViewShellBase& rBase, +RecentMasterPagesSelector::RecentMasterPagesSelector( + weld::Widget* pParent, SdDrawDocument& rDocument, ViewShellBase& rBase, const std::shared_ptr& rpContainer, const css::uno::Reference& rxSidebar) - : MasterPagesSelector (pParent, rDocument, rBase, rpContainer, rxSidebar, u"modules/simpress/ui/masterpagepanelrecent.ui"_ustr, u"recentvalueset"_ustr) + : MasterPagesSelector(pParent, rDocument, rBase, rpContainer, rxSidebar, + u"modules/simpress/ui/masterpagepanelrecent.ui"_ustr, + u"masterpagerecent_icons"_ustr) { } @@ -115,24 +115,6 @@ void RecentMasterPagesSelector::Fill (ItemList& rItemList) } } -void RecentMasterPagesSelector::AssignMasterPageToPageList ( - SdPage* pMasterPage, - const std::shared_ptr >& rpPageList) -{ - sal_uInt16 nSelectedItemId = mxPreviewValueSet->GetSelectedItemId(); - - MasterPagesSelector::AssignMasterPageToPageList(pMasterPage, rpPageList); - - // Restore the selection. - if (mxPreviewValueSet->GetItemCount() > 0) - { - if (mxPreviewValueSet->GetItemCount() >= nSelectedItemId) - mxPreviewValueSet->SelectItem(nSelectedItemId); - else - mxPreviewValueSet->SelectItem(mxPreviewValueSet->GetItemCount()); - } -} - } // end of namespace sd::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx index 6dbc3a2aae07..bf35ca0adf3b 100644 --- a/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx +++ b/sd/source/ui/sidebar/RecentMasterPagesSelector.hxx @@ -49,20 +49,6 @@ private: using sd::sidebar::MasterPagesSelector::Fill; - /** Forward this call to the base class but save and restore the - currently selected item. - Assign the given master page to the list of pages. - @param pMasterPage - This master page will usually be a member of the list of all - available master pages as provided by the MasterPageContainer. - @param rPageList - The pages to which to assign the master page. These pages may - be slides or master pages themselves. - */ - virtual void AssignMasterPageToPageList ( - SdPage* pMasterPage, - const std::shared_ptr >& rpPageList) override; - virtual void LateInit() override; }; diff --git a/sd/uiconfig/simpress/ui/masterpagepanel.ui b/sd/uiconfig/simpress/ui/masterpagepanel.ui index 429032ed2148..666d30ffacb5 100644 --- a/sd/uiconfig/simpress/ui/masterpagepanel.ui +++ b/sd/uiconfig/simpress/ui/masterpagepanel.ui @@ -3,22 +3,51 @@ - + + + + + + + + + True False - True True + vertical - + True True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK True True + never + in + + + True + 2 + True + True + True + liststore1 + 0 + 55 + 6 + True + + + Currently selected master slide. + + + + - 0 - 0 + False + True + 0 diff --git a/sd/uiconfig/simpress/ui/masterpagepanelall.ui b/sd/uiconfig/simpress/ui/masterpagepanelall.ui index 979d06990e9e..078c4b7bec09 100644 --- a/sd/uiconfig/simpress/ui/masterpagepanelall.ui +++ b/sd/uiconfig/simpress/ui/masterpagepanelall.ui @@ -3,22 +3,51 @@ - + + + + + + + + + True False - True True + vertical - + True True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK True True + never + in + + + 2 + True + True + True + True + liststore1 + 0 + True + 55 + 6 + + + Select master slide from available. + + + + - 0 - 0 + False + True + 0 diff --git a/sd/uiconfig/simpress/ui/masterpagepanelrecent.ui b/sd/uiconfig/simpress/ui/masterpagepanelrecent.ui index 4ec8487cfc5c..9be8d5a3ec9e 100644 --- a/sd/uiconfig/simpress/ui/masterpagepanelrecent.ui +++ b/sd/uiconfig/simpress/ui/masterpagepanelrecent.ui @@ -3,22 +3,51 @@ - + + + + + + + + + True False - True True + vertical - + True True - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK True True + never + in + + + 2 + True + True + True + True + liststore1 + 0 + 55 + 6 + True + + + Select recenty used master slide. + + + + - 0 - 0 + False + True + 0 diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index cf05e4de8eb8..6eff59432b41 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -9874,7 +9874,6 @@ sd/source/ui/sidebar/NavigatorWrapper.hxx sd/source/ui/sidebar/PageMarginUtils.hxx sd/source/ui/sidebar/PanelFactory.cxx sd/source/ui/sidebar/PanelFactory.hxx -sd/source/ui/sidebar/PreviewValueSet.cxx sd/source/ui/sidebar/RecentMasterPagesSelector.cxx sd/source/ui/sidebar/RecentMasterPagesSelector.hxx sd/source/ui/sidebar/RecentlyUsedMasterPages.cxx diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 3837576c486e..534e158b4196 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1979,14 +1979,30 @@ public: virtual bool get_iter_first(weld::TreeIter& rIter) const override; + virtual bool iter_next_sibling(weld::TreeIter& rIter) const override; + virtual void scroll_to_item(const weld::TreeIter& rIter) override; virtual void selected_foreach(const std::function& func) override; virtual OUString get_id(const weld::TreeIter& rIter) const override; + virtual OUString get_id(int pos) const override; + + virtual void remove(int pos) override; + + const OUString* getEntryData(int index) const; + + virtual void set_image(int pos, VirtualDevice* rImage) override; + + virtual void set_text(int pos, const OUString& rText) override; + + virtual void set_id(int pos, const OUString& rId) override; + virtual OUString get_text(const weld::TreeIter& rIter) const override; + virtual tools::Rectangle get_rect(int pos) const override; + virtual void clear() override; virtual ~SalInstanceIconView() override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index a20c1831626d..3b06cc0e05e6 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5667,6 +5667,13 @@ bool SalInstanceIconView::get_iter_first(weld::TreeIter& rIter) const return rVclIter.iter != nullptr; } +bool SalInstanceIconView::iter_next_sibling(weld::TreeIter& rIter) const +{ + SalInstanceTreeIter& rVclIter = static_cast(rIter); + rVclIter.iter = rVclIter.iter->NextSibling(); + return rVclIter.iter != nullptr; +} + void SalInstanceIconView::scroll_to_item(const weld::TreeIter& rIter) { assert(m_xIconView->IsUpdateMode() @@ -5698,12 +5705,99 @@ OUString SalInstanceIconView::get_id(const weld::TreeIter& rIter) const return OUString(); } +OUString SalInstanceIconView::get_id(int pos) const +{ + const OUString* pRet = getEntryData(pos); + if (!pRet) + return OUString(); + return *pRet; +} + +void SalInstanceIconView::set_image(int pos, VirtualDevice* pIcon) +{ + SvTreeListEntry* aEntry = m_xIconView->GetEntry(nullptr, pos); + if (aEntry == nullptr) + return; + SvLBoxContextBmp* aItem + = static_cast(aEntry->GetFirstItem(SvLBoxItemType::ContextBmp)); + + Image aImage; + if (pIcon) + { + const Point aNull(0, 0); + const Size aSize = pIcon->GetOutputSize(); + aImage = Image(pIcon->GetBitmapEx(aNull, aSize)); + } + if (aItem == nullptr) + { + aEntry->AddItem(std::make_unique(aImage, aImage, false)); + } + else + { + aItem->SetBitmap1(aImage); + aItem->SetBitmap2(aImage); + } + + if (!m_xIconView->GetModel()->IsEnableInvalidate()) + m_xIconView->ModelHasEntryInvalidated(aEntry); +} + +void SalInstanceIconView::remove(int pos) +{ + disable_notify_events(); + SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos); + m_xIconView->RemoveEntry(pEntry); + enable_notify_events(); +} + +const OUString* SalInstanceIconView::getEntryData(int index) const +{ + SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, index); + return pEntry ? static_cast(pEntry->GetUserData()) : nullptr; +} + OUString SalInstanceIconView::get_text(const weld::TreeIter& rIter) const { const SalInstanceTreeIter& rVclIter = static_cast(rIter); return SvTabListBox::GetEntryText(rVclIter.iter, 0); } +void SalInstanceIconView::set_text(int pos, const OUString& rText) +{ + SvTreeListEntry* aEntry = m_xIconView->GetEntry(nullptr, pos); + if (aEntry == nullptr) + return; + + SvLBoxString* aItem = static_cast(aEntry->GetFirstItem(SvLBoxItemType::String)); + if (aItem == nullptr) + { + aEntry->AddItem(std::make_unique(rText)); + } + else + { + aItem->SetText(rText); + } + + if (!m_xIconView->GetModel()->IsEnableInvalidate()) + m_xIconView->ModelHasEntryInvalidated(aEntry); +} + +void SalInstanceIconView::set_id(int pos, const OUString& rId) +{ + SvTreeListEntry* pEntry = m_xIconView->GetEntry(nullptr, pos); + m_aUserData.emplace_back(std::make_unique(rId)); + pEntry->SetUserData(m_aUserData.back().get()); +} + +tools::Rectangle SalInstanceIconView::get_rect(int pos) const +{ + SvTreeListEntry* aEntry = m_xIconView->GetEntry(nullptr, pos); + if (aEntry == nullptr) + return tools::Rectangle(); + + return m_xIconView->GetBoundingRect(aEntry); +} + void SalInstanceIconView::clear() { disable_notify_events(); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 834984642a1e..47841398e847 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2262,6 +2262,17 @@ namespace { rOutRect = GdkRectangle{static_cast(rInRect.Left()), static_cast(rInRect.Top()), static_cast(rInRect.GetWidth()), static_cast(rInRect.GetHeight())}; + + if (GTK_IS_ICON_VIEW(pWidget)) + { + // GtkIconView is a little weird in its positioning with scrolling, so adjust here to match what + // it expects + gint nOffsetX(0), nOffsetY(0); + gtk_icon_view_convert_widget_to_bin_window_coords(GTK_ICON_VIEW(pWidget), 0, 0, &nOffsetX, &nOffsetY); + rOutRect.x -= nOffsetX; + rOutRect.y -= nOffsetY; + } + if (SwapForRTL(pWidget)) rOutRect.x = gtk_widget_get_allocated_width(pWidget) - rOutRect.width - 1 - rOutRect.x; } @@ -17123,6 +17134,87 @@ private: return sRet; } + OUString get(int pos, int col) const + { + GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore); + OUString sRet; + GtkTreeIter iter; + if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos)) + sRet = get(iter, col); + return sRet; + } + + tools::Rectangle get_rect(int pos) const override + { + GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore); + GtkTreeIter rIter; + if (!gtk_tree_model_iter_nth_child(pModel, &rIter, nullptr, pos)) + return tools::Rectangle(); + + const GtkInstanceTreeIter& rGtkIter = static_cast(rIter); + GtkTreePath* path + = gtk_tree_model_get_path(pModel, const_cast(&rGtkIter.iter)); + + GdkRectangle aRect; + gtk_icon_view_get_cell_rect(m_pIconView, path, nullptr, &aRect); + gtk_tree_path_free(path); + + // GtkIconView is a little weird in its positioning with scrolling + gtk_icon_view_convert_widget_to_bin_window_coords(m_pIconView, aRect.x, aRect.y, &aRect.x, + &aRect.y); + + return tools::Rectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height); + } + + void set_image(int pos, VirtualDevice* pIcon) override + { + GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore); + GtkTreeIter iter; + if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos)) + { + if (pIcon) + { + GdkPixbuf* pixbuf = getPixbuf(*pIcon); + gtk_tree_store_set(m_pTreeStore, &iter, m_nImageCol, pixbuf, -1); + if (pixbuf) + g_object_unref(pixbuf); + } + } + } + + virtual void set_text(int pos, const OUString& rText) override + { + GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore); + GtkTreeIter iter; + if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos)) + { + OString aStr(OUStringToOString(rText, RTL_TEXTENCODING_UTF8)); + gtk_tree_store_set(m_pTreeStore, &iter, m_nTextCol, aStr.getStr(), -1); + } + } + + virtual void set_id(int pos, const OUString& rId) override + { + GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore); + GtkTreeIter iter; + + if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos)) + { + OString aStr(OUStringToOString(rId, RTL_TEXTENCODING_UTF8)); + gtk_tree_store_set(m_pTreeStore, &iter, m_nIdCol, aStr.getStr(), -1); + } + } + + virtual void remove(int pos) override + { + disable_notify_events(); + GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore); + GtkTreeIter iter; + if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos)) + tree_store_remove(pModel, &iter); + enable_notify_events(); + } + bool get_selected_iterator(GtkTreeIter* pIter) const { assert(gtk_icon_view_get_model(m_pIconView) && "don't request selection when frozen"); @@ -17387,6 +17479,13 @@ public: return gtk_tree_model_get_iter_first(pModel, &rGtkIter.iter); } + virtual bool iter_next_sibling(weld::TreeIter& rIter) const override + { + GtkInstanceTreeIter& rGtkIter = static_cast(rIter); + GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore); + return gtk_tree_model_iter_next(pModel, &rGtkIter.iter); + } + virtual void scroll_to_item(const weld::TreeIter& rIter) override { assert(gtk_icon_view_get_model(m_pIconView) && "don't select when frozen, select after thaw. Note selection doesn't survive a freeze"); @@ -17431,6 +17530,8 @@ public: return get(rGtkIter.iter, m_nIdCol); } + virtual OUString get_id(int pos) const override { return get(pos, m_nIdCol); } + virtual OUString get_text(const weld::TreeIter& rIter) const override { const GtkInstanceTreeIter& rGtkIter = static_cast(rIter); From 02bc6cd589ae4bf8469afea297b970d579a12229 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 3 Dec 2024 16:04:49 +0100 Subject: [PATCH 071/155] vcl: Change Menu::ClosePopup param to PopupMenu* Change Menu::ClosePopup param from Menu* to the child class PopupMenu*, as this is always a PopupMenu. This also removes the need to cast to PopupMenu in the PopupMenu::ClosePopup override. Change-Id: I129e6ebc7c801c1ca93514f26f79b76f970957a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177745 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/menu.hxx | 6 +++--- vcl/source/window/menu.cxx | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 36259d5ffb7f..19216d9585cc 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -201,7 +201,7 @@ protected: size_t nPos, const OUString &rIdent); /// Close the 'pStartedFrom' menu window. - virtual void ClosePopup(Menu* pMenu) = 0; + virtual void ClosePopup(PopupMenu* pPopupMenu) = 0; /// Forward the KeyInput call to the MenuBar. virtual void MenuBarKeyInput(const KeyEvent& rEvent); @@ -440,7 +440,7 @@ public: SAL_DLLPRIVATE MenuBarWindow* getMenuBarWindow(); /// Close the 'pStartedFrom' menu window. - virtual void ClosePopup(Menu* pMenu) override; + virtual void ClosePopup(PopupMenu* pPopupMenu) override; /// Forward the KeyInput call to the MenuBar. SAL_DLLPRIVATE virtual void MenuBarKeyInput(const KeyEvent& rEvent) override; @@ -514,7 +514,7 @@ public: virtual bool IsMenuBar() const override { return false; } /// Close the 'pStartedFrom' menu window. - SAL_DLLPRIVATE virtual void ClosePopup(Menu* pMenu) override; + SAL_DLLPRIVATE virtual void ClosePopup(PopupMenu* pPopupMenu) override; void SetText( const OUString& rTitle ) { diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 40a946bbdf8a..5ab0eef8471a 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2431,12 +2431,12 @@ void MenuBar::dispose() Menu::dispose(); } -void MenuBar::ClosePopup(Menu *pMenu) +void MenuBar::ClosePopup(PopupMenu *pPopupMenu) { MenuBarWindow* pMenuWin = getMenuBarWindow(); if (!pMenuWin) return; - pMenuWin->PopupClosed(pMenu); + pMenuWin->PopupClosed(pPopupMenu); } void MenuBar::MenuBarKeyInput(const KeyEvent& rEvent) @@ -2742,12 +2742,11 @@ PopupMenu::~PopupMenu() disposeOnce(); } -void PopupMenu::ClosePopup(Menu* pMenu) +void PopupMenu::ClosePopup(PopupMenu* pPopupMenu) { - MenuFloatingWindow* p = dynamic_cast(GetWindow()); - PopupMenu *pPopup = dynamic_cast(pMenu); - if (p && pPopup) - p->KillActivePopup(pPopup); + MenuFloatingWindow* p = ImplGetFloatingWindow(); + if (p && pPopupMenu) + p->KillActivePopup(pPopupMenu); } namespace vcl From 3e144ccb3cd9a1a093357b55140cc0be61beb3f7 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 3 Dec 2024 16:10:39 +0100 Subject: [PATCH 072/155] vcl: Slightly simplify check in MenuBarWindow::KillActivePopup Use existing PopupMenu::ImplGetFloatingWindow instead of casting manually. Change-Id: I9449130e077fc997d724d5fadc854a278ba16cce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177746 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menubarwindow.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 9eaaba67db81..a4eb0f74952a 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -350,9 +350,9 @@ void MenuBarWindow::KillActivePopup() if ( !m_pActivePopup ) return; - if (m_pActivePopup->m_pWindow) - if (static_cast(m_pActivePopup->m_pWindow.get())->IsInCleanUp()) - return; // kill it later + FloatingWindow* pFloatWin = m_pActivePopup->ImplGetFloatingWindow(); + if (pFloatWin && pFloatWin->IsInCleanUp()) + return; // kill it later if ( m_pActivePopup->bInCallback ) m_pActivePopup->bCanceled = true; From 230a9da04f81c5ae54b6d7dc7972ac05a20a52c8 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 3 Dec 2024 16:21:27 +0100 Subject: [PATCH 073/155] vcl: Drop MenuFloatingWindow::KillActivePopup param Move logic to the only caller that passed something else than the default nullptr. Change-Id: I293f2ca7ccd22f8f0f57a7fd91a6b4dfaa6a8846 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177747 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/source/window/menu.cxx | 4 ++-- vcl/source/window/menufloatingwindow.cxx | 4 ++-- vcl/source/window/menufloatingwindow.hxx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 5ab0eef8471a..6e7fc5494ca5 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2745,8 +2745,8 @@ PopupMenu::~PopupMenu() void PopupMenu::ClosePopup(PopupMenu* pPopupMenu) { MenuFloatingWindow* p = ImplGetFloatingWindow(); - if (p && pPopupMenu) - p->KillActivePopup(pPopupMenu); + if (p && pPopupMenu && p->GetActivePopup() == pPopupMenu) + p->KillActivePopup(); } namespace vcl diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 0d6a60689c35..8beb36be0760 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -477,9 +477,9 @@ void MenuFloatingWindow::StopExecute() pMenu->pStartedFrom->ImplCallEventListeners( VclEventId::MenuSubmenuDeactivate, nPosInParent ); } -void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) +void MenuFloatingWindow::KillActivePopup() { - if ( !pActivePopup || ( pThisOnly && ( pThisOnly != pActivePopup ) ) ) + if (!pActivePopup) return; if (MenuFloatingWindow* pFloatWin = pActivePopup->ImplGetFloatingWindow()) diff --git a/vcl/source/window/menufloatingwindow.hxx b/vcl/source/window/menufloatingwindow.hxx index 5324197aa8bd..3d364847361a 100644 --- a/vcl/source/window/menufloatingwindow.hxx +++ b/vcl/source/window/menufloatingwindow.hxx @@ -113,7 +113,7 @@ public: void EndExecute( sal_uInt16 nSelectId ); PopupMenu* GetActivePopup() const { return pActivePopup; } - void KillActivePopup( PopupMenu* pThisOnly = nullptr ); + void KillActivePopup(); void ChangeHighlightItem(sal_uInt16 n, bool bStartPopupTimer); sal_uInt16 GetHighlightedItem() const { return nHighlightedItem; } From eae43ee9112e59b8aabc2abad04d5413230e17a4 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 4 Dec 2024 11:21:55 +0500 Subject: [PATCH 074/155] Use o3tl::cow_wrapper instead of std::shared_ptr Change-Id: I05ff47fe51cccce6a78745027ae8c2679783bd8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177766 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- include/vcl/settings.hxx | 26 +- vcl/source/app/settings.cxx | 505 +++++++++++------------------------- 2 files changed, 168 insertions(+), 363 deletions(-) diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index d7cbcc174792..432419abc568 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -84,11 +85,13 @@ enum class MouseWheelBehaviour class VCL_DLLPUBLIC MouseSettings { private: - SAL_DLLPRIVATE void CopyData(); - std::shared_ptr mxData; + o3tl::cow_wrapper mxData; public: MouseSettings(); + MouseSettings(const MouseSettings&); + ~MouseSettings(); + MouseSettings& operator=(const MouseSettings&); void SetOptions( MouseSettingsOptions nOptions ); MouseSettingsOptions GetOptions() const; @@ -136,7 +139,6 @@ public: MouseWheelBehaviour GetWheelBehavior() const; bool operator ==( const MouseSettings& rSet ) const; - bool operator !=( const MouseSettings& rSet ) const; }; struct DialogStyle @@ -217,13 +219,14 @@ enum class ComboBoxTextSelectionMode class VCL_DLLPUBLIC StyleSettings { - SAL_DLLPRIVATE void CopyData(); - private: - std::shared_ptr mxData; + o3tl::cow_wrapper mxData; public: StyleSettings(); + StyleSettings(const StyleSettings&); + ~StyleSettings(); + StyleSettings& operator=(const StyleSettings&); SAL_DLLPRIVATE void Set3DColors( const Color& rColor ); @@ -646,7 +649,6 @@ public: void SetStandardStyles(); bool operator ==( const StyleSettings& rSet ) const; - bool operator !=( const StyleSettings& rSet ) const; // Batch setters used by various backends void BatchSetBackgrounds( const Color &aBackColor, @@ -716,12 +718,13 @@ namespace o3tl class VCL_DLLPUBLIC AllSettings { private: - SAL_DLLPRIVATE void CopyData(); - - std::shared_ptr mxData; + o3tl::cow_wrapper mxData; public: AllSettings(); + AllSettings(const AllSettings&); + ~AllSettings(); + AllSettings& operator=(const AllSettings&); void SetMouseSettings( const MouseSettings& rSet ); const MouseSettings& GetMouseSettings() const; @@ -758,9 +761,8 @@ public: SAL_DLLPRIVATE AllSettingsFlags GetChangeFlags( const AllSettings& rSettings ) const; SAL_DLLPRIVATE bool operator ==( const AllSettings& rSet ) const; - SAL_DLLPRIVATE bool operator !=( const AllSettings& rSet ) const; SAL_DLLPRIVATE static void LocaleSettingsChanged( ConfigurationHints nHint ); - SAL_DLLPRIVATE SvtSysLocale& GetSysLocale(); + SAL_DLLPRIVATE const SvtSysLocale& GetSysLocale() const; }; #endif // INCLUDED_VCL_SETTINGS_HXX diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index cacb278077ae..b4b8907f89cf 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -70,6 +70,8 @@ struct ImplMouseData MouseFollowFlags mnFollow = MouseFollowFlags::Menu; MouseMiddleButtonAction mnMiddleButtonAction= MouseMiddleButtonAction::AutoScroll; MouseWheelBehaviour mnWheelBehavior = MouseWheelBehaviour::FocusOnly; + + bool operator==(const ImplMouseData& rSet) const = default; }; namespace @@ -206,7 +208,7 @@ struct ImplStyleData ToolbarIconSize mnToolbarIconSize = ToolbarIconSize::Unknown; StyleSettingsOptions mnOptions = StyleSettingsOptions::NONE; TriState meUseImagesInMenus = TRISTATE_INDET; - std::optional + std::optional mutable mIconThemeScanner; vcl::IconThemeSelector mIconThemeSelector; @@ -246,13 +248,15 @@ struct ImplStyleData ComboBoxTextSelectionMode meComboBoxTextSelectionMode = ComboBoxTextSelectionMode::SelectText; Size maListBoxPreviewDefaultLogicSize = getInitListBoxPreviewDefaultLogicSize(); // on-demand calculated in GetListBoxPreviewDefaultPixelSize() - Size maListBoxPreviewDefaultPixelSize; + Size mutable maListBoxPreviewDefaultPixelSize; - OUString maPersonaHeaderFooter; ///< Cache the settings to detect changes. + OUString mutable maPersonaHeaderFooter; ///< Cache the settings to detect changes. - BitmapEx maPersonaHeaderBitmap; ///< Cache the header bitmap. - BitmapEx maPersonaFooterBitmap; ///< Cache the footer bitmap. - std::optional maPersonaMenuBarTextColor; ///< Cache the menubar color. + BitmapEx mutable maPersonaHeaderBitmap; ///< Cache the header bitmap. + BitmapEx mutable maPersonaFooterBitmap; ///< Cache the footer bitmap. + std::optional mutable maPersonaMenuBarTextColor; ///< Cache the menubar color. + + bool operator==(const ImplStyleData& rSet) const; }; struct ImplMiscData @@ -277,20 +281,21 @@ struct ImplAllSettingsData StyleSettings maStyleSettings; MiscSettings maMiscSettings; HelpSettings maHelpSettings; + SvtSysLocale maSysLocale; LanguageTag maLocale; LanguageTag maUILocale; - std::unique_ptr mpLocaleDataWrapper; - std::unique_ptr mpUILocaleDataWrapper; - std::unique_ptr mpNeutralLocaleDataWrapper; - std::unique_ptr mpI18nHelper; - std::unique_ptr mpUII18nHelper; - SvtSysLocale maSysLocale; + mutable std::unique_ptr mpLocaleDataWrapper; + mutable std::unique_ptr mpUILocaleDataWrapper; + mutable std::unique_ptr mpNeutralLocaleDataWrapper; + mutable std::unique_ptr mpI18nHelper; + mutable std::unique_ptr mpUII18nHelper; + + bool operator==(const ImplAllSettingsData& rSet) const; }; void MouseSettings::SetOptions(MouseSettingsOptions nOptions) { - CopyData(); mxData->mnOptions = nOptions; } @@ -303,7 +308,6 @@ MouseSettings::GetOptions() const void MouseSettings::SetDoubleClickTime( sal_uInt64 nDoubleClkTime ) { - CopyData(); mxData->mnDoubleClkTime = nDoubleClkTime; } @@ -316,7 +320,6 @@ MouseSettings::GetDoubleClickTime() const void MouseSettings::SetDoubleClickWidth( sal_Int32 nDoubleClkWidth ) { - CopyData(); mxData->mnDoubleClkWidth = nDoubleClkWidth; } @@ -329,7 +332,6 @@ MouseSettings::GetDoubleClickWidth() const void MouseSettings::SetDoubleClickHeight( sal_Int32 nDoubleClkHeight ) { - CopyData(); mxData->mnDoubleClkHeight = nDoubleClkHeight; } @@ -342,7 +344,6 @@ MouseSettings::GetDoubleClickHeight() const void MouseSettings::SetStartDragWidth( sal_Int32 nDragWidth ) { - CopyData(); mxData->mnStartDragWidth = nDragWidth; } @@ -355,7 +356,6 @@ MouseSettings::GetStartDragWidth() const void MouseSettings::SetStartDragHeight( sal_Int32 nDragHeight ) { - CopyData(); mxData->mnStartDragHeight = nDragHeight; } @@ -398,7 +398,6 @@ MouseSettings::GetButtonStartRepeat() void MouseSettings::SetButtonRepeat( sal_Int32 nRepeat ) { - CopyData(); mxData->mnButtonRepeat = nRepeat; } @@ -417,7 +416,6 @@ MouseSettings::GetActionDelay() void MouseSettings::SetMenuDelay( sal_Int32 nDelay ) { - CopyData(); mxData->mnMenuDelay = nDelay; } @@ -430,7 +428,6 @@ MouseSettings::GetMenuDelay() const void MouseSettings::SetFollow( MouseFollowFlags nFollow ) { - CopyData(); mxData->mnFollow = nFollow; } @@ -443,7 +440,6 @@ MouseSettings::GetFollow() const void MouseSettings::SetMiddleButtonAction( MouseMiddleButtonAction nAction ) { - CopyData(); mxData->mnMiddleButtonAction = nAction; } @@ -456,7 +452,6 @@ MouseSettings::GetMiddleButtonAction() const void MouseSettings::SetWheelBehavior( MouseWheelBehaviour nBehavior ) { - CopyData(); mxData->mnWheelBehavior = nBehavior; } @@ -466,43 +461,15 @@ MouseSettings::GetWheelBehavior() const return mxData->mnWheelBehavior; } -bool -MouseSettings::operator !=( const MouseSettings& rSet ) const -{ - return !(*this == rSet); -} - -MouseSettings::MouseSettings() - : mxData(std::make_shared()) -{ -} - -void MouseSettings::CopyData() -{ - // copy if other references exist - if (mxData.use_count() > 1) - { - mxData = std::make_shared(*mxData); - } -} +MouseSettings::MouseSettings() = default; +MouseSettings::MouseSettings(const MouseSettings&) = default; +MouseSettings::~MouseSettings() = default; +MouseSettings& MouseSettings::operator=(const MouseSettings&) = default; +// Until Clang 14, P2085R0 is unsupported, and the operator can't be default outside of declaration bool MouseSettings::operator ==( const MouseSettings& rSet ) const { - if ( mxData == rSet.mxData ) - return true; - - return - (mxData->mnOptions == rSet.mxData->mnOptions) && - (mxData->mnDoubleClkTime == rSet.mxData->mnDoubleClkTime) && - (mxData->mnDoubleClkWidth == rSet.mxData->mnDoubleClkWidth) && - (mxData->mnDoubleClkHeight == rSet.mxData->mnDoubleClkHeight) && - (mxData->mnStartDragWidth == rSet.mxData->mnStartDragWidth) && - (mxData->mnStartDragHeight == rSet.mxData->mnStartDragHeight) && - (mxData->mnMiddleButtonAction == rSet.mxData->mnMiddleButtonAction) && - (mxData->mnButtonRepeat == rSet.mxData->mnButtonRepeat) && - (mxData->mnMenuDelay == rSet.mxData->mnMenuDelay) && - (mxData->mnFollow == rSet.mxData->mnFollow) && - (mxData->mnWheelBehavior == rSet.mxData->mnWheelBehavior ); + return mxData == rSet.mxData; } ImplStyleData::ImplStyleData() @@ -626,15 +593,14 @@ void ImplStyleData::SetStandardStyles() mbPrimaryButtonWarpsSlider = false; } -StyleSettings::StyleSettings() - : mxData(std::make_shared()) -{ -} +StyleSettings::StyleSettings() = default; +StyleSettings::StyleSettings(const StyleSettings&) = default; +StyleSettings::~StyleSettings() = default; +StyleSettings& StyleSettings::operator=(const StyleSettings&) = default; void StyleSettings::SetFaceColor( const Color& rColor ) { - CopyData(); mxData->maColors.maFaceColor = rColor; } @@ -647,7 +613,6 @@ StyleSettings::GetFaceColor() const void StyleSettings::SetCheckedColor( const Color& rColor ) { - CopyData(); mxData->maColors.maCheckedColor = rColor; } @@ -660,7 +625,6 @@ StyleSettings::GetCheckedColor() const void StyleSettings::SetLightColor( const Color& rColor ) { - CopyData(); mxData->maColors.maLightColor = rColor; } @@ -673,7 +637,6 @@ StyleSettings::GetLightColor() const void StyleSettings::SetLightBorderColor( const Color& rColor ) { - CopyData(); mxData->maColors.maLightBorderColor = rColor; } @@ -686,7 +649,6 @@ StyleSettings::GetLightBorderColor() const void StyleSettings::SetWarningColor( const Color& rColor ) { - CopyData(); mxData->maColors.maWarningColor = rColor; } @@ -699,7 +661,6 @@ StyleSettings::GetWarningColor() const void StyleSettings::SetWarningTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maWarningTextColor = rColor; } @@ -712,7 +673,6 @@ StyleSettings::GetWarningTextColor() const void StyleSettings::SetErrorColor( const Color& rColor ) { - CopyData(); mxData->maColors.maErrorColor = rColor; } @@ -725,7 +685,6 @@ StyleSettings::GetErrorColor() const void StyleSettings::SetErrorTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maErrorTextColor = rColor; } @@ -738,7 +697,6 @@ StyleSettings::GetErrorTextColor() const void StyleSettings::SetShadowColor( const Color& rColor ) { - CopyData(); mxData->maColors.maShadowColor = rColor; } @@ -751,7 +709,6 @@ StyleSettings::GetShadowColor() const void StyleSettings::SetDarkShadowColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDarkShadowColor = rColor; } @@ -764,7 +721,6 @@ StyleSettings::GetDarkShadowColor() const void StyleSettings::SetDefaultButtonTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDefaultButtonTextColor = rColor; } @@ -777,7 +733,6 @@ StyleSettings::GetDefaultButtonTextColor() const void StyleSettings::SetButtonTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maButtonTextColor = rColor; } @@ -790,7 +745,6 @@ StyleSettings::GetButtonTextColor() const void StyleSettings::SetDefaultActionButtonTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDefaultActionButtonTextColor = rColor; } @@ -803,7 +757,6 @@ StyleSettings::GetDefaultActionButtonTextColor() const void StyleSettings::SetActionButtonTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maActionButtonTextColor = rColor; } @@ -816,7 +769,6 @@ StyleSettings::GetActionButtonTextColor() const void StyleSettings::SetFlatButtonTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maFlatButtonTextColor = rColor; } @@ -829,7 +781,6 @@ StyleSettings::GetFlatButtonTextColor() const void StyleSettings::SetDefaultButtonRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDefaultButtonRolloverTextColor = rColor; } @@ -842,7 +793,6 @@ StyleSettings::GetDefaultButtonRolloverTextColor() const void StyleSettings::SetButtonRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maButtonRolloverTextColor = rColor; } @@ -855,7 +805,6 @@ StyleSettings::GetButtonRolloverTextColor() const void StyleSettings::SetDefaultActionButtonRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDefaultActionButtonRolloverTextColor = rColor; } @@ -868,7 +817,6 @@ StyleSettings::GetDefaultActionButtonRolloverTextColor() const void StyleSettings::SetActionButtonRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maActionButtonRolloverTextColor = rColor; } @@ -881,7 +829,6 @@ StyleSettings::GetActionButtonRolloverTextColor() const void StyleSettings::SetFlatButtonRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maFlatButtonRolloverTextColor = rColor; } @@ -894,7 +841,6 @@ StyleSettings::GetFlatButtonRolloverTextColor() const void StyleSettings::SetDefaultButtonPressedRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDefaultButtonPressedRolloverTextColor = rColor; } @@ -907,7 +853,6 @@ StyleSettings::GetDefaultButtonPressedRolloverTextColor() const void StyleSettings::SetButtonPressedRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maButtonPressedRolloverTextColor = rColor; } @@ -920,7 +865,6 @@ StyleSettings::GetButtonPressedRolloverTextColor() const void StyleSettings::SetDefaultActionButtonPressedRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDefaultActionButtonPressedRolloverTextColor = rColor; } @@ -933,7 +877,6 @@ StyleSettings::GetDefaultActionButtonPressedRolloverTextColor() const void StyleSettings::SetActionButtonPressedRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maActionButtonPressedRolloverTextColor = rColor; } @@ -946,7 +889,6 @@ StyleSettings::GetActionButtonPressedRolloverTextColor() const void StyleSettings::SetFlatButtonPressedRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maFlatButtonPressedRolloverTextColor = rColor; } @@ -959,7 +901,6 @@ StyleSettings::GetFlatButtonPressedRolloverTextColor() const void StyleSettings::SetRadioCheckTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maRadioCheckTextColor = rColor; } @@ -972,7 +913,6 @@ StyleSettings::GetRadioCheckTextColor() const void StyleSettings::SetGroupTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maGroupTextColor = rColor; } @@ -985,7 +925,6 @@ StyleSettings::GetGroupTextColor() const void StyleSettings::SetLabelTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maLabelTextColor = rColor; } @@ -998,7 +937,6 @@ StyleSettings::GetLabelTextColor() const void StyleSettings::SetWindowColor( const Color& rColor ) { - CopyData(); mxData->maColors.maWindowColor = rColor; } @@ -1011,7 +949,6 @@ StyleSettings::GetWindowColor() const void StyleSettings::SetWindowTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maWindowTextColor = rColor; } @@ -1024,7 +961,6 @@ StyleSettings::GetWindowTextColor() const void StyleSettings::SetDialogColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDialogColor = rColor; } @@ -1037,7 +973,6 @@ StyleSettings::GetDialogColor() const void StyleSettings::SetDialogTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDialogTextColor = rColor; } @@ -1050,7 +985,6 @@ StyleSettings::GetDialogTextColor() const void StyleSettings::SetWorkspaceColor( const Color& rColor ) { - CopyData(); mxData->maColors.maWorkspaceColor = rColor; } @@ -1063,7 +997,6 @@ StyleSettings::GetWorkspaceColor() const void StyleSettings::SetFieldColor( const Color& rColor ) { - CopyData(); mxData->maColors.maFieldColor = rColor; } @@ -1076,7 +1009,6 @@ StyleSettings::GetFieldColor() const void StyleSettings::SetFieldTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maFieldTextColor = rColor; } @@ -1089,7 +1021,6 @@ StyleSettings::GetFieldTextColor() const void StyleSettings::SetFieldRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maFieldRolloverTextColor = rColor; } @@ -1102,7 +1033,6 @@ StyleSettings::GetFieldRolloverTextColor() const void StyleSettings::SetActiveColor( const Color& rColor ) { - CopyData(); mxData->maColors.maActiveColor = rColor; } @@ -1115,7 +1045,6 @@ StyleSettings::GetActiveColor() const void StyleSettings::SetActiveTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maActiveTextColor = rColor; } @@ -1128,7 +1057,6 @@ StyleSettings::GetActiveTextColor() const void StyleSettings::SetActiveBorderColor( const Color& rColor ) { - CopyData(); mxData->maColors.maActiveBorderColor = rColor; } @@ -1141,7 +1069,6 @@ StyleSettings::GetActiveBorderColor() const void StyleSettings::SetDeactiveColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDeactiveColor = rColor; } @@ -1154,7 +1081,6 @@ StyleSettings::GetDeactiveColor() const void StyleSettings::SetDeactiveTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDeactiveTextColor = rColor; } @@ -1167,7 +1093,6 @@ StyleSettings::GetDeactiveTextColor() const void StyleSettings::SetDeactiveBorderColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDeactiveBorderColor = rColor; } @@ -1180,7 +1105,6 @@ StyleSettings::GetDeactiveBorderColor() const void StyleSettings::SetAccentColor( const Color& rColor ) { - CopyData(); mxData->maColors.maAccentColor = rColor; } @@ -1193,7 +1117,6 @@ StyleSettings::GetAccentColor() const void StyleSettings::SetHighlightColor( const Color& rColor ) { - CopyData(); mxData->maColors.maHighlightColor = rColor; } @@ -1206,7 +1129,6 @@ StyleSettings::GetHighlightColor() const void StyleSettings::SetHighlightTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maHighlightTextColor = rColor; } @@ -1219,7 +1141,6 @@ StyleSettings::GetHighlightTextColor() const void StyleSettings::SetDisableColor( const Color& rColor ) { - CopyData(); mxData->maColors.maDisableColor = rColor; } @@ -1232,7 +1153,6 @@ StyleSettings::GetDisableColor() const void StyleSettings::SetHelpColor( const Color& rColor ) { - CopyData(); mxData->maColors.maHelpColor = rColor; } @@ -1245,7 +1165,6 @@ StyleSettings::GetHelpColor() const void StyleSettings::SetHelpTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maHelpTextColor = rColor; } @@ -1258,7 +1177,6 @@ StyleSettings::GetHelpTextColor() const void StyleSettings::SetMenuColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuColor = rColor; } @@ -1271,7 +1189,6 @@ StyleSettings::GetMenuColor() const void StyleSettings::SetMenuBarColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuBarColor = rColor; } @@ -1284,7 +1201,6 @@ StyleSettings::GetMenuBarColor() const void StyleSettings::SetMenuBarRolloverColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuBarRolloverColor = rColor; } @@ -1297,7 +1213,6 @@ StyleSettings::GetMenuBarRolloverColor() const void StyleSettings::SetMenuBorderColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuBorderColor = rColor; } @@ -1310,7 +1225,6 @@ StyleSettings::GetMenuBorderColor() const void StyleSettings::SetMenuTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuTextColor = rColor; } @@ -1323,7 +1237,6 @@ StyleSettings::GetMenuTextColor() const void StyleSettings::SetMenuBarTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuBarTextColor = rColor; } @@ -1336,7 +1249,6 @@ StyleSettings::GetMenuBarTextColor() const void StyleSettings::SetMenuBarRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuBarRolloverTextColor = rColor; } @@ -1349,7 +1261,6 @@ StyleSettings::GetMenuBarRolloverTextColor() const void StyleSettings::SetMenuBarHighlightTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuBarHighlightTextColor = rColor; } @@ -1362,7 +1273,6 @@ StyleSettings::GetMenuBarHighlightTextColor() const void StyleSettings::SetMenuHighlightColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuHighlightColor = rColor; } @@ -1375,7 +1285,6 @@ StyleSettings::GetMenuHighlightColor() const void StyleSettings::SetMenuHighlightTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMenuHighlightTextColor = rColor; } @@ -1388,7 +1297,6 @@ StyleSettings::GetMenuHighlightTextColor() const void StyleSettings::SetListBoxWindowBackgroundColor( const Color& rColor ) { - CopyData(); mxData->maColors.maListBoxWindowBackgroundColor = rColor; } @@ -1401,7 +1309,6 @@ StyleSettings::GetListBoxWindowBackgroundColor() const void StyleSettings::SetListBoxWindowTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maListBoxWindowTextColor = rColor; } @@ -1414,7 +1321,6 @@ StyleSettings::GetListBoxWindowTextColor() const void StyleSettings::SetListBoxWindowHighlightColor( const Color& rColor ) { - CopyData(); mxData->maColors.maListBoxWindowHighlightColor = rColor; } @@ -1427,7 +1333,6 @@ StyleSettings::GetListBoxWindowHighlightColor() const void StyleSettings::SetListBoxWindowHighlightTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maListBoxWindowHighlightTextColor = rColor; } @@ -1440,7 +1345,6 @@ StyleSettings::GetListBoxWindowHighlightTextColor() const void StyleSettings::SetTabTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maTabTextColor = rColor; } @@ -1453,7 +1357,6 @@ StyleSettings::GetTabTextColor() const void StyleSettings::SetTabRolloverTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maTabRolloverTextColor = rColor; } @@ -1466,7 +1369,6 @@ StyleSettings::GetTabRolloverTextColor() const void StyleSettings::SetTabHighlightTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maTabHighlightTextColor = rColor; } @@ -1479,7 +1381,6 @@ StyleSettings::GetTabHighlightTextColor() const void StyleSettings::SetLinkColor( const Color& rColor ) { - CopyData(); mxData->maColors.maLinkColor = rColor; } @@ -1492,7 +1393,6 @@ StyleSettings::GetLinkColor() const void StyleSettings::SetVisitedLinkColor( const Color& rColor ) { - CopyData(); mxData->maColors.maVisitedLinkColor = rColor; } @@ -1505,7 +1405,6 @@ StyleSettings::GetVisitedLinkColor() const void StyleSettings::SetToolTextColor( const Color& rColor ) { - CopyData(); mxData->maColors.maToolTextColor = rColor; } @@ -1518,7 +1417,6 @@ StyleSettings::GetToolTextColor() const void StyleSettings::SetMonoColor( const Color& rColor ) { - CopyData(); mxData->maColors.maMonoColor = rColor; } @@ -1531,7 +1429,6 @@ StyleSettings::GetMonoColor() const void StyleSettings::SetActiveTabColor( const Color& rColor ) { - CopyData(); mxData->maColors.maActiveTabColor = rColor; } @@ -1544,7 +1441,6 @@ StyleSettings::GetActiveTabColor() const void StyleSettings::SetInactiveTabColor( const Color& rColor ) { - CopyData(); mxData->maColors.maInactiveTabColor = rColor; } @@ -1556,7 +1452,6 @@ StyleSettings::GetInactiveTabColor() const void StyleSettings::SetAlternatingRowColor(const Color& rColor) { - CopyData(); mxData->maColors.maAlternatingRowColor = rColor; } @@ -1569,7 +1464,6 @@ StyleSettings::GetAlternatingRowColor() const void StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts ) { - CopyData(); mxData->mbUseSystemUIFonts = bUseSystemUIFonts; } @@ -1581,7 +1475,6 @@ StyleSettings::GetUseSystemUIFonts() const void StyleSettings::SetUseFontAAFromSystem(bool bUseFontAAFromSystem) { - CopyData(); mxData->mbUseFontAAFromSystem = bUseFontAAFromSystem; } @@ -1593,7 +1486,6 @@ bool StyleSettings::GetUseFontAAFromSystem() const void StyleSettings::SetUseFlatBorders( bool bUseFlatBorders ) { - CopyData(); mxData->mnUseFlatBorders = bUseFlatBorders; } @@ -1606,7 +1498,6 @@ StyleSettings::GetUseFlatBorders() const void StyleSettings::SetUseFlatMenus( bool bUseFlatMenus ) { - CopyData(); mxData->mnUseFlatMenus = bUseFlatMenus; } @@ -1619,14 +1510,12 @@ StyleSettings::GetUseFlatMenus() const void StyleSettings::SetUseImagesInMenus( TriState eUseImagesInMenus ) { - CopyData(); mxData->meUseImagesInMenus = eUseImagesInMenus; } void StyleSettings::SetPreferredUseImagesInMenus( bool bPreferredUseImagesInMenus ) { - CopyData(); mxData->mbPreferredUseImagesInMenus = bPreferredUseImagesInMenus; } @@ -1639,7 +1528,6 @@ StyleSettings::GetPreferredUseImagesInMenus() const void StyleSettings::SetSkipDisabledInMenus( bool bSkipDisabledInMenus ) { - CopyData(); mxData->mbSkipDisabledInMenus = bSkipDisabledInMenus; } @@ -1652,7 +1540,6 @@ StyleSettings::GetSkipDisabledInMenus() const void StyleSettings::SetHideDisabledMenuItems( bool bHideDisabledMenuItems ) { - CopyData(); mxData->mbHideDisabledMenuItems = bHideDisabledMenuItems; } @@ -1665,7 +1552,6 @@ StyleSettings::GetHideDisabledMenuItems() const void StyleSettings::SetContextMenuShortcuts( TriState eContextMenuShortcuts ) { - CopyData(); mxData->meContextMenuShortcuts = eContextMenuShortcuts; } @@ -1686,7 +1572,6 @@ StyleSettings::GetContextMenuShortcuts() const void StyleSettings::SetPreferredContextMenuShortcuts( bool bContextMenuShortcuts ) { - CopyData(); mxData->mbPreferredContextMenuShortcuts = bContextMenuShortcuts; } @@ -1699,7 +1584,6 @@ StyleSettings::GetPreferredContextMenuShortcuts() const void StyleSettings::SetPrimaryButtonWarpsSlider( bool bPrimaryButtonWarpsSlider ) { - CopyData(); mxData->mbPrimaryButtonWarpsSlider = bPrimaryButtonWarpsSlider; } @@ -1712,7 +1596,6 @@ StyleSettings::GetPrimaryButtonWarpsSlider() const void StyleSettings::SetAppFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maAppFont = rFont; } @@ -1725,7 +1608,6 @@ StyleSettings::GetAppFont() const void StyleSettings::SetHelpFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maHelpFont = rFont; } @@ -1738,7 +1620,6 @@ StyleSettings::GetHelpFont() const void StyleSettings::SetTitleFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maTitleFont = rFont; } @@ -1751,7 +1632,6 @@ StyleSettings::GetTitleFont() const void StyleSettings::SetFloatTitleFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maFloatTitleFont = rFont; } @@ -1764,7 +1644,6 @@ StyleSettings::GetFloatTitleFont() const void StyleSettings::SetMenuFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maMenuFont = rFont; } @@ -1777,7 +1656,6 @@ StyleSettings::GetMenuFont() const void StyleSettings::SetToolFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maToolFont = rFont; } @@ -1790,7 +1668,6 @@ StyleSettings::GetToolFont() const void StyleSettings::SetGroupFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maGroupFont = rFont; } @@ -1803,7 +1680,6 @@ StyleSettings::GetGroupFont() const void StyleSettings::SetLabelFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maLabelFont = rFont; } @@ -1816,7 +1692,6 @@ StyleSettings::GetLabelFont() const void StyleSettings::SetRadioCheckFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maRadioCheckFont = rFont; } @@ -1829,7 +1704,6 @@ StyleSettings::GetRadioCheckFont() const void StyleSettings::SetPushButtonFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maPushButtonFont = rFont; } @@ -1842,7 +1716,6 @@ StyleSettings::GetPushButtonFont() const void StyleSettings::SetFieldFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maFieldFont = rFont; } @@ -1855,7 +1728,6 @@ StyleSettings::GetFieldFont() const void StyleSettings::SetIconFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maIconFont = rFont; } @@ -1868,7 +1740,6 @@ StyleSettings::GetIconFont() const void StyleSettings::SetTabFont( const vcl::Font& rFont ) { - CopyData(); mxData->maFonts.maTabFont = rFont; } @@ -1887,7 +1758,6 @@ StyleSettings::GetBorderSize() void StyleSettings::SetTitleHeight( sal_Int32 nSize ) { - CopyData(); mxData->mnTitleHeight = nSize; } @@ -1900,7 +1770,6 @@ StyleSettings::GetTitleHeight() const void StyleSettings::SetFloatTitleHeight( sal_Int32 nSize ) { - CopyData(); mxData->mnFloatTitleHeight = nSize; } @@ -1913,7 +1782,6 @@ StyleSettings::GetFloatTitleHeight() const void StyleSettings::SetScrollBarSize( sal_Int32 nSize ) { - CopyData(); mxData->mnScrollBarSize = nSize; } @@ -1926,7 +1794,6 @@ StyleSettings::GetScrollBarSize() const void StyleSettings::SetMinThumbSize( sal_Int32 nSize ) { - CopyData(); mxData->mnMinThumbSize = nSize; } @@ -1939,7 +1806,6 @@ StyleSettings::GetMinThumbSize() const void StyleSettings::SetSpinSize( sal_Int32 nSize ) { - CopyData(); mxData->mnSpinSize = nSize; } @@ -1958,7 +1824,6 @@ StyleSettings::GetSplitSize() void StyleSettings::SetCursorSize( sal_Int32 nSize ) { - CopyData(); mxData->mnCursorSize = nSize; } @@ -1971,7 +1836,6 @@ StyleSettings::GetCursorSize() const void StyleSettings::SetCursorBlinkTime( sal_uInt64 nBlinkTime ) { - CopyData(); mxData->mnCursorBlinkTime = nBlinkTime; } @@ -1984,7 +1848,6 @@ StyleSettings::GetCursorBlinkTime() const void StyleSettings::SetDragFullOptions( DragFullOptions nOptions ) { - CopyData(); mxData->mnDragFullOptions = nOptions; } @@ -1997,7 +1860,6 @@ StyleSettings::GetDragFullOptions() const void StyleSettings::SetSelectionOptions( SelectionOptions nOptions ) { - CopyData(); mxData->mnSelectionOptions = nOptions; } @@ -2010,7 +1872,6 @@ StyleSettings::GetSelectionOptions() const void StyleSettings::SetDisplayOptions( DisplayOptions nOptions ) { - CopyData(); mxData->mnDisplayOptions = nOptions; } @@ -2023,7 +1884,6 @@ StyleSettings::GetDisplayOptions() const void StyleSettings::SetAntialiasingMinPixelHeight( sal_Int32 nMinPixel ) { - CopyData(); mxData->mnAntialiasedMin = nMinPixel; } @@ -2036,14 +1896,12 @@ StyleSettings::GetAntialiasingMinPixelHeight() const void StyleSettings::SetOptions( StyleSettingsOptions nOptions ) { - CopyData(); mxData->mnOptions = nOptions; } void StyleSettings::SetAutoMnemonic( bool bAutoMnemonic ) { - CopyData(); mxData->mbAutoMnemonic = bAutoMnemonic; } @@ -2063,7 +1921,6 @@ StyleSettings::GetDockingFloatsSupported() void StyleSettings::SetToolbarIconSize( ToolbarIconSize nSize ) { - CopyData(); mxData->mnToolbarIconSize = nSize; } @@ -2096,7 +1953,6 @@ StyleSettings::GetDialogStyle() const void StyleSettings::SetEdgeBlending(sal_uInt16 nCount) { - CopyData(); mxData->mnEdgeBlending = nCount; } @@ -2121,7 +1977,6 @@ StyleSettings::GetEdgeBlendingBottomRightColor() const void StyleSettings::SetListBoxMaximumLineCount(sal_uInt16 nCount) { - CopyData(); mxData->mnListBoxMaximumLineCount = nCount; } @@ -2134,7 +1989,6 @@ StyleSettings::GetListBoxMaximumLineCount() const void StyleSettings::SetColorValueSetColumnCount(sal_uInt16 nCount) { - CopyData(); mxData->mnColorValueSetColumnCount = nCount; } @@ -2164,7 +2018,6 @@ ComboBoxTextSelectionMode StyleSettings::GetComboBoxTextSelectionMode() const void StyleSettings::SetPreviewUsesCheckeredBackground(bool bNew) { - CopyData(); mxData->mbPreviewUsesCheckeredBackground = bNew; } @@ -2174,22 +2027,18 @@ StyleSettings::GetPreviewUsesCheckeredBackground() const return mxData->mbPreviewUsesCheckeredBackground; } -bool -StyleSettings::operator !=( const StyleSettings& rSet ) const -{ - return !(*this == rSet); -} - void StyleSettings::SetListBoxPreviewDefaultLogicSize(Size const& rSize) { - mxData->maListBoxPreviewDefaultLogicSize = rSize; + auto* myData = mxData.get(); + myData->maListBoxPreviewDefaultLogicSize = rSize; + mxData->maListBoxPreviewDefaultPixelSize = {}; // recalc } const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const { if(0 == mxData->maListBoxPreviewDefaultPixelSize.Width() || 0 == mxData->maListBoxPreviewDefaultPixelSize.Height()) { - const_cast< StyleSettings* >(this)->mxData->maListBoxPreviewDefaultPixelSize = + mxData->maListBoxPreviewDefaultPixelSize = Application::GetDefaultDevice()->LogicToPixel(mxData->maListBoxPreviewDefaultLogicSize, MapMode(MapUnit::MapAppFont)); } @@ -2198,55 +2047,55 @@ const Size& StyleSettings::GetListBoxPreviewDefaultPixelSize() const void StyleSettings::Set3DColors( const Color& rColor ) { - CopyData(); - mxData->maColors.maFaceColor = rColor; - mxData->maColors.maLightBorderColor = rColor; - mxData->maColors.maMenuBorderColor = rColor; - mxData->maColors.maDarkShadowColor = COL_BLACK; + auto* myData = mxData.get(); + myData->maColors.maFaceColor = rColor; + myData->maColors.maLightBorderColor = rColor; + myData->maColors.maMenuBorderColor = rColor; + myData->maColors.maDarkShadowColor = COL_BLACK; if ( rColor != COL_LIGHTGRAY ) { - mxData->maColors.maLightColor = rColor; - mxData->maColors.maShadowColor = rColor; - mxData->maColors.maDarkShadowColor = rColor; + myData->maColors.maLightColor = rColor; + myData->maColors.maShadowColor = rColor; + myData->maColors.maDarkShadowColor = rColor; if (!rColor.IsDark()) { - mxData->maColors.maLightColor.IncreaseLuminance(64); - mxData->maColors.maShadowColor.DecreaseLuminance(64); - mxData->maColors.maDarkShadowColor.DecreaseLuminance(100); + myData->maColors.maLightColor.IncreaseLuminance(64); + myData->maColors.maShadowColor.DecreaseLuminance(64); + myData->maColors.maDarkShadowColor.DecreaseLuminance(100); } else { - mxData->maColors.maLightColor.DecreaseLuminance(64); - mxData->maColors.maShadowColor.IncreaseLuminance(64); - mxData->maColors.maDarkShadowColor.IncreaseLuminance(100); + myData->maColors.maLightColor.DecreaseLuminance(64); + myData->maColors.maShadowColor.IncreaseLuminance(64); + myData->maColors.maDarkShadowColor.IncreaseLuminance(100); } - sal_uInt8 nRed = (mxData->maColors.maLightColor.GetRed() + mxData->maColors.maShadowColor.GetRed()) / 2; - sal_uInt8 nGreen = (mxData->maColors.maLightColor.GetGreen() + mxData->maColors.maShadowColor.GetGreen()) / 2; - sal_uInt8 nBlue = (mxData->maColors.maLightColor.GetBlue() + mxData->maColors.maShadowColor.GetBlue()) / 2; - mxData->maColors.maCheckedColor = Color(nRed, nGreen, nBlue); + sal_uInt8 nRed = (myData->maColors.maLightColor.GetRed() + myData->maColors.maShadowColor.GetRed()) / 2; + sal_uInt8 nGreen = (myData->maColors.maLightColor.GetGreen() + myData->maColors.maShadowColor.GetGreen()) / 2; + sal_uInt8 nBlue = (myData->maColors.maLightColor.GetBlue() + myData->maColors.maShadowColor.GetBlue()) / 2; + myData->maColors.maCheckedColor = Color(nRed, nGreen, nBlue); } else { - mxData->maColors.maCheckedColor = Color( 0x99, 0x99, 0x99 ); - mxData->maColors.maLightColor = COL_WHITE; - mxData->maColors.maShadowColor = COL_GRAY; + myData->maColors.maCheckedColor = Color( 0x99, 0x99, 0x99 ); + myData->maColors.maLightColor = COL_WHITE; + myData->maColors.maShadowColor = COL_GRAY; } } void StyleSettings::SetCheckedColorSpecialCase( ) { - CopyData(); + auto* myData = mxData.get(); // Light gray checked color special case if ( GetFaceColor() == COL_LIGHTGRAY ) - mxData->maColors.maCheckedColor = Color(0xCC, 0xCC, 0xCC); + myData->maColors.maCheckedColor = Color(0xCC, 0xCC, 0xCC); else { - sal_uInt8 nRed = static_cast((static_cast(mxData->maColors.maFaceColor.GetRed()) + static_cast(mxData->maColors.maLightColor.GetRed()))/2); - sal_uInt8 nGreen = static_cast((static_cast(mxData->maColors.maFaceColor.GetGreen()) + static_cast(mxData->maColors.maLightColor.GetGreen()))/2); - sal_uInt8 nBlue = static_cast((static_cast(mxData->maColors.maFaceColor.GetBlue()) + static_cast(mxData->maColors.maLightColor.GetBlue()))/2); - mxData->maColors.maCheckedColor = Color(nRed, nGreen, nBlue); + sal_uInt8 nRed = static_cast((static_cast(myData->maColors.maFaceColor.GetRed()) + static_cast(myData->maColors.maLightColor.GetRed()))/2); + sal_uInt8 nGreen = static_cast((static_cast(myData->maColors.maFaceColor.GetGreen()) + static_cast(myData->maColors.maLightColor.GetGreen()))/2); + sal_uInt8 nBlue = static_cast((static_cast(myData->maColors.maFaceColor.GetBlue()) + static_cast(myData->maColors.maLightColor.GetBlue()))/2); + myData->maColors.maCheckedColor = Color(nRed, nGreen, nBlue); } } @@ -2379,7 +2228,6 @@ const std::optional& StyleSettings::GetPersonaMenuBarTextColor() const void StyleSettings::SetStandardStyles() { - CopyData(); mxData->SetStandardStyles(); } @@ -2405,63 +2253,56 @@ Color StyleSettings::GetSeparatorColor() const return Color::HSBtoRGB( h, s, b ); } -void StyleSettings::CopyData() -{ - // copy if other references exist - if (mxData.use_count() > 1) - { - mxData = std::make_shared(*mxData); - } -} - +// Until Clang 14, P2085R0 is unsupported, and the operator can't be default outside of declaration bool StyleSettings::operator ==( const StyleSettings& rSet ) const { - if ( mxData == rSet.mxData ) - return true; + return mxData == rSet.mxData; +} - if (mxData->mIconTheme != rSet.mxData->mIconTheme) { +bool ImplStyleData::operator==(const ImplStyleData& rSet) const +{ + if (mIconTheme != rSet.mIconTheme) { return false; } - if (mxData->mIconThemeSelector != rSet.mxData->mIconThemeSelector) { + if (mIconThemeSelector != rSet.mIconThemeSelector) { return false; } - return (mxData->mnOptions == rSet.mxData->mnOptions) && - (mxData->mbAutoMnemonic == rSet.mxData->mbAutoMnemonic) && - (mxData->mnDragFullOptions == rSet.mxData->mnDragFullOptions) && - (mxData->mnSelectionOptions == rSet.mxData->mnSelectionOptions) && - (mxData->mnDisplayOptions == rSet.mxData->mnDisplayOptions) && - (mxData->mnCursorSize == rSet.mxData->mnCursorSize) && - (mxData->mnCursorBlinkTime == rSet.mxData->mnCursorBlinkTime) && - (mxData->mnTitleHeight == rSet.mxData->mnTitleHeight) && - (mxData->mnFloatTitleHeight == rSet.mxData->mnFloatTitleHeight) && - (mxData->mnScrollBarSize == rSet.mxData->mnScrollBarSize) && - (mxData->mnMinThumbSize == rSet.mxData->mnMinThumbSize) && - (mxData->mnSpinSize == rSet.mxData->mnSpinSize) && - (mxData->mnAntialiasedMin == rSet.mxData->mnAntialiasedMin) && - (mxData->mbHighContrast == rSet.mxData->mbHighContrast) && - (mxData->mbUseSystemUIFonts == rSet.mxData->mbUseSystemUIFonts) && - (mxData->mbUseFontAAFromSystem == rSet.mxData->mbUseFontAAFromSystem) && - (mxData->mnUseFlatBorders == rSet.mxData->mnUseFlatBorders) && - (mxData->mnUseFlatMenus == rSet.mxData->mnUseFlatMenus) && - (mxData->maColors == rSet.mxData->maColors) && - (mxData->maFonts == rSet.mxData->maFonts) && - (mxData->meUseImagesInMenus == rSet.mxData->meUseImagesInMenus) && - (mxData->mbPreferredUseImagesInMenus == rSet.mxData->mbPreferredUseImagesInMenus) && - (mxData->mbSkipDisabledInMenus == rSet.mxData->mbSkipDisabledInMenus) && - (mxData->mbHideDisabledMenuItems == rSet.mxData->mbHideDisabledMenuItems) && - (mxData->mbPreferredContextMenuShortcuts == rSet.mxData->mbPreferredContextMenuShortcuts)&& - (mxData->meContextMenuShortcuts == rSet.mxData->meContextMenuShortcuts) && - (mxData->mbPrimaryButtonWarpsSlider == rSet.mxData->mbPrimaryButtonWarpsSlider) && - (mxData->mnEdgeBlending == rSet.mxData->mnEdgeBlending) && - (mxData->maEdgeBlendingTopLeftColor == rSet.mxData->maEdgeBlendingTopLeftColor) && - (mxData->maEdgeBlendingBottomRightColor == rSet.mxData->maEdgeBlendingBottomRightColor) && - (mxData->mnListBoxMaximumLineCount == rSet.mxData->mnListBoxMaximumLineCount) && - (mxData->mnColorValueSetColumnCount == rSet.mxData->mnColorValueSetColumnCount) && - (mxData->maListBoxPreviewDefaultLogicSize == rSet.mxData->maListBoxPreviewDefaultLogicSize) && - (mxData->maListBoxPreviewDefaultPixelSize == rSet.mxData->maListBoxPreviewDefaultPixelSize) && - (mxData->mbPreviewUsesCheckeredBackground == rSet.mxData->mbPreviewUsesCheckeredBackground); + return (mnOptions == rSet.mnOptions) && + (mbAutoMnemonic == rSet.mbAutoMnemonic) && + (mnDragFullOptions == rSet.mnDragFullOptions) && + (mnSelectionOptions == rSet.mnSelectionOptions) && + (mnDisplayOptions == rSet.mnDisplayOptions) && + (mnCursorSize == rSet.mnCursorSize) && + (mnCursorBlinkTime == rSet.mnCursorBlinkTime) && + (mnTitleHeight == rSet.mnTitleHeight) && + (mnFloatTitleHeight == rSet.mnFloatTitleHeight) && + (mnScrollBarSize == rSet.mnScrollBarSize) && + (mnMinThumbSize == rSet.mnMinThumbSize) && + (mnSpinSize == rSet.mnSpinSize) && + (mnAntialiasedMin == rSet.mnAntialiasedMin) && + (mbHighContrast == rSet.mbHighContrast) && + (mbUseSystemUIFonts == rSet.mbUseSystemUIFonts) && + (mbUseFontAAFromSystem == rSet.mbUseFontAAFromSystem) && + (mnUseFlatBorders == rSet.mnUseFlatBorders) && + (mnUseFlatMenus == rSet.mnUseFlatMenus) && + (maColors == rSet.maColors) && + (maFonts == rSet.maFonts) && + (meUseImagesInMenus == rSet.meUseImagesInMenus) && + (mbPreferredUseImagesInMenus == rSet.mbPreferredUseImagesInMenus) && + (mbSkipDisabledInMenus == rSet.mbSkipDisabledInMenus) && + (mbHideDisabledMenuItems == rSet.mbHideDisabledMenuItems) && + (mbPreferredContextMenuShortcuts == rSet.mbPreferredContextMenuShortcuts) && + (meContextMenuShortcuts == rSet.meContextMenuShortcuts) && + (mbPrimaryButtonWarpsSlider == rSet.mbPrimaryButtonWarpsSlider) && + (mnEdgeBlending == rSet.mnEdgeBlending) && + (maEdgeBlendingTopLeftColor == rSet.maEdgeBlendingTopLeftColor) && + (maEdgeBlendingBottomRightColor == rSet.maEdgeBlendingBottomRightColor) && + (mnListBoxMaximumLineCount == rSet.mnListBoxMaximumLineCount) && + (mnColorValueSetColumnCount == rSet.mnColorValueSetColumnCount) && + (maListBoxPreviewDefaultLogicSize == rSet.maListBoxPreviewDefaultLogicSize) && + (mbPreviewUsesCheckeredBackground == rSet.mbPreviewUsesCheckeredBackground); } ImplMiscData::ImplMiscData() : @@ -2705,8 +2546,8 @@ HelpSettings::operator !=( const HelpSettings& rSet ) const ImplAllSettingsData::ImplAllSettingsData() : - maLocale( LANGUAGE_SYSTEM ), - maUILocale( LANGUAGE_SYSTEM ) + maLocale( maSysLocale.GetLanguageTag() ), + maUILocale( maSysLocale.GetUILanguageTag() ) { if (!comphelper::IsFuzzing()) maMiscSettings.SetEnableLocalizedDecimalSep( maSysLocale.GetOptions().IsDecimalSeparatorAsLocale() ); @@ -2732,31 +2573,20 @@ ImplAllSettingsData::~ImplAllSettingsData() mpUII18nHelper.reset(); } -AllSettings::AllSettings() - : mxData(std::make_shared()) -{ -} - -void AllSettings::CopyData() -{ - // copy if other references exist - if (mxData.use_count() > 1) - { - mxData = std::make_shared(*mxData); - } - -} +AllSettings::AllSettings() = default; +AllSettings::AllSettings(const AllSettings&) = default; +AllSettings::~AllSettings() = default; +AllSettings& AllSettings::operator=(const AllSettings&) = default; AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings& rSet ) { - + const auto* constData = std::as_const(mxData).get(); AllSettingsFlags nChangeFlags = AllSettingsFlags::NONE; if ( nFlags & AllSettingsFlags::MOUSE ) { - if ( mxData->maMouseSettings != rSet.mxData->maMouseSettings ) + if (constData->maMouseSettings != rSet.mxData->maMouseSettings) { - CopyData(); mxData->maMouseSettings = rSet.mxData->maMouseSettings; nChangeFlags |= AllSettingsFlags::MOUSE; } @@ -2764,9 +2594,8 @@ AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings if ( nFlags & AllSettingsFlags::STYLE ) { - if ( mxData->maStyleSettings != rSet.mxData->maStyleSettings ) + if (constData->maStyleSettings != rSet.mxData->maStyleSettings) { - CopyData(); mxData->maStyleSettings = rSet.mxData->maStyleSettings; nChangeFlags |= AllSettingsFlags::STYLE; } @@ -2774,9 +2603,8 @@ AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings if ( nFlags & AllSettingsFlags::MISC ) { - if ( mxData->maMiscSettings != rSet.mxData->maMiscSettings ) + if (constData->maMiscSettings != rSet.mxData->maMiscSettings) { - CopyData(); mxData->maMiscSettings = rSet.mxData->maMiscSettings; nChangeFlags |= AllSettingsFlags::MISC; } @@ -2784,7 +2612,7 @@ AllSettingsFlags AllSettings::Update( AllSettingsFlags nFlags, const AllSettings if ( nFlags & AllSettingsFlags::LOCALE ) { - if ( mxData->maLocale != rSet.mxData->maLocale ) + if (constData->maLocale != rSet.mxData->maLocale) { SetLanguageTag( rSet.mxData->maLocale ); nChangeFlags |= AllSettingsFlags::LOCALE; @@ -2811,21 +2639,19 @@ AllSettingsFlags AllSettings::GetChangeFlags( const AllSettings& rSet ) const return nChangeFlags; } +// Until Clang 14, P2085R0 is unsupported, and the operator can't be default outside of declaration bool AllSettings::operator ==( const AllSettings& rSet ) const { - if ( mxData == rSet.mxData ) - return true; + return mxData == rSet.mxData; +} - if ( (mxData->maMouseSettings == rSet.mxData->maMouseSettings) && - (mxData->maStyleSettings == rSet.mxData->maStyleSettings) && - (mxData->maMiscSettings == rSet.mxData->maMiscSettings) && - (mxData->maHelpSettings == rSet.mxData->maHelpSettings) && - (mxData->maLocale == rSet.mxData->maLocale) ) - { - return true; - } - - return false; +bool ImplAllSettingsData::operator==(const ImplAllSettingsData& rSet) const +{ + return (maMouseSettings == rSet.maMouseSettings) && + (maStyleSettings == rSet.maStyleSettings) && + (maMiscSettings == rSet.maMiscSettings) && + (maHelpSettings == rSet.maHelpSettings) && + (maLocale == rSet.maLocale); } void AllSettings::SetLanguageTag(const OUString& rLanguage, bool bCanonicalize) @@ -2835,20 +2661,21 @@ void AllSettings::SetLanguageTag(const OUString& rLanguage, bool bCanonicalize) void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag ) { - if (mxData->maLocale == rLanguageTag) + if (std::as_const(mxData)->maLocale == rLanguageTag) return; - CopyData(); + auto* myData = mxData.get(); - mxData->maLocale = rLanguageTag; + myData->maLocale + = rLanguageTag.isSystemLocale() ? GetSysLocale().GetLanguageTag() : rLanguageTag; - if ( mxData->mpLocaleDataWrapper ) + if ( myData->mpLocaleDataWrapper ) { - mxData->mpLocaleDataWrapper.reset(); + myData->mpLocaleDataWrapper.reset(); } - if ( mxData->mpI18nHelper ) + if ( myData->mpI18nHelper ) { - mxData->mpI18nHelper.reset(); + myData->mpI18nHelper.reset(); } } @@ -2923,9 +2750,7 @@ const LanguageTag& AllSettings::GetLanguageTag() const if (comphelper::LibreOfficeKit::isActive()) return comphelper::LibreOfficeKit::getLanguageTag(); - // SYSTEM locale means: use settings from SvtSysLocale that is resolved - if ( mxData->maLocale.isSystemLocale() ) - mxData->maLocale = mxData->maSysLocale.GetLanguageTag(); + assert(!mxData->maLocale.isSystemLocale()); return mxData->maLocale; } @@ -2941,9 +2766,7 @@ const LanguageTag& AllSettings::GetUILanguageTag() const if (comphelper::LibreOfficeKit::isActive()) return comphelper::LibreOfficeKit::getLanguageTag(); - // the UILocale is never changed - if ( mxData->maUILocale.isSystemLocale() ) - mxData->maUILocale = mxData->maSysLocale.GetUILanguageTag(); + assert(!mxData->maUILocale.isSystemLocale()); return mxData->maUILocale; } @@ -2951,7 +2774,7 @@ const LanguageTag& AllSettings::GetUILanguageTag() const const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const { if ( !mxData->mpLocaleDataWrapper ) - const_cast(this)->mxData->mpLocaleDataWrapper.reset( new LocaleDataWrapper( + mxData->mpLocaleDataWrapper.reset( new LocaleDataWrapper( comphelper::getProcessComponentContext(), GetLanguageTag() ) ); return *mxData->mpLocaleDataWrapper; } @@ -2959,7 +2782,7 @@ const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const { if ( !mxData->mpUILocaleDataWrapper ) - const_cast(this)->mxData->mpUILocaleDataWrapper.reset( new LocaleDataWrapper( + mxData->mpUILocaleDataWrapper.reset( new LocaleDataWrapper( comphelper::getProcessComponentContext(), GetUILanguageTag() ) ); return *mxData->mpUILocaleDataWrapper; } @@ -2967,7 +2790,7 @@ const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const const LocaleDataWrapper& AllSettings::GetNeutralLocaleDataWrapper() const { if ( !mxData->mpNeutralLocaleDataWrapper ) - const_cast(this)->mxData->mpNeutralLocaleDataWrapper.reset( new LocaleDataWrapper( + mxData->mpNeutralLocaleDataWrapper.reset( new LocaleDataWrapper( comphelper::getProcessComponentContext(), LanguageTag(u"en-US"_ustr) ) ); return *mxData->mpNeutralLocaleDataWrapper; } @@ -2975,7 +2798,7 @@ const LocaleDataWrapper& AllSettings::GetNeutralLocaleDataWrapper() const const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const { if ( !mxData->mpI18nHelper ) { - const_cast(this)->mxData->mpI18nHelper.reset( new vcl::I18nHelper( + mxData->mpI18nHelper.reset( new vcl::I18nHelper( comphelper::getProcessComponentContext(), GetLanguageTag() ) ); } return *mxData->mpI18nHelper; @@ -2984,7 +2807,7 @@ const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const { if ( !mxData->mpUII18nHelper ) { - const_cast(this)->mxData->mpUII18nHelper.reset( new vcl::I18nHelper( + mxData->mpUII18nHelper.reset( new vcl::I18nHelper( comphelper::getProcessComponentContext(), GetUILanguageTag() ) ); } return *mxData->mpUII18nHelper; @@ -2996,7 +2819,7 @@ void AllSettings::LocaleSettingsChanged( ConfigurationHints nHint ) if ( nHint & ConfigurationHints::DecSep ) { MiscSettings aMiscSettings = aAllSettings.GetMiscSettings(); - bool bIsDecSepAsLocale = aAllSettings.mxData->maSysLocale.GetOptions().IsDecimalSeparatorAsLocale(); + bool bIsDecSepAsLocale = aAllSettings.GetSysLocale().GetOptions().IsDecimalSeparatorAsLocale(); if ( aMiscSettings.GetEnableLocalizedDecimalSep() != bIsDecSepAsLocale ) { aMiscSettings.SetEnableLocalizedDecimalSep( bIsDecSepAsLocale ); @@ -3005,7 +2828,7 @@ void AllSettings::LocaleSettingsChanged( ConfigurationHints nHint ) } if ( nHint & ConfigurationHints::Locale ) - aAllSettings.SetLanguageTag( aAllSettings.mxData->maSysLocale.GetOptions().GetLanguageTag() ); + aAllSettings.SetLanguageTag(aAllSettings.GetSysLocale().GetOptions().GetLanguageTag()); Application::SetSettings( aAllSettings ); } @@ -3026,29 +2849,22 @@ std::vector const & StyleSettings::GetInstalledIconThemes() const { if (!mxData->mIconThemeScanner) { - const_cast(this)->mxData->mIconThemeScanner.emplace(vcl::IconThemeScanner::GetStandardIconThemePath()); + mxData->mIconThemeScanner.emplace(vcl::IconThemeScanner::GetStandardIconThemePath()); } return mxData->mIconThemeScanner->GetFoundIconThemes(); } -/*static*/ OUString +OUString StyleSettings::GetAutomaticallyChosenIconTheme() const { - OUString desktopEnvironment = Application::GetDesktopEnvironment(); - if (!mxData->mIconThemeScanner) { - const_cast(this)->mxData->mIconThemeScanner.emplace(vcl::IconThemeScanner::GetStandardIconThemePath()); - } - OUString themeName = mxData->mIconThemeSelector.SelectIconThemeForDesktopEnvironment( - mxData->mIconThemeScanner->GetFoundIconThemes(), - desktopEnvironment - ); - return themeName; + return mxData->mIconThemeSelector.SelectIconThemeForDesktopEnvironment( + GetInstalledIconThemes(), + Application::GetDesktopEnvironment()); } void StyleSettings::SetIconTheme(const OUString& theme) { - CopyData(); mxData->mIconTheme = theme; } @@ -3070,25 +2886,21 @@ StyleSettings::DetermineIconTheme() const } } - if (!mxData->mIconThemeScanner) { - const_cast(this)->mxData->mIconThemeScanner.emplace(vcl::IconThemeScanner::GetStandardIconThemePath()); - } - OUString r = mxData->mIconThemeSelector.SelectIconTheme( - mxData->mIconThemeScanner->GetFoundIconThemes(), + return mxData->mIconThemeSelector.SelectIconTheme( + GetInstalledIconThemes(), sTheme); - return r; } void StyleSettings::SetHighContrastMode(bool bHighContrast ) { - if (mxData->mbHighContrast == bHighContrast) { + if (std::as_const(mxData)->mbHighContrast == bHighContrast) { return; } - CopyData(); - mxData->mbHighContrast = bHighContrast; - mxData->mIconThemeSelector.SetUseHighContrastTheme(bHighContrast); + auto* myData = mxData.get(); + myData->mbHighContrast = bHighContrast; + myData->mIconThemeSelector.SetUseHighContrastTheme(bHighContrast); } bool @@ -3100,18 +2912,18 @@ StyleSettings::GetHighContrastMode() const void StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme) { - const bool bChanged = mxData->mIconThemeSelector.SetPreferredIconTheme(theme, bDarkIconTheme); + auto* myData = mxData.get(); + const bool bChanged = myData->mIconThemeSelector.SetPreferredIconTheme(theme, bDarkIconTheme); if (bChanged) { // clear this so it is recalculated if it was selected as the automatic theme - mxData->mIconTheme.clear(); + myData->mIconTheme.clear(); } } void AllSettings::SetMouseSettings( const MouseSettings& rSet ) { - CopyData(); mxData->maMouseSettings = rSet; } @@ -3124,14 +2936,12 @@ AllSettings::GetMouseSettings() const void AllSettings::SetStyleSettings( const StyleSettings& rSet ) { - CopyData(); mxData->maStyleSettings = rSet; } void AllSettings::SetMiscSettings( const MiscSettings& rSet ) { - CopyData(); mxData->maMiscSettings = rSet; } @@ -3144,7 +2954,6 @@ AllSettings::GetMiscSettings() const void AllSettings::SetHelpSettings( const HelpSettings& rSet ) { - CopyData(); mxData->maHelpSettings = rSet; } @@ -3154,14 +2963,8 @@ AllSettings::GetHelpSettings() const return mxData->maHelpSettings; } -bool -AllSettings::operator !=( const AllSettings& rSet ) const -{ - return !(*this == rSet); -} - -SvtSysLocale& -AllSettings::GetSysLocale() +const SvtSysLocale& +AllSettings::GetSysLocale() const { return mxData->maSysLocale; } From 43e511e642a2ce7026b30ea5c212940ff3eb522e Mon Sep 17 00:00:00 2001 From: Tibor Nagy Date: Fri, 29 Nov 2024 02:10:21 +0100 Subject: [PATCH 075/155] tdf#88226 sd: fix cutting off the overflow text on the notes print page This fix offers two options to preserve the overflowed text: 1: if the "Original size" option is selected for printing, the overflowed text will be displayed on a new page. 2: if the "Fit to Printable Area" option is selected for printing, notes will be scaled to fit within the available printable space. The "Multiple sheets of paper" and "Tile sheet of paper" options are disabled for notes because these options are intended for slide printing and do not make much sense for printing notes. The orientation for the notes print page has also been fixed. Change-Id: I99e56cf9aed5c32764797469a8ea7f3b25053882 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177511 Reviewed-by: Nagy Tibor Tested-by: Jenkins --- editeng/source/editeng/editeng.cxx | 4 +- editeng/source/outliner/outlin2.cxx | 4 +- include/editeng/editeng.hxx | 2 +- include/editeng/outliner.hxx | 2 +- include/vcl/print.hxx | 3 + sd/source/core/sdpage.cxx | 3 + sd/source/ui/view/DocumentRenderer.cxx | 465 +++++++++++++++++++++++-- vcl/source/gdi/print.cxx | 9 + vcl/source/gdi/print3.cxx | 5 + vcl/source/window/printdlg.cxx | 29 ++ 10 files changed, 500 insertions(+), 26 deletions(-) diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 15dcc2d7dc5a..ee4f23275377 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -439,10 +439,10 @@ sal_Int32 EditEngine::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) return getImpl().GetLineNumberAtIndex(nPara, nIndex); } -sal_uInt32 EditEngine::GetLineHeight( sal_Int32 nParagraph ) +sal_uInt32 EditEngine::GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ) { // If someone calls GetLineHeight() with an empty Engine. - return getImpl().GetLineHeight( nParagraph, 0 ); + return getImpl().GetLineHeight( nParagraph, nLine ); } tools::Rectangle EditEngine::GetParaBounds( sal_Int32 nPara ) diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index 0e791eee9a36..a0e384d1388f 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -318,9 +318,9 @@ sal_Int32 Outliner::GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const return pEditEngine->GetLineLen( nParagraph, nLine ); } -sal_uInt32 Outliner::GetLineHeight( sal_Int32 nParagraph ) +sal_uInt32 Outliner::GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine ) { - return pEditEngine->GetLineHeight( nParagraph ); + return pEditEngine->GetLineHeight( nParagraph, nLine ); } void Outliner::RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich ) diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 9636a260ccac..a5dde05c00c7 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -294,7 +294,7 @@ public: sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const; void GetLineBoundaries( /*out*/sal_Int32& rStart, /*out*/sal_Int32& rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const; sal_Int32 GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const; - SAL_DLLPRIVATE sal_uInt32 GetLineHeight( sal_Int32 nParagraph ); + SAL_DLLPRIVATE sal_uInt32 GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine = 0 ); SAL_DLLPRIVATE tools::Rectangle GetParaBounds( sal_Int32 nPara ); SAL_DLLPRIVATE ParagraphInfos GetParagraphInfos( sal_Int32 nPara ); SAL_DLLPRIVATE sal_Int32 FindParagraph( tools::Long nDocPosY ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 9a57b6c6aef1..b18690050037 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -868,7 +868,7 @@ public: sal_uInt32 GetLineCount( sal_Int32 nParagraph ) const; sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const; - sal_uInt32 GetLineHeight( sal_Int32 nParagraph ); + sal_uInt32 GetLineHeight( sal_Int32 nParagraph, sal_Int32 nLine = 0 ); ErrCode Read( SvStream& rInput, const OUString& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = nullptr ); diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index f511af70d977..962308e327dc 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -417,6 +417,9 @@ public: bool isUIOptionEnabled( const OUString& rPropName ) const; SAL_DLLPRIVATE bool isUIChoiceEnabled( const OUString& rPropName, sal_Int32 nChoice ) const; + /// Defines which options in a UI element should be disabled or enabled. + void setUIChoicesDisabled(const OUString& rPropName, css::uno::Sequence& rChoicesDisabled); + /** MakeEnabled will change the property rPropName depends on to the value that makes rPropName enabled. If the dependency itself is also disabled, diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 4607a5f3aa65..04d0f020ebbc 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -460,6 +460,9 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, bool bVertical, const ::t else aTempAttr.Put( makeSdrTextMinFrameHeightItem( rRect.GetSize().Height() ) ); + if (eObjKind == PresObjKind::Notes) + aTempAttr.Put(makeSdrTextAutoGrowHeightItem(false)); + if (mbMaster) { // The size of presentation objects on the master page have to diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index e062b79259f3..467c3fba4bc9 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -44,6 +44,8 @@ #include #include #include +#include +#include #include #include #include @@ -75,6 +77,20 @@ namespace sd { namespace { + void lcl_AdjustPageSize(Size& rPageSize, const Size& rPrintPageSize) + { + bool bOrientationDiff = (rPageSize.Width() < rPageSize.Height() + && rPrintPageSize.Width() > rPrintPageSize.Height()) + || (rPageSize.Width() > rPageSize.Height() + && rPrintPageSize.Width() < rPrintPageSize.Height()); + if (bOrientationDiff) + { + ::tools::Long nTmp = rPageSize.Width(); + rPageSize.setWidth(rPageSize.Height()); + rPageSize.setHeight(nTmp); + } + } + /** Convenience class to extract values from the sequence of properties given to one of the XRenderable methods. */ @@ -781,6 +797,279 @@ namespace { const sal_uInt16 mnPageIndex; }; + /** The NotesPrinterPage is used for printing notes pages onto one or more printer pages + */ + class NotesPrinterPage : public PrinterPage + { + public: + NotesPrinterPage( + const sal_uInt16 nPageIndex, + const sal_Int32 nPageNumb, + const sal_Int32 nPageCount, + const bool bScaled, + const PageKind ePageKind, + const MapMode& rMapMode, + const bool bPrintMarkedOnly, + const OUString& rsPageString, + const Point& rPageStringOffset, + const DrawModeFlags nDrawMode, + const Orientation eOrientation, + const sal_uInt16 nPaperTray) + : PrinterPage(ePageKind, rMapMode, bPrintMarkedOnly, rsPageString, rPageStringOffset, + nDrawMode, eOrientation, nPaperTray), + mnPageIndex(nPageIndex), + mnPageNumb(nPageNumb), + mnPageCount(nPageCount), + mbScaled(bScaled) + { + } + + virtual void Print( + Printer& rPrinter, + SdDrawDocument& rDocument, + ViewShell&, + View* pView, + DrawView& rPrintView, + const SdrLayerIDSet& rVisibleLayers, + const SdrLayerIDSet& rPrintableLayers) const override + { + SdPage* pPageToPrint = rDocument.GetSdPage(mnPageIndex, mePageKind); + rPrinter.SetMapMode(maMap); + + // Clone the current page to create an independent instance for modifications. + // This ensures that changes made to pNotesPage do not affect the original page. + rtl::Reference pNotesPage + = static_cast(pPageToPrint->CloneSdrPage(rDocument).get()); + + Size aPageSize; + if (mbScaled) + { + aPageSize = pNotesPage->GetSize(); + lcl_AdjustPageSize(aPageSize, rPrinter.GetPrintPageSize()); + } + else + aPageSize = rPrinter.GetPrintPageSize(); + + // Adjusts the objects on the notes page to fit the new page size. + ::tools::Rectangle aNewBorderRect(-1, -1, -1, -1); + pNotesPage->ScaleObjects(aPageSize, aNewBorderRect, true); + + SdrObject* pNotesObj = pNotesPage->GetPresObj(PresObjKind::Notes); + if (pNotesObj) + { + // new page(s) margins + sal_Int32 nLeft = 2000; + sal_Int32 nRight = 2000; + sal_Int32 nTop = 2250; + sal_Int32 nBottom = 2250; + + double nRatioX = aPageSize.Width() / 21000.0; + double nRatioY = aPageSize.Height() / 29700.0; + + nLeft *= nRatioX; + nRight *= nRatioX; + nTop *= nRatioY; + nBottom *= nRatioY; + + Point aNotesPt = pNotesObj->GetRelativePos(); + Size aNotesSize = pNotesObj->GetLogicRect().GetSize(); + + Outliner* pOut = rDocument.GetInternalOutliner(); + const OutlinerMode nSaveOutlMode(pOut->GetOutlinerMode()); + const bool bSavedUpdateMode(pOut->IsUpdateLayout()); + pOut->SetPaperSize(aNotesSize); + pOut->SetUpdateLayout(true); + pOut->Clear(); + pOut->SetText(*pNotesObj->GetOutlinerParaObject()); + + bool bAutoGrow = pNotesObj->GetMergedItem(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue(); + + // If AutoGrowHeight property is enabled and the notes page has a lower border, + // use the lower border but if there is no lower border, use the bottom margin + // to determine the first page break position. + // If AutoGrow is not enabled, the notes object defines the first page break. + ::tools::Long nNotesPageBottom + = bAutoGrow ? (pNotesPage->GetLowerBorder() != 0) + ? aPageSize.Height() - pNotesPage->GetLowerBorder() + : aPageSize.Height() - nBottom + : aNotesPt.Y() + aNotesSize.Height(); + if (mbScaled) + { + sal_Int32 nTextHeight = aNotesPt.Y() + pOut->GetTextHeight(); + if (bAutoGrow && (nTextHeight > nNotesPageBottom)) + { + pNotesObj->SetMergedItem(SdrOnOffItem(SDRATTR_TEXT_AUTOGROWHEIGHT, false)); + + ::tools::Long nObjW = aNotesSize.Width(); + ::tools::Long nObjH = aPageSize.Height() - aNotesPt.Y() - nBottom; + + pNotesObj->SetLogicRect(::tools::Rectangle(aNotesPt, Size(nObjW, nObjH))); + } + SdrTextFitToSizeTypeItem eFitToSize = drawing::TextFitToSizeType_AUTOFIT; + pNotesObj->SetMergedItem(eFitToSize); + } + else // original size + { + bool bExit = false; + sal_Int32 nPrevLineLen = 0; + sal_Int32 nPrevParaIdx = 0; + sal_uInt16 nActualPageNumb = 1; + ::tools::Long nCurrentPosY = aNotesPt.Y(); + sal_Int32 nParaCount = pOut->GetParagraphCount(); + std::vector> aPageBreaks; + + for (sal_Int32 i = 0; i < nParaCount && !bExit; ++i) + { + sal_Int32 nActualLineLen = 0; + sal_uInt32 nLineCount = pOut->GetLineCount(i); + for (sal_uInt32 j = 0; j < nLineCount; ++j) + { + nActualLineLen += pOut->GetLineLen(i, j); + sal_Int32 nLineHeight = pOut->GetLineHeight(i, j); + sal_Int32 nNextPosY = nCurrentPosY + nLineHeight; + + if (nNextPosY > nNotesPageBottom) + { + // If the current or the next page matches the print page + // calculate and add a page break, since we only want to add + // a page break if the page is relevant. + if (mnPageNumb == nActualPageNumb + || mnPageNumb == nActualPageNumb + 1) + { + if (!aPageBreaks.empty()) + { + // determine the page break at the bottom of the page + // for pages that have both a previous and a following page + aPageBreaks.emplace_back( + nPrevParaIdx - aPageBreaks[0].first, nPrevLineLen); + } + else + { + if (mnPageNumb == 1 || (nLineCount > 1 && j != 0)) + { + // first page or multi-line paragraphs + aPageBreaks.emplace_back(nPrevParaIdx, nPrevLineLen); + } + else + { // single-line paragraphs + aPageBreaks.emplace_back(nPrevParaIdx + 1, 0); + } + } + + if (mnPageNumb == nActualPageNumb || mnPageNumb == mnPageCount) + { + bExit = true; + break; + } + } + nNotesPageBottom = aPageSize.Height() - nBottom; + nCurrentPosY = nTop; + nActualPageNumb++; + nActualLineLen = 0; + } + nPrevParaIdx = i; + nPrevLineLen = nActualLineLen; + nCurrentPosY += nLineHeight; + } + } + + if (!aPageBreaks.empty()) + { + ESelection aE; + if (mnPageNumb == 1) + { + aE.start.nPara = aPageBreaks[0].first; + aE.start.nIndex = aPageBreaks[0].second; + aE.end.nPara = pOut->GetParagraphCount() - 1; + aE.end.nIndex = pOut->GetText(pOut->GetParagraph(aE.end.nPara)).getLength(); + pOut->QuickDelete(aE); + } + else + { + sal_Int16 nDepth = pOut->GetDepth(aPageBreaks[0].first); + SfxItemSet aItemSet = pOut->GetParaAttribs(aPageBreaks[0].first); + + aE.start.nPara = 0; + aE.start.nIndex = 0; + aE.end.nPara = aPageBreaks[0].first; + aE.end.nIndex = aPageBreaks[0].second; + + if (aPageBreaks[0].second != 0) // Multi-line + { + pOut->QuickInsertLineBreak(ESelection(aE.end.nPara, aE.end.nIndex, + aE.end.nPara, aE.end.nIndex)); + nTop -= pOut->GetLineHeight(0,0); + } + pOut->QuickDelete(aE); + + Paragraph* pFirstPara = pOut->GetParagraph(0); + pOut->SetDepth(pFirstPara, nDepth); + pOut->SetParaAttribs(0, aItemSet); + + if (aPageBreaks.size() > 1) + { + aE.start.nPara = aPageBreaks[1].first; + aE.start.nIndex = aPageBreaks[1].second; + aE.end.nPara = pOut->GetParagraphCount() - 1; + aE.end.nIndex = pOut->GetText(pOut->GetParagraph(aE.end.nPara)).getLength(); + pOut->QuickDelete(aE); + } + } + } + pNotesObj->SetOutlinerParaObject(pOut->CreateParaObject()); + + Size aObjSize; + if (mnPageNumb != 1) // new page(s) + { + SdrObjListIter aShapeIter(pNotesPage.get()); + while (aShapeIter.IsMore()) + { + SdrObject* pObj = aShapeIter.Next(); + if (pObj && pObj->GetObjIdentifier() != SdrObjKind::Text) + pNotesPage->RemoveObject(pObj->GetOrdNum()); + } + + aNotesPt.setX(nLeft); + aNotesPt.setY(nTop); + ::tools::Long nWidth = aPageSize.Width() - nLeft - nRight; + aObjSize = Size(nWidth, pOut->GetTextHeight()); + } + else // first page + { + if (!bAutoGrow) + aObjSize = aNotesSize; + else + aObjSize = Size(aNotesSize.Width(), pOut->GetTextHeight()); + } + pNotesObj->SetLogicRect(::tools::Rectangle(aNotesPt, aObjSize)); + } + pOut->Clear(); + pOut->SetUpdateLayout(bSavedUpdateMode); + pOut->Init(nSaveOutlMode); + } + pNotesPage->SetSize(aPageSize); + + PrintPage( + rPrinter, + rPrintView, + *pNotesPage, + pView, + mbPrintMarkedOnly, + rVisibleLayers, + rPrintableLayers); + PrintMessage( + rPrinter, + msPageString, + maPageStringOffset); + } + + private: + const sal_uInt16 mnPageIndex; + const sal_Int32 mnPageNumb; + const sal_Int32 mnPageCount; + const bool mbScaled; + }; + /** Print one slide multiple times on a printer page so that the whole printer page is covered. */ @@ -1198,7 +1487,11 @@ public: : VclPtr< OutputDevice >(); mpPrinter = dynamic_cast(pOut.get()); Size aPageSizePixel = mpPrinter ? mpPrinter->GetPaperSizePixel() : Size(); - if( aPageSizePixel != maPrinterPageSizePixel ) + Size aPrintPageSize = mpPrinter ? mpPrinter->GetPrintPageSize() : Size(); + + lcl_AdjustPageSize(aPageSizePixel, aPrintPageSize); + + if (aPageSizePixel != maPrinterPageSizePixel) { bIsPaperChanged = true; maPrinterPageSizePixel = aPageSizePixel; @@ -1361,11 +1654,15 @@ private: { aPaperSize.setWidth(rInfo.mpPrinter->GetPaperSize().Width()); aPaperSize.setHeight(rInfo.mpPrinter->GetPaperSize().Height()); + + if (!mpOptions->IsBooklet()) + lcl_AdjustPageSize(aPaperSize, rInfo.mpPrinter->GetPrintPageSize()); } maPrintSize = awt::Size(aPaperSize.Width(), aPaperSize.Height()); - if (mpOptions->IsPrinterPreferred(pDocument->GetDocumentType())) + if (mpOptions->IsPrinterPreferred(pDocument->GetDocumentType()) + && ePageKind == PageKind::Standard && !mpOptions->IsBooklet()) { if( (rInfo.meOrientation == Orientation::Landscape && (aPaperSize.Width() < aPaperSize.Height())) @@ -1863,7 +2160,11 @@ private: if (pDocument->GetSdPageCount(ePageKind) == 0) return; SdPage* pRefPage = pDocument->GetSdPage(0, ePageKind); - rInfo.maPageSize = pRefPage->GetSize(); + + if (!mpOptions->IsPrinterPreferred(pDocument->GetDocumentType()) && mpOptions->IsNotes()) + rInfo.maPageSize = mpPrinter->GetPrintPageSize(); + else + rInfo.maPageSize = pRefPage->GetSize(); SetupPaperOrientation(ePageKind, rInfo); @@ -1898,19 +2199,22 @@ private: continue; MapMode aMap (rInfo.maMap); - // is it possible that the page size changed? - const Size aPageSize = pPage->GetSize(); + + Size aPageSize = pPage->GetSize(); if (mpOptions->IsPageSize()) { - const double fHorz (static_cast(rInfo.maPrintSize.Width()) / aPageSize.Width()); - const double fVert (static_cast(rInfo.maPrintSize.Height()) / aPageSize.Height()); + Size aPrintSize = rInfo.maPrintSize; + lcl_AdjustPageSize(aPageSize, aPrintSize); + + const double fHorz(static_cast(aPrintSize.Width()) / aPageSize.Width()); + const double fVert(static_cast(aPrintSize.Height()) / aPageSize.Height()); Fraction aFract; if (fHorz < fVert) - aFract = Fraction(rInfo.maPrintSize.Width(), aPageSize.Width()); + aFract = Fraction(aPrintSize.Width(), aPageSize.Width()); else - aFract = Fraction(rInfo.maPrintSize.Height(), aPageSize.Height()); + aFract = Fraction(aPrintSize.Height(), aPageSize.Height()); aMap.SetScaleX(aFract); aMap.SetScaleY(aFract); @@ -2136,17 +2440,138 @@ private: // if CutPage is set then do not move it, otherwise move the // scaled page to printable area - maPrinterPages.push_back( - std::make_shared( - sal::static_int_cast(nPageIndex), - ePageKind, - aMap, - rInfo.mbPrintMarkedOnly, - rInfo.msPageString, - aPageOffset, - rInfo.mnDrawMode, - rInfo.meOrientation, - nPaperBin)); + if (ePageKind == PageKind::Standard) + { + maPrinterPages.push_back( + std::make_shared( + sal::static_int_cast(nPageIndex), + ePageKind, + aMap, + rInfo.mbPrintMarkedOnly, + rInfo.msPageString, + aPageOffset, + rInfo.mnDrawMode, + rInfo.meOrientation, + nPaperBin)); + } + else // Notes + { + SdPage* pPage = GetFilteredPage(nPageIndex, PageKind::Notes); + SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc(); + + // Clone the current page to create an independent instance. + // This ensures that changes made to pNotesPage do not affect the original page. + rtl::Reference pNotesPage + = static_cast(pPage->CloneSdrPage(*pDocument).get()); + + Size aPageSize = bScalePage ? pNotesPage->GetSize() : rInfo.mpPrinter->GetPrintPageSize(); + // Adjusts the objects on the notes page to fit the new page size. + ::tools::Rectangle aNewBorderRect(-1, -1, -1, -1); + pNotesPage->ScaleObjects(aPageSize, aNewBorderRect, true); + + SdrObject* pNotesObj = pNotesPage->GetPresObj(PresObjKind::Notes); + if (pNotesObj && bCutPage) + { + // default margins + sal_Int32 nTopMargin = 2250, nBottomMargin = 2250; + double nRatioY = aPageSize.Height() / 29700.0; + nTopMargin *= nRatioY; + nBottomMargin *= nRatioY; + + Size nNotesObjSize = pNotesObj->GetLogicRect().GetSize(); + + Outliner* pOut = pDocument->GetInternalOutliner(); + const OutlinerMode nSaveOutlMode(pOut->GetOutlinerMode()); + const bool bSavedUpdateMode(pOut->IsUpdateLayout()); + pOut->Init(OutlinerMode::OutlineView); + pOut->SetPaperSize(nNotesObjSize); + pOut->SetUpdateLayout(true); + pOut->Clear(); + pOut->SetText(*pNotesObj->GetOutlinerParaObject()); + + sal_Int32 nFirstPageBottomMargin = 0; + ::tools::Long nNotesHeight = nNotesObjSize.Height(); + bool bAutoGrow = pNotesObj->GetMergedItem(SDRATTR_TEXT_AUTOGROWHEIGHT).GetValue(); + if (bAutoGrow) + { + nNotesHeight += pNotesObj->GetRelativePos().Y(); + nFirstPageBottomMargin = (pNotesPage->GetLowerBorder() != 0) + ? pNotesPage->GetLowerBorder() + : nBottomMargin; + } + double nOverflowedTextHeight = 0; + ::tools::Long nFirstPageBottom = aPageSize.Height() - nFirstPageBottomMargin; + if (nNotesHeight > nFirstPageBottom) + { + // Calculate the height of the overflow text + // when the AutoGrowHeight property of the notes object is enabled + // and the height of the object exceeds the page height. + nOverflowedTextHeight = pNotesObj->GetRelativePos().Y() + + pOut->GetTextHeight() - nFirstPageBottom; + } + else + nOverflowedTextHeight = pOut->GetTextHeight() - nNotesObjSize.Height(); + + sal_Int32 nNotePageCount = 1; + double nNewPageHeight = aPageSize.Height() - nTopMargin - nBottomMargin; + if (nOverflowedTextHeight > 0) + { + nNotePageCount += std::ceil(nOverflowedTextHeight / nNewPageHeight); + } + + for (sal_Int32 i = 1; i <= nNotePageCount; i++) + { + // set page numbers + sal_Int32 nPageNumb = i; + OUString sPageNumb = rInfo.msPageString; + if (!sPageNumb.isEmpty() && nNotePageCount > 1) + { + OUString sTmp; + if (!rInfo.msTimeDate.isEmpty()) + { + sTmp += " "; + } + sTmp += SdResId(STR_PAGE_NAME) + " " + OUString::number(i); + sPageNumb += sTmp; + } + + maPrinterPages.push_back( + std::make_shared( + sal::static_int_cast(nPageIndex), + nPageNumb, + nNotePageCount, + bScalePage, + PageKind::Notes, + aMap, + rInfo.mbPrintMarkedOnly, + sPageNumb, + aPageOffset, + rInfo.mnDrawMode, + rInfo.meOrientation, + nPaperBin)); + } + pOut->Clear(); + pOut->SetUpdateLayout(bSavedUpdateMode); + pOut->Init(nSaveOutlMode); + } + else // scaled page + { + maPrinterPages.push_back( + std::make_shared( + sal::static_int_cast(nPageIndex), + sal_Int32(0), + sal_Int32(0), + bScalePage, + PageKind::Notes, + aMap, + rInfo.mbPrintMarkedOnly, + rInfo.msPageString, + aPageOffset, + rInfo.mnDrawMode, + rInfo.meOrientation, + nPaperBin)); + } + } } else { diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 9833aa125771..f0308a5ec686 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1316,6 +1316,15 @@ bool Printer::SetPaperSizeUser( const Size& rSize ) bNeedToChange = maJobSetup.ImplGetConstData().GetPaperFormat() != PAPER_USER && maJobSetup.ImplGetConstData().GetPaperFormat() != aPaper; + + if (!bNeedToChange) + { + Size aPaperSize = GetPaperSizePixel(); + bNeedToChange = (aPageSize.Width() < aPageSize.Height() + && aPaperSize.Width() > aPaperSize.Height()) + || (aPageSize.Width() > aPageSize.Height() + && aPaperSize.Width() < aPaperSize.Height()); + } } if(bNeedToChange) diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 73b70a37ded8..934a80fe991a 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -1683,6 +1683,11 @@ bool PrinterController::isUIOptionEnabled( const OUString& i_rProperty ) const return bEnabled; } +void PrinterController::setUIChoicesDisabled(const OUString& rPropName, css::uno::Sequence& rChoicesDisabled) +{ + mpImplData->maChoiceDisableMap[rPropName] = std::move(rChoicesDisabled); +} + bool PrinterController::isUIChoiceEnabled( const OUString& i_rProperty, sal_Int32 i_nValue ) const { bool bEnabled = true; diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 1bad80864979..46bd7df183f5 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -659,6 +659,8 @@ PrintDialog::PrintDialog(weld::Window* i_pWindow, std::shared_ptrgetMultipage() ); + updatePageSize(mxOrientationBox->get_active()); + // setup optional UI options set by application setupOptionalUI(); @@ -1205,10 +1207,23 @@ void PrintDialog::updateNup( bool i_bMayUseCache ) aMPS.aPaperSize = maNupPortraitSize; else // automatic mode { + updatePageSize(mxOrientationBox->get_active()); + Size aPrintPageSize = maPController->getPrinter()->GetPrintPageSize(); + // get size of first real page to see if it is portrait or landscape // we assume same page sizes for all the pages for this Size aPageSize = getJobPageSize(); + if ((aPageSize.Width() < aPageSize.Height() + && aPrintPageSize.Width() > aPrintPageSize.Height()) + || (aPageSize.Width() > aPageSize.Height() + && aPrintPageSize.Width() < aPrintPageSize.Height())) + { + tools::Long nTmp = aPageSize.Width(); + aPageSize.setWidth(aPageSize.Height()); + aPageSize.setHeight(nTmp); + } + Size aMultiSize( aPageSize.Width() * nCols, aPageSize.Height() * nRows ); if( aMultiSize.Width() > aMultiSize.Height() ) // fits better on landscape { @@ -2069,6 +2084,10 @@ IMPL_LINK( PrintDialog, SelectHdl, weld::ComboBox&, rBox, void ) updatePageSize(mxOrientationBox->get_active()); + int nOrientation = mxOrientationBox->get_active(); + if (nOrientation != ORIENTATION_AUTOMATIC) + setPaperOrientation(static_cast(nOrientation - 1), true); + maUpdatePreviewNoCacheIdle.Start(); } } @@ -2186,8 +2205,18 @@ IMPL_LINK( PrintDialog, UIOption_SelectHdl, weld::ComboBox&, i_rBox, void ) //n-up print, we will assume notes are in landscape unless we throw //away maFirstPageSize when we change page content type if (pVal->Name == "PageContentType") + { maFirstPageSize = Size(); + css::uno::Sequence aChoicesDisabled{ + false, // Original size + false, // Fit to printable page + (nVal == 2) /*Notes*/ ? true : false, // disable/enable Multiple sheets of paper + (nVal == 2) /*Notes*/ ? true : false // disable/enable Tile sheet of paper + }; + maPController->setUIChoicesDisabled(u"PageOptions"_ustr, aChoicesDisabled); + } + checkOptionalControlDependencies(); // update preview and page settings From d28fcb3e26497ab1982ffcaee613e33821773c2a Mon Sep 17 00:00:00 2001 From: Jean-Pierre Ledure Date: Tue, 3 Dec 2024 17:06:16 +0100 Subject: [PATCH 076/155] ScriptForge (SF_Session) enhance ExecuteCalcFunction The ExecuteCalcFunction() method is a wrapper of the com.sun.star.sheet.FunctionAccess::callFunction() method. This method accepts a broad variety of arguments - scalars: numeric and strings only - data arrays (= arrays os arrays) - 2D arrays (1D arrays give errors) - com.sun.star.table.XCellRange objects depending on the called function and its execution or not as an "array function". The actual commit makes that the arguments passed to session.ExecuteCalcFunction() are checked as formally correct: scalars are filtered as numeric or strings, dates and booleans are converted, arrays are reshaped to 2D where necessary. The actual change facilitates, as an example, the use of complex array functions like XLOOKUP, a powerful search engine on large data sets. The implemented functionalities are valid in Basic and Python. The help documentation might be completed with additional examples. Change-Id: I6bba1e21828ef09c5c6f0463cbcfa1f5df695073 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177744 Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure --- wizards/source/scriptforge/SF_Array.xba | 17 ++++++++++++++--- wizards/source/scriptforge/SF_Session.xba | 12 ++++++++++-- .../source/scriptforge/python/scriptforge.py | 3 ++- .../source/scriptforge/python/scriptforge.pyi | 9 +++++---- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/wizards/source/scriptforge/SF_Array.xba b/wizards/source/scriptforge/SF_Array.xba index 386b405bd89a..05c96c96d494 100644 --- a/wizards/source/scriptforge/SF_Array.xba +++ b/wizards/source/scriptforge/SF_Array.xba @@ -2673,19 +2673,30 @@ Private Function _ConvertToCellValue(ByVal pvItem As Variant _ , ByVal pbIsCell As Boolean _ ) As Variant ''' Convert the argument to a valid Calc cell content, i.e. a string or a double. -''' When the argument is not convertible, either +''' When the argument is not immediately convertible, either +''' - the cell range is returned unchanged if the argument is a UNO com.sun.star.table.XCellRange object +''' - the date is converted to a double when the argument is a UNO com.sun.star.util.DateTime object ''' - the zero-length string is returned (pbIsCell = True) ''' - the argument is returned unchanged (pbIsCell = False) -Dim vCell As Variant ' Return value +Dim vCell As Variant ' Return value +Dim oObjectDescriptor As Object ' Object descriptor (see SF_Utils) Try: + ' Conversion takes place only when pbIsCell = True If pbIsCell Then Select Case SF_Utils._VarTypeExt(pvItem) Case V_STRING : vCell = pvItem Case V_DATE : vCell = CDbl(pvItem) Case V_NUMERIC : vCell = CDbl(pvItem) Case V_BOOLEAN : vCell = CDbl(Iif(pvItem, 1, 0)) + Case V_OBJECT + Set oObjectDescriptor = SF_Utils._VarTypeObj(pvItem) + Select Case oObjectDescriptor.sObjectType + Case "ScCellRangeObj" : vCell = pvItem + Case "com.sun.star.util.DateTime" : vCell = CDbl(CDateFromUnoDateTime(pvItem)) ' Python date + Case Else : vCell = "" + End Select Case Else : vCell = "" End Select Else ' Return the input item unchanged @@ -2978,4 +2989,4 @@ Dim iCompare As Integer, iVarType1 As Integer, iVarType2 As Integer End Function ' ScriptForge.SF_Array._ValCompare REM ================================================= END OF SCRIPTFORGE.SF_ARRAY - + \ No newline at end of file diff --git a/wizards/source/scriptforge/SF_Session.xba b/wizards/source/scriptforge/SF_Session.xba index ebde30256c7f..30d220d3be4c 100644 --- a/wizards/source/scriptforge/SF_Session.xba +++ b/wizards/source/scriptforge/SF_Session.xba @@ -190,8 +190,10 @@ Public Function ExecuteCalcFunction(Optional ByVal CalcFunction As Variant _ ''' Args: ''' CalcFunction: the english name of the function to execute ''' pvArgs: the arguments of the called function -''' Each argument must be either a string, a numeric value -''' or an array of arrays combining those types +''' Each argument must be either +''' - a string, a numeric value, a date or a boolean +''' - a 1D array, a 2D array or an array of arrays combining those types +''' - a com.sun.star.table.XCellRange UNO object ''' Returns: ''' The (string or numeric) value or the array of arrays returned by the call to the function ''' When the arguments contain arrays, the function is executed as an array function @@ -205,6 +207,7 @@ Public Function ExecuteCalcFunction(Optional ByVal CalcFunction As Variant _ Dim oCalc As Object ' Give access to the com.sun.star.sheet.FunctionAccess service Dim vReturn As Variant ' Returned value +Dim i As Long Const cstThisSub = "Session.ExecuteCalcFunction" Const cstSubArgs = "CalcFunction, arg0[, arg1] ..." @@ -223,6 +226,11 @@ Try: If UBound(pvArgs) = 0 Then If IsEmpty(pvArgs(0)) Then pvArgs = Array() End If + ' Force suitable arguments + For i = 0 To UBound(pvArgs) + pvArgs(i) = SF_Array.ConvertToRange(pvArgs(i), Direction := "V") + Next i + ' Error trapping and execution If SF_Utils._ErrorHandling() Then On Local Error GoTo CatchCall vReturn = oCalc.callFunction(UCase(CalcFunction), pvArgs()) diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index 05a7fa557e74..9dd8a90d7b2f 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1545,7 +1545,8 @@ class SFScriptForge: # Arguments of Calc functions are strings or numbers. None == Empty is a good alias for no argument args = (calcfunction,) + (None,) else: - args = (calcfunction,) + args + # Date arguments are converted on-the-fly to com.sun.star.util.DateTime + args = (calcfunction,) + tuple(map(SFScriptForge.SF_Basic.CDateToUnoDateTime, args)) # ExecuteCalcFunction method has a ParamArray parameter in Basic return cls.SIMPLEEXEC('@SF_Session.ExecuteCalcFunction', args) diff --git a/wizards/source/scriptforge/python/scriptforge.pyi b/wizards/source/scriptforge/python/scriptforge.pyi index 879db366e4a9..1f4bc8f8f5e9 100644 --- a/wizards/source/scriptforge/python/scriptforge.pyi +++ b/wizards/source/scriptforge/python/scriptforge.pyi @@ -1797,11 +1797,12 @@ class SFScriptForge: Args ``calcfunction``: the name of the Calc function to be called, in English. - ``args``: the arguments to be passed to the called Calc function. - Each argument must be either a string, a numeric value or an array of arrays combining - those types. + ``args``: the arguments to be passed to the called Calc function. Each argument may be either + - a string, a numeric value, a bool or a datatime.datetime instance + - a tuple or a tuple of tuples combining those types + - a com.sun.star.table.XCellRange UNO object Returns - The value returned by the function. + The value returned by the function as a scalar or a tuple of tuples. """ ... From 5155e21bf1c511fa844010b9d07e2bfcb9ce8570 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 3 Dec 2024 09:53:24 +0200 Subject: [PATCH 077/155] loplugin:unusedfields Change-Id: Iac4a64af74c92cbd76335faa62e51fa80ef21789 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177718 Tested-by: Jenkins Reviewed-by: Noel Grandin --- compilerplugins/clang/unusedfields.py | 9 ++------- filter/source/msfilter/eschesdo.cxx | 11 ----------- filter/source/msfilter/eschesdo.hxx | 2 -- filter/source/svg/svgexport.cxx | 13 ------------- filter/source/svg/svgfilter.hxx | 10 ---------- filter/source/svg/svgwriter.cxx | 3 --- filter/source/svg/svgwriter.hxx | 1 - include/oox/core/contexthandler2.hxx | 3 +-- oox/source/core/contexthandler2.cxx | 8 +++----- oox/source/core/fragmenthandler2.cxx | 2 +- vcl/source/filter/igif/gifread.cxx | 3 --- 11 files changed, 7 insertions(+), 58 deletions(-) diff --git a/compilerplugins/clang/unusedfields.py b/compilerplugins/clang/unusedfields.py index bbfbd0164dca..83e21bb8df62 100755 --- a/compilerplugins/clang/unusedfields.py +++ b/compilerplugins/clang/unusedfields.py @@ -174,13 +174,8 @@ for d in definitionSet: if "Guard" in fieldType: continue # these are just all model classes - if (srcLoc.startswith("oox/") - or srcLoc.startswith("lotuswordpro/") - or srcLoc.startswith("include/oox/") - or srcLoc.startswith("include/filter/") - or srcLoc.startswith("hwpfilter/") - or srcLoc.startswith("filter/") - or srcLoc.startswith("vcl/source/filter/")): + if (srcLoc.startswith("lotuswordpro/") + or srcLoc.startswith("hwpfilter/")): continue if "(lambda at " in d[0]: continue diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index 5571a38419f3..edffd563ffc5 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -53,7 +53,6 @@ ImplEESdrWriter::ImplEESdrWriter( EscherEx& rEx ) : mpEscherEx(&rEx) , mpPicStrm(nullptr) , mpHostAppData(nullptr) - , mbIsTitlePossible(false) , mpSdrPage( nullptr ) { } @@ -829,16 +828,9 @@ sal_uInt32 ImplEESdrWriter::ImplEnterAdditionalTextGroup( const Reference< XShap } -void ImplEESdrWriter::ImplInitPageValues() -{ - mbIsTitlePossible = true; // With more than one title PowerPoint will fail. -} - void ImplEESdrWriter::ImplWritePage( EscherSolverContainer& rSolverContainer, bool ooxmlExport ) { - ImplInitPageValues(); - const sal_uInt32 nShapes = mXShapes->getCount(); for( sal_uInt32 n = 0; n < nShapes; ++n ) { @@ -875,7 +867,6 @@ bool ImplEESdrWriter::ImplInitPage( const SdrPage& rPage ) mXShapes = mXDrawPage; if ( !mXShapes.is() ) return false; - ImplInitPageValues(); mpSdrPage = &rPage; mpSolverContainer.reset( new EscherSolverContainer ); @@ -898,8 +889,6 @@ bool ImplEESdrWriter::ImplInitUnoShapes( const Reference< XShapes >& rxShapes ) mXDrawPage.clear(); mXShapes = rxShapes; - ImplInitPageValues(); - mpSolverContainer.reset( new EscherSolverContainer ); return true; } diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx index bd2c1153eacb..5e4bda191e1f 100644 --- a/filter/source/msfilter/eschesdo.hxx +++ b/filter/source/msfilter/eschesdo.hxx @@ -105,11 +105,9 @@ class ImplEESdrWriter SvStream* mpPicStrm; // own extensions EscherExHostAppData* mpHostAppData; - bool mbIsTitlePossible; const SdrPage* mpSdrPage; std::unique_ptr mpSolverContainer; - void ImplInitPageValues(); void ImplWritePage( EscherSolverContainer& rSolver, bool ooxmlExport ); sal_uInt32 ImplWriteShape( ImplEESdrObject& rObj, EscherSolverContainer& rSolver, diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index f7b30e5b446e..63e829653046 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -1792,11 +1792,6 @@ void SVGFilter::implGetPagePropSet( const Reference< css::drawing::XDrawPage > & mVisiblePagePropSet.bIsBackgroundVisible = true; mVisiblePagePropSet.bAreBackgroundObjectsVisible = true; mVisiblePagePropSet.bIsPageNumberFieldVisible = false; - mVisiblePagePropSet.bIsHeaderFieldVisible = false; - mVisiblePagePropSet.bIsFooterFieldVisible = true; - mVisiblePagePropSet.bIsDateTimeFieldVisible = true; - mVisiblePagePropSet.bIsDateTimeFieldFixed = true; - mVisiblePagePropSet.nDateTimeFormat = SvxDateFormat::B; mVisiblePagePropSet.nPageNumberingType = css::style::NumberingType::ARABIC; // We collect info on master page elements visibility, and placeholder text shape content. @@ -1811,14 +1806,6 @@ void SVGFilter::implGetPagePropSet( const Reference< css::drawing::XDrawPage > & implSafeGetPagePropSet( u"IsBackgroundVisible"_ustr, xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsBackgroundVisible; implSafeGetPagePropSet( u"IsBackgroundObjectsVisible"_ustr, xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bAreBackgroundObjectsVisible; implSafeGetPagePropSet( u"IsPageNumberVisible"_ustr, xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsPageNumberFieldVisible; - implSafeGetPagePropSet( u"IsHeaderVisible"_ustr, xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsHeaderFieldVisible; - implSafeGetPagePropSet( u"IsFooterVisible"_ustr, xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsFooterFieldVisible; - implSafeGetPagePropSet( u"IsDateTimeVisible"_ustr, xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsDateTimeFieldVisible; - - implSafeGetPagePropSet( u"IsDateTimeFixed"_ustr, xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsDateTimeFieldFixed; - sal_Int32 nTmp; - if (implSafeGetPagePropSet( u"DateTimeFormat"_ustr, xPropSet, xPropSetInfo ) >>= nTmp) - mVisiblePagePropSet.nDateTimeFormat = static_cast(nTmp); if( mVisiblePagePropSet.bIsPageNumberFieldVisible ) { diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 29b0a7d29374..90bd682fdb95 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -122,22 +122,12 @@ struct PagePropertySet bool bIsBackgroundVisible; bool bAreBackgroundObjectsVisible; bool bIsPageNumberFieldVisible; - bool bIsDateTimeFieldVisible; - bool bIsFooterFieldVisible; - bool bIsHeaderFieldVisible; sal_Int32 nPageNumberingType; - bool bIsDateTimeFieldFixed; - SvxDateFormat nDateTimeFormat; PagePropertySet() : bIsBackgroundVisible(false) , bAreBackgroundObjectsVisible(false) , bIsPageNumberFieldVisible(false) - , bIsDateTimeFieldVisible(false) - , bIsFooterFieldVisible(false) - , bIsHeaderFieldVisible(false) , nPageNumberingType(0) - , bIsDateTimeFieldFixed(false) - , nDateTimeFormat(SvxDateFormat::AppDefault) { } }; diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 6a9ae6b6219f..00c3f1eb0e40 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1858,7 +1858,6 @@ SVGActionWriter::SVGActionWriter( SVGExport& rExport, SVGFontExport& rFontExport maAttributeWriter( rExport, rFontExport, mrCurrentState ), maTextWriter(rExport, maAttributeWriter, *this), mpVDev(VclPtr::Create()), - mbClipAttrChanged( false ), mbIsPlaceholderShape( false ), mpEmbeddedBitmapsMap( nullptr ), mbIsPreview( false ) @@ -4054,8 +4053,6 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, const_cast(pAction)->Execute( mpVDev ); const vcl::Region aClipRegion = mpVDev->GetActiveClipRegion(); ImplWriteClipPath( aClipRegion.GetAsPolyPolygon() ); - - mbClipAttrChanged = true; } break; diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx index d87e2e67d4df..a798b8b74a78 100644 --- a/filter/source/svg/svgwriter.hxx +++ b/filter/source/svg/svgwriter.hxx @@ -316,7 +316,6 @@ private: SVGTextWriter maTextWriter; VclPtr mpVDev; MapMode maTargetMapMode; - bool mbClipAttrChanged; bool mbIsPlaceholderShape; const MetaBitmapActionMap* mpEmbeddedBitmapsMap; bool mbIsPreview; diff --git a/include/oox/core/contexthandler2.hxx b/include/oox/core/contexthandler2.hxx index b6664704044e..dab78e8ed7a6 100644 --- a/include/oox/core/contexthandler2.hxx +++ b/include/oox/core/contexthandler2.hxx @@ -72,7 +72,7 @@ struct ElementInfo; class OOX_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") ContextHandler2Helper { public: - explicit ContextHandler2Helper( bool bEnableTrimSpace, XmlFilterBase& rFilter ); + explicit ContextHandler2Helper( bool bEnableTrimSpace ); explicit ContextHandler2Helper( const ContextHandler2Helper& rParent ); virtual ~ContextHandler2Helper(); @@ -232,7 +232,6 @@ private: protected: bool mbEnableTrimSpace; ///< True = trim whitespace in characters(). - XmlFilterBase& mrFilter; }; class OOX_DLLPUBLIC ContextHandler2 : public ContextHandler, public ContextHandler2Helper diff --git a/oox/source/core/contexthandler2.cxx b/oox/source/core/contexthandler2.cxx index 5c4ab66987ab..5eb725204125 100644 --- a/oox/source/core/contexthandler2.cxx +++ b/oox/source/core/contexthandler2.cxx @@ -45,11 +45,10 @@ struct ElementInfo explicit ElementInfo() : maChars( 0), mnElement( XML_TOKEN_INVALID ), mbTrimSpaces( false ) {} }; -ContextHandler2Helper::ContextHandler2Helper( bool bEnableTrimSpace, XmlFilterBase& rFilter ) : +ContextHandler2Helper::ContextHandler2Helper( bool bEnableTrimSpace ) : mxContextStack( std::make_shared() ), mnRootStackSize( 0 ), - mbEnableTrimSpace( bEnableTrimSpace ), - mrFilter( rFilter ) + mbEnableTrimSpace( bEnableTrimSpace ) { pushElementInfo( XML_ROOT_CONTEXT ); } @@ -57,8 +56,7 @@ ContextHandler2Helper::ContextHandler2Helper( bool bEnableTrimSpace, XmlFilterBa ContextHandler2Helper::ContextHandler2Helper( const ContextHandler2Helper& rParent ) : mxContextStack( rParent.mxContextStack ), mnRootStackSize( rParent.mxContextStack->size() ), - mbEnableTrimSpace( rParent.mbEnableTrimSpace ), - mrFilter(rParent.mrFilter) + mbEnableTrimSpace( rParent.mbEnableTrimSpace ) { } diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx index e4eeef076f41..aac1d0c3899e 100644 --- a/oox/source/core/fragmenthandler2.cxx +++ b/oox/source/core/fragmenthandler2.cxx @@ -33,7 +33,7 @@ using namespace ::com::sun::star::xml::sax; FragmentHandler2::FragmentHandler2( XmlFilterBase& rFilter, const OUString& rFragmentPath, bool bEnableTrimSpace ) : FragmentHandler( rFilter, rFragmentPath ), - ContextHandler2Helper( bEnableTrimSpace, rFilter ) + ContextHandler2Helper( bEnableTrimSpace ) { } diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 6f96131a7908..a402faab1871 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -88,7 +88,6 @@ class GIFReader bool bGCTransparent; // is the image transparent, if yes: bool bInterlaced; bool bOverreadBlock; - bool bImGraphicReady; bool bGlobalPalette; sal_uInt8 nBackgroundColor; // backgroundcolour sal_uInt8 nGCTransparentIndex; // pixels of this index are transparent @@ -146,7 +145,6 @@ GIFReader::GIFReader( SvStream& rStm ) , bGCTransparent ( false ) , bInterlaced ( false) , bOverreadBlock ( false ) - , bImGraphicReady ( false ) , bGlobalPalette ( false ) , nBackgroundColor ( 0 ) , nGCTransparentIndex ( 0 ) @@ -825,7 +823,6 @@ bool GIFReader::ProcessGIF() if ( nRet == 1 ) { - bImGraphicReady = true; eActAction = NEXT_BLOCK_READING; bOverreadBlock = false; } From 16030c0700a3a68b5d6bbb8567bcc8bd690ba966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 4 Dec 2024 08:37:26 +0000 Subject: [PATCH 078/155] cid#1636562 Uninitialized scalar field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4d9f76cc5cb767054e138819d2b8dd9032188c6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177770 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sc/source/ui/app/acctrl.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sc/source/ui/app/acctrl.cxx b/sc/source/ui/app/acctrl.cxx index 4f3ac234c3dc..bff92c18e684 100644 --- a/sc/source/ui/app/acctrl.cxx +++ b/sc/source/ui/app/acctrl.cxx @@ -33,6 +33,7 @@ SFX_IMPL_STATUSBAR_CONTROL(ScAutoCalculateControl, SfxBoolItem); ScAutoCalculateControl::ScAutoCalculateControl(sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStb) : SfxStatusBarControl(_nSlotId, _nId, rStb) + , m_bIsActive(false) { } @@ -80,4 +81,4 @@ void ScAutoCalculateControl::Click() SfxStatusBarControl::Click(); // exec FID_AUTO_CALC and toggle AutoCalc on } -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 913854864096605bcea23a6174834fb5750ddad0 Mon Sep 17 00:00:00 2001 From: anonymotter Date: Wed, 27 Nov 2024 20:29:04 -0800 Subject: [PATCH 079/155] tdf#158979 Add static variable for last used merge option A static variable has been added so that, when merging cells in Calc where multiple cells have content in them, it will remember which of the three merge options was last used in a given session and automatically select that option the next time the merge cells dialog pops up. The default for the first merge in a session remains the option to keep the content of hidden cells. Change-Id: I35f6c01ffe9dff2756e3b9f5d530725e5d939db8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177455 Reviewed-by: Mike Kaganski Tested-by: Jenkins Reviewed-by: Heiko Tietze --- sc/source/ui/miscdlgs/mergecellsdialog.cxx | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/sc/source/ui/miscdlgs/mergecellsdialog.cxx b/sc/source/ui/miscdlgs/mergecellsdialog.cxx index cedcf6777b46..0c365f9bb773 100644 --- a/sc/source/ui/miscdlgs/mergecellsdialog.cxx +++ b/sc/source/ui/miscdlgs/mergecellsdialog.cxx @@ -10,6 +10,8 @@ #include +static ScMergeCellsOption lastUsedMergeCellsOption = KeepContentHiddenCells; + ScMergeCellsDialog::ScMergeCellsDialog(weld::Window* pParent) : GenericDialogController(pParent, u"modules/scalc/ui/mergecellsdialog.ui"_ustr, u"MergeCellsDialog"_ustr) @@ -17,7 +19,18 @@ ScMergeCellsDialog::ScMergeCellsDialog(weld::Window* pParent) , m_xRBKeepContent(m_xBuilder->weld_radio_button(u"keep-content-radio"_ustr)) , m_xRBEmptyContent(m_xBuilder->weld_radio_button(u"empty-cells-radio"_ustr)) { - m_xRBKeepContent->set_active(true); + if (lastUsedMergeCellsOption == MoveContentHiddenCells) + { + m_xRBMoveContent->set_active(true); + } + else if (lastUsedMergeCellsOption == KeepContentHiddenCells) + { + m_xRBKeepContent->set_active(true); + } + else if (lastUsedMergeCellsOption == EmptyContentHiddenCells) + { + m_xRBEmptyContent->set_active(true); + } } ScMergeCellsDialog::~ScMergeCellsDialog() {} @@ -25,11 +38,20 @@ ScMergeCellsDialog::~ScMergeCellsDialog() {} ScMergeCellsOption ScMergeCellsDialog::GetMergeCellsOption() const { if (m_xRBMoveContent->get_active()) + { + lastUsedMergeCellsOption = MoveContentHiddenCells; return MoveContentHiddenCells; - if (m_xRBKeepContent->get_active()) + } + else if (m_xRBKeepContent->get_active()) + { + lastUsedMergeCellsOption = KeepContentHiddenCells; return KeepContentHiddenCells; - if (m_xRBEmptyContent->get_active()) + } + else if (m_xRBEmptyContent->get_active()) + { + lastUsedMergeCellsOption = EmptyContentHiddenCells; return EmptyContentHiddenCells; + } assert(!"Unknown selection for merge cells."); return KeepContentHiddenCells; // default value } From 10d32939b1742f0eb935dc970d298c5f4b8b127c Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 09:17:21 +0100 Subject: [PATCH 080/155] gtk4: Unbreak --enable-gtk4 build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gtk_icon_view_convert_widget_to_bin_window_coords was dropped in gtk commit [1] commit 8dc5e13e8c66cd260edff17dbaa10eedcc95ae1b Author: Timm Bäder Date: Tue Jun 27 11:11:57 2017 +0200 iconview: Remove bin_window , so make the code using it conditional for gtk3. This at least unbreaks the build for now after commit a36a58933a1e07d3f54bacd5c2fe8ca53063a63a Date: Mon Nov 25 17:07:59 2024 +0530 sd: convert sidebar masterpage panels from drawingview to iconview It's possible gtk4 needs to do something else instead, but that can still be added later. See discussion newly started at [2] which might give some insights. [1] https://gitlab.gnome.org/GNOME/gtk/-/commit/8dc5e13e8c66cd260edff17dbaa10eedcc95ae1b [2] https://gerrit.libreoffice.org/c/core/+/177642/comment/4edf0ddd_f71cb30b/ Change-Id: I3bd42614addd03d483c7b41daa2b3a4677b9318e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177769 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/unx/gtk3/gtkinst.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 47841398e847..f1ca1030e300 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2263,6 +2263,7 @@ namespace rOutRect = GdkRectangle{static_cast(rInRect.Left()), static_cast(rInRect.Top()), static_cast(rInRect.GetWidth()), static_cast(rInRect.GetHeight())}; +#if !GTK_CHECK_VERSION(4, 0, 0) if (GTK_IS_ICON_VIEW(pWidget)) { // GtkIconView is a little weird in its positioning with scrolling, so adjust here to match what @@ -2272,6 +2273,7 @@ namespace rOutRect.x -= nOffsetX; rOutRect.y -= nOffsetY; } +#endif if (SwapForRTL(pWidget)) rOutRect.x = gtk_widget_get_allocated_width(pWidget) - rOutRect.width - 1 - rOutRect.x; @@ -17159,9 +17161,11 @@ private: gtk_icon_view_get_cell_rect(m_pIconView, path, nullptr, &aRect); gtk_tree_path_free(path); +#if !GTK_CHECK_VERSION(4, 0, 0) // GtkIconView is a little weird in its positioning with scrolling gtk_icon_view_convert_widget_to_bin_window_coords(m_pIconView, aRect.x, aRect.y, &aRect.x, &aRect.y); +#endif return tools::Rectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height); } From 75235a0759160fea2a15c2eaf9f7155f218b898a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 4 Dec 2024 08:52:03 +0000 Subject: [PATCH 081/155] cid#1636560 silence Unchecked return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iffb4b464ff124ffce19548a756d878130c10921a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177772 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- cui/source/dialogs/MacroManagerDialog.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cui/source/dialogs/MacroManagerDialog.cxx b/cui/source/dialogs/MacroManagerDialog.cxx index 021bcaf19751..0d070420fbb1 100644 --- a/cui/source/dialogs/MacroManagerDialog.cxx +++ b/cui/source/dialogs/MacroManagerDialog.cxx @@ -188,7 +188,7 @@ void ScriptContainersListBox::Remove(const weld::TreeIter* pEntryIter, bool bRem while (m_xTreeView->iter_compare(*xIter, *pEntryIter) != 0) { m_xTreeView->copy_iterator(*xIter, *xRemoveIter); - m_xTreeView->iter_previous(*xIter); + (void)m_xTreeView->iter_previous(*xIter); ScriptContainerInfo* pScriptContainerInfo = weld::fromId(m_xTreeView->get_id(*xRemoveIter)); if (pScriptContainerInfo) From a1d7dd96ea89427f8b8e8553b5bf46302432c645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 3 Dec 2024 10:02:01 +0000 Subject: [PATCH 082/155] cid#1607257 Overflowed constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this shouldn't happen unless the rdb is broken Change-Id: I3e861d25a8c10243f03446ec8a7b44457186585a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177774 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- store/source/lockbyte.cxx | 6 +++++- store/source/storcach.cxx | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index a786488ad7f6..a907c0f8ddc3 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -36,7 +36,11 @@ using namespace store; storeError ILockBytes::initialize (rtl::Reference< PageData::Allocator > & rxAllocator, sal_uInt16 nPageSize) { - OSL_PRECOND((STORE_MINIMUM_PAGESIZE <= nPageSize) && (nPageSize <= STORE_MAXIMUM_PAGESIZE), "invalid PageSize"); + if (nPageSize < STORE_MINIMUM_PAGESIZE || nPageSize > STORE_MAXIMUM_PAGESIZE) + { + SAL_WARN("store", "invalid PageSize"); + return store_E_InvalidParameter; + } return initialize_Impl (rxAllocator, nPageSize); } diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx index 82b5dcea9ef9..5907cfc730e7 100644 --- a/store/source/storcach.cxx +++ b/store/source/storcach.cxx @@ -127,8 +127,8 @@ static constexpr int highbit(std::size_t n) { int k = 1; - if (n == 0) - return 0; + assert(n > 0 && "can never be called with n == 0"); + if constexpr (sizeof(n) == 8) { if (n & 0xffffffff00000000) From e4dbbcd7a56f6b6b4827c0df3d2588d4a5ca3cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 4 Dec 2024 08:53:35 +0000 Subject: [PATCH 083/155] cid#1636563 Unchecked return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8d9cf983ca8c96d1619aceff9113732814d09f09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177773 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- basctl/source/basicide/moduldlg.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 3909f696708e..991fd7d8a4c0 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -981,7 +981,8 @@ SbModule* createModImpl(weld::Window* pWin, const ScriptDocument& rDocument, // the module has existed if( rDocument.hasModule( aLibName, aModName ) ) return nullptr; - rDocument.createModule( aLibName, aModName, bMain, sModuleCode ); + if (!rDocument.createModule(aLibName, aModName, bMain, sModuleCode)) + return nullptr; BasicManager* pBasMgr = rDocument.getBasicManager(); StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : nullptr; if ( pBasic ) From 6f70663c322209626bec08e3b63be6f0de663911 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 4 Dec 2024 09:28:28 +0200 Subject: [PATCH 084/155] tdf#163010 include GetPattern here we are already at the column data level, no need to call via ScDocument Change-Id: Ib8b0bc0f1fd9782229dc6c5240f87c086bdc970c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177777 Reviewed-by: Noel Grandin Tested-by: Jenkins --- sc/source/core/data/column3.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 825d0bb58d02..dd3f477f6c44 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2735,7 +2735,7 @@ void ScColumn::GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, ScFilterEntri Color aBackColor; bool bCondBackColor = false; - const ScPatternAttr* pPattern = rDoc.GetPattern(aCell.Col(), aCell.Row(), aCell.Tab()); + const ScPatternAttr* pPattern = GetPattern(nRow1); ScConditionalFormat* pCondFormat = rDoc.GetCondFormat(aCell.Col(), aCell.Row(), aCell.Tab()); if (pPattern) From 3fa6edf0b8625185fc19a76fc1e6268d99275cb0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 4 Dec 2024 10:17:51 +0200 Subject: [PATCH 085/155] tdf#163010 walk pattern by range which avoids a lot of lookup cost Change-Id: I9b030f3f8402f05a5c7b03c0147ff3ffc91d1cdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177778 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/core/data/column3.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index dd3f477f6c44..3b28214a913c 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2729,13 +2729,19 @@ void ScColumn::GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, ScFilterEntri const ScPatternAttr* pPrevPattern = nullptr; ScRefCellValue aPrevCellValue; Color aPrevPatternColor; + const ScPatternAttr* pPattern = nullptr; + SCROW nPatternStartRow = -1; + SCROW nPatternEndRow = -1; while (nRow1 <= nRow2) { aCell.SetRow(nRow1); Color aBackColor; bool bCondBackColor = false; - const ScPatternAttr* pPattern = GetPattern(nRow1); + if (nRow1 <= nPatternEndRow) + ; // then the previous value of pPattern is still valid + else + pPattern = pAttrArray->GetPatternRange(nPatternStartRow, nPatternEndRow, nRow1); ScConditionalFormat* pCondFormat = rDoc.GetCondFormat(aCell.Col(), aCell.Row(), aCell.Tab()); if (pPattern) From 2c613da01d02d45a140b94b391a142aede46e8b8 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 4 Dec 2024 11:20:01 +0200 Subject: [PATCH 086/155] tdf#163010 inline and cache rDoc.GetCondFormat call which reduces save time to around 30s for me Change-Id: I6889312d25bd8f297f1c54f683496ef00e114d51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177779 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/core/data/column3.cxx | 38 ++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 3b28214a913c..7c2cd876f906 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2725,11 +2725,16 @@ void ScColumn::GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, ScFilterEntri ScAddress aCell(GetCol(), 0, GetTab()); ScDocument& rDoc = GetDoc(); + ScConditionalFormatList* pCondFormList = rDoc.GetCondFormList(aCell.Tab()); // cache the output of GetCondResult const ScPatternAttr* pPrevPattern = nullptr; ScRefCellValue aPrevCellValue; Color aPrevPatternColor; + Color aPrevInsertColor; const ScPatternAttr* pPattern = nullptr; + ScConditionalFormat* pCondFormat = nullptr; + const ScCondFormatIndexes* pCondFormats = nullptr; + Color aBackgroundBrushColor; SCROW nPatternStartRow = -1; SCROW nPatternEndRow = -1; while (nRow1 <= nRow2) @@ -2738,15 +2743,29 @@ void ScColumn::GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, ScFilterEntri Color aBackColor; bool bCondBackColor = false; + if (nRow1 <= nPatternEndRow) - ; // then the previous value of pPattern is still valid + ; // then the previous value of pPattern and pCondFormat and pCondFormats and aBackgroundBrushColor is still valid else + { pPattern = pAttrArray->GetPatternRange(nPatternStartRow, nPatternEndRow, nRow1); - ScConditionalFormat* pCondFormat = rDoc.GetCondFormat(aCell.Col(), aCell.Row(), aCell.Tab()); + pCondFormats = &pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData(); + sal_uInt32 nIndex = 0; + if(!pCondFormats->empty()) + nIndex = (*pCondFormats)[0]; + if (nIndex) + { + assert(pCondFormList); + pCondFormat = pCondFormList->GetFormat( nIndex ); + } + else + pCondFormat = nullptr; + aBackgroundBrushColor = pPattern->GetItem(ATTR_BACKGROUND).GetColor(); + } if (pPattern) { - if (!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty()) + if (!pCondFormats->empty()) { // Speed up processing when dealing with runs of identical cells. This avoids // an expensive GetCondResult call. @@ -2759,8 +2778,8 @@ void ScColumn::GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, ScFilterEntri else { const SfxItemSet* pCondSet = rDoc.GetCondResult(GetCol(), nRow1, GetTab()); - const SvxBrushItem* pBrush = &pPattern->GetItem(ATTR_BACKGROUND, pCondSet); - aBackColor = pBrush->GetColor(); + const SvxBrushItem* pCondBrush = &pPattern->GetItem(ATTR_BACKGROUND, pCondSet); + aBackColor = pCondBrush->GetColor(); bCondBackColor = true; aPrevCellValue = aCellValue; pPrevPattern = pPattern; @@ -2789,11 +2808,14 @@ void ScColumn::GetBackColorFilterEntries(SCROW nRow1, SCROW nRow2, ScFilterEntri if (!bCondBackColor) { - const SvxBrushItem* pBrush = rDoc.GetAttr(aCell, ATTR_BACKGROUND); - aBackColor = pBrush->GetColor(); + aBackColor = aBackgroundBrushColor; } - rFilterEntries.addBackgroundColor(aBackColor); + if (aPrevInsertColor != aBackColor) + { + rFilterEntries.addBackgroundColor(aBackColor); + aPrevInsertColor = aBackColor; + } nRow1++; } } From bc09a4f1ce1f6a714f7827a404aa6317b503d307 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Wed, 4 Dec 2024 14:25:42 +0500 Subject: [PATCH 087/155] Disable subpixel AA in GraphicExporter::filter unconditionally ... in D2DWriteTextOutRenderer. Commit 785a56b6be7f3128c2e7a131381e02525a50eb6b (D2DWriteTextOutRenderer: use grayscale AA for file output, 2024-11-27) has disabled it only when the export settings explicitly specified a concrete AA setting. In case when the settings didn't specify explicitly, if AA should be used or not, then system settings were used, which in case of D2DWriteTextOutRenderer would still enable ClearType (subpixel AA). This stores additional flag in StyleSettings, similar to what was done in commit e6538f5bdd876911ea30f84a6512c03908e620fd (tdf#118966 vcl: add a flag to determine if AA of fonts is used from the system, 2018-07-28), that tells the renderer to prevent subpixel AA, even if use of AA itself is defined by system settings. This flag is currently only considered by D2DWriteTextOutRenderer. Change-Id: Ibd1879d3c222276eee00c37a442881d6d47c831f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177780 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- include/vcl/settings.hxx | 5 +++++ svx/source/unodraw/UnoGraphicExporter.cxx | 11 +++++++---- vcl/source/app/settings.cxx | 13 +++++++++++++ vcl/win/gdi/DWriteTextRenderer.cxx | 4 +++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index 432419abc568..401da27abf7d 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -460,6 +460,11 @@ public: void SetUseFontAAFromSystem(bool bUseFontAAFromSystem); bool GetUseFontAAFromSystem() const; + // Using subpixel anti-aliasing is unwanted in some cases, like when saving to file, + // even when the use of anti-aliasing itself is defined by system settings. + void SetUseSubpixelAA(bool val); + bool GetUseSubpixelAA() const; + SAL_DLLPRIVATE void SetUseFlatBorders( bool bUseFlatBorders ); SAL_DLLPRIVATE bool GetUseFlatBorders() const; diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 0ea662b61a1c..e2b6f7ad029b 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -1004,23 +1004,26 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes AllSettings aAllSettings = Application::GetSettings(); StyleSettings aStyleSettings = aAllSettings.GetStyleSettings(); bool bUseFontAAFromSystem = aStyleSettings.GetUseFontAAFromSystem(); + bool bUseSubpixelAA = aStyleSettings.GetUseSubpixelAA(); + aStyleSettings.SetUseSubpixelAA(false); if (aSettings.meAntiAliasing != TRISTATE_INDET) { // This is safe to do globally as we own the solar mutex. SvtOptionsDrawinglayer::SetAntiAliasing(aSettings.meAntiAliasing == TRISTATE_TRUE, /*bTemporary*/true); // Opt in to have AA affect font rendering as well. aStyleSettings.SetUseFontAAFromSystem(false); - aAllSettings.SetStyleSettings(aStyleSettings); - Application::SetSettings(aAllSettings); } + aAllSettings.SetStyleSettings(aStyleSettings); + Application::SetSettings(aAllSettings); nStatus = GetGraphic( aSettings, aGraphic, bVectorType ) ? ERRCODE_NONE : ERRCODE_GRFILTER_FILTERERROR; if (aSettings.meAntiAliasing != TRISTATE_INDET) { SvtOptionsDrawinglayer::SetAntiAliasing(bAntiAliasing, /*bTemporary*/true); aStyleSettings.SetUseFontAAFromSystem(bUseFontAAFromSystem); - aAllSettings.SetStyleSettings(aStyleSettings); - Application::SetSettings(aAllSettings); } + aStyleSettings.SetUseSubpixelAA(bUseSubpixelAA); + aAllSettings.SetStyleSettings(aStyleSettings); + Application::SetSettings(aAllSettings); } if( nStatus == ERRCODE_NONE ) diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index b4b8907f89cf..7d807a7bdae0 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -225,6 +225,7 @@ struct ImplStyleData * from system settings. */ bool mbUseFontAAFromSystem : 1; + bool mbUseSubpixelAA : 1; bool mbAutoMnemonic : 1 = true; bool mnUseFlatBorders : 1; bool mbPreferredUseImagesInMenus : 1; @@ -584,6 +585,7 @@ void ImplStyleData::SetStandardStyles() mbHighContrast = false; mbUseSystemUIFonts = true; mbUseFontAAFromSystem = true; + mbUseSubpixelAA = true; mnUseFlatBorders = false; mnUseFlatMenus = false; mbPreferredUseImagesInMenus = true; @@ -1483,6 +1485,16 @@ bool StyleSettings::GetUseFontAAFromSystem() const return mxData->mbUseFontAAFromSystem; } +void StyleSettings::SetUseSubpixelAA(bool val) +{ + mxData->mbUseSubpixelAA = val; +} + +bool StyleSettings::GetUseSubpixelAA() const +{ + return mxData->mbUseSubpixelAA; +} + void StyleSettings::SetUseFlatBorders( bool bUseFlatBorders ) { @@ -2285,6 +2297,7 @@ bool ImplStyleData::operator==(const ImplStyleData& rSet) const (mbHighContrast == rSet.mbHighContrast) && (mbUseSystemUIFonts == rSet.mbUseSystemUIFonts) && (mbUseFontAAFromSystem == rSet.mbUseFontAAFromSystem) && + (mbUseSubpixelAA == rSet.mbUseSubpixelAA) && (mnUseFlatBorders == rSet.mnUseFlatBorders) && (mnUseFlatMenus == rSet.mnUseFlatMenus) && (maColors == rSet.maColors) && diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index 06f927b725a6..cb3c1ba4c060 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -41,7 +41,9 @@ namespace D2D1_TEXT_ANTIALIAS_MODE lclGetSystemTextAntiAliasType() { UINT t; - if (SystemParametersInfoW(SPI_GETFONTSMOOTHINGTYPE, 0, &t, 0) && t == FE_FONTSMOOTHINGCLEARTYPE) + if (Application::GetSettings().GetStyleSettings().GetUseSubpixelAA() + && SystemParametersInfoW(SPI_GETFONTSMOOTHINGTYPE, 0, &t, 0) + && t == FE_FONTSMOOTHINGCLEARTYPE) return D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE; return D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE; } From e90ebdde4110ea7e250f66327af1e3f4eeb8718f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 4 Dec 2024 08:49:15 +0000 Subject: [PATCH 088/155] cid#1636561 Dereference after null check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7a4c19d9344dba9c09861fe78b864a8651c3286f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177771 Reviewed-by: Caolán McNamara Tested-by: Jenkins --- sw/source/core/draw/dflyobj.cxx | 4 ++-- sw/source/core/inc/flyfrm.hxx | 2 +- sw/source/core/layout/paintfrm.cxx | 16 +++++++--------- sw/source/core/text/porfly.cxx | 2 +- sw/source/core/view/viewimp.cxx | 2 +- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 29a818a52847..9b6ffb4b2939 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -509,12 +509,12 @@ void SwVirtFlyDrawObj::wrap_DoPaintObject( // but no paints. IsPaintInProgress() depends on SW repaint, so, as long // as SW paints self and calls DrawLayer() for Heaven and Hell, this will // be correct - if ( !(pShell && pShell->IsDrawingLayerPaintInProgress()) ) + if (!pShell || !pShell->IsDrawingLayerPaintInProgress()) return; bool bDrawObject(true); - if ( !SwFlyFrame::IsPaint( const_cast(this), pShell ) ) + if ( !SwFlyFrame::IsPaint( const_cast(this), *pShell ) ) { bDrawObject = false; } diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 31821741c85b..bbad4462bee2 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -242,7 +242,7 @@ public: const bool _bForPaint = false ) const; // Paint on this shell (consider Preview, print flag, etc. recursively)? - static bool IsPaint( SdrObject *pObj, const SwViewShell *pSh ); + static bool IsPaint(SdrObject *pObj, const SwViewShell& rSh); /** SwFlyFrame::IsBackgroundTransparent diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index e8188f77f7f5..68486df83780 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -4101,20 +4101,19 @@ static void lcl_PaintReplacement( const SwRect &rRect, const SwViewShell &rSh ) Graphic::DrawEx(*rSh.GetOut(), OUString(), aFont, rBmp, rRect.Pos(), rRect.SSize()); } -bool SwFlyFrame::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) +bool SwFlyFrame::IsPaint(SdrObject *pObj, const SwViewShell& rSh) { SdrObjUserCall *pUserCall = GetUserCall(pObj); if ( nullptr == pUserCall ) return true; - if ( pSh && ((!pSh->GetViewOptions()->IsDraw() + if ( (!rSh.GetViewOptions()->IsDraw() && (dynamic_cast(pObj) || dynamic_cast(pObj) || dynamic_cast(pObj))) - || (!pSh->GetViewOptions()->IsGraphic() && dynamic_cast(pObj)) ) - ) + || (!rSh.GetViewOptions()->IsGraphic() && dynamic_cast(pObj)) ) { SwRect rBoundRect = GetBoundRectOfAnchoredObj( pObj ); - lcl_PaintReplacement( rBoundRect, *pSh ); + lcl_PaintReplacement(rBoundRect, rSh); return false; } assert(pObj); @@ -4123,7 +4122,7 @@ bool SwFlyFrame::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) bool bPaint = gProp.pSFlyOnlyDraw || static_cast(pUserCall)->GetFormat()->GetPrint().GetValue(); if ( !bPaint ) - bPaint = pSh->GetWin() && !pSh->IsPreview(); + bPaint = rSh.GetWin() && !rSh.IsPreview(); if ( bPaint ) { @@ -4160,7 +4159,7 @@ bool SwFlyFrame::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) { if ( !pAnch->isFrameAreaPositionValid() ) pAnch = nullptr; - else if ( pSh->GetOut() == pSh->getIDocumentDeviceAccess().getPrinter( false )) + else if ( rSh.GetOut() == rSh.getIDocumentDeviceAccess().getPrinter( false )) { //HACK: we have to omit some of the objects for printing, //otherwise they would be printed twice. @@ -4183,8 +4182,7 @@ bool SwFlyFrame::IsPaint( SdrObject *pObj, const SwViewShell *pSh ) if ( pAnch ) { if ( pAnch->IsInFly() ) - bPaint = SwFlyFrame::IsPaint( pAnch->FindFlyFrame()->GetVirtDrawObj(), - pSh ); + bPaint = SwFlyFrame::IsPaint(pAnch->FindFlyFrame()->GetVirtDrawObj(), rSh); else if ( gProp.pSFlyOnlyDraw ) bPaint = false; } diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index ac0c96590f93..d4612cbd26d0 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -225,7 +225,7 @@ void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const if(!((m_pFly->IsCompletePaint() || m_pFly->getFrameArea().Overlaps(aRepaintRect)) && - SwFlyFrame::IsPaint(m_pFly->GetVirtDrawObj(), m_pFly->getRootFrame()->GetCurrShell()))) + SwFlyFrame::IsPaint(m_pFly->GetVirtDrawObj(), *m_pFly->getRootFrame()->GetCurrShell()))) return; SwRect aRect(m_pFly->getFrameArea()); diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 73ddbac03b84..dd3aeb3d86a3 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -537,7 +537,7 @@ void SwViewObjectContactRedirector::createRedirectedPrimitive2DSequence( SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject(); if ( pObj ) { - bPaint = SwFlyFrame::IsPaint( pObj, &mrViewShell ); + bPaint = SwFlyFrame::IsPaint(pObj, mrViewShell); } if ( !bPaint ) From 76be2970722faceda1552681d6d2ab942d350595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Wed, 11 Sep 2024 17:17:23 +0200 Subject: [PATCH 089/155] slideshow: lok: export hiden slide we need to be aware of hidden slides to make correct decision when doing "start from current slide" based on the slide number Change-Id: Ib4944c699fa2589026e4d8ae57766c83e0439d49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177775 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sd/qa/unit/tiledrendering/tiledrendering.cxx | 9 +++++++-- sd/source/ui/unoidl/unomodel.cxx | 10 +++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 4a17fc480ca7..18b213e99abf 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2704,7 +2704,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testPresentationInfo) CPPUNIT_ASSERT_EQUAL(15875, aTree.get_child("docWidth").get_value()); CPPUNIT_ASSERT_EQUAL(8930, aTree.get_child("docHeight").get_value()); - CPPUNIT_ASSERT_EQUAL(size_t(4), aTree.get_child("slides").size()); + CPPUNIT_ASSERT_EQUAL(size_t(5), aTree.get_child("slides").size()); // Slide Index 0 { @@ -2756,10 +2756,15 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testPresentationInfo) } // Slide Index 3 - Hidden + { + const boost::property_tree::ptree& rChild = child_at(aTree, "slides", 3); + CPPUNIT_ASSERT_EQUAL(3, rChild.get_child("index").get_value()); + CPPUNIT_ASSERT_EQUAL(true, rChild.get_child("hidden").get_value()); + } // Slide Index 4 { - const boost::property_tree::ptree& rChild = child_at(aTree, "slides", 3); + const boost::property_tree::ptree& rChild = child_at(aTree, "slides", 4); CPPUNIT_ASSERT_EQUAL(4, rChild.get_child("index").get_value()); CPPUNIT_ASSERT_EQUAL(false, rChild.get_child("empty").get_value()); // Check only that these exist diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 436a0c91211a..12953834614c 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -4376,7 +4376,15 @@ OString SdXImpressDocument::getPresentationInfo() const SdGenericDrawPage* pSlide(xDrawPages->getDrawPageByIndex(i)); bool bIsVisible = true; // default visible pSlide->getPropertyValue("Visible") >>= bIsVisible; - if (bIsVisible) + if (!bIsVisible) + { + auto aSlideNode = aJsonWriter.startStruct(); + std::string sSlideHash = GetInterfaceHash(cppu::getXWeak(pSlide)); + aJsonWriter.put("hash", sSlideHash); + aJsonWriter.put("index", i); + aJsonWriter.put("hidden", true); + } + else { SdrPage* pPage = pSlide->GetSdrPage(); From d28ca0db5edd43b9e2bb82d78021b4c4eb276d4e Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Wed, 4 Dec 2024 14:56:06 +0100 Subject: [PATCH 090/155] Update git submodules * Update translations from branch 'master' to 6eca395810730a005bd24fcafa92eba4860350b9 - update translations for master/25.2.0 Beta1 and force-fix errors using pocheck Change-Id: I291ff1a663a6689b727528a376ac200d4041281d --- translations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translations b/translations index 9a24d35bd210..6eca39581073 160000 --- a/translations +++ b/translations @@ -1 +1 @@ -Subproject commit 9a24d35bd2100d7686503528bfce2cb2d6d18ca4 +Subproject commit 6eca395810730a005bd24fcafa92eba4860350b9 From 8fb31e76975124a12a070ec681bd410f05a18eed Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Wed, 4 Dec 2024 15:07:36 +0100 Subject: [PATCH 091/155] bump product version to 25.8.0.0.alpha0+ Change-Id: I8b5394fb5119e124240a567e99497337ff897686 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d58af4af258b..370cedc91c29 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ dnl in order to create a configure script. # several non-alphanumeric characters, those are split off and used only for the # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea. -AC_INIT([LibreOffice],[25.2.0.0.alpha1+],[],[],[http://documentfoundation.org/]) +AC_INIT([LibreOffice],[25.8.0.0.alpha0+],[],[],[http://documentfoundation.org/]) dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard From 1ad425812aaa29d0f449a27350a86b90c18c626c Mon Sep 17 00:00:00 2001 From: Johann Lorber Date: Wed, 4 Dec 2024 11:47:36 +0100 Subject: [PATCH 092/155] tdf#143148: Use pragma once instead of include guards Change-Id: Iac334c822ab0699b5cc5122e5f2b1a2b9662f58e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177784 Reviewed-by: Skyler Grey Tested-by: Jenkins --- sw/inc/edglbldc.hxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sw/inc/edglbldc.hxx b/sw/inc/edglbldc.hxx index ede49d8e894e..e585fbe5cd49 100644 --- a/sw/inc/edglbldc.hxx +++ b/sw/inc/edglbldc.hxx @@ -16,8 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_INC_EDGLBLDC_HXX -#define INCLUDED_SW_INC_EDGLBLDC_HXX +#pragma once #include @@ -64,6 +63,4 @@ public: class SwGlblDocContents : public o3tl::sorted_vector, o3tl::less_ptr_to > {}; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From d775d637b9ff7619aba195559deed6e9a341e372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 4 Dec 2024 11:34:25 +0000 Subject: [PATCH 093/155] crashtesting: failure to reimport forum-es-2526.odt after export to odt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2nd arg to copy is len, not index. Probably a problem since: commit 12a7a3d57d3dcf222b13fa9143c37736f8ea3d0b CommitDate: Thu Sep 3 15:33:36 2020 +0200 Fix crashtest fdo77855.odt in forum-es-2526.odt the input has: fo:border-=".009cm solid #595959" where 'fo:border-' is an unknown attr and "fo" ends up truncated to "f". On export and reimport the 'f' is further truncated to '' and we assert on this oddness. Change-Id: Ie85d81947504bf15b9caefb92477c7f977eb5cb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177788 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/filter/xml/xmlimpit.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index af8e30c19a5e..59678acf33ef 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -227,7 +227,7 @@ void SvXMLImportItemMapper::importXMLUnknownAttributes( SfxItemSet& rSet, int i = sName.indexOf(':'); if (i != -1) { - sPrefix = sName.copy(0, i-1); + sPrefix = sName.copy(0, i); sName = sName.copy(i+1); } // the sax parser doesn't reject these, strangely From 285b66443303b8e240a6af48adb1f58bf4f8644e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 4 Dec 2024 15:57:14 +0200 Subject: [PATCH 094/155] split up SwGetRefFieldType::FindAnchor method to make it easier to read Change-Id: Ifaece90d4fb18be3caae9fd4afbbbdf64ff9d18a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177800 Reviewed-by: Noel Grandin Tested-by: Jenkins --- sw/inc/reffld.hxx | 7 + sw/source/core/fields/reffld.cxx | 492 ++++++++++++++++--------------- 2 files changed, 259 insertions(+), 240 deletions(-) diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx index a6d51679f101..471226b7f028 100644 --- a/sw/inc/reffld.hxx +++ b/sw/inc/reffld.hxx @@ -101,6 +101,13 @@ public: SwTextNode* pSelf = nullptr, SwFrame* pFrame = nullptr); void UpdateGetReferences(); void UpdateStyleReferences(); + +private: + static SwTextNode* FindAnchorRefStyle( SwDoc* pDoc, const OUString& rRefMark, + sal_uInt16 nFlags, + sal_Int32* pStt, sal_Int32* pEnd, + SwRootFrame const* pLayout, + SwTextNode* pSelf, SwFrame* pFrame); }; class SAL_DLLPUBLIC_RTTI SwGetRefField final : public SwField diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index e994dabfab17..0a1e25a119a1 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -1390,252 +1390,264 @@ SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, } break; case REF_STYLE: - if (!pSelf) break; - - const SwNodes& nodes = pDoc->GetNodes(); - - StyleRefElementType elementType = StyleRefElementType::Default; - const SwTextNode* pReference = nullptr; - - { /* Check if we're a footnote/endnote */ - for (SwTextFootnote* pFootnoteIdx : pDoc->GetFootnoteIdxs()) - { - if (pLayout && pLayout->IsHideRedlines() - && sw::IsFootnoteDeleted(rIDRA, *pFootnoteIdx)) - { - continue; - } - const SwNodeIndex* pIdx = pFootnoteIdx->GetStartNode(); - if (pIdx) - { - SwNodeIndex aIdx(*pIdx, 1); - SwTextNode* pFootnoteNode = aIdx.GetNode().GetTextNode(); - if (nullptr == pFootnoteNode) - pFootnoteNode = static_cast(SwNodes::GoNext(&aIdx)); - - if (*pSelf == *pFootnoteNode) - { - elementType = StyleRefElementType::Reference; - pReference = &pFootnoteIdx->GetTextNode(); - } - } - } - } - - if (pDoc->IsInHeaderFooter(*pSelf)) - { - elementType = StyleRefElementType::Marginal; - } - - if (pReference == nullptr) - { - pReference = pSelf; - } - - // undocumented Word feature: 1 = "Heading 1" etc. - OUString const styleName( - (rRefMark.getLength() == 1 && '1' <= rRefMark[0] && rRefMark[0] <= '9') - ? SwStyleNameMapper::GetProgName(RES_POOLCOLL_HEADLINE1 + rRefMark[0] - '1', rRefMark) - : rRefMark); - - switch (elementType) - { - case Marginal: - { - // For marginals, styleref tries to act on the current page first - // 1. Get the page we're on, search it from top to bottom - - bool bFlagFromBottom = (nFlags & REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM; - - Point aPt; - std::pair const tmp(aPt, false); - - if (!pContentFrame) SAL_WARN("xmloff.text", ": Missing content frame for marginal styleref"); - const SwPageFrame* pPageFrame = nullptr; - - if (pContentFrame) - pPageFrame = pContentFrame->FindPageFrame(); - - const SwNode* pPageStart(nullptr); - const SwNode* pPageEnd(nullptr); - - if (pPageFrame) - { - const SwContentFrame* pPageStartFrame = pPageFrame->FindFirstBodyContent(); - const SwContentFrame* pPageEndFrame = pPageFrame->FindLastBodyContent(); - - if (pPageStartFrame) { - if (pPageStartFrame->IsTextFrame()) - { - pPageStart = static_cast(pPageStartFrame) - ->GetTextNodeFirst(); - } - else - { - pPageStart - = static_cast(pPageStartFrame)->GetNode(); - } - } - - if (pPageEndFrame) { - if (pPageEndFrame->IsTextFrame()) - { - pPageEnd = static_cast(pPageEndFrame) - ->GetTextNodeFirst(); - } - else - { - pPageEnd = static_cast(pPageEndFrame)->GetNode(); - } - } - } - - if (!pPageStart || !pPageEnd) - { - pPageStart = pReference; - pPageEnd = pReference; - } - - std::deque pSearchSecond; - std::deque pInPage; /* or pSearchFirst */ - std::deque pSearchThird; - - bool beforeStart = true; - bool beforeEnd = true; - - for (SwNodeOffset n(0); n < nodes.Count(); n++) - { - if (beforeStart && *pPageStart == *nodes[n]) - { - beforeStart = false; - } - - if (beforeStart) - { - pSearchSecond.push_front(nodes[n]); - } - else if (beforeEnd) - { - if (bFlagFromBottom) - pInPage.push_front(nodes[n]); - else - pInPage.push_back(nodes[n]); - - if (*pPageEnd == *nodes[n]) - { - beforeEnd = false; - } - } - else - pSearchThird.push_back(nodes[n]); - } - - pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // 2. Search up from the top of the page - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // 3. Search down from the bottom of the page - pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // Word has case insensitive styles. LO has case sensitive styles. If we didn't find - // it yet, maybe we could with a case insensitive search. Let's do that - - pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd, - false /* bCaseSensitive */); - if (pTextNd) - { - break; - } - - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, - false /* bCaseSensitive */); - if (pTextNd) - { - break; - } - - pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd, - false /* bCaseSensitive */); - break; - } - case Reference: - case Default: - { - // Normally, styleref does searches around the field position - // For references, styleref acts from the position of the reference not the field - // Happily, the previous code saves either one into pReference, so the following is generic for both - - std::deque pSearchFirst; - std::deque pSearchSecond; - - bool beforeElement = true; - - for (SwNodeOffset n(0); n < nodes.Count(); n++) - { - if (beforeElement) - { - pSearchFirst.push_front(nodes[n]); - - if (*pReference == *nodes[n]) - { - beforeElement = false; - } - } - pSearchSecond.push_back(nodes[n]); - } - - // 1. Search up until we hit the top of the document - - pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // 2. Search down until we hit the bottom of the document - - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // Again, we need to remember that Word styles are not case sensitive - - pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd, - false /* bCaseSensitive */); - if (pTextNd) - { - break; - } - - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, - false /* bCaseSensitive */); - break; - } - default: - OSL_FAIL(" - unknown getref element type"); - } - + pTextNd = FindAnchorRefStyle(pDoc, rRefMark, nFlags, + pStt, pEnd, pLayout, pSelf, pContentFrame); break; } return pTextNd; } +SwTextNode* SwGetRefFieldType::FindAnchorRefStyle(SwDoc* pDoc, const OUString& rRefMark, + sal_uInt16 nFlags, + sal_Int32* pStt, sal_Int32* pEnd, SwRootFrame const* const pLayout, + SwTextNode* pSelf, SwFrame* pContentFrame) +{ + if (!pSelf) + return nullptr; + + SwTextNode* pTextNd = nullptr; + + const SwNodes& nodes = pDoc->GetNodes(); + + StyleRefElementType elementType = StyleRefElementType::Default; + const SwTextNode* pReference = nullptr; + IDocumentRedlineAccess & rIDRA(pDoc->getIDocumentRedlineAccess()); + + /* Check if we're a footnote/endnote */ + for (SwTextFootnote* pFootnoteIdx : pDoc->GetFootnoteIdxs()) + { + if (pLayout && pLayout->IsHideRedlines() + && sw::IsFootnoteDeleted(rIDRA, *pFootnoteIdx)) + { + continue; + } + const SwNodeIndex* pIdx = pFootnoteIdx->GetStartNode(); + if (pIdx) + { + SwNodeIndex aIdx(*pIdx, 1); + SwTextNode* pFootnoteNode = aIdx.GetNode().GetTextNode(); + if (nullptr == pFootnoteNode) + pFootnoteNode = static_cast(SwNodes::GoNext(&aIdx)); + + if (*pSelf == *pFootnoteNode) + { + elementType = StyleRefElementType::Reference; + pReference = &pFootnoteIdx->GetTextNode(); + } + } + } + + if (pDoc->IsInHeaderFooter(*pSelf)) + { + elementType = StyleRefElementType::Marginal; + } + + if (pReference == nullptr) + { + pReference = pSelf; + } + + // undocumented Word feature: 1 = "Heading 1" etc. + OUString const styleName( + (rRefMark.getLength() == 1 && '1' <= rRefMark[0] && rRefMark[0] <= '9') + ? SwStyleNameMapper::GetProgName(RES_POOLCOLL_HEADLINE1 + rRefMark[0] - '1', rRefMark) + : rRefMark); + + switch (elementType) + { + case Marginal: + { + // For marginals, styleref tries to act on the current page first + // 1. Get the page we're on, search it from top to bottom + + bool bFlagFromBottom = (nFlags & REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM; + + Point aPt; + std::pair const tmp(aPt, false); + + if (!pContentFrame) SAL_WARN("xmloff.text", ": Missing content frame for marginal styleref"); + const SwPageFrame* pPageFrame = nullptr; + + if (pContentFrame) + pPageFrame = pContentFrame->FindPageFrame(); + + const SwNode* pPageStart(nullptr); + const SwNode* pPageEnd(nullptr); + + if (pPageFrame) + { + const SwContentFrame* pPageStartFrame = pPageFrame->FindFirstBodyContent(); + const SwContentFrame* pPageEndFrame = pPageFrame->FindLastBodyContent(); + + if (pPageStartFrame) { + if (pPageStartFrame->IsTextFrame()) + { + pPageStart = static_cast(pPageStartFrame) + ->GetTextNodeFirst(); + } + else + { + pPageStart + = static_cast(pPageStartFrame)->GetNode(); + } + } + + if (pPageEndFrame) { + if (pPageEndFrame->IsTextFrame()) + { + pPageEnd = static_cast(pPageEndFrame) + ->GetTextNodeFirst(); + } + else + { + pPageEnd = static_cast(pPageEndFrame)->GetNode(); + } + } + } + + if (!pPageStart || !pPageEnd) + { + pPageStart = pReference; + pPageEnd = pReference; + } + + std::deque pSearchSecond; + std::deque pInPage; /* or pSearchFirst */ + std::deque pSearchThird; + + bool beforeStart = true; + bool beforeEnd = true; + + for (SwNodeOffset n(0); n < nodes.Count(); n++) + { + if (beforeStart && *pPageStart == *nodes[n]) + { + beforeStart = false; + } + + if (beforeStart) + { + pSearchSecond.push_front(nodes[n]); + } + else if (beforeEnd) + { + if (bFlagFromBottom) + pInPage.push_front(nodes[n]); + else + pInPage.push_back(nodes[n]); + + if (*pPageEnd == *nodes[n]) + { + beforeEnd = false; + } + } + else + pSearchThird.push_back(nodes[n]); + } + + pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd); + if (pTextNd) + { + break; + } + + // 2. Search up from the top of the page + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); + if (pTextNd) + { + break; + } + + // 3. Search down from the bottom of the page + pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd); + if (pTextNd) + { + break; + } + + // Word has case insensitive styles. LO has case sensitive styles. If we didn't find + // it yet, maybe we could with a case insensitive search. Let's do that + + pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd, + false /* bCaseSensitive */); + if (pTextNd) + { + break; + } + + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, + false /* bCaseSensitive */); + if (pTextNd) + { + break; + } + + pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd, + false /* bCaseSensitive */); + break; + } + case Reference: + case Default: + { + // Normally, styleref does searches around the field position + // For references, styleref acts from the position of the reference not the field + // Happily, the previous code saves either one into pReference, so the following is generic for both + + std::deque pSearchFirst; + std::deque pSearchSecond; + + bool beforeElement = true; + + for (SwNodeOffset n(0); n < nodes.Count(); n++) + { + if (beforeElement) + { + pSearchFirst.push_front(nodes[n]); + + if (*pReference == *nodes[n]) + { + beforeElement = false; + } + } + pSearchSecond.push_back(nodes[n]); + } + + // 1. Search up until we hit the top of the document + + pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd); + if (pTextNd) + { + break; + } + + // 2. Search down until we hit the bottom of the document + + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); + if (pTextNd) + { + break; + } + + // Again, we need to remember that Word styles are not case sensitive + + pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd, + false /* bCaseSensitive */); + if (pTextNd) + { + break; + } + + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, + false /* bCaseSensitive */); + break; + } + default: + OSL_FAIL(" - unknown getref element type"); + } + return pTextNd; +} + namespace { struct RefIdsMap From 48d0d525d0cc579be2b1ba195ee797fd6f670276 Mon Sep 17 00:00:00 2001 From: Christopher Sherlock Date: Thu, 14 Nov 2024 00:38:25 +1100 Subject: [PATCH 095/155] vcl: fix call sites for createBlendFrame(), rename to createAlphaBlendFrame() The call sites are actually passing in transparency, in fact to be consistent with current conventions we are actually dealing with alpha values. So we need to take the transparent values at the call sites and convert to alpha values by just subtracting 255. Hence fixing the FIXME comment. Change-Id: Ibc55ea77f469ec8afcab0cc26d2b8cdf25ea8a72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173858 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/bitmapex.hxx | 9 ++++----- svtools/source/control/valueset.cxx | 4 ++-- vcl/source/bitmap/BitmapEx.cxx | 10 ++++------ vcl/source/control/imp_listbox.cxx | 8 ++++---- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx index b102ced8ba9b..ebc56930192e 100644 --- a/include/vcl/bitmapex.hxx +++ b/include/vcl/bitmapex.hxx @@ -467,7 +467,7 @@ private: }; -/** Create a blend frame as BitmapEx +/** Create a blend frame as BitmapEx using an alpha value @param nAlpha The blend value defines how strong the frame will be blended with the @@ -480,14 +480,13 @@ private: @param rSize The size of the frame in pixels */ -BitmapEx VCL_DLLPUBLIC createBlendFrame( +BitmapEx VCL_DLLPUBLIC createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, Color aColorTopLeft, Color aColorBottomRight); - -/** Create a blend frame as BitmapEx +/** Create a blend frame as BitmapEx using an alpha value @param nAlpha The blend value defines how strong the frame will be blended with the @@ -499,7 +498,7 @@ BitmapEx VCL_DLLPUBLIC createBlendFrame( @param rSize The size of the frame in pixels */ -BitmapEx createBlendFrame( +BitmapEx createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, Color aColorTopLeft, diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 5a056751b105..a3dcb17d9a77 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1487,8 +1487,8 @@ void ValueSet::ImplFormatItem(vcl::RenderContext const & rRenderContext, ValueSe { const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); - const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); - const BitmapEx aBlendFrame(createBlendFrame(aRect.GetSize(), nAlpha, rTopLeft, rBottomRight)); + const sal_uInt8 nAlpha(255 - ((nEdgeBlendingPercent * 255) / 100)); + const BitmapEx aBlendFrame(createAlphaBlendFrame(aRect.GetSize(), nAlpha, rTopLeft, rBottomRight)); if (!aBlendFrame.IsEmpty()) { diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index b44a1ca5cad9..8ce9c47dee09 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -1024,7 +1024,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const basegfx::BColorModifierStack& rBColorMod return BitmapEx(aChangedBitmap); } -BitmapEx createBlendFrame( +BitmapEx createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, Color aColorTopLeft, @@ -1042,13 +1042,13 @@ BitmapEx createBlendFrame( aColTopRight.Merge(aColorBottomRight, 255 - sal_uInt8((nW * 255) / nDE)); aColBottomLeft.Merge(aColorBottomRight, 255 - sal_uInt8((nH * 255) / nDE)); - return createBlendFrame(rSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft); + return createAlphaBlendFrame(rSize, nAlpha, aColorTopLeft, aColTopRight, aColorBottomRight, aColBottomLeft); } return BitmapEx(); } -BitmapEx createBlendFrame( +BitmapEx createAlphaBlendFrame( const Size& rSize, sal_uInt8 nAlpha, Color aColorTopLeft, @@ -1056,8 +1056,6 @@ BitmapEx createBlendFrame( Color aColorBottomRight, Color aColorBottomLeft) { - // FIXME the call sites are actually passing in transparency - nAlpha = 255 - nAlpha; BlendFrameCache* pBlendFrameCache = ImplGetBlendFrameCache(); if(pBlendFrameCache->m_aLastSize == rSize @@ -1340,7 +1338,7 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect, pPoints1.reset(new Point[ nHeight ]); pPoints2.reset(new Point[ nHeight ]); - for (tools::Long nY = nStartY1; nY < nEndY1; nY++ ) + for (tools::Long nY = nStartY1; nY < nEndY1; nY++) { tools::Long nX = nStartX1; Scanline pScanline = pAcc->GetScanline( nY ); diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 488c032a89f6..45b84c7db4ea 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -1691,8 +1691,8 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 { const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); - const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); - const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight)); + const sal_uInt8 nAlpha(255 - ((nEdgeBlendingPercent * 255) / 100)); + const BitmapEx aBlendFrame(createAlphaBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight)); if (!aBlendFrame.IsEmpty()) { @@ -2709,8 +2709,8 @@ void ImplWin::DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout) { const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor()); const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor()); - const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100); - const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight)); + const sal_uInt8 nAlpha(255 - ((nEdgeBlendingPercent * 255) / 100)); + const BitmapEx aBlendFrame(createAlphaBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight)); if(!aBlendFrame.IsEmpty()) { From 75d734698347565253571978fd585f1681229a97 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 4 Dec 2024 16:14:35 +0200 Subject: [PATCH 096/155] split up SwGetRefFieldType::FindAnchor method some more To make it easier to see the modifications I want to do to improve performance here. Change-Id: Icbb663b39905ce0fe82544bac7afd21314d4c7c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177801 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/inc/reffld.hxx | 9 + sw/source/core/fields/reffld.cxx | 372 ++++++++++++++++--------------- 2 files changed, 198 insertions(+), 183 deletions(-) diff --git a/sw/inc/reffld.hxx b/sw/inc/reffld.hxx index 471226b7f028..2adc2f3a3244 100644 --- a/sw/inc/reffld.hxx +++ b/sw/inc/reffld.hxx @@ -108,6 +108,15 @@ private: sal_Int32* pStt, sal_Int32* pEnd, SwRootFrame const* pLayout, SwTextNode* pSelf, SwFrame* pFrame); + static SwTextNode* FindAnchorRefStyleMarginal( SwDoc* pDoc, + sal_uInt16 nFlags, + sal_Int32* pStt, sal_Int32* pEnd, + SwTextNode* pSelf, SwFrame* pFrame, + const SwTextNode* pReference, std::u16string_view styleName); + static SwTextNode* FindAnchorRefStyleOther( SwDoc* pDoc, + sal_Int32* pStt, sal_Int32* pEnd, + SwTextNode* pSelf, + const SwTextNode* pReference, std::u16string_view styleName); }; class SAL_DLLPUBLIC_RTTI SwGetRefField final : public SwField diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 0a1e25a119a1..cca05dcb4dec 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -1408,8 +1408,6 @@ SwTextNode* SwGetRefFieldType::FindAnchorRefStyle(SwDoc* pDoc, const OUString& r SwTextNode* pTextNd = nullptr; - const SwNodes& nodes = pDoc->GetNodes(); - StyleRefElementType elementType = StyleRefElementType::Default; const SwTextNode* pReference = nullptr; IDocumentRedlineAccess & rIDRA(pDoc->getIDocumentRedlineAccess()); @@ -1457,197 +1455,205 @@ SwTextNode* SwGetRefFieldType::FindAnchorRefStyle(SwDoc* pDoc, const OUString& r switch (elementType) { case Marginal: - { - // For marginals, styleref tries to act on the current page first - // 1. Get the page we're on, search it from top to bottom - - bool bFlagFromBottom = (nFlags & REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM; - - Point aPt; - std::pair const tmp(aPt, false); - - if (!pContentFrame) SAL_WARN("xmloff.text", ": Missing content frame for marginal styleref"); - const SwPageFrame* pPageFrame = nullptr; - - if (pContentFrame) - pPageFrame = pContentFrame->FindPageFrame(); - - const SwNode* pPageStart(nullptr); - const SwNode* pPageEnd(nullptr); - - if (pPageFrame) - { - const SwContentFrame* pPageStartFrame = pPageFrame->FindFirstBodyContent(); - const SwContentFrame* pPageEndFrame = pPageFrame->FindLastBodyContent(); - - if (pPageStartFrame) { - if (pPageStartFrame->IsTextFrame()) - { - pPageStart = static_cast(pPageStartFrame) - ->GetTextNodeFirst(); - } - else - { - pPageStart - = static_cast(pPageStartFrame)->GetNode(); - } - } - - if (pPageEndFrame) { - if (pPageEndFrame->IsTextFrame()) - { - pPageEnd = static_cast(pPageEndFrame) - ->GetTextNodeFirst(); - } - else - { - pPageEnd = static_cast(pPageEndFrame)->GetNode(); - } - } - } - - if (!pPageStart || !pPageEnd) - { - pPageStart = pReference; - pPageEnd = pReference; - } - - std::deque pSearchSecond; - std::deque pInPage; /* or pSearchFirst */ - std::deque pSearchThird; - - bool beforeStart = true; - bool beforeEnd = true; - - for (SwNodeOffset n(0); n < nodes.Count(); n++) - { - if (beforeStart && *pPageStart == *nodes[n]) - { - beforeStart = false; - } - - if (beforeStart) - { - pSearchSecond.push_front(nodes[n]); - } - else if (beforeEnd) - { - if (bFlagFromBottom) - pInPage.push_front(nodes[n]); - else - pInPage.push_back(nodes[n]); - - if (*pPageEnd == *nodes[n]) - { - beforeEnd = false; - } - } - else - pSearchThird.push_back(nodes[n]); - } - - pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // 2. Search up from the top of the page - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // 3. Search down from the bottom of the page - pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // Word has case insensitive styles. LO has case sensitive styles. If we didn't find - // it yet, maybe we could with a case insensitive search. Let's do that - - pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd, - false /* bCaseSensitive */); - if (pTextNd) - { - break; - } - - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, - false /* bCaseSensitive */); - if (pTextNd) - { - break; - } - - pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd, - false /* bCaseSensitive */); + pTextNd = FindAnchorRefStyleMarginal(pDoc, nFlags, + pStt, pEnd, pSelf, pContentFrame, pReference, styleName); break; - } case Reference: case Default: - { - // Normally, styleref does searches around the field position - // For references, styleref acts from the position of the reference not the field - // Happily, the previous code saves either one into pReference, so the following is generic for both - - std::deque pSearchFirst; - std::deque pSearchSecond; - - bool beforeElement = true; - - for (SwNodeOffset n(0); n < nodes.Count(); n++) - { - if (beforeElement) - { - pSearchFirst.push_front(nodes[n]); - - if (*pReference == *nodes[n]) - { - beforeElement = false; - } - } - pSearchSecond.push_back(nodes[n]); - } - - // 1. Search up until we hit the top of the document - - pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // 2. Search down until we hit the bottom of the document - - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); - if (pTextNd) - { - break; - } - - // Again, we need to remember that Word styles are not case sensitive - - pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd, - false /* bCaseSensitive */); - if (pTextNd) - { - break; - } - - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, - false /* bCaseSensitive */); + pTextNd = FindAnchorRefStyleOther(pDoc, + pStt, pEnd, pSelf, pReference, styleName); break; - } default: OSL_FAIL(" - unknown getref element type"); } return pTextNd; } +SwTextNode* SwGetRefFieldType::FindAnchorRefStyleMarginal(SwDoc* pDoc, + sal_uInt16 nFlags, + sal_Int32* pStt, sal_Int32* pEnd, + SwTextNode* pSelf, SwFrame* pContentFrame, + const SwTextNode* pReference, std::u16string_view styleName) +{ + // For marginals, styleref tries to act on the current page first + // 1. Get the page we're on, search it from top to bottom + + SwTextNode* pTextNd = nullptr; + + bool bFlagFromBottom = (nFlags & REFFLDFLAG_STYLE_FROM_BOTTOM) == REFFLDFLAG_STYLE_FROM_BOTTOM; + + Point aPt; + std::pair const tmp(aPt, false); + + if (!pContentFrame) SAL_WARN("xmloff.text", ": Missing content frame for marginal styleref"); + const SwPageFrame* pPageFrame = nullptr; + + if (pContentFrame) + pPageFrame = pContentFrame->FindPageFrame(); + + const SwNode* pPageStart(nullptr); + const SwNode* pPageEnd(nullptr); + + if (pPageFrame) + { + const SwContentFrame* pPageStartFrame = pPageFrame->FindFirstBodyContent(); + const SwContentFrame* pPageEndFrame = pPageFrame->FindLastBodyContent(); + + if (pPageStartFrame) + { + if (pPageStartFrame->IsTextFrame()) + { + pPageStart = static_cast(pPageStartFrame) + ->GetTextNodeFirst(); + } + else + { + pPageStart + = static_cast(pPageStartFrame)->GetNode(); + } + } + + if (pPageEndFrame) + { + if (pPageEndFrame->IsTextFrame()) + { + pPageEnd = static_cast(pPageEndFrame) + ->GetTextNodeFirst(); + } + else + { + pPageEnd = static_cast(pPageEndFrame)->GetNode(); + } + } + } + + if (!pPageStart || !pPageEnd) + { + pPageStart = pReference; + pPageEnd = pReference; + } + + std::deque pSearchSecond; + std::deque pInPage; /* or pSearchFirst */ + std::deque pSearchThird; + + bool beforeStart = true; + bool beforeEnd = true; + + const SwNodes& nodes = pDoc->GetNodes(); + for (SwNodeOffset n(0); n < nodes.Count(); n++) + { + if (beforeStart && *pPageStart == *nodes[n]) + { + beforeStart = false; + } + + if (beforeStart) + { + pSearchSecond.push_front(nodes[n]); + } + else if (beforeEnd) + { + if (bFlagFromBottom) + pInPage.push_front(nodes[n]); + else + pInPage.push_back(nodes[n]); + + if (*pPageEnd == *nodes[n]) + { + beforeEnd = false; + } + } + else + pSearchThird.push_back(nodes[n]); + } + + pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd); + if (pTextNd) + return pTextNd; + + // 2. Search up from the top of the page + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); + if (pTextNd) + return pTextNd; + + // 3. Search down from the bottom of the page + pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd); + if (pTextNd) + return pTextNd; + + // Word has case insensitive styles. LO has case sensitive styles. If we didn't find + // it yet, maybe we could with a case insensitive search. Let's do that + + pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd, + false /* bCaseSensitive */); + if (pTextNd) + return pTextNd; + + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, + false /* bCaseSensitive */); + if (pTextNd) + return pTextNd; + + pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd, + false /* bCaseSensitive */); + return pTextNd; +} + +SwTextNode* SwGetRefFieldType::FindAnchorRefStyleOther(SwDoc* pDoc, + sal_Int32* pStt, sal_Int32* pEnd, + SwTextNode* pSelf, + const SwTextNode* pReference, std::u16string_view styleName) +{ + // Normally, styleref does searches around the field position + // For references, styleref acts from the position of the reference not the field + // Happily, the previous code saves either one into pReference, so the following is generic for both + + SwTextNode* pTextNd = nullptr; + std::deque pSearchFirst; + std::deque pSearchSecond; + + bool beforeElement = true; + + const SwNodes& nodes = pDoc->GetNodes(); + for (SwNodeOffset n(0); n < nodes.Count(); n++) + { + if (beforeElement) + { + pSearchFirst.push_front(nodes[n]); + + if (*pReference == *nodes[n]) + { + beforeElement = false; + } + } + pSearchSecond.push_back(nodes[n]); + } + + // 1. Search up until we hit the top of the document + + pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd); + if (pTextNd) + return pTextNd; + + // 2. Search down until we hit the bottom of the document + + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); + if (pTextNd) + return pTextNd; + + // Again, we need to remember that Word styles are not case sensitive + + pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd, + false /* bCaseSensitive */); + if (pTextNd) + return pTextNd; + + pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, + false /* bCaseSensitive */); + return pTextNd; +} + namespace { struct RefIdsMap From 78ef285661c9f936c2bf2fa832c3aec7bbb1760a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 12:24:46 +0100 Subject: [PATCH 097/155] Use '#pragma once' in vclxfont.hxx Change-Id: I445ec8a08c6622c681e459efc2dd2afbf74dd78e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177794 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- include/toolkit/awt/vclxfont.hxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/toolkit/awt/vclxfont.hxx b/include/toolkit/awt/vclxfont.hxx index c3276de03c9f..16f349038287 100644 --- a/include/toolkit/awt/vclxfont.hxx +++ b/include/toolkit/awt/vclxfont.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX -#define INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX +#pragma once #include #include @@ -67,7 +66,4 @@ public: sal_Bool SAL_CALL hasGlyphs( const OUString& aText ) override; }; - -#endif // INCLUDED_TOOLKIT_AWT_VCLXFONT_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 7431507d247b6a5e867ae85647550f55d3641e31 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 13:11:19 +0100 Subject: [PATCH 098/155] toolkit: Pass VCLXFont init args in ctor Pass arguments right away in ctor rather than having a ctor that takes no arguments and then having to call VCLXFont::Init with the arguments right after calling the ctor. Change-Id: I651e27154499f61638409377438f9589bc7412a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177795 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- accessibility/source/extended/accessibletabbar.cxx | 3 +-- .../source/standard/accessiblemenucomponent.cxx | 4 ++-- .../accessibility/accessibledialogcontrolshape.cxx | 3 +-- .../accessibility/accessibledialogwindow.cxx | 3 +-- include/toolkit/awt/vclxfont.hxx | 5 ++--- toolkit/source/awt/vclxaccessiblecomponent.cxx | 3 +-- toolkit/source/awt/vclxdevice.cxx | 4 ++-- toolkit/source/awt/vclxfont.cxx | 14 +++----------- 8 files changed, 13 insertions(+), 26 deletions(-) diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx index 2b1522f30a28..f6b722c09d88 100644 --- a/accessibility/source/extended/accessibletabbar.cxx +++ b/accessibility/source/extended/accessibletabbar.cxx @@ -443,8 +443,7 @@ namespace accessibility aFont = m_pTabBar->GetControlFont(); else aFont = m_pTabBar->GetFont(); - rtl::Reference pVCLXFont = new VCLXFont; - pVCLXFont->Init( *xDev, aFont ); + rtl::Reference pVCLXFont = new VCLXFont(*xDev, aFont); xFont = pVCLXFont; } } diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx index 051828d21a1f..470a87fc8234 100644 --- a/accessibility/source/standard/accessiblemenucomponent.cxx +++ b/accessibility/source/standard/accessiblemenucomponent.cxx @@ -293,8 +293,8 @@ Reference< awt::XFont > OAccessibleMenuComponent::getFont( ) if ( xDev.is() ) { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - rtl::Reference pVCLXFont = new VCLXFont; - pVCLXFont->Init( *xDev, rStyleSettings.GetMenuFont() ); + rtl::Reference pVCLXFont + = new VCLXFont(*xDev, rStyleSettings.GetMenuFont()); xFont = pVCLXFont; } } diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index 22e9403bfed2..0dbe0bbbf364 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -497,8 +497,7 @@ Reference< awt::XFont > AccessibleDialogControlShape::getFont( ) aFont = pWindow->GetControlFont(); else aFont = pWindow->GetFont(); - rtl::Reference pVCLXFont = new VCLXFont; - pVCLXFont->Init( *xDev, aFont ); + rtl::Reference pVCLXFont = new VCLXFont(*xDev, aFont); xFont = pVCLXFont; } } diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 39b19e8a4462..48e887e34dd2 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -766,8 +766,7 @@ Reference< awt::XFont > AccessibleDialogWindow::getFont( ) aFont = m_pDialogWindow->GetControlFont(); else aFont = m_pDialogWindow->GetFont(); - rtl::Reference pVCLXFont = new VCLXFont; - pVCLXFont->Init( *xDev, aFont ); + rtl::Reference pVCLXFont = new VCLXFont(*xDev, aFont); xFont = pVCLXFont; } } diff --git a/include/toolkit/awt/vclxfont.hxx b/include/toolkit/awt/vclxfont.hxx index 16f349038287..4452659e8e4e 100644 --- a/include/toolkit/awt/vclxfont.hxx +++ b/include/toolkit/awt/vclxfont.hxx @@ -47,10 +47,9 @@ class UNLESS_MERGELIBS_MORE(TOOLKIT_DLLPUBLIC) VCLXFont final : bool ImplAssertValidFontMetric(); public: - VCLXFont(); - virtual ~VCLXFont() override; + VCLXFont(css::awt::XDevice& rxDev, const vcl::Font& rFont); + virtual ~VCLXFont() override; - void Init( css::awt::XDevice& rxDev, const vcl::Font& rFont ); const vcl::Font& GetFont() const { return maFont; } // css::lang::XFont diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index b53e56bf5921..e415f353c848 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -820,8 +820,7 @@ uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( ) aFont = pWindow->GetControlFont(); else aFont = pWindow->GetFont(); - rtl::Reference pVCLXFont = new VCLXFont; - pVCLXFont->Init( *xDev, aFont ); + rtl::Reference pVCLXFont = new VCLXFont(*xDev, aFont); xFont = pVCLXFont; } } diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx index c4ed98146713..13acc4d270ec 100644 --- a/toolkit/source/awt/vclxdevice.cxx +++ b/toolkit/source/awt/vclxdevice.cxx @@ -112,8 +112,8 @@ css::uno::Reference< css::awt::XFont > VCLXDevice::getFont( const css::awt::Font css::uno::Reference< css::awt::XFont > xRef; if( mpOutputDevice ) { - rtl::Reference pMetric = new VCLXFont; - pMetric->Init( *this, VCLUnoHelper::CreateFont( rDescriptor, mpOutputDevice->GetFont() ) ); + rtl::Reference pMetric + = new VCLXFont(*this, VCLUnoHelper::CreateFont(rDescriptor, mpOutputDevice->GetFont())); xRef = pMetric; } return xRef; diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx index 32a42dec7579..d95ec480191b 100644 --- a/toolkit/source/awt/vclxfont.cxx +++ b/toolkit/source/awt/vclxfont.cxx @@ -30,24 +30,16 @@ #include #include -VCLXFont::VCLXFont() +VCLXFont::VCLXFont(css::awt::XDevice& rxDev, const vcl::Font& rFont) { - mpFontMetric = nullptr; + mxDevice = &rxDev; + maFont = rFont; } VCLXFont::~VCLXFont() { } -void VCLXFont::Init( css::awt::XDevice& rxDev, const vcl::Font& rFont ) -{ - mxDevice = &rxDev; - - mpFontMetric.reset(); - - maFont = rFont; -} - bool VCLXFont::ImplAssertValidFontMetric() { if ( !mpFontMetric && mxDevice.is() ) From a2c1a337f0bd02353433c2f944049e9f3ee72bcb Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 15:36:59 +0100 Subject: [PATCH 099/155] [API CHANGE] a11y: Drop XAccessibleExtendedComponent::getFont This method from the unpublished XAccessibleExtendedComponent interface is not used by any of the a11y platform bridges, and I don't know of any platform a11y API that would need it. In order to report character/font attributes, there is the XAccessibleText interface and its XAccessiText::getCharacterAttributes method instead, which actually gets used by the platform a11y bridges. Therefore, drop this method to simplify code, and also decouple the accessibility module a bit further from the toolkit module without having to reorganize code further. (VCLXFont from the toolkit module currently gets used in various implementations.) Change-Id: I06ea3cc5998a13927b3f869877b28f03ac07c89b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177809 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- .../inc/extended/accessibletabbar.hxx | 1 - .../inc/extended/accessibletabbarpage.hxx | 1 - .../inc/extended/accessibletabbarpagelist.hxx | 1 - .../inc/standard/accessiblemenucomponent.hxx | 1 - .../standard/accessiblemenuitemcomponent.hxx | 1 - .../standard/vclxaccessibleheaderbaritem.hxx | 1 - .../standard/vclxaccessiblestatusbaritem.hxx | 1 - .../inc/standard/vclxaccessibletabpage.hxx | 1 - .../standard/vclxaccessibletoolboxitem.hxx | 1 - .../source/extended/accessibletabbar.cxx | 25 ----------------- .../source/extended/accessibletabbarpage.cxx | 18 ------------- .../extended/accessibletabbarpagelist.cxx | 18 ------------- .../standard/accessiblemenucomponent.cxx | 27 ------------------- .../standard/accessiblemenuitemcomponent.cxx | 18 ------------- .../standard/vclxaccessibleheaderbaritem.cxx | 7 ----- .../standard/vclxaccessiblestatusbaritem.cxx | 18 ------------- .../source/standard/vclxaccessibletabpage.cxx | 18 ------------- .../standard/vclxaccessibletoolboxitem.cxx | 4 --- .../accessibledialogcontrolshape.cxx | 26 ------------------ .../accessibility/accessibledialogwindow.cxx | 25 ----------------- .../inc/accessibledialogcontrolshape.hxx | 1 - basctl/source/inc/accessibledialogwindow.hxx | 1 - .../accessibility/AccessibleChartElement.cxx | 19 ------------- .../accessibility/AccessibleChartElement.hxx | 1 - .../accessibility/AccessibleChartShape.cxx | 9 ------- .../accessibility/AccessibleChartShape.hxx | 1 - .../accessibility/AccessibleComponentBase.cxx | 6 ----- include/editeng/AccessibleComponentBase.hxx | 1 - .../toolkit/awt/vclxaccessiblecomponent.hxx | 1 - .../XAccessibleExtendedComponent.idl | 8 ------ ...sun.star.comp.svtools.AccessibleTabBar.csv | 1 - ...star.comp.svtools.AccessibleTabBarPage.csv | 1 - ....comp.svtools.AccessibleTabBarPageList.csv | 1 - ...ar.comp.unknown.AccessibleControlShape.csv | 1 - ...ar.comp.unknown.AccessibleGraphicShape.csv | 1 - ...n.star.comp.unknown.AccessibleOLEShape.csv | 1 - ....star.comp.unknown.AccessiblePageShape.csv | 1 - ...own.AccessiblePresentationGraphicShape.csv | 1 - ...unknown.AccessiblePresentationOLEShape.csv | 1 - ...mp.unknown.AccessiblePresentationShape.csv | 1 - ....sun.star.comp.unknown.AccessibleShape.csv | 1 - ...sun.star.comp.toolkit.AccessibleButton.csv | 1 - ...n.star.comp.toolkit.AccessibleCheckBox.csv | 1 - ...n.star.comp.toolkit.AccessibleComboBox.csv | 1 - ...omp.toolkit.AccessibleDropDownComboBox.csv | 1 - ...comp.toolkit.AccessibleDropDownListBox.csv | 1 - ...m.sun.star.comp.toolkit.AccessibleEdit.csv | 1 - ....star.comp.toolkit.AccessibleFixedText.csv | 1 - ...m.sun.star.comp.toolkit.AccessibleList.csv | 1 - ...un.star.comp.toolkit.AccessibleListBox.csv | 1 - ...m.sun.star.comp.toolkit.AccessibleMenu.csv | 1 - ...un.star.comp.toolkit.AccessibleMenuBar.csv | 1 - ...n.star.comp.toolkit.AccessibleMenuItem.csv | 1 - ...r.comp.toolkit.AccessibleMenuSeparator.csv | 1 - ....star.comp.toolkit.AccessiblePopupMenu.csv | 1 - ...tar.comp.toolkit.AccessibleRadioButton.csv | 1 - ....star.comp.toolkit.AccessibleScrollBar.csv | 1 - ....star.comp.toolkit.AccessibleStatusBar.csv | 1 - ...r.comp.toolkit.AccessibleStatusBarItem.csv | 1 - ...star.comp.toolkit.AccessibleTabControl.csv | 1 - ...un.star.comp.toolkit.AccessibleTabPage.csv | 1 - ...un.star.comp.toolkit.AccessibleToolBox.csv | 1 - ...tar.comp.toolkit.AccessibleToolBoxItem.csv | 1 - ...sun.star.comp.toolkit.AccessibleWindow.csv | 1 - .../_XAccessibleExtendedComponent.java | 10 ------- svx/source/table/accessiblecell.cxx | 8 ------ svx/source/table/accessiblecell.hxx | 1 - .../toolkit/AccessibleStatusBarItem.java | 1 - .../_XAccessibleExtendedComponent.java | 10 ------- .../XAccessibleExtendedComponentTester.cxx | 9 ------- .../XAccessibleExtendedComponentTester.hxx | 2 -- .../source/awt/vclxaccessiblecomponent.cxx | 24 ----------------- vcl/osx/a11ytextattributeswrapper.mm | 1 + 73 files changed, 1 insertion(+), 360 deletions(-) diff --git a/accessibility/inc/extended/accessibletabbar.hxx b/accessibility/inc/extended/accessibletabbar.hxx index 86848679ffbb..6d75c83a7e23 100644 --- a/accessibility/inc/extended/accessibletabbar.hxx +++ b/accessibility/inc/extended/accessibletabbar.hxx @@ -79,7 +79,6 @@ namespace accessibility virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; }; diff --git a/accessibility/inc/extended/accessibletabbarpage.hxx b/accessibility/inc/extended/accessibletabbarpage.hxx index 052650c19de0..a8266b55c2a5 100644 --- a/accessibility/inc/extended/accessibletabbarpage.hxx +++ b/accessibility/inc/extended/accessibletabbarpage.hxx @@ -93,7 +93,6 @@ namespace accessibility virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; }; diff --git a/accessibility/inc/extended/accessibletabbarpagelist.hxx b/accessibility/inc/extended/accessibletabbarpagelist.hxx index b3045aa77c6f..950a37167086 100644 --- a/accessibility/inc/extended/accessibletabbarpagelist.hxx +++ b/accessibility/inc/extended/accessibletabbarpagelist.hxx @@ -89,7 +89,6 @@ namespace accessibility virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; diff --git a/accessibility/inc/standard/accessiblemenucomponent.hxx b/accessibility/inc/standard/accessiblemenucomponent.hxx index 90c89922654a..e9d46dcfa70a 100644 --- a/accessibility/inc/standard/accessiblemenucomponent.hxx +++ b/accessibility/inc/standard/accessiblemenucomponent.hxx @@ -60,7 +60,6 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; diff --git a/accessibility/inc/standard/accessiblemenuitemcomponent.hxx b/accessibility/inc/standard/accessiblemenuitemcomponent.hxx index b6adebbde81e..fae6e577b590 100644 --- a/accessibility/inc/standard/accessiblemenuitemcomponent.hxx +++ b/accessibility/inc/standard/accessiblemenuitemcomponent.hxx @@ -78,7 +78,6 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; }; diff --git a/accessibility/inc/standard/vclxaccessibleheaderbaritem.hxx b/accessibility/inc/standard/vclxaccessibleheaderbaritem.hxx index 563e86ff5252..337a3db65845 100644 --- a/accessibility/inc/standard/vclxaccessibleheaderbaritem.hxx +++ b/accessibility/inc/standard/vclxaccessibleheaderbaritem.hxx @@ -79,7 +79,6 @@ public: virtual sal_Int32 SAL_CALL getBackground() override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; }; diff --git a/accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx b/accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx index 9556f961d140..87bed611bf0a 100644 --- a/accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx +++ b/accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx @@ -92,7 +92,6 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; diff --git a/accessibility/inc/standard/vclxaccessibletabpage.hxx b/accessibility/inc/standard/vclxaccessibletabpage.hxx index efdc75e2c677..fece8744721a 100644 --- a/accessibility/inc/standard/vclxaccessibletabpage.hxx +++ b/accessibility/inc/standard/vclxaccessibletabpage.hxx @@ -102,7 +102,6 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; diff --git a/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx index 6fbfc1e55138..e33e61eb568e 100644 --- a/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx +++ b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx @@ -127,7 +127,6 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx index f6b722c09d88..58f8ab58539f 100644 --- a/accessibility/source/extended/accessibletabbar.cxx +++ b/accessibility/source/extended/accessibletabbar.cxx @@ -427,31 +427,6 @@ namespace accessibility // XAccessibleExtendedComponent - - Reference< awt::XFont > AccessibleTabBar::getFont( ) - { - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - if ( m_pTabBar ) - { - Reference< awt::XDevice > xDev( m_pTabBar->GetComponentInterface(), UNO_QUERY ); - if ( xDev.is() ) - { - vcl::Font aFont; - if ( m_pTabBar->IsControlFont() ) - aFont = m_pTabBar->GetControlFont(); - else - aFont = m_pTabBar->GetFont(); - rtl::Reference pVCLXFont = new VCLXFont(*xDev, aFont); - xFont = pVCLXFont; - } - } - - return xFont; - } - - OUString AccessibleTabBar::getTitledBorderText( ) { OExternalLockGuard aGuard( this ); diff --git a/accessibility/source/extended/accessibletabbarpage.cxx b/accessibility/source/extended/accessibletabbarpage.cxx index 97af7f39d8b1..4f9249ce9099 100644 --- a/accessibility/source/extended/accessibletabbarpage.cxx +++ b/accessibility/source/extended/accessibletabbarpage.cxx @@ -371,24 +371,6 @@ namespace accessibility // XAccessibleExtendedComponent - - Reference< awt::XFont > AccessibleTabBarPage::getFont( ) - { - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; - } - - OUString AccessibleTabBarPage::getTitledBorderText( ) { OExternalLockGuard aGuard( this ); diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx index db553e40e0ce..a1e1f0a6f893 100644 --- a/accessibility/source/extended/accessibletabbarpagelist.cxx +++ b/accessibility/source/extended/accessibletabbarpagelist.cxx @@ -548,24 +548,6 @@ namespace accessibility // XAccessibleExtendedComponent - - Reference< awt::XFont > AccessibleTabBarPageList::getFont( ) - { - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; - } - - OUString AccessibleTabBarPageList::getTitledBorderText( ) { return OUString(); diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx index 470a87fc8234..4fbbd394e92f 100644 --- a/accessibility/source/standard/accessiblemenucomponent.cxx +++ b/accessibility/source/standard/accessiblemenucomponent.cxx @@ -277,33 +277,6 @@ sal_Int32 OAccessibleMenuComponent::getBackground( ) // XAccessibleExtendedComponent - -Reference< awt::XFont > OAccessibleMenuComponent::getFont( ) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - - if ( m_pMenu ) - { - vcl::Window* pWindow = m_pMenu->GetWindow(); - if ( pWindow ) - { - Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY ); - if ( xDev.is() ) - { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - rtl::Reference pVCLXFont - = new VCLXFont(*xDev, rStyleSettings.GetMenuFont()); - xFont = pVCLXFont; - } - } - } - - return xFont; -} - - OUString OAccessibleMenuComponent::getTitledBorderText( ) { OExternalLockGuard aGuard( this ); diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx index 011e05f9dadf..0fa008b11aff 100644 --- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx +++ b/accessibility/source/standard/accessiblemenuitemcomponent.cxx @@ -417,24 +417,6 @@ sal_Int32 OAccessibleMenuItemComponent::getBackground( ) // XAccessibleExtendedComponent - -Reference< awt::XFont > OAccessibleMenuItemComponent::getFont( ) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; -} - - OUString OAccessibleMenuItemComponent::getTitledBorderText( ) { OExternalLockGuard aGuard( this ); diff --git a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx index df740cd7cf62..7e9f03f061d9 100644 --- a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx +++ b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx @@ -227,13 +227,6 @@ sal_Int32 VCLXAccessibleHeaderBarItem::getBackground() // XAccessibleExtendedComponent - -Reference< awt::XFont > VCLXAccessibleHeaderBarItem::getFont() -{ - return Reference< awt::XFont >(); -} - - OUString VCLXAccessibleHeaderBarItem::getTitledBorderText() { return OUString(); diff --git a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx index b49f3cbecd4b..b309d6c39c9d 100644 --- a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx +++ b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx @@ -378,24 +378,6 @@ sal_Int32 VCLXAccessibleStatusBarItem::getBackground( ) // XAccessibleExtendedComponent - -Reference< awt::XFont > VCLXAccessibleStatusBarItem::getFont( ) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; -} - - OUString VCLXAccessibleStatusBarItem::getTitledBorderText( ) { OExternalLockGuard aGuard( this ); diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx index 1cf1330cfbe9..9c1b2d3db303 100644 --- a/accessibility/source/standard/vclxaccessibletabpage.cxx +++ b/accessibility/source/standard/vclxaccessibletabpage.cxx @@ -469,24 +469,6 @@ sal_Int32 VCLXAccessibleTabPage::getBackground( ) // XAccessibleExtendedComponent - -Reference< awt::XFont > VCLXAccessibleTabPage::getFont( ) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - xFont = xParentComp->getFont(); - } - - return xFont; -} - - OUString VCLXAccessibleTabPage::getTitledBorderText( ) { OExternalLockGuard aGuard( this ); diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index bb6796ba4d76..b7e31f3bd1be 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -594,10 +594,6 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getBackground( ) } // XAccessibleExtendedComponent -Reference< awt::XFont > SAL_CALL VCLXAccessibleToolBoxItem::getFont( ) -{ - return uno::Reference< awt::XFont >(); -} OUString SAL_CALL VCLXAccessibleToolBoxItem::getTitledBorderText( ) { diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index 0dbe0bbbf364..0d929b144f47 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -480,32 +480,6 @@ sal_Int32 AccessibleDialogControlShape::getBackground( ) // XAccessibleExtendedComponent - -Reference< awt::XFont > AccessibleDialogControlShape::getFont( ) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - vcl::Window* pWindow = GetWindow(); - if ( pWindow ) - { - Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY ); - if ( xDev.is() ) - { - vcl::Font aFont; - if ( pWindow->IsControlFont() ) - aFont = pWindow->GetControlFont(); - else - aFont = pWindow->GetFont(); - rtl::Reference pVCLXFont = new VCLXFont(*xDev, aFont); - xFont = pVCLXFont; - } - } - - return xFont; -} - - OUString AccessibleDialogControlShape::getTitledBorderText( ) { OExternalLockGuard aGuard( this ); diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 48e887e34dd2..9e31a8783cc4 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -750,31 +750,6 @@ sal_Int32 AccessibleDialogWindow::getBackground( ) // XAccessibleExtendedComponent - -Reference< awt::XFont > AccessibleDialogWindow::getFont( ) -{ - OExternalLockGuard aGuard( this ); - - Reference< awt::XFont > xFont; - if ( m_pDialogWindow ) - { - Reference< awt::XDevice > xDev( m_pDialogWindow->GetComponentInterface(), UNO_QUERY ); - if ( xDev.is() ) - { - vcl::Font aFont; - if ( m_pDialogWindow->IsControlFont() ) - aFont = m_pDialogWindow->GetControlFont(); - else - aFont = m_pDialogWindow->GetFont(); - rtl::Reference pVCLXFont = new VCLXFont(*xDev, aFont); - xFont = pVCLXFont; - } - } - - return xFont; -} - - OUString AccessibleDialogWindow::getTitledBorderText( ) { OExternalLockGuard aGuard( this ); diff --git a/basctl/source/inc/accessibledialogcontrolshape.hxx b/basctl/source/inc/accessibledialogcontrolshape.hxx index 3af6e3da90ee..6979fee0f025 100644 --- a/basctl/source/inc/accessibledialogcontrolshape.hxx +++ b/basctl/source/inc/accessibledialogcontrolshape.hxx @@ -110,7 +110,6 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; }; diff --git a/basctl/source/inc/accessibledialogwindow.hxx b/basctl/source/inc/accessibledialogwindow.hxx index 0332b98a4175..42c1f9390433 100644 --- a/basctl/source/inc/accessibledialogwindow.hxx +++ b/basctl/source/inc/accessibledialogwindow.hxx @@ -124,7 +124,6 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx index 2ed0d06e29c4..adec462c4db3 100644 --- a/chart2/source/controller/accessibility/AccessibleChartElement.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx @@ -138,25 +138,6 @@ OUString SAL_CALL AccessibleChartElement::getAccessibleDescription() } // ________ AccessibleChartElement::XAccessibleExtendedComponent ________ -Reference< awt::XFont > SAL_CALL AccessibleChartElement::getFont() -{ - CheckDisposeState(); - - Reference< awt::XFont > xFont; - Reference< awt::XDevice > xDevice( Reference< awt::XWindow >( GetInfo().m_xWindow ), uno::UNO_QUERY ); - - if( xDevice.is()) - { - Reference< beans::XMultiPropertySet > xObjProp( - ObjectIdentifier::getObjectPropertySet( - GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument ), uno::UNO_QUERY ); - awt::FontDescriptor aDescr( - CharacterProperties::createFontDescriptorFromPropertySet( xObjProp )); - xFont = xDevice->getFont( aDescr ); - } - - return xFont; -} OUString SAL_CALL AccessibleChartElement::getTitledBorderText() { diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.hxx b/chart2/source/controller/accessibility/AccessibleChartElement.hxx index 283efed69d80..e2a94bf69ff8 100644 --- a/chart2/source/controller/accessibility/AccessibleChartElement.hxx +++ b/chart2/source/controller/accessibility/AccessibleChartElement.hxx @@ -70,7 +70,6 @@ public: virtual OUString SAL_CALL getAccessibleDescription() override; // ________ XAccessibleExtendedComponent ________ - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont() override; virtual OUString SAL_CALL getTitledBorderText() override; virtual OUString SAL_CALL getToolTipText() override; diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.cxx b/chart2/source/controller/accessibility/AccessibleChartShape.cxx index f0ebacf77a86..6d573762eb95 100644 --- a/chart2/source/controller/accessibility/AccessibleChartShape.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartShape.cxx @@ -215,15 +215,6 @@ sal_Int32 AccessibleChartShape::getBackground() } // ________ XAccessibleExtendedComponent ________ -Reference< awt::XFont > AccessibleChartShape::getFont() -{ - Reference< awt::XFont > xFont; - if ( m_pAccShape.is() ) - { - xFont.set( m_pAccShape->getFont() ); - } - return xFont; -} OUString AccessibleChartShape::getTitledBorderText() { diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.hxx b/chart2/source/controller/accessibility/AccessibleChartShape.hxx index c31204ed3c8a..3f8975921e68 100644 --- a/chart2/source/controller/accessibility/AccessibleChartShape.hxx +++ b/chart2/source/controller/accessibility/AccessibleChartShape.hxx @@ -69,7 +69,6 @@ public: virtual sal_Int32 SAL_CALL getBackground() override; // ________ XAccessibleExtendedComponent ________ - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont() override; virtual OUString SAL_CALL getTitledBorderText() override; virtual OUString SAL_CALL getToolTipText() override; diff --git a/editeng/source/accessibility/AccessibleComponentBase.cxx b/editeng/source/accessibility/AccessibleComponentBase.cxx index 5e95afbd2f70..4b1d5438b735 100644 --- a/editeng/source/accessibility/AccessibleComponentBase.cxx +++ b/editeng/source/accessibility/AccessibleComponentBase.cxx @@ -114,12 +114,6 @@ sal_Int32 SAL_CALL AccessibleComponentBase::getBackground() // XAccessibleExtendedComponent -css::uno::Reference< css::awt::XFont > SAL_CALL - AccessibleComponentBase::getFont() -{ - return uno::Reference(); -} - OUString SAL_CALL AccessibleComponentBase::getTitledBorderText() { diff --git a/include/editeng/AccessibleComponentBase.hxx b/include/editeng/AccessibleComponentBase.hxx index 80b0c2b95030..cf73a5bd2144 100644 --- a/include/editeng/AccessibleComponentBase.hxx +++ b/include/editeng/AccessibleComponentBase.hxx @@ -92,7 +92,6 @@ public: virtual sal_Int32 SAL_CALL getBackground() override; //===== XAccessibleExtendedComponent ==================================== - virtual css::uno::Reference SAL_CALL getFont() override; virtual OUString SAL_CALL getTitledBorderText() override; virtual OUString SAL_CALL getToolTipText() override; diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx index d3aaa30f5646..9227f6958035 100644 --- a/include/toolkit/awt/vclxaccessiblecomponent.hxx +++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx @@ -100,7 +100,6 @@ public: virtual sal_Int32 SAL_CALL getBackground( ) override; // css::accessibility::XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; virtual OUString SAL_CALL getTitledBorderText( ) override; virtual OUString SAL_CALL getToolTipText( ) override; diff --git a/offapi/com/sun/star/accessibility/XAccessibleExtendedComponent.idl b/offapi/com/sun/star/accessibility/XAccessibleExtendedComponent.idl index d8d755fe0b2a..ea9afea783b1 100644 --- a/offapi/com/sun/star/accessibility/XAccessibleExtendedComponent.idl +++ b/offapi/com/sun/star/accessibility/XAccessibleExtendedComponent.idl @@ -37,14 +37,6 @@ module com { module sun { module star { module accessibility { */ interface XAccessibleExtendedComponent : XAccessibleComponent { - /** Returns the font of this object. - - @return - The returned reference to a font object is empty if a font is not - supported by this object. - */ - ::com::sun::star::awt::XFont getFont (); - /** Returns the titled border text.

This method stems from the Java interface diff --git a/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBar.csv b/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBar.csv index 73948b2fc6f0..93aca238e1fc 100644 --- a/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBar.csv +++ b/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBar.csv @@ -1,4 +1,3 @@ -"AccessibleTabBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleTabBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleTabBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleTabBar";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBarPage.csv b/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBarPage.csv index 32b30d64b1a5..0390988618e1 100644 --- a/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBarPage.csv +++ b/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBarPage.csv @@ -1,4 +1,3 @@ -"AccessibleTabBarPage";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleTabBarPage";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleTabBarPage";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleTabBarPage";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBarPageList.csv b/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBarPageList.csv index b4f87286f6b7..fcb2912662d8 100644 --- a/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBarPageList.csv +++ b/qadevOOo/objdsc/svtools/com.sun.star.comp.svtools.AccessibleTabBarPageList.csv @@ -1,4 +1,3 @@ -"AccessibleTabBarPageList";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleTabBarPageList";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleTabBarPageList";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleTabBarPageList";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleControlShape.csv b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleControlShape.csv index 887d3151b4c5..832b17a4368f 100644 --- a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleControlShape.csv +++ b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleControlShape.csv @@ -1,4 +1,3 @@ -"AccessibleControlShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getFont()" "AccessibleControlShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getTitledBorderText()" "AccessibleControlShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getToolTipText()" "AccessibleControlShape";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleGraphicShape.csv b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleGraphicShape.csv index 2db06b3e8b53..35ca0d8dc5f5 100644 --- a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleGraphicShape.csv +++ b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleGraphicShape.csv @@ -1,4 +1,3 @@ -"AccessibleGraphicShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getFont()" "AccessibleGraphicShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getTitledBorderText()" "AccessibleGraphicShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getToolTipText()" "AccessibleGraphicShape";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleOLEShape.csv b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleOLEShape.csv index e5db4c6989e8..a8a99d8561f9 100644 --- a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleOLEShape.csv +++ b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleOLEShape.csv @@ -1,4 +1,3 @@ -"AccessibleOLEShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getFont()" "AccessibleOLEShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getTitledBorderText()" "AccessibleOLEShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getToolTipText()" "AccessibleOLEShape";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePageShape.csv b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePageShape.csv index 8a61c76902dd..0ac7da9bf9b9 100644 --- a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePageShape.csv +++ b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePageShape.csv @@ -1,4 +1,3 @@ -"AccessiblePageShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getFont()" "AccessiblePageShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getTitledBorderText()" "AccessiblePageShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getToolTipText()" "AccessiblePageShape";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationGraphicShape.csv b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationGraphicShape.csv index 991f2b8f078c..1e57d8568041 100644 --- a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationGraphicShape.csv +++ b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationGraphicShape.csv @@ -1,4 +1,3 @@ -"AccessiblePresentationGraphicShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getFont()" "AccessiblePresentationGraphicShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getTitledBorderText()" "AccessiblePresentationGraphicShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getToolTipText()" "AccessiblePresentationGraphicShape";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationOLEShape.csv b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationOLEShape.csv index c37eea41cb82..c69cbd7e00b1 100644 --- a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationOLEShape.csv +++ b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationOLEShape.csv @@ -1,4 +1,3 @@ -"AccessiblePresentationOLEShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getFont()" "AccessiblePresentationOLEShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getTitledBorderText()" "AccessiblePresentationOLEShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getToolTipText()" "AccessiblePresentationOLEShape";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationShape.csv b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationShape.csv index 84d3ebc1fe12..6ba64047c3ab 100644 --- a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationShape.csv +++ b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessiblePresentationShape.csv @@ -1,4 +1,3 @@ -"AccessiblePresentationShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getFont()" "AccessiblePresentationShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getTitledBorderText()" "AccessiblePresentationShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getToolTipText()" "AccessiblePresentationShape";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleShape.csv b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleShape.csv index 154ee27961c0..24c5fbdb945a 100644 --- a/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleShape.csv +++ b/qadevOOo/objdsc/svx/com.sun.star.comp.unknown.AccessibleShape.csv @@ -1,4 +1,3 @@ -"AccessibleShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getFont()" "AccessibleShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getTitledBorderText()" "AccessibleShape";"com::sun::star::accessibility::XAccessibleExtendedComponent#optional";"getToolTipText()" "AccessibleShape";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleButton.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleButton.csv index b5074fae0796..ebef697030df 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleButton.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleButton.csv @@ -1,4 +1,3 @@ -"AccessibleButton";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleButton";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleButton";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleButton";"com::sun::star::accessibility::XAccessibleValue";"getCurrentValue()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleCheckBox.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleCheckBox.csv index f55d013eae03..59e2efe3799a 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleCheckBox.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleCheckBox.csv @@ -1,4 +1,3 @@ -"AccessibleCheckBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleCheckBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleCheckBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleCheckBox";"com::sun::star::accessibility::XAccessibleValue";"getCurrentValue()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleComboBox.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleComboBox.csv index 30956a4ef8a0..b2c7d4414714 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleComboBox.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleComboBox.csv @@ -1,4 +1,3 @@ -"AccessibleComboBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleComboBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleComboBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleComboBox";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleDropDownComboBox.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleDropDownComboBox.csv index 96e3d27f3ba4..593fdcab0416 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleDropDownComboBox.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleDropDownComboBox.csv @@ -1,4 +1,3 @@ -"AccessibleDropDownComboBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleDropDownComboBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleDropDownComboBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleDropDownComboBox";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleDropDownListBox.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleDropDownListBox.csv index 2df3ecb2f6a3..be66442c2e93 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleDropDownListBox.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleDropDownListBox.csv @@ -1,4 +1,3 @@ -"AccessibleDropDownListBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleDropDownListBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleDropDownListBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleDropDownListBox";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleEdit.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleEdit.csv index ab60d7412017..004352673b9d 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleEdit.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleEdit.csv @@ -1,4 +1,3 @@ -"AccessibleEdit";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleEdit";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleEdit";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleEdit";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleFixedText.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleFixedText.csv index 0a58a7933a6c..c736c47d402f 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleFixedText.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleFixedText.csv @@ -1,4 +1,3 @@ -"AccessibleFixedText";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleFixedText";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleFixedText";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleFixedText";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleList.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleList.csv index ddbc2a586b70..4952e9f2b1dc 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleList.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleList.csv @@ -1,4 +1,3 @@ -"AccessibleList";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleList";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleList";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleList";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleListBox.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleListBox.csv index fbf420288a74..819e661c184a 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleListBox.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleListBox.csv @@ -1,4 +1,3 @@ -"AccessibleListBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleListBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleListBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleListBox";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenu.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenu.csv index 017a8ff4e902..8d0e92af515a 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenu.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenu.csv @@ -1,4 +1,3 @@ -"AccessibleMenu";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleMenu";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleMenu";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleMenu";"com::sun::star::accessibility::XAccessibleValue";"getCurrentValue()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuBar.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuBar.csv index 580dcf2b2bb8..f1c3c3696961 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuBar.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuBar.csv @@ -1,4 +1,3 @@ -"AccessibleMenuBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleMenuBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleMenuBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleMenuBar";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuItem.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuItem.csv index 12978754ab68..9c69804ab849 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuItem.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuItem.csv @@ -1,4 +1,3 @@ -"AccessibleMenuItem";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleMenuItem";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleMenuItem";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleMenuItem";"com::sun::star::accessibility::XAccessibleValue";"getCurrentValue()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuSeparator.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuSeparator.csv index d0fd63b66dce..ada369f7263f 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuSeparator.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleMenuSeparator.csv @@ -1,4 +1,3 @@ -"AccessibleMenuSeparator";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleMenuSeparator";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleMenuSeparator";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleMenuSeparator";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessiblePopupMenu.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessiblePopupMenu.csv index ec26fdf299e8..205f80cd9c08 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessiblePopupMenu.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessiblePopupMenu.csv @@ -1,4 +1,3 @@ -"AccessiblePopupMenu";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessiblePopupMenu";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessiblePopupMenu";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessiblePopupMenu";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleRadioButton.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleRadioButton.csv index e6b09510472c..b64a3aa8ed24 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleRadioButton.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleRadioButton.csv @@ -1,4 +1,3 @@ -"AccessibleRadioButton";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleRadioButton";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleRadioButton";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleRadioButton";"com::sun::star::accessibility::XAccessibleValue";"getCurrentValue()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleScrollBar.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleScrollBar.csv index 38ef1161a39e..e5d9daee7c10 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleScrollBar.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleScrollBar.csv @@ -1,4 +1,3 @@ -"AccessibleScrollBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleScrollBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleScrollBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleScrollBar";"com::sun::star::accessibility::XAccessibleValue";"getCurrentValue()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleStatusBar.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleStatusBar.csv index 3850e15f2969..e2c8e4e2c009 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleStatusBar.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleStatusBar.csv @@ -1,4 +1,3 @@ -"AccessibleStatusBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleStatusBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleStatusBar";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleStatusBar";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleStatusBarItem.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleStatusBarItem.csv index 78254662dd4b..0d08841628d0 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleStatusBarItem.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleStatusBarItem.csv @@ -1,4 +1,3 @@ -"AccessibleStatusBarItem";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleStatusBarItem";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleStatusBarItem";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleStatusBarItem";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleTabControl.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleTabControl.csv index 34936b28a5c1..d8434f71616a 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleTabControl.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleTabControl.csv @@ -1,4 +1,3 @@ -"AccessibleTabControl";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleTabControl";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleTabControl";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleTabControl";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleTabPage.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleTabPage.csv index 9df4ff13dc9c..de2248619165 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleTabPage.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleTabPage.csv @@ -1,4 +1,3 @@ -"AccessibleTabPage";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleTabPage";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleTabPage";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleTabPage";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleToolBox.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleToolBox.csv index 38b6e66890d4..a230ea8b3282 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleToolBox.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleToolBox.csv @@ -1,4 +1,3 @@ -"AccessibleToolBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleToolBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleToolBox";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleToolBox";"com::sun::star::accessibility::XAccessibleEventBroadcaster#optional";"addEventListener()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleToolBoxItem.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleToolBoxItem.csv index c37673d7e271..b38537283fc9 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleToolBoxItem.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleToolBoxItem.csv @@ -1,4 +1,3 @@ -"AccessibleToolBoxItem";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleToolBoxItem";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleToolBoxItem";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleToolBoxItem";"com::sun::star::accessibility::XAccessibleValue";"getCurrentValue()" diff --git a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleWindow.csv b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleWindow.csv index c59a575c8fb2..b8679d33948a 100644 --- a/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleWindow.csv +++ b/qadevOOo/objdsc/toolkit/com.sun.star.comp.toolkit.AccessibleWindow.csv @@ -1,4 +1,3 @@ -"AccessibleWindow";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getFont()" "AccessibleWindow";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getTitledBorderText()" "AccessibleWindow";"com::sun::star::accessibility::XAccessibleExtendedComponent";"getToolTipText()" "AccessibleWindow";"com::sun::star::accessibility::XAccessibleEventBroadcaster";"addEventListener()" diff --git a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleExtendedComponent.java b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleExtendedComponent.java index 2156c09a00dc..902722a6a1a5 100644 --- a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleExtendedComponent.java +++ b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleExtendedComponent.java @@ -29,7 +29,6 @@ import com.sun.star.awt.XFont; *

    *
  • getForeground()
  • *
  • getBackground()
  • - *
  • getFont()
  • *
  • isEnabled()
  • *
  • getTitledBorderText()
  • *
  • getToolTipText()
  • @@ -60,15 +59,6 @@ public class _XAccessibleExtendedComponent extends MultiMethodTest { tRes.tested("getBackground()", true); } - /** - * Just calls the method. - */ - public void _getFont() { - XFont font = oObj.getFont(); - log.println("getFont(): " + font); - tRes.tested("getFont()", true); - } - /** * Calls the method and checks returned value. * Has OK status if returned value isn't null. diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index e74674d9ba26..65b74d4ae6de 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -385,14 +385,6 @@ sal_Int32 SAL_CALL AccessibleCell::getBackground() // XAccessibleExtendedComponent - -css::uno::Reference< css::awt::XFont > SAL_CALL AccessibleCell::getFont() -{ -//todo - return AccessibleComponentBase::getFont(); -} - - OUString SAL_CALL AccessibleCell::getTitledBorderText() { return AccessibleComponentBase::getTitledBorderText(); diff --git a/svx/source/table/accessiblecell.hxx b/svx/source/table/accessiblecell.hxx index 39c45da3d890..4218225cc064 100644 --- a/svx/source/table/accessiblecell.hxx +++ b/svx/source/table/accessiblecell.hxx @@ -84,7 +84,6 @@ public: virtual sal_Int32 SAL_CALL getBackground() override; // XAccessibleExtendedComponent - virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont() override; virtual OUString SAL_CALL getTitledBorderText() override; virtual OUString SAL_CALL getToolTipText() override; diff --git a/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java b/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java index d2c9b0f68a43..153bdd494aaf 100644 --- a/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java +++ b/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java @@ -305,7 +305,6 @@ public class AccessibleStatusBarItem { System.out.println("*** Now testing XAccessibleExtendedComponent ***"); _XAccessibleExtendedComponent _xAccExtComp = new _XAccessibleExtendedComponent(object); - assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont()); assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText()); assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText()); diff --git a/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java index 64dd66fcb71f..c26dd83403f0 100644 --- a/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java +++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java @@ -29,7 +29,6 @@ import com.sun.star.uno.UnoRuntime; *
      *
    • getForeground()
    • *
    • getBackground()
    • - *
    • getFont()
    • *
    • isEnabled()
    • *
    • getTitledBorderText()
    • *
    • getToolTipText()
    • @@ -44,15 +43,6 @@ public class _XAccessibleExtendedComponent { oObj = UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, object); } - /** - * Just calls the method. - */ - public boolean _getFont() { - XFont font = oObj.getFont(); - System.out.println("getFont(): " + font); - return true; - } - /** * Calls the method and checks returned value. * Has OK status if returned value isn't null. diff --git a/toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.cxx b/toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.cxx index a7137c4ba5ac..ec192bdf0f47 100644 --- a/toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.cxx +++ b/toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.cxx @@ -23,15 +23,6 @@ #include -/** - * @brief Just calls the method. - */ -void XAccessibleExtendedComponentTester::testGetFont() -{ - auto font = mxExtendedComponent->getFont(); - std::cout << "font: " << font << std::endl; -} - /** * @brief Just calls the method. */ diff --git a/toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.hxx b/toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.hxx index 12970528229e..353fd663b1a9 100644 --- a/toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.hxx +++ b/toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.hxx @@ -35,13 +35,11 @@ public: { } - void testGetFont(); void testGetTitledBorderText(); void testGetToolTipText(); void testAll() { - testGetFont(); testGetTitledBorderText(); testGetToolTipText(); } diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index e415f353c848..2f709a2329a8 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -804,30 +804,6 @@ sal_Int32 SAL_CALL VCLXAccessibleComponent::getBackground( ) // XAccessibleExtendedComponent -uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( ) -{ - OExternalLockGuard aGuard( this ); - - uno::Reference< awt::XFont > xFont; - VclPtr pWindow = GetWindow(); - if ( pWindow ) - { - uno::Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), uno::UNO_QUERY ); - if ( xDev.is() ) - { - vcl::Font aFont; - if ( pWindow->IsControlFont() ) - aFont = pWindow->GetControlFont(); - else - aFont = pWindow->GetFont(); - rtl::Reference pVCLXFont = new VCLXFont(*xDev, aFont); - xFont = pVCLXFont; - } - } - - return xFont; -} - OUString SAL_CALL VCLXAccessibleComponent::getTitledBorderText( ) { OExternalLockGuard aGuard( this ); diff --git a/vcl/osx/a11ytextattributeswrapper.mm b/vcl/osx/a11ytextattributeswrapper.mm index 11b205a8039b..9310ae137726 100644 --- a/vcl/osx/a11ytextattributeswrapper.mm +++ b/vcl/osx/a11ytextattributeswrapper.mm @@ -25,6 +25,7 @@ #include "a11ytextattributeswrapper.h" #include +#include #include #include #include From b28f16520bff4a8bd8b09661f7393a4d91a853f5 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 11:45:44 +0100 Subject: [PATCH 100/155] a11y: Move CharacterAttributeshelper from accessibility to vcl This is in preparation of moving more from the accessibility module to vcl. Currently, the a11y implementations for vcl widgets are implemented in the accessibility module (in directory of the same name), which in turn depends on the toolkit module. To break the dependency cycle (vcl needs accessibility to create a11y objects for its widgets), there's a UNO service. At least some a11y classes don't really need toolkit, however, so the plan is to decouple this and move those from the accessibility module into vcl in upcoming commits. Change-Id: I6aeee104f271c804c85727002822b89a9263628f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177810 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- accessibility/Library_acc.mk | 1 - accessibility/inc/pch/precompiled_acc.hxx | 2 +- accessibility/source/standard/vclxaccessiblemenuitem.cxx | 2 +- accessibility/source/standard/vclxaccessiblestatusbaritem.cxx | 2 +- accessibility/source/standard/vclxaccessibletabpage.cxx | 2 +- accessibility/source/standard/vclxaccessibletextcomponent.cxx | 2 +- .../vcl/accessibility}/characterattributeshelper.hxx | 3 ++- solenv/clang-format/excludelist | 2 +- vcl/Library_vcl.mk | 1 + .../source/accessibility}/characterattributeshelper.cxx | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) rename {accessibility/inc/helper => include/vcl/accessibility}/characterattributeshelper.hxx (95%) rename {accessibility/source/helper => vcl/source/accessibility}/characterattributeshelper.cxx (98%) diff --git a/accessibility/Library_acc.mk b/accessibility/Library_acc.mk index 1382e00019fa..7080203fccaf 100644 --- a/accessibility/Library_acc.mk +++ b/accessibility/Library_acc.mk @@ -71,7 +71,6 @@ $(eval $(call gb_Library_add_exception_objects,acc,\ accessibility/source/extended/textwindowaccessibility \ accessibility/source/helper/acc_factory \ accessibility/source/helper/accresmgr \ - accessibility/source/helper/characterattributeshelper \ accessibility/source/helper/IComboListBoxHelper \ accessibility/source/standard/accessiblemenubasecomponent \ accessibility/source/standard/accessiblemenucomponent \ diff --git a/accessibility/inc/pch/precompiled_acc.hxx b/accessibility/inc/pch/precompiled_acc.hxx index 885d43ce436f..1bc2832a650f 100644 --- a/accessibility/inc/pch/precompiled_acc.hxx +++ b/accessibility/inc/pch/precompiled_acc.hxx @@ -90,6 +90,7 @@ #include #include #include +#include #include #include #include @@ -290,7 +291,6 @@ #include #include #include -#include #include #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx index b505920aed93..b48d35ad7637 100644 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include #include @@ -31,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx index b309d6c39c9d..f47cffd1b148 100644 --- a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx +++ b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx index 9c1b2d3db303..90cd8807170c 100644 --- a/accessibility/source/standard/vclxaccessibletabpage.cxx +++ b/accessibility/source/standard/vclxaccessibletabpage.cxx @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx index 8085759cc948..0c38f6f522c7 100644 --- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx +++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx @@ -19,13 +19,13 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/accessibility/inc/helper/characterattributeshelper.hxx b/include/vcl/accessibility/characterattributeshelper.hxx similarity index 95% rename from accessibility/inc/helper/characterattributeshelper.hxx rename to include/vcl/accessibility/characterattributeshelper.hxx index a73ee76c09f2..2e58761ea27e 100644 --- a/accessibility/inc/helper/characterattributeshelper.hxx +++ b/include/vcl/accessibility/characterattributeshelper.hxx @@ -21,12 +21,13 @@ #include #include +#include #include #include #include -class CharacterAttributesHelper +class VCL_DLLPUBLIC CharacterAttributesHelper { private: typedef std::map AttributeMap; diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 6eff59432b41..2e50309b96d6 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -100,7 +100,6 @@ accessibility/source/extended/accessibletablistbox.cxx accessibility/source/extended/accessibletablistboxtable.cxx accessibility/source/extended/textwindowaccessibility.cxx accessibility/source/helper/acc_factory.cxx -accessibility/source/helper/characterattributeshelper.cxx accessibility/source/standard/accessiblemenubasecomponent.cxx accessibility/source/standard/accessiblemenucomponent.cxx accessibility/source/standard/accessiblemenuitemcomponent.cxx @@ -14523,6 +14522,7 @@ vcl/quartz/salgdi.cxx vcl/quartz/salgdicommon.cxx vcl/quartz/salvd.cxx vcl/quartz/utils.cxx +vcl/source/accessibility/characterattributeshelper.cxx vcl/source/animate/AnimationRenderer.cxx vcl/source/app/IconThemeInfo.cxx vcl/source/app/IconThemeScanner.cxx diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 8f2e7ccf35df..ae12cf9cfda7 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -98,6 +98,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/rendercontext/drawmode \ vcl/skia/SkiaHelper \ vcl/source/accessibility/AccessibleTextAttributeHelper \ + vcl/source/accessibility/characterattributeshelper \ vcl/source/animate/Animation \ vcl/source/animate/AnimationFrame \ vcl/source/animate/AnimationRenderer \ diff --git a/accessibility/source/helper/characterattributeshelper.cxx b/vcl/source/accessibility/characterattributeshelper.cxx similarity index 98% rename from accessibility/source/helper/characterattributeshelper.cxx rename to vcl/source/accessibility/characterattributeshelper.cxx index 7e2a2334bf57..e01d2d8625f5 100644 --- a/accessibility/source/helper/characterattributeshelper.cxx +++ b/vcl/source/accessibility/characterattributeshelper.cxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include #include +#include #include #include From 2449571a3ed5f0f5daeb60db6e740a5d830afa4a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 12:04:01 +0100 Subject: [PATCH 101/155] a11y: Move action string header to vcl ... so these constants can be reused in vcl. See commit message of Change-Id: I6aeee104f271c804c85727002822b89a9263628f Author: Michael Weghorn Date: Wed Dec 4 11:45:44 2024 +0100 a11y: Move CharacterAttributeshelper from accessibility to vcl for motivation. Change-Id: I1552c0a0111c81643ab9bb6f202c8a31662251d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177811 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- accessibility/inc/pch/precompiled_acc.hxx | 2 +- accessibility/source/standard/vclxaccessiblebox.cxx | 3 ++- accessibility/source/standard/vclxaccessiblebutton.cxx | 2 +- accessibility/source/standard/vclxaccessiblemenuitem.cxx | 2 +- accessibility/source/standard/vclxaccessibleradiobutton.cxx | 2 +- accessibility/source/standard/vclxaccessiblescrollbar.cxx | 2 +- accessibility/source/standard/vclxaccessibletoolboxitem.cxx | 2 +- {accessibility/inc => include/vcl/accessibility}/strings.hxx | 1 - solenv/clang-format/excludelist | 1 - 9 files changed, 8 insertions(+), 9 deletions(-) rename {accessibility/inc => include/vcl/accessibility}/strings.hxx (99%) diff --git a/accessibility/inc/pch/precompiled_acc.hxx b/accessibility/inc/pch/precompiled_acc.hxx index 1bc2832a650f..7919e40b3c08 100644 --- a/accessibility/inc/pch/precompiled_acc.hxx +++ b/accessibility/inc/pch/precompiled_acc.hxx @@ -342,7 +342,7 @@ #include #endif // PCH_LEVEL >= 3 #if PCH_LEVEL >= 4 -#include +#include #endif // PCH_LEVEL >= 4 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx index 9e8569ce0826..9690eff35ee2 100644 --- a/accessibility/source/standard/vclxaccessiblebox.cxx +++ b/accessibility/source/standard/vclxaccessiblebox.cxx @@ -26,10 +26,11 @@ #include #include #include + +#include #include #include #include -#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx index 7ede9e02c808..56f30c3d2148 100644 --- a/accessibility/source/standard/vclxaccessiblebutton.cxx +++ b/accessibility/source/standard/vclxaccessiblebutton.cxx @@ -27,8 +27,8 @@ #include #include #include -#include +#include #include #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx index b48d35ad7637..ef092d25b79a 100644 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx @@ -31,13 +31,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::uno; diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx index 3e1cd085fdfb..03d12bb3ffc0 100644 --- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx +++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx @@ -30,11 +30,11 @@ #include #include #include +#include #include #include #include #include -#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx index 7ffc11da3390..cc58f17efa06 100644 --- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx +++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx @@ -28,9 +28,9 @@ #include #include #include +#include #include #include -#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index b7e31f3bd1be..ac37733db0ea 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -31,13 +31,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include diff --git a/accessibility/inc/strings.hxx b/include/vcl/accessibility/strings.hxx similarity index 99% rename from accessibility/inc/strings.hxx rename to include/vcl/accessibility/strings.hxx index 6fd402a9ba06..720252140418 100644 --- a/accessibility/inc/strings.hxx +++ b/include/vcl/accessibility/strings.hxx @@ -19,5 +19,4 @@ inline constexpr OUString RID_STR_ACC_ACTION_DECLINE = u"decrementLine"_ustr; inline constexpr OUString RID_STR_ACC_ACTION_INCBLOCK = u"incrementBlock"_ustr; inline constexpr OUString RID_STR_ACC_ACTION_DECBLOCK = u"decrementBlock"_ustr; - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 2e50309b96d6..acffbef29a58 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -70,7 +70,6 @@ accessibility/inc/standard/vclxaccessibletextcomponent.hxx accessibility/inc/standard/vclxaccessibletextfield.hxx accessibility/inc/standard/vclxaccessibletoolbox.hxx accessibility/inc/standard/vclxaccessibletoolboxitem.hxx -accessibility/inc/strings.hxx accessibility/source/extended/AccessibleBrowseBox.cxx accessibility/source/extended/AccessibleBrowseBoxBase.cxx accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx From 3d780e72b93773a25f796feb488b0fd878c490b5 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 18:10:11 +0100 Subject: [PATCH 102/155] Move helpers for css::awt/VCL point/rect/size to vcl::unohelper Move helpers to convert between the Rectangle, Point and Size classes in vcl and in css::awt from VCLUnoHelper (in the toolkit module) to vcl::unohelper (in the vcl module), for reuse in vcl in upcoming commits. Change-Id: I7b11c8a6b8c843a01ce25b1e4c0fb1869ad1e6ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177816 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- .../source/extended/AccessibleBrowseBox.cxx | 9 +-- .../extended/AccessibleBrowseBoxBase.cxx | 14 ++-- .../extended/AccessibleBrowseBoxHeaderBar.cxx | 6 +- .../extended/AccessibleBrowseBoxTable.cxx | 4 +- .../extended/AccessibleBrowseBoxTableCell.cxx | 6 +- .../source/extended/AccessibleGridControl.cxx | 8 +-- .../extended/AccessibleGridControlBase.cxx | 14 ++-- .../extended/AccessibleGridControlHeader.cxx | 3 +- .../extended/AccessibleGridControlTable.cxx | 4 +- .../AccessibleGridControlTableCell.cxx | 6 +- .../source/extended/AccessibleIconView.cxx | 4 +- .../accessibleiconchoicectrlentry.cxx | 12 ++-- .../extended/accessiblelistboxentry.cxx | 22 +++--- .../source/extended/accessibletabbar.cxx | 9 ++- .../source/extended/accessibletabbarpage.cxx | 4 +- .../extended/accessibletabbarpagelist.cxx | 8 +-- .../extended/textwindowaccessibility.cxx | 4 +- .../standard/accessiblemenubasecomponent.cxx | 6 +- .../standard/accessiblemenucomponent.cxx | 8 +-- .../standard/accessiblemenuitemcomponent.cxx | 6 +- .../source/standard/vclxaccessibleedit.cxx | 4 +- .../standard/vclxaccessibleheaderbaritem.cxx | 4 +- .../source/standard/vclxaccessiblelist.cxx | 6 +- .../standard/vclxaccessiblelistitem.cxx | 16 ++--- .../standard/vclxaccessiblemenuitem.cxx | 6 +- .../standard/vclxaccessiblestatusbar.cxx | 4 +- .../standard/vclxaccessiblestatusbaritem.cxx | 8 +-- .../source/standard/vclxaccessibletabpage.cxx | 12 ++-- .../standard/vclxaccessibletabpagewindow.cxx | 4 +- .../standard/vclxaccessibletextcomponent.cxx | 6 +- .../source/standard/vclxaccessibletoolbox.cxx | 4 +- .../standard/vclxaccessibletoolboxitem.cxx | 8 +-- .../accessibledialogcontrolshape.cxx | 3 +- .../accessibility/accessibledialogwindow.cxx | 9 ++- .../layoutmanager/toolbarlayoutmanager.cxx | 27 +++---- .../uielement/popuptoolbarcontroller.cxx | 3 +- include/toolkit/helper/vclunohelper.hxx | 34 --------- include/vcl/unohelp.hxx | 11 +++ .../source/ui/inspection/GeometryHandler.cxx | 9 +-- reportdesign/source/ui/misc/UITools.cxx | 4 +- .../source/ui/report/ReportController.cxx | 3 +- .../source/ui/report/ReportSection.cxx | 12 ++-- reportdesign/source/ui/report/ViewsWindow.cxx | 7 +- .../Accessibility/AccessibleContextBase.cxx | 14 ++-- .../ui/Accessibility/AccessibleDocument.cxx | 11 +-- .../AccessibleDocumentPagePreview.cxx | 19 ++--- .../AccessiblePageHeaderArea.cxx | 8 +-- .../Accessibility/AccessiblePreviewCell.cxx | 4 +- .../AccessiblePreviewHeaderCell.cxx | 3 +- sc/source/ui/unoobj/shapeuno.cxx | 9 +-- sc/source/ui/unoobj/viewuno.cxx | 5 +- sfx2/source/statbar/stbitem.cxx | 3 +- sfx2/source/view/ipclient.cxx | 9 +-- sfx2/source/view/sfxbasecontroller.cxx | 5 +- svtools/source/control/accessibleruler.cxx | 13 ++-- .../svxpixelctlaccessiblecontext.cxx | 3 +- .../svxrectctaccessiblecontext.cxx | 4 +- .../contact/viewobjectcontactofunocontrol.cxx | 3 +- svx/source/svdraw/svdoole2.cxx | 7 +- sw/source/uibase/uiview/viewling.cxx | 3 +- .../source/awt/vclxaccessiblecomponent.cxx | 10 +-- toolkit/source/awt/vclxdevice.cxx | 17 ++--- toolkit/source/awt/vclxgraphics.cxx | 3 +- toolkit/source/awt/vclxmenu.cxx | 3 +- toolkit/source/awt/vclxregion.cxx | 15 ++-- toolkit/source/awt/vclxtoolkit.cxx | 3 +- toolkit/source/awt/vclxwindow.cxx | 21 +++--- toolkit/source/awt/vclxwindows.cxx | 71 ++++++++++--------- .../source/controls/tree/treecontrolpeer.cxx | 8 +-- toolkit/source/hatchwindow/hatchwindow.cxx | 8 +-- toolkit/source/helper/vclunohelper.cxx | 2 +- vcl/source/app/unohelp.cxx | 31 ++++++++ 72 files changed, 354 insertions(+), 322 deletions(-) diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx index b78c6cb65048..c3b48b6b8d86 100644 --- a/accessibility/source/extended/AccessibleBrowseBox.cxx +++ b/accessibility/source/extended/AccessibleBrowseBox.cxx @@ -22,8 +22,9 @@ #include #include #include -#include #include +#include +#include #include @@ -135,12 +136,12 @@ AccessibleBrowseBox::getAccessibleAtPoint( const awt::Point& rPoint ) ensureIsAlive(); sal_Int32 nIndex = 0; - if (mpBrowseBox->ConvertPointToControlIndex(nIndex, VCLUnoHelper::ConvertToVCLPoint(rPoint))) + if (mpBrowseBox->ConvertPointToControlIndex(nIndex, vcl::unohelper::ConvertToVCLPoint(rPoint))) return mpBrowseBox->CreateAccessibleControl(nIndex); // try whether point is in one of the fixed children // (table, header bars, corner control) - Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + Point aPoint(vcl::unohelper::ConvertToVCLPoint(rPoint)); for (nIndex = 0; nIndex < vcl::BBINDEX_FIRSTCONTROL; ++nIndex) { css::uno::Reference< css::accessibility::XAccessible > xCurrChild(implGetFixedChild(nIndex)); @@ -148,7 +149,7 @@ AccessibleBrowseBox::getAccessibleAtPoint( const awt::Point& rPoint ) xCurrChildComp( xCurrChild, uno::UNO_QUERY ); if (xCurrChildComp.is() - && VCLUnoHelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) + && vcl::unohelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) return xCurrChild; } return nullptr; diff --git a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx index 541b5ead7057..6108fa0a1801 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx @@ -26,8 +26,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -211,27 +211,27 @@ lang::Locale SAL_CALL AccessibleBrowseBoxBase::getLocale() sal_Bool SAL_CALL AccessibleBrowseBoxBase::containsPoint( const css::awt::Point& rPoint ) { return tools::Rectangle(Point(), getBoundingBox().GetSize()) - .Contains(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + .Contains(vcl::unohelper::ConvertToVCLPoint(rPoint)); } awt::Rectangle SAL_CALL AccessibleBrowseBoxBase::getBounds() { - return VCLUnoHelper::ConvertToAWTRect(getBoundingBox()); + return vcl::unohelper::ConvertToAWTRect(getBoundingBox()); } awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocation() { - return VCLUnoHelper::ConvertToAWTPoint(getBoundingBox().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(getBoundingBox().TopLeft()); } awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocationOnScreen() { - return VCLUnoHelper::ConvertToAWTPoint(getBoundingBoxOnScreen().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(getBoundingBoxOnScreen().TopLeft()); } awt::Size SAL_CALL AccessibleBrowseBoxBase::getSize() { - return VCLUnoHelper::ConvertToAWTSize(getBoundingBox().GetSize()); + return vcl::unohelper::ConvertToAWTSize(getBoundingBox().GetSize()); } void SAL_CALL AccessibleBrowseBoxBase::focusGained( const css::awt::FocusEvent& ) @@ -351,7 +351,7 @@ bool AccessibleBrowseBoxBase::implIsShowing() xParentComp( mxParent->getAccessibleContext(), uno::UNO_QUERY ); if( xParentComp.is() ) bShowing = implGetBoundingBox().Overlaps( - VCLUnoHelper::ConvertToVCLRect(xParentComp->getBounds())); + vcl::unohelper::ConvertToVCLRect(xParentComp->getBounds())); } return bShowing; } diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx index 26704ccb3387..3918c4551308 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx @@ -18,8 +18,8 @@ */ #include -#include #include +#include #include using ::com::sun::star::uno::Reference; @@ -78,9 +78,9 @@ AccessibleBrowseBoxHeaderBar::getAccessibleAtPoint( const awt::Point& rPoint ) sal_uInt16 nColumnPos = 0; bool bConverted = isRowBar() - ? mpBrowseBox->ConvertPointToRowHeader(nRow, VCLUnoHelper::ConvertToVCLPoint(rPoint)) + ? mpBrowseBox->ConvertPointToRowHeader(nRow, vcl::unohelper::ConvertToVCLPoint(rPoint)) : mpBrowseBox->ConvertPointToColumnHeader(nColumnPos, - VCLUnoHelper::ConvertToVCLPoint(rPoint)); + vcl::unohelper::ConvertToVCLPoint(rPoint)); return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >(); } diff --git a/accessibility/source/extended/AccessibleBrowseBoxTable.cxx b/accessibility/source/extended/AccessibleBrowseBoxTable.cxx index 83ab211b18f2..99764f4c1f8a 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxTable.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxTable.cxx @@ -18,8 +18,8 @@ */ #include -#include #include +#include #include @@ -78,7 +78,7 @@ AccessibleBrowseBoxTable::getAccessibleAtPoint( const awt::Point& rPoint ) sal_Int32 nRow = 0; sal_uInt16 nColumnPos = 0; if (mpBrowseBox->ConvertPointToCellAddress(nRow, nColumnPos, - VCLUnoHelper::ConvertToVCLPoint(rPoint))) + vcl::unohelper::ConvertToVCLPoint(rPoint))) xChild = mpBrowseBox->CreateAccessibleCell( nRow, nColumnPos ); return xChild; diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx index bd092a0114b4..dbfce6d4d3a9 100644 --- a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx +++ b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx @@ -20,8 +20,8 @@ #include -#include #include +#include #include #include @@ -118,7 +118,7 @@ namespace accessibility if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) throw IndexOutOfBoundsException(); - aRect = VCLUnoHelper::ConvertToAWTRect( + aRect = vcl::unohelper::ConvertToAWTRect( mpBrowseBox->GetFieldCharacterBounds(getRowPos(), getColumnPos(), nIndex)); } @@ -133,7 +133,7 @@ namespace accessibility ensureIsAlive(); return mpBrowseBox->GetFieldIndexAtPoint(getRowPos(), getColumnPos(), - VCLUnoHelper::ConvertToVCLPoint(_aPoint)); + vcl::unohelper::ConvertToVCLPoint(_aPoint)); } /** @return diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx index 6dcd09748d79..0f9e352e7c46 100644 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -23,10 +23,10 @@ #include #include #include -#include #include #include #include +#include namespace accessibility { @@ -147,13 +147,13 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) ensureIsAlive(); sal_Int32 nIndex = 0; - if (m_aTable.ConvertPointToControlIndex(nIndex, VCLUnoHelper::ConvertToVCLPoint(rPoint))) + if (m_aTable.ConvertPointToControlIndex(nIndex, vcl::unohelper::ConvertToVCLPoint(rPoint))) return m_aTable.CreateAccessibleControl(nIndex); else { // try whether point is in one of the fixed children // (table, header bars, corner control) - Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + Point aPoint(vcl::unohelper::ConvertToVCLPoint(rPoint)); for (nIndex = 0; nIndex < 3; ++nIndex) { css::uno::Reference< css::accessibility::XAccessible > xCurrChild( implGetFixedChild( nIndex ) ); @@ -161,7 +161,7 @@ AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint ) xCurrChildComp( xCurrChild, uno::UNO_QUERY ); if (xCurrChildComp.is() - && VCLUnoHelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) + && vcl::unohelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint)) return xCurrChild; } } diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx index 950e927fca86..aff3dc66a247 100644 --- a/accessibility/source/extended/AccessibleGridControlBase.cxx +++ b/accessibility/source/extended/AccessibleGridControlBase.cxx @@ -18,10 +18,10 @@ */ #include -#include #include #include #include +#include #include #include #include @@ -184,27 +184,27 @@ lang::Locale SAL_CALL AccessibleGridControlBase::getLocale() sal_Bool SAL_CALL AccessibleGridControlBase::containsPoint( const awt::Point& rPoint ) { return tools::Rectangle(Point(), getBoundingBox().GetSize()) - .Contains(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + .Contains(vcl::unohelper::ConvertToVCLPoint(rPoint)); } awt::Rectangle SAL_CALL AccessibleGridControlBase::getBounds() { - return VCLUnoHelper::ConvertToAWTRect(getBoundingBox()); + return vcl::unohelper::ConvertToAWTRect(getBoundingBox()); } awt::Point SAL_CALL AccessibleGridControlBase::getLocation() { - return VCLUnoHelper::ConvertToAWTPoint(getBoundingBox().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(getBoundingBox().TopLeft()); } awt::Point SAL_CALL AccessibleGridControlBase::getLocationOnScreen() { - return VCLUnoHelper::ConvertToAWTPoint(getBoundingBoxOnScreen().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(getBoundingBoxOnScreen().TopLeft()); } awt::Size SAL_CALL AccessibleGridControlBase::getSize() { - return VCLUnoHelper::ConvertToAWTSize(getBoundingBox().GetSize()); + return vcl::unohelper::ConvertToAWTSize(getBoundingBox().GetSize()); } // css::accessibility::XAccessibleEventBroadcaster @@ -274,7 +274,7 @@ bool AccessibleGridControlBase::implIsShowing() xParentComp( m_xParent->getAccessibleContext(), uno::UNO_QUERY ); if( xParentComp.is() ) bShowing = implGetBoundingBox().Overlaps( - VCLUnoHelper::ConvertToVCLRect(xParentComp->getBounds())); + vcl::unohelper::ConvertToVCLRect(xParentComp->getBounds())); } return bShowing; } diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx index b028f6837141..a50b2c434594 100644 --- a/accessibility/source/extended/AccessibleGridControlHeader.cxx +++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx @@ -23,6 +23,7 @@ #include #include #include +#include using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; @@ -97,7 +98,7 @@ AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint ) sal_Int32 nRow = 0; sal_Int32 nColumnPos = 0; bool bConverted = m_aTable.ConvertPointToCellAddress(nRow, nColumnPos, - VCLUnoHelper::ConvertToVCLPoint(rPoint)); + vcl::unohelper::ConvertToVCLPoint(rPoint)); return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >(); } diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx index 41308d8d4acf..930d5c9395ce 100644 --- a/accessibility/source/extended/AccessibleGridControlTable.cxx +++ b/accessibility/source/extended/AccessibleGridControlTable.cxx @@ -23,9 +23,9 @@ #include #include #include -#include #include #include +#include #include using ::com::sun::star::uno::Reference; @@ -96,7 +96,7 @@ AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint ) sal_Int32 nRow = 0; sal_Int32 nColumnPos = 0; if (m_aTable.ConvertPointToCellAddress(nRow, nColumnPos, - VCLUnoHelper::ConvertToVCLPoint(rPoint))) + vcl::unohelper::ConvertToVCLPoint(rPoint))) xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumnPos); return xChild; } diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx index a24e62d068e3..a1a1af5fe641 100644 --- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx +++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -138,7 +138,7 @@ namespace accessibility if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) throw IndexOutOfBoundsException(); - return VCLUnoHelper::ConvertToAWTRect( + return vcl::unohelper::ConvertToAWTRect( m_aTable.GetFieldCharacterBounds(getRowPos(), getColumnPos(), nIndex)); } @@ -149,7 +149,7 @@ namespace accessibility ensureIsAlive(); return m_aTable.GetFieldIndexAtPoint(getRowPos(), getColumnPos(), - VCLUnoHelper::ConvertToVCLPoint(_aPoint)); + vcl::unohelper::ConvertToVCLPoint(_aPoint)); } /** @return diff --git a/accessibility/source/extended/AccessibleIconView.cxx b/accessibility/source/extended/AccessibleIconView.cxx index a1321c7dded6..25b5f39cdafe 100644 --- a/accessibility/source/extended/AccessibleIconView.cxx +++ b/accessibility/source/extended/AccessibleIconView.cxx @@ -11,8 +11,8 @@ #include -#include #include +#include #include @@ -36,7 +36,7 @@ void AccessibleIconView::ProcessWindowEvent(const VclWindowEvent& rVclWindowEven if (MouseEvent* pMouseEvt = static_cast(rVclWindowEvent.GetData())) { if (auto xChild = getAccessibleAtPoint( - VCLUnoHelper::ConvertToAWTPoint(pMouseEvt->GetPosPixel()))) + vcl::unohelper::ConvertToAWTPoint(pMouseEvt->GetPosPixel()))) { // Allow announcing the element on mouse hover css::uno::Any aNew(xChild); diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx index 696f7cbea2c0..991a417e080c 100644 --- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx +++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -129,7 +129,7 @@ namespace accessibility Reference< XAccessibleComponent > xParentComp( xParentContext, uno::UNO_QUERY ); if( xParentComp.is() ) bShowing = GetBoundingBox_Impl().Overlaps( - VCLUnoHelper::ConvertToVCLRect(xParentComp->getBounds())); + vcl::unohelper::ConvertToVCLRect(xParentComp->getBounds())); } return bShowing; @@ -152,7 +152,7 @@ namespace accessibility css::awt::Rectangle AccessibleIconChoiceCtrlEntry::implGetBounds() { - return VCLUnoHelper::ConvertToAWTRect(GetBoundingBox_Impl()); + return vcl::unohelper::ConvertToAWTRect(GetBoundingBox_Impl()); } OUString AccessibleIconChoiceCtrlEntry::implGetText() @@ -324,7 +324,7 @@ namespace accessibility awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocationOnScreen( ) { - return VCLUnoHelper::ConvertToAWTPoint( GetBoundingBoxOnScreen().TopLeft() ); + return vcl::unohelper::ConvertToAWTPoint( GetBoundingBoxOnScreen().TopLeft() ); } void SAL_CALL AccessibleIconChoiceCtrlEntry::grabFocus( ) @@ -383,7 +383,7 @@ namespace accessibility tools::Rectangle aItemRect = GetBoundingBox_Impl(); tools::Rectangle aCharRect = m_pIconCtrl->GetEntryCharacterBounds( m_nIndex, _nIndex ); aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = VCLUnoHelper::ConvertToAWTRect(aCharRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); } return aBounds; @@ -400,7 +400,7 @@ namespace accessibility vcl::ControlLayoutData aLayoutData; tools::Rectangle aItemRect = GetBoundingBox_Impl(); m_pIconCtrl->RecordLayoutData( &aLayoutData, aItemRect ); - Point aPnt(VCLUnoHelper::ConvertToVCLPoint(aPoint)); + Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); aPnt += aItemRect.TopLeft(); nIndex = aLayoutData.GetIndexForPoint( aPnt ); diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index 3a2c616cabe4..f88825818257 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -177,7 +177,7 @@ namespace accessibility Reference< XAccessibleComponent > xParentComp( xParentContext, uno::UNO_QUERY ); if( xParentComp.is() ) bShowing = GetBoundingBox_Impl().Overlaps( - VCLUnoHelper::ConvertToVCLRect(xParentComp->getBounds())); + vcl::unohelper::ConvertToVCLRect(xParentComp->getBounds())); } return bShowing; @@ -522,7 +522,7 @@ namespace accessibility sal_Bool SAL_CALL AccessibleListBoxEntry::containsPoint( const awt::Point& rPoint ) { return tools::Rectangle(Point(), GetBoundingBox().GetSize()) - .Contains(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + .Contains(vcl::unohelper::ConvertToVCLPoint(rPoint)); } Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleAtPoint( const awt::Point& _aPoint ) @@ -532,7 +532,7 @@ namespace accessibility EnsureIsAlive(); SvTreeListEntry* pEntry - = m_pTreeListBox->GetEntry(VCLUnoHelper::ConvertToVCLPoint(_aPoint)); + = m_pTreeListBox->GetEntry(vcl::unohelper::ConvertToVCLPoint(_aPoint)); if ( !pEntry ) throw RuntimeException(u"AccessibleListBoxEntry::getAccessibleAtPoint - pEntry cannot be empty!"_ustr); @@ -541,29 +541,29 @@ namespace accessibility assert(xListBox.is()); auto pAccEntry = xListBox->implGetAccessible(*pEntry); tools::Rectangle aRect = pAccEntry->GetBoundingBox_Impl(); - if (aRect.Contains(VCLUnoHelper::ConvertToVCLPoint(_aPoint))) + if (aRect.Contains(vcl::unohelper::ConvertToVCLPoint(_aPoint))) xAcc = pAccEntry.get(); return xAcc; } awt::Rectangle SAL_CALL AccessibleListBoxEntry::getBounds( ) { - return VCLUnoHelper::ConvertToAWTRect(GetBoundingBox()); + return vcl::unohelper::ConvertToAWTRect(GetBoundingBox()); } awt::Point SAL_CALL AccessibleListBoxEntry::getLocation( ) { - return VCLUnoHelper::ConvertToAWTPoint(GetBoundingBox().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(GetBoundingBox().TopLeft()); } awt::Point SAL_CALL AccessibleListBoxEntry::getLocationOnScreen( ) { - return VCLUnoHelper::ConvertToAWTPoint(GetBoundingBoxOnScreen().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(GetBoundingBoxOnScreen().TopLeft()); } awt::Size SAL_CALL AccessibleListBoxEntry::getSize( ) { - return VCLUnoHelper::ConvertToAWTSize(GetBoundingBox().GetSize()); + return vcl::unohelper::ConvertToAWTSize(GetBoundingBox().GetSize()); } void SAL_CALL AccessibleListBoxEntry::grabFocus( ) @@ -627,7 +627,7 @@ namespace accessibility m_pTreeListBox->RecordLayoutData( &aLayoutData, aItemRect ); tools::Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex ); aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = VCLUnoHelper::ConvertToAWTRect(aCharRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); } return aBounds; @@ -647,7 +647,7 @@ namespace accessibility vcl::ControlLayoutData aLayoutData; tools::Rectangle aItemRect = GetBoundingBox(); m_pTreeListBox->RecordLayoutData( &aLayoutData, aItemRect ); - Point aPnt(VCLUnoHelper::ConvertToVCLPoint(aPoint)); + Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); aPnt += aItemRect.TopLeft(); nIndex = aLayoutData.GetIndexForPoint( aPnt ); } diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx index 58f8ab58539f..ede35977d93a 100644 --- a/accessibility/source/extended/accessibletabbar.cxx +++ b/accessibility/source/extended/accessibletabbar.cxx @@ -33,8 +33,7 @@ #include #include #include -#include -#include +#include namespace accessibility { @@ -145,7 +144,7 @@ namespace accessibility { awt::Rectangle aBounds; if ( m_pTabBar ) - aBounds = VCLUnoHelper::ConvertToAWTRect( + aBounds = vcl::unohelper::ConvertToAWTRect( tools::Rectangle(m_pTabBar->GetPosPixel(), m_pTabBar->GetSizePixel())); return aBounds; @@ -362,8 +361,8 @@ namespace accessibility Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); if ( xComp.is() ) { - tools::Rectangle aRect = VCLUnoHelper::ConvertToVCLRect(xComp->getBounds()); - Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); + tools::Rectangle aRect = vcl::unohelper::ConvertToVCLRect(xComp->getBounds()); + Point aPos = vcl::unohelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { return xAcc; diff --git a/accessibility/source/extended/accessibletabbarpage.cxx b/accessibility/source/extended/accessibletabbarpage.cxx index 4f9249ce9099..f2de152f871f 100644 --- a/accessibility/source/extended/accessibletabbarpage.cxx +++ b/accessibility/source/extended/accessibletabbarpage.cxx @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include @@ -164,7 +164,7 @@ namespace accessibility if ( m_pTabBar ) { // get bounding rectangle relative to the AccessibleTabBar - aBounds = VCLUnoHelper::ConvertToAWTRect(m_pTabBar->GetPageRect(m_nPageId)); + aBounds = vcl::unohelper::ConvertToAWTRect(m_pTabBar->GetPageRect(m_nPageId)); // get position of the AccessibleTabBarPageList relative to the AccessibleTabBar Reference< XAccessible > xParent = getAccessibleParent(); diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx index a1e1f0a6f893..4bde87630738 100644 --- a/accessibility/source/extended/accessibletabbarpagelist.cxx +++ b/accessibility/source/extended/accessibletabbarpagelist.cxx @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include @@ -306,7 +306,7 @@ namespace accessibility { awt::Rectangle aBounds; if ( m_pTabBar ) - aBounds = VCLUnoHelper::ConvertToAWTRect(m_pTabBar->GetPageArea()); + aBounds = vcl::unohelper::ConvertToAWTRect(m_pTabBar->GetPageArea()); return aBounds; } @@ -491,8 +491,8 @@ namespace accessibility Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); if ( xComp.is() ) { - tools::Rectangle aRect = VCLUnoHelper::ConvertToVCLRect(xComp->getBounds()); - Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); + tools::Rectangle aRect = vcl::unohelper::ConvertToVCLRect(xComp->getBounds()); + Point aPos = vcl::unohelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { xChild = xAcc; diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 8068d118ed9f..04939fee3b3a 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -37,9 +37,9 @@ #include #include #include +#include #include #include -#include #include #include @@ -876,7 +876,7 @@ Document::retrieveCharacterBounds(Paragraph const * pParagraph, if ( nIndex == nLength ) { aBounds - = VCLUnoHelper::ConvertToAWTRect(m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, nIndex))); + = vcl::unohelper::ConvertToAWTRect(m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, nIndex))); } else { diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx index 5c9e1e47b637..dbedd1daff30 100644 --- a/accessibility/source/standard/accessiblemenubasecomponent.cxx +++ b/accessibility/source/standard/accessiblemenubasecomponent.cxx @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include #include #include @@ -342,8 +342,8 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Po Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); if ( xComp.is() ) { - tools::Rectangle aRect = VCLUnoHelper::ConvertToVCLRect(xComp->getBounds()); - Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); + tools::Rectangle aRect = vcl::unohelper::ConvertToVCLRect(xComp->getBounds()); + Point aPos = vcl::unohelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { return xAcc; diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx index 4fbbd394e92f..7fe594721294 100644 --- a/accessibility/source/standard/accessiblemenucomponent.cxx +++ b/accessibility/source/standard/accessiblemenucomponent.cxx @@ -19,9 +19,6 @@ #include -#include -#include - #include #include #include @@ -33,6 +30,7 @@ #include #include #include +#include #include using namespace ::com::sun::star::accessibility; @@ -98,7 +96,7 @@ awt::Rectangle OAccessibleMenuComponent::implGetBounds() { // get bounding rectangle of the window in screen coordinates AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); - aBounds = VCLUnoHelper::ConvertToAWTRect(aRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aRect); // get position of the accessible parent in screen coordinates Reference< XAccessible > xParent = getAccessibleParent(); @@ -235,7 +233,7 @@ awt::Point OAccessibleMenuComponent::getLocationOnScreen( ) if ( pWindow ) { AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); - aPos = VCLUnoHelper::ConvertToAWTPoint(aRect.TopLeft()); + aPos = vcl::unohelper::ConvertToAWTPoint(aRect.TopLeft()); } } diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx index 0fa008b11aff..0d171e64ccaa 100644 --- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx +++ b/accessibility/source/standard/accessiblemenuitemcomponent.cxx @@ -26,8 +26,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -239,14 +239,14 @@ awt::Rectangle OAccessibleMenuItemComponent::implGetBounds() if ( m_pParent ) { // get bounding rectangle of the item relative to the containing window - aBounds = VCLUnoHelper::ConvertToAWTRect(m_pParent->GetBoundingRectangle(m_nItemPos)); + aBounds = vcl::unohelper::ConvertToAWTRect(m_pParent->GetBoundingRectangle(m_nItemPos)); // get position of containing window in screen coordinates vcl::Window* pWindow = m_pParent->GetWindow(); if ( pWindow ) { AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); - awt::Point aWindowScreenLoc = VCLUnoHelper::ConvertToAWTPoint(aRect.TopLeft()); + awt::Point aWindowScreenLoc = vcl::unohelper::ConvertToAWTPoint(aRect.TopLeft()); // get position of accessible parent in screen coordinates Reference< XAccessible > xParent = getAccessibleParent(); diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index 73298a4ff255..5cb259dddc08 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -38,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -390,7 +390,7 @@ awt::Rectangle VCLXAccessibleEdit::getCharacterBounds( sal_Int32 nIndex ) } else { - aBounds = VCLUnoHelper::ConvertToAWTRect(pControl->GetCharacterBounds(nIndex)); + aBounds = vcl::unohelper::ConvertToAWTRect(pControl->GetCharacterBounds(nIndex)); } } diff --git a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx index 7e9f03f061d9..7bbc2684524d 100644 --- a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx +++ b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include using namespace ::com::sun::star; @@ -76,7 +76,7 @@ awt::Rectangle VCLXAccessibleHeaderBarItem::implGetBounds() if ( m_pHeadBar ) aBounds - = VCLUnoHelper::ConvertToAWTRect(m_pHeadBar->GetItemRect(sal_uInt16(m_nIndexInParent))); + = vcl::unohelper::ConvertToAWTRect(m_pHeadBar->GetItemRect(sal_uInt16(m_nIndexInParent))); return aBounds; } diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx index 335ffffe6624..d84a631687fc 100644 --- a/accessibility/source/standard/vclxaccessiblelist.cxx +++ b/accessibility/source/standard/vclxaccessiblelist.cxx @@ -30,10 +30,10 @@ #include #include #include -#include #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -877,7 +877,7 @@ awt::Rectangle VCLXAccessibleList::implGetBounds() && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) { if ( m_pListBoxHelper->IsInDropDown() ) - aBounds = VCLUnoHelper::ConvertToAWTRect(m_pListBoxHelper->GetDropDownPosSizePixel()); + aBounds = vcl::unohelper::ConvertToAWTRect(m_pListBoxHelper->GetDropDownPosSizePixel()); } else { @@ -910,7 +910,7 @@ awt::Point VCLXAccessibleList::getLocationOnScreen( ) && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN ) { if ( m_pListBoxHelper->IsInDropDown() ) - aPos = VCLUnoHelper::ConvertToAWTPoint( + aPos = vcl::unohelper::ConvertToAWTPoint( m_pListBoxHelper->GetDropDownPosSizePixel().TopLeft()); } else diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx b/accessibility/source/standard/vclxaccessiblelistitem.cxx index 7625d05cdf24..0a9d2bee1806 100644 --- a/accessibility/source/standard/vclxaccessiblelistitem.cxx +++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include @@ -32,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -289,7 +289,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::containsPoint( const awt::Point& _aPoi { tools::Rectangle aRect(pListBoxHelper->GetBoundingRectangle(static_cast(m_nIndexInParent))); aRect.Move(-aRect.Left(), -aRect.Top()); - bInside = aRect.Contains(VCLUnoHelper::ConvertToVCLPoint(_aPoint)); + bInside = aRect.Contains(vcl::unohelper::ConvertToVCLPoint(_aPoint)); } return bInside; } @@ -307,7 +307,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleListItem::getBounds( ) awt::Rectangle aRect; ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper) - aRect = VCLUnoHelper::ConvertToAWTRect( + aRect = vcl::unohelper::ConvertToAWTRect( pListBoxHelper->GetBoundingRectangle(static_cast(m_nIndexInParent))); return aRect; @@ -325,7 +325,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocation( ) tools::Rectangle aRect = pListBoxHelper->GetBoundingRectangle( static_cast(m_nIndexInParent) ); aPoint = aRect.TopLeft(); } - return VCLUnoHelper::ConvertToAWTPoint(aPoint); + return vcl::unohelper::ConvertToAWTPoint(aPoint); } awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( ) @@ -341,7 +341,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( ) aPoint = aRect.TopLeft(); aPoint += Point(pListBoxHelper->GetWindowExtentsAbsolute().TopLeft()); } - return VCLUnoHelper::ConvertToAWTPoint(aPoint); + return vcl::unohelper::ConvertToAWTPoint(aPoint); } awt::Size SAL_CALL VCLXAccessibleListItem::getSize( ) @@ -354,7 +354,7 @@ awt::Size SAL_CALL VCLXAccessibleListItem::getSize( ) if (pListBoxHelper) aSize = pListBoxHelper->GetBoundingRectangle( static_cast(m_nIndexInParent) ).GetSize(); - return VCLUnoHelper::ConvertToAWTSize(aSize); + return vcl::unohelper::ConvertToAWTSize(aSize); } void SAL_CALL VCLXAccessibleListItem::grabFocus( ) @@ -414,7 +414,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nI tools::Rectangle aCharRect = pListBoxHelper->GetEntryCharacterBounds( m_nIndexInParent, nIndex ); tools::Rectangle aItemRect = pListBoxHelper->GetBoundingRectangle( static_cast(m_nIndexInParent) ); aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = VCLUnoHelper::ConvertToAWTRect(aCharRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); } return aBounds; @@ -438,7 +438,7 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aP { sal_Int32 nPos = LISTBOX_ENTRY_NOTFOUND; tools::Rectangle aItemRect = pListBoxHelper->GetBoundingRectangle( static_cast(m_nIndexInParent) ); - Point aPnt(VCLUnoHelper::ConvertToVCLPoint(aPoint)); + Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); aPnt += aItemRect.TopLeft(); sal_Int32 nI = pListBoxHelper->GetIndexForPoint( aPnt, nPos ); if ( nI != -1 && m_nIndexInParent == nPos ) diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx index ef092d25b79a..a1491c99bc4c 100644 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx @@ -29,13 +29,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include #include #include @@ -239,7 +239,7 @@ awt::Rectangle VCLXAccessibleMenuItem::getCharacterBounds( sal_Int32 nIndex ) tools::Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos ); tools::Rectangle aCharRect = m_pParent->GetCharacterBounds( nItemId, nIndex ); aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = VCLUnoHelper::ConvertToAWTRect(aCharRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); } return aBounds; @@ -263,7 +263,7 @@ sal_Int32 VCLXAccessibleMenuItem::getIndexAtPoint( const awt::Point& aPoint ) { sal_uInt16 nItemId = 0; tools::Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos ); - Point aPnt(VCLUnoHelper::ConvertToVCLPoint(aPoint)); + Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); aPnt += aItemRect.TopLeft(); sal_Int32 nI = m_pParent->GetIndexForPoint( aPnt, nItemId ); if ( nI != -1 && m_pParent->GetItemId( m_nItemPos ) == nItemId ) diff --git a/accessibility/source/standard/vclxaccessiblestatusbar.cxx b/accessibility/source/standard/vclxaccessiblestatusbar.cxx index 416c5781b156..877abf27e090 100644 --- a/accessibility/source/standard/vclxaccessiblestatusbar.cxx +++ b/accessibility/source/standard/vclxaccessiblestatusbar.cxx @@ -19,12 +19,12 @@ #include #include -#include #include #include #include #include #include +#include #include @@ -307,7 +307,7 @@ Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleAtPoint( const aw Reference< XAccessible > xChild; if ( m_pStatusBar ) { - sal_uInt16 nItemId = m_pStatusBar->GetItemId(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + sal_uInt16 nItemId = m_pStatusBar->GetItemId(vcl::unohelper::ConvertToVCLPoint(rPoint)); sal_Int32 nItemPos = m_pStatusBar->GetItemPos( nItemId ); if ( nItemPos >= 0 && o3tl::make_unsigned(nItemPos) < m_aAccessibleChildren.size() ) xChild = getAccessibleChild( nItemPos ); diff --git a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx index f47cffd1b148..58eb5f42005c 100644 --- a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx +++ b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include @@ -32,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -148,7 +148,7 @@ awt::Rectangle VCLXAccessibleStatusBarItem::implGetBounds() awt::Rectangle aBounds( 0, 0, 0, 0 ); if ( m_pStatusBar ) - aBounds = VCLUnoHelper::ConvertToAWTRect(m_pStatusBar->GetItemRect(m_nItemId)); + aBounds = vcl::unohelper::ConvertToAWTRect(m_pStatusBar->GetItemRect(m_nItemId)); return aBounds; } @@ -482,7 +482,7 @@ awt::Rectangle VCLXAccessibleStatusBarItem::getCharacterBounds( sal_Int32 nIndex m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect ); tools::Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex ); aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = VCLUnoHelper::ConvertToAWTRect(aCharRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); } return aBounds; @@ -499,7 +499,7 @@ sal_Int32 VCLXAccessibleStatusBarItem::getIndexAtPoint( const awt::Point& aPoint vcl::ControlLayoutData aLayoutData; tools::Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId ); m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect ); - Point aPnt(VCLUnoHelper::ConvertToVCLPoint(aPoint)); + Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); aPnt += aItemRect.TopLeft(); nIndex = aLayoutData.GetIndexForPoint( aPnt ); } diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx index 90cd8807170c..f4a221ec687f 100644 --- a/accessibility/source/standard/vclxaccessibletabpage.cxx +++ b/accessibility/source/standard/vclxaccessibletabpage.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include @@ -32,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -191,7 +191,7 @@ awt::Rectangle VCLXAccessibleTabPage::implGetBounds() awt::Rectangle aBounds( 0, 0, 0, 0 ); if ( m_pTabControl ) - aBounds = VCLUnoHelper::ConvertToAWTRect(m_pTabControl->GetTabBounds(m_nPageId)); + aBounds = vcl::unohelper::ConvertToAWTRect(m_pTabControl->GetTabBounds(m_nPageId)); return aBounds; } @@ -407,8 +407,8 @@ Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleAtPoint( const awt: Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); if ( xComp.is() ) { - tools::Rectangle aRect = VCLUnoHelper::ConvertToVCLRect(xComp->getBounds()); - Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); + tools::Rectangle aRect = vcl::unohelper::ConvertToVCLRect(xComp->getBounds()); + Point aPos = vcl::unohelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { return xAcc; @@ -568,7 +568,7 @@ awt::Rectangle VCLXAccessibleTabPage::getCharacterBounds( sal_Int32 nIndex ) tools::Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId ); tools::Rectangle aCharRect; // m_pTabControl->GetCharacterBounds( m_nPageId, nIndex ); aCharRect.Move( -aPageRect.Left(), -aPageRect.Top() ); - aBounds = VCLUnoHelper::ConvertToAWTRect(aCharRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); } return aBounds; @@ -584,7 +584,7 @@ sal_Int32 VCLXAccessibleTabPage::getIndexAtPoint( const awt::Point& /*aPoint*/ ) // { // sal_uInt16 nPageId = 0; // tools::Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId ); -// Point aPnt( VCLUnoHelper::ConvertToVCLPoint( aPoint ) ); +// Point aPnt( vcl::unohelper::ConvertToVCLPoint( aPoint ) ); // aPnt += aPageRect.TopLeft(); // sal_Int32 nI = m_pTabControl->GetIndexForPoint( aPnt, nPageId ); // if ( nI != -1 && m_nPageId == nPageId ) diff --git a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx index 32424e807cec..be41e86b1634 100644 --- a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx +++ b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx @@ -19,9 +19,9 @@ #include #include -#include #include #include +#include #include using namespace ::com::sun::star; @@ -72,7 +72,7 @@ awt::Rectangle VCLXAccessibleTabPageWindow::implGetBounds() { tools::Rectangle aRect( m_pTabPage->GetPosPixel(), m_pTabPage->GetSizePixel() ); aRect.Move( -aPageRect.Left(), -aPageRect.Top() ); - aBounds = VCLUnoHelper::ConvertToAWTRect(aRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aRect); } } diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx index 0c38f6f522c7..ba2324b1bc94 100644 --- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx +++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include @@ -32,6 +31,7 @@ #include #include #include +#include #include using namespace ::com::sun::star; @@ -250,7 +250,7 @@ awt::Rectangle VCLXAccessibleTextComponent::getCharacterBounds( sal_Int32 nIndex awt::Rectangle aRect; VclPtr< Control > pControl = GetAs< Control >(); if ( pControl ) - aRect = VCLUnoHelper::ConvertToAWTRect(pControl->GetCharacterBounds(nIndex)); + aRect = vcl::unohelper::ConvertToAWTRect(pControl->GetCharacterBounds(nIndex)); return aRect; } @@ -271,7 +271,7 @@ sal_Int32 VCLXAccessibleTextComponent::getIndexAtPoint( const awt::Point& aPoint sal_Int32 nIndex = -1; VclPtr< Control > pControl = GetAs< Control >(); if ( pControl ) - nIndex = pControl->GetIndexForPoint(VCLUnoHelper::ConvertToVCLPoint(aPoint)); + nIndex = pControl->GetIndexForPoint(vcl::unohelper::ConvertToVCLPoint(aPoint)); return nIndex; } diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index 9d4cb3aaf203..d2a1e8d23e27 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -20,13 +20,13 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -664,7 +664,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleAtPoint( c if ( pToolBox ) { ToolBox::ImplToolItems::size_type nItemPos - = pToolBox->GetItemPos(VCLUnoHelper::ConvertToVCLPoint(_rPoint)); + = pToolBox->GetItemPos(vcl::unohelper::ConvertToVCLPoint(_rPoint)); if ( nItemPos != ToolBox::ITEM_NOTFOUND ) xAccessible = getAccessibleChild( nItemPos ); } diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index ac37733db0ea..754bbad58392 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include #include @@ -34,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -208,7 +208,7 @@ awt::Rectangle VCLXAccessibleToolBoxItem::implGetBounds( ) { awt::Rectangle aRect; if ( m_pToolBox ) - aRect = VCLUnoHelper::ConvertToAWTRect(m_pToolBox->GetItemPosRect(m_nIndexInParent)); + aRect = vcl::unohelper::ConvertToAWTRect(m_pToolBox->GetItemPosRect(m_nIndexInParent)); return aRect; } @@ -477,7 +477,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::getCharacterBounds( sal_Int32 tools::Rectangle aCharRect = m_pToolBox->GetCharacterBounds( m_nItemId, nIndex ); tools::Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId ); aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = VCLUnoHelper::ConvertToAWTRect(aCharRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); } return aBounds; @@ -492,7 +492,7 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getIndexAtPoint( const awt::Point& { ToolBoxItemId nItemId; tools::Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId ); - Point aPnt(VCLUnoHelper::ConvertToVCLPoint(aPoint)); + Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); aPnt += aItemRect.TopLeft(); sal_Int32 nIdx = m_pToolBox->GetIndexForPoint( aPnt, nItemId ); if ( nIdx != -1 && nItemId == m_nItemId ) diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index 0d929b144f47..ce65b97f819d 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include namespace basctl @@ -146,7 +147,7 @@ awt::Rectangle AccessibleDialogControlShape::GetBounds() const // clip the shape's bounding box with the bounding box of its parent tools::Rectangle aParentRect( Point( 0, 0 ), m_pDialogWindow->GetSizePixel() ); aRect = aRect.GetIntersection( aParentRect ); - aBounds = VCLUnoHelper::ConvertToAWTRect(aRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aRect); } } diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 9e31a8783cc4..d648340beb69 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -35,10 +35,9 @@ #include #include #include -#include -#include #include #include +#include #include namespace basctl @@ -409,7 +408,7 @@ awt::Rectangle AccessibleDialogWindow::implGetBounds() { awt::Rectangle aBounds; if ( m_pDialogWindow ) - aBounds = VCLUnoHelper::ConvertToAWTRect( + aBounds = vcl::unohelper::ConvertToAWTRect( tools::Rectangle(m_pDialogWindow->GetPosPixel(), m_pDialogWindow->GetSizePixel())); return aBounds; @@ -685,8 +684,8 @@ Reference< XAccessible > AccessibleDialogWindow::getAccessibleAtPoint( const awt Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY ); if ( xComp.is() ) { - tools::Rectangle aRect = VCLUnoHelper::ConvertToVCLRect(xComp->getBounds()); - Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); + tools::Rectangle aRect = vcl::unohelper::ConvertToVCLRect(xComp->getBounds()); + Point aPos = vcl::unohelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { xChild = std::move(xAcc); diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index a4f6a70e651f..01d0b05ac201 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -1497,7 +1498,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno xWindow->setPosSize( aPixelPos.X(), aPixelPos.Y(), 0, 0, awt::PosSize::POS ); if( bSetSize ) - xWindow->setOutputSize(VCLUnoHelper::ConvertToAWTSize(aSize)); + xWindow->setOutputSize(vcl::unohelper::ConvertToAWTSize(aSize)); if ( pWindow ) { @@ -1725,8 +1726,8 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos() SolarMutexGuard aGuard; VclPtr pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); if ( pContainerWindow ) - aStartPos = VCLUnoHelper::ConvertToAWTPoint( - pContainerWindow->OutputToScreenPixel(VCLUnoHelper::ConvertToVCLPoint(aStartPos))); + aStartPos = vcl::unohelper::ConvertToAWTPoint( + pContainerWindow->OutputToScreenPixel(vcl::unohelper::ConvertToVCLPoint(aStartPos))); } // Determine size of top and left docking area @@ -3394,14 +3395,14 @@ awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent if ( aFloatSize.Width > 0 && aFloatSize.Height > 0 ) { aUIDockingElement.m_aFloatingData.m_aPos - = VCLUnoHelper::ConvertToAWTPoint(pContainerWindow->ScreenToOutputPixel( - VCLUnoHelper::ConvertToVCLPoint(e.MousePos))); + = vcl::unohelper::ConvertToAWTPoint(pContainerWindow->ScreenToOutputPixel( + vcl::unohelper::ConvertToVCLPoint(e.MousePos))); aDockingData.TrackingRectangle.Height = aFloatSize.Height; aDockingData.TrackingRectangle.Width = aFloatSize.Width; } else { - aFloatSize = VCLUnoHelper::ConvertToAWTSize(pToolBox->CalcWindowSizePixel()); + aFloatSize = vcl::unohelper::ConvertToAWTSize(pToolBox->CalcWindowSizePixel()); if ( !bIsHorizontal ) { // Floating toolbars are always horizontal aligned! We have to swap @@ -3417,8 +3418,8 @@ awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent // For the first time we don't have any data about the floating size of a toolbar. // We calculate it and store it for later use. aUIDockingElement.m_aFloatingData.m_aPos - = VCLUnoHelper::ConvertToAWTPoint(pContainerWindow->ScreenToOutputPixel( - VCLUnoHelper::ConvertToVCLPoint(e.MousePos))); + = vcl::unohelper::ConvertToAWTPoint(pContainerWindow->ScreenToOutputPixel( + vcl::unohelper::ConvertToVCLPoint(e.MousePos))); aUIDockingElement.m_aFloatingData.m_aSize = aFloatSize; aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); @@ -3574,8 +3575,8 @@ sal_Bool SAL_CALL ToolbarLayoutManager::prepareToggleFloatingMode( const lang::E { ToolBox* pToolBox = static_cast< ToolBox *>( pWindow.get() ); aUIDockingElement.m_aFloatingData.m_aPos - = VCLUnoHelper::ConvertToAWTPoint(pToolBox->GetPosPixel()); - aUIDockingElement.m_aFloatingData.m_aSize = VCLUnoHelper::ConvertToAWTSize(pToolBox->GetOutputSizePixel()); + = vcl::unohelper::ConvertToAWTPoint(pToolBox->GetPosPixel()); + aUIDockingElement.m_aFloatingData.m_aSize = vcl::unohelper::ConvertToAWTSize(pToolBox->GetOutputSizePixel()); aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); } @@ -3643,9 +3644,9 @@ void SAL_CALL ToolbarLayoutManager::toggleFloatingMode( const lang::EventObject& if ( !bSetSize ) { if ( pToolBox ) - aUIDockingElement.m_aFloatingData.m_aSize = VCLUnoHelper::ConvertToAWTSize(pToolBox->CalcFloatingWindowSizePixel()); + aUIDockingElement.m_aFloatingData.m_aSize = vcl::unohelper::ConvertToAWTSize(pToolBox->CalcFloatingWindowSizePixel()); else if ( pWindow ) - aUIDockingElement.m_aFloatingData.m_aSize = VCLUnoHelper::ConvertToAWTSize(pWindow->GetOutputSizePixel()); + aUIDockingElement.m_aFloatingData.m_aSize = vcl::unohelper::ConvertToAWTSize(pWindow->GetOutputSizePixel()); } xWindow->setPosSize( aUIDockingElement.m_aFloatingData.m_aPos.X, @@ -3682,7 +3683,7 @@ void SAL_CALL ToolbarLayoutManager::toggleFloatingMode( const lang::EventObject& ::Size aSize = pToolBox->CalcWindowSizePixel( 1 ); awt::Rectangle aRect = xWindow->getPosSize(); xWindow->setPosSize( aRect.X, aRect.Y, 0, 0, awt::PosSize::POS ); - xWindow->setOutputSize(VCLUnoHelper::ConvertToAWTSize(aSize)); + xWindow->setOutputSize(vcl::unohelper::ConvertToAWTSize(aSize)); } } diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 9c3dabd0067b..4fbbf6839b07 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -207,7 +208,7 @@ PopupMenuToolbarController::createPopupWindow() css::uno::Reference< css::awt::XPopupMenu > xPopupMenu ( m_xPopupMenu ); sal_uInt16 nId = xPopupMenu->execute( css::uno::Reference< css::awt::XWindowPeer >( getParent(), css::uno::UNO_QUERY ), - VCLUnoHelper::ConvertToAWTRect( pToolBox->GetItemRect( m_nToolBoxId ) ), + vcl::unohelper::ConvertToAWTRect( pToolBox->GetItemRect( m_nToolBoxId ) ), ( eAlign == WindowAlign::Top || eAlign == WindowAlign::Bottom ) ? css::awt::PopupMenuDirection::EXECUTE_DOWN : css::awt::PopupMenuDirection::EXECUTE_RIGHT ); diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx index 16616119e1aa..4c364963b36b 100644 --- a/include/toolkit/helper/vclunohelper.hxx +++ b/include/toolkit/helper/vclunohelper.hxx @@ -24,9 +24,7 @@ #include #include -#include #include -#include #include #include @@ -125,38 +123,6 @@ public: /// @throws css::lang::IllegalArgumentException static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit); - static inline ::Size ConvertToVCLSize(const css::awt::Size& rAWTSize) - { - return ::Size(rAWTSize.Width, rAWTSize.Height); - } - - static inline css::awt::Size ConvertToAWTSize(const Size& rVCLSize) - { - return css::awt::Size(rVCLSize.Width(), rVCLSize.Height()); - } - - static inline ::Point ConvertToVCLPoint(const css::awt::Point& rAWTPoint) - { - return ::Point(rAWTPoint.X, rAWTPoint.Y); - } - - static inline css::awt::Point ConvertToAWTPoint(const PointTemplateBase& rVCLPoint) - { - return css::awt::Point(rVCLPoint.X(), rVCLPoint.Y()); - } - - static inline ::tools::Rectangle ConvertToVCLRect(const css::awt::Rectangle& rAWTRect) - { - return ::tools::Rectangle(::Point(rAWTRect.X, rAWTRect.Y), - ::Size(rAWTRect.Width, rAWTRect.Height)); - } - - static inline css::awt::Rectangle ConvertToAWTRect(const RectangleTemplateBase& rVCLRect) - { - return css::awt::Rectangle(rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), - rVCLRect.GetHeight()); - } - static css::awt::MouseEvent createMouseEvent( const ::MouseEvent& _rVclEvent, diff --git a/include/vcl/unohelp.hxx b/include/vcl/unohelp.hxx index c7b9dcc06956..9c6aa3470855 100644 --- a/include/vcl/unohelp.hxx +++ b/include/vcl/unohelp.hxx @@ -22,7 +22,11 @@ #include #include +#include +#include +#include #include +#include #include namespace com::sun::star::i18n { @@ -43,6 +47,13 @@ VCL_DLLPUBLIC float ConvertFontWeight( FontWeight eWeight ); VCL_DLLPUBLIC FontWeight ConvertFontWeight( float f ); VCL_DLLPUBLIC css::awt::FontSlant ConvertFontSlant( FontItalic eWeight ); VCL_DLLPUBLIC FontItalic ConvertFontSlant( css::awt::FontSlant ); +VCL_DLLPUBLIC Size ConvertToVCLSize(const css::awt::Size& rAWTSize); +VCL_DLLPUBLIC css::awt::Size ConvertToAWTSize(const Size& rVCLSize); +VCL_DLLPUBLIC Point ConvertToVCLPoint(const css::awt::Point& rAWTPoint); +VCL_DLLPUBLIC css::awt::Point ConvertToAWTPoint(const PointTemplateBase& rVCLPoint); +VCL_DLLPUBLIC tools::Rectangle ConvertToVCLRect(const css::awt::Rectangle& rAWTRect); +VCL_DLLPUBLIC css::awt::Rectangle ConvertToAWTRect(const RectangleTemplateBase& rVCLRect); + } // namespace vcl::unohelper #endif // INCLUDED_VCL_UNOHELP_HXX diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index eb834838734f..9f56510451ea 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -67,6 +67,7 @@ #include #include +#include #include #include @@ -1598,11 +1599,11 @@ void GeometryHandler::checkPosAndSize( const awt::Point& _aNewPos, if ( !xSection.is() || uno::Reference< report::XShape>(xSourceReportComponent,uno::UNO_QUERY).is() ) // shapes can overlap. return; - ::Point aPos(VCLUnoHelper::ConvertToVCLPoint(_aNewPos)); + ::Point aPos(vcl::unohelper::ConvertToVCLPoint(_aNewPos)); if ( aPos.X() < 0 || aPos.Y() < 0 ) // TODO: have to check size with pos aka || (aPos.X() + aAwtSize.Width) > m_xSection->getReportDefinition()-> throw beans::PropertyVetoException(RptResId(RID_STR_ILLEGAL_POSITION),xSourceReportComponent); - ::tools::Rectangle aSourceRect(aPos, VCLUnoHelper::ConvertToVCLSize(_aSize)); + ::tools::Rectangle aSourceRect(aPos, vcl::unohelper::ConvertToVCLSize(_aSize)); const sal_Int32 nCount = xSection->getCount(); for (sal_Int32 i = 0; i < nCount ; ++i) @@ -1611,8 +1612,8 @@ void GeometryHandler::checkPosAndSize( const awt::Point& _aNewPos, if ( xReportComponent.is() && xReportComponent != xSourceReportComponent ) { const ::tools::Rectangle aBoundRect( - VCLUnoHelper::ConvertToVCLPoint(xReportComponent->getPosition()), - VCLUnoHelper::ConvertToVCLSize(xReportComponent->getSize())); + vcl::unohelper::ConvertToVCLPoint(xReportComponent->getPosition()), + vcl::unohelper::ConvertToVCLSize(xReportComponent->getSize())); const ::tools::Rectangle aRect = aSourceRect.GetIntersection(aBoundRect); if ( !aRect.IsEmpty() && (aRect.Left() != aRect.Right() && aRect.Top() != aRect.Bottom() ) ) throw beans::PropertyVetoException(RptResId( RID_STR_OVERLAP_OTHER_CONTROL),xSourceReportComponent); diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index cbaad4ebd14a..ba51cb2ccc6a 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -936,8 +936,8 @@ tools::Rectangle getRectangleFromControl(SdrObject* _pControl) uno::Reference< report::XReportComponent > xComponent( _pControl->getUnoShape(), uno::UNO_QUERY); if (xComponent.is()) { - tools::Rectangle aRect(VCLUnoHelper::ConvertToVCLPoint(xComponent->getPosition()), - VCLUnoHelper::ConvertToVCLSize(xComponent->getSize())); + tools::Rectangle aRect(vcl::unohelper::ConvertToVCLPoint(xComponent->getPosition()), + vcl::unohelper::ConvertToVCLSize(xComponent->getSize())); aRect.setHeight(aRect.getOpenHeight() + 1); aRect.setWidth(aRect.getOpenWidth() + 1); return aRect; diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 1fa4beb1466c..42ed5b8f36ce 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -67,6 +67,7 @@ #include #include +#include #include #include @@ -2414,7 +2415,7 @@ void OReportController::openPageDialog(const uno::Reference& _ else { aDescriptor.Put(SvxSizeItem(RPTUI_ID_SIZE, - VCLUnoHelper::ConvertToVCLSize(getStyleProperty(m_xReportDefinition,PROPERTY_PAPERSIZE)))); + vcl::unohelper::ConvertToVCLSize(getStyleProperty(m_xReportDefinition,PROPERTY_PAPERSIZE)))); aDescriptor.Put(SvxLRSpaceItem(SvxIndentValue::twips(getStyleProperty( m_xReportDefinition, PROPERTY_LEFTMARGIN)), SvxIndentValue::twips(getStyleProperty( diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index ca9842cef7ab..77ad558e0396 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -53,6 +52,7 @@ #include #include +#include #include #include @@ -255,8 +255,8 @@ void OReportSection::Paste(const uno::Sequence< beans::NamedValue >& _aAllreadyC // Clone to target SdrModel rtl::Reference pNewObj(pObject->CloneSdrObject(*m_pModel)); m_pPage->InsertObject(pNewObj.get(), SAL_MAX_SIZE); - tools::Rectangle aRet(VCLUnoHelper::ConvertToVCLPoint(rCopy->getPosition()), - VCLUnoHelper::ConvertToVCLSize(rCopy->getSize())); + tools::Rectangle aRet(vcl::unohelper::ConvertToVCLPoint(rCopy->getPosition()), + vcl::unohelper::ConvertToVCLSize(rCopy->getSize())); aRet.setHeight(aRet.getOpenHeight() + 1); aRet.setWidth(aRet.getOpenWidth() + 1); bool bOverlapping = true; @@ -538,8 +538,8 @@ void OReportSection::impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_I xReportComponent->setPosition(aPos); correctOverlapping(pObject,*this,false); tools::Rectangle aRet( - VCLUnoHelper::ConvertToVCLPoint(xReportComponent->getPosition()), - VCLUnoHelper::ConvertToVCLSize(xReportComponent->getSize())); + vcl::unohelper::ConvertToVCLPoint(xReportComponent->getPosition()), + vcl::unohelper::ConvertToVCLSize(xReportComponent->getSize())); aRet.setHeight(aRet.getOpenHeight() + 1); aRet.setWidth(aRet.getOpenWidth() + 1); if ( m_xSection.is() && (o3tl::make_unsigned(aRet.getOpenHeight() + aRet.Top()) > m_xSection->getHeight()) ) @@ -771,7 +771,7 @@ sal_Int8 OReportSection::ExecuteDrop( const ExecuteDropEvent& _rEvt ) aCurrent.realloc(nLength + 3); auto pCurrent = aCurrent.getArray(); pCurrent[nLength].Name = PROPERTY_POSITION; - pCurrent[nLength++].Value <<= VCLUnoHelper::ConvertToAWTPoint(aDropPos); + pCurrent[nLength++].Value <<= vcl::unohelper::ConvertToAWTPoint(aDropPos); // give also the DND Action (Shift|Ctrl) Key to really say what we want pCurrent[nLength].Name = "DNDAction"; pCurrent[nLength++].Value <<= _rEvt.mnAction; diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 3dfb95ead12f..7ac2a49e14eb 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -1238,7 +1239,7 @@ void OViewsWindow::EndDragObj(bool _bControlKeyPressed, const OSectionView* _pSe for (; pColIter != pColEnd; ++pColIter) { uno::Reference< report::XReportComponent> xRC(*pColIter); - aPrevious = VCLUnoHelper::ConvertToVCLPoint(xRC->getPosition()); + aPrevious = vcl::unohelper::ConvertToVCLPoint(xRC->getPosition()); awt::Size aSize = xRC->getSize(); if ( aNewPos.X() < nLeftMargin ) @@ -1259,13 +1260,13 @@ void OViewsWindow::EndDragObj(bool _bControlKeyPressed, const OSectionView* _pSe aNewPos.setX( 0 ); xRC->setSize(aSize); } - xRC->setPosition(VCLUnoHelper::ConvertToAWTPoint(aNewPos)); + xRC->setPosition(vcl::unohelper::ConvertToAWTPoint(aNewPos)); if ( (pColIter+1) != pColEnd ) { // bring aNewPos to the position of the next object uno::Reference< report::XReportComponent> xRCNext = *(pColIter + 1); Point aNextPosition - = VCLUnoHelper::ConvertToVCLPoint(xRCNext->getPosition()); + = vcl::unohelper::ConvertToVCLPoint(xRCNext->getPosition()); aNewPos += aNextPosition - aPrevious; } } diff --git a/sc/source/ui/Accessibility/AccessibleContextBase.cxx b/sc/source/ui/Accessibility/AccessibleContextBase.cxx index 4300cf98cbab..b121893e2f6c 100644 --- a/sc/source/ui/Accessibility/AccessibleContextBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleContextBase.cxx @@ -159,7 +159,7 @@ sal_Bool SAL_CALL ScAccessibleContextBase::containsPoint(const awt::Point& rPoin SolarMutexGuard aGuard; IsObjectValid(); return tools::Rectangle(Point(), GetBoundingBox().GetSize()) - .Contains(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + .Contains(vcl::unohelper::ConvertToVCLPoint(rPoint)); } uno::Reference< XAccessible > SAL_CALL ScAccessibleContextBase::getAccessibleAtPoint( @@ -173,28 +173,28 @@ awt::Rectangle SAL_CALL ScAccessibleContextBase::getBounds( ) { SolarMutexGuard aGuard; IsObjectValid(); - return VCLUnoHelper::ConvertToAWTRect(GetBoundingBox()); + return vcl::unohelper::ConvertToAWTRect(GetBoundingBox()); } awt::Point SAL_CALL ScAccessibleContextBase::getLocation( ) { SolarMutexGuard aGuard; IsObjectValid(); - return VCLUnoHelper::ConvertToAWTPoint(GetBoundingBox().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(GetBoundingBox().TopLeft()); } awt::Point SAL_CALL ScAccessibleContextBase::getLocationOnScreen( ) { SolarMutexGuard aGuard; IsObjectValid(); - return VCLUnoHelper::ConvertToAWTPoint(GetBoundingBoxOnScreen().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(GetBoundingBoxOnScreen().TopLeft()); } awt::Size SAL_CALL ScAccessibleContextBase::getSize( ) { SolarMutexGuard aGuard; IsObjectValid(); - return VCLUnoHelper::ConvertToAWTSize(GetBoundingBox().GetSize()); + return vcl::unohelper::ConvertToAWTSize(GetBoundingBox().GetSize()); } bool ScAccessibleContextBase::isShowing( ) @@ -208,8 +208,8 @@ bool ScAccessibleContextBase::isShowing( ) if (xParentComponent.is()) { tools::Rectangle aParentBounds( - VCLUnoHelper::ConvertToVCLRect(xParentComponent->getBounds())); - tools::Rectangle aBounds(VCLUnoHelper::ConvertToVCLRect(getBounds())); + vcl::unohelper::ConvertToVCLRect(xParentComponent->getBounds())); + tools::Rectangle aBounds(vcl::unohelper::ConvertToVCLRect(getBounds())); bShowing = aBounds.Overlaps(aParentBounds); } } diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index d4eca4f99487..5658ee2a27a9 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -572,10 +573,10 @@ uno::Reference< XAccessible > ScChildrenShapes::GetAt(const awt::Point& rPoint) if (pShape->pAccShape.is()) { - Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + Point aPoint(vcl::unohelper::ConvertToVCLPoint(rPoint)); aPoint - -= VCLUnoHelper::ConvertToVCLRect(pShape->pAccShape->getBounds()).TopLeft(); - if (pShape->pAccShape->containsPoint(VCLUnoHelper::ConvertToAWTPoint(aPoint))) + -= vcl::unohelper::ConvertToVCLRect(pShape->pAccShape->getBounds()).TopLeft(); + if (pShape->pAccShape->containsPoint(vcl::unohelper::ConvertToAWTPoint(aPoint))) { xAccessible = pShape->pAccShape.get(); bFound = true; @@ -1640,8 +1641,8 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleDocument::getAccessibleAtPoin uno::Reference< XAccessibleComponent > xComp(xCont, uno::UNO_QUERY); if (xComp.is()) { - tools::Rectangle aBound(VCLUnoHelper::ConvertToVCLRect(xComp->getBounds())); - if (aBound.Contains(VCLUnoHelper::ConvertToVCLPoint(rPoint))) + tools::Rectangle aBound(vcl::unohelper::ConvertToVCLRect(xComp->getBounds())); + if (aBound.Contains(vcl::unohelper::ConvertToVCLPoint(rPoint))) xAccessible = mxTempAcc; } } diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index fa51d4818983..5ba18208d110 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -924,13 +925,13 @@ struct ScShapePointFound { Point maPoint; explicit ScShapePointFound(const awt::Point& rPoint) - : maPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)) + : maPoint(vcl::unohelper::ConvertToVCLPoint(rPoint)) { } bool operator() (const ScShapeChild& rShape) { bool bResult(false); - if (VCLUnoHelper::ConvertToVCLRect(rShape.mpAccShape->getBounds()).Contains(maPoint)) + if (vcl::unohelper::ConvertToVCLRect(rShape.mpAccShape->getBounds()).Contains(maPoint)) bResult = true; return bResult; } @@ -1030,8 +1031,8 @@ void ScShapeChildren::FillShapes(const tools::Rectangle& aPixelPaintRect, const if (xShape.is()) { tools::Rectangle aRect(pWin->LogicToPixel( - tools::Rectangle(VCLUnoHelper::ConvertToVCLPoint(xShape->getPosition()), - VCLUnoHelper::ConvertToVCLSize(xShape->getSize())), aMapMode)); + tools::Rectangle(vcl::unohelper::ConvertToVCLPoint(xShape->getPosition()), + vcl::unohelper::ConvertToVCLSize(xShape->getSize())), aMapMode)); if(!aClippedPixelPaintRect.GetIntersection(aRect).IsEmpty()) { ScShapeChild aShape; @@ -1305,8 +1306,8 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleDocumentPagePreview::getAcces mpTable->Init(); } if (mpTable.is() - && VCLUnoHelper::ConvertToVCLRect(mpTable->getBounds()) - .Contains(VCLUnoHelper::ConvertToVCLPoint(rPoint))) + && vcl::unohelper::ConvertToVCLRect(mpTable->getBounds()) + .Contains(vcl::unohelper::ConvertToVCLPoint(rPoint))) xAccessible = mpTable.get(); } if (!xAccessible.is()) @@ -1328,11 +1329,11 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleDocumentPagePreview::getAcces } } - Point aPoint(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + Point aPoint(vcl::unohelper::ConvertToVCLPoint(rPoint)); - if (VCLUnoHelper::ConvertToVCLRect(mpHeader->getBounds()).Contains(aPoint)) + if (vcl::unohelper::ConvertToVCLRect(mpHeader->getBounds()).Contains(aPoint)) xAccessible = mpHeader.get(); - else if (VCLUnoHelper::ConvertToVCLRect(mpFooter->getBounds()).Contains(aPoint)) + else if (vcl::unohelper::ConvertToVCLRect(mpFooter->getBounds()).Contains(aPoint)) xAccessible = mpFooter.get(); } if (!xAccessible.is()) diff --git a/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx b/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx index 89ed4343ff35..4881e2a8ce60 100644 --- a/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx +++ b/sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx @@ -34,8 +34,8 @@ #include #include #include -#include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; @@ -234,9 +234,9 @@ AbsoluteScreenPixelRectangle ScAccessiblePageHeaderArea::GetBoundingBoxOnScreen( // has the same size and position on screen like the parent aRect = AbsoluteScreenPixelRectangle( AbsoluteScreenPixelPoint( - VCLUnoHelper::ConvertToVCLPoint(xComp->getLocationOnScreen())), + vcl::unohelper::ConvertToVCLPoint(xComp->getLocationOnScreen())), AbsoluteScreenPixelSize( - VCLUnoHelper::ConvertToVCLRect(xComp->getBounds()).GetSize())); + vcl::unohelper::ConvertToVCLRect(xComp->getBounds()).GetSize())); } } return aRect; @@ -253,7 +253,7 @@ tools::Rectangle ScAccessiblePageHeaderArea::GetBoundingBox() const { // has the same size and position on screen like the parent and so the pos is (0, 0) tools::Rectangle aNewRect(Point(0, 0), - VCLUnoHelper::ConvertToVCLRect(xComp->getBounds()).GetSize()); + vcl::unohelper::ConvertToVCLRect(xComp->getBounds()).GetSize()); aRect = aNewRect; } } diff --git a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx index 9bcbb14e3b92..c0aefc808cc8 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewCell.cxx @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -221,7 +221,7 @@ tools::Rectangle ScAccessiblePreviewCell::GetBoundingBox() const if (xAccParentComp.is()) { tools::Rectangle aParentRect( - VCLUnoHelper::ConvertToVCLRect(xAccParentComp->getBounds())); + vcl::unohelper::ConvertToVCLRect(xAccParentComp->getBounds())); aCellRect.Move(-aParentRect.Left(), -aParentRect.Top()); } } diff --git a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx index c16ae0f72c37..670d45ff0cb9 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -326,7 +327,7 @@ tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBox() const if (xAccParentComp.is()) { tools::Rectangle aParentRect( - VCLUnoHelper::ConvertToVCLRect(xAccParentComp->getBounds())); + vcl::unohelper::ConvertToVCLRect(xAccParentComp->getBounds())); aCellRect.Move(-aParentRect.Left(), -aParentRect.Top()); } } diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx index 3452718c61e4..4aabcf03ebe0 100644 --- a/sc/source/ui/unoobj/shapeuno.cxx +++ b/sc/source/ui/unoobj/shapeuno.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -302,8 +303,8 @@ static ScRange lcl_GetAnchorCell( const uno::Reference< drawing::XShape >& xShap rUnoPoint.Y += rCaptionPoint.Y; } aReturn - = pDoc->GetRange(nTab, tools::Rectangle(VCLUnoHelper::ConvertToVCLPoint(rUnoPoint), - VCLUnoHelper::ConvertToVCLPoint(rUnoPoint))); + = pDoc->GetRange(nTab, tools::Rectangle(vcl::unohelper::ConvertToVCLPoint(rUnoPoint), + vcl::unohelper::ConvertToVCLPoint(rUnoPoint))); } else { @@ -315,8 +316,8 @@ static ScRange lcl_GetAnchorCell( const uno::Reference< drawing::XShape >& xShap rUnoPoint.Y += rCaptionPoint.Y; } aReturn - = pDoc->GetRange(nTab, tools::Rectangle(VCLUnoHelper::ConvertToVCLPoint(rUnoPoint), - VCLUnoHelper::ConvertToVCLPoint(rUnoPoint))); + = pDoc->GetRange(nTab, tools::Rectangle(vcl::unohelper::ConvertToVCLPoint(rUnoPoint), + vcl::unohelper::ConvertToVCLPoint(rUnoPoint))); } return aReturn; diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 6003c9f7e0ac..02f66358cb25 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -406,7 +407,7 @@ awt::Rectangle ScViewPaneBase::GetVisArea() const aVisPos.AdjustX( -(aVisSize.Width()) ); } tools::Rectangle aVisRect( aVisPos, aVisSize ); - aVisArea = VCLUnoHelper::ConvertToAWTRect(aVisRect); + aVisArea = vcl::unohelper::ConvertToAWTRect(aVisRect); } } return aVisArea; @@ -1937,7 +1938,7 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName if ( pActiveWin ) { AbsoluteScreenPixelRectangle aRect = pActiveWin->GetWindowExtentsAbsolute(); - aRet <<= VCLUnoHelper::ConvertToAWTRect(aRect); + aRet <<= vcl::unohelper::ConvertToAWTRect(aRect); } } } diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index c195af87bb41..049f810a27f3 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -330,7 +331,7 @@ void SAL_CALL SfxStatusBarControl::paint( OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( xGraphics ); if ( pOutDev ) { - ::tools::Rectangle aRect = VCLUnoHelper::ConvertToVCLRect(rOutputRectangle); + ::tools::Rectangle aRect = vcl::unohelper::ConvertToVCLRect(rOutputRectangle); UserDrawEvent aUserDrawEvent(pOutDev, aRect, pBar->GetCurItemId()); Paint( aUserDrawEvent ); } diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 6ad66b0c9ed2..2215e17469e1 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -457,7 +458,7 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getPlacement() aRealObjArea = pEditWin->LogicToPixel(aRealObjArea); } - return VCLUnoHelper::ConvertToAWTRect(aRealObjArea); + return vcl::unohelper::ConvertToAWTRect(aRealObjArea); } @@ -487,7 +488,7 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getClipRectangle() aRealObjArea = pEditWin->LogicToPixel(aRealObjArea); } - return VCLUnoHelper::ConvertToAWTRect(aRealObjArea); + return vcl::unohelper::ConvertToAWTRect(aRealObjArea); } @@ -515,8 +516,8 @@ void SAL_CALL SfxInPlaceClient_Impl::changedPlacement( const awt::Rectangle& aPo // check if the change is at least one pixel in size awt::Rectangle aOldRect = getPlacement(); - tools::Rectangle aNewPixelRect = VCLUnoHelper::ConvertToVCLRect(aPosRect); - tools::Rectangle aOldPixelRect = VCLUnoHelper::ConvertToVCLRect(aOldRect); + tools::Rectangle aNewPixelRect = vcl::unohelper::ConvertToVCLRect(aPosRect); + tools::Rectangle aOldPixelRect = vcl::unohelper::ConvertToVCLRect(aOldRect); if ( aOldPixelRect == aNewPixelRect ) // nothing has changed return; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 30718d1d42e7..c4a255e7722f 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -66,6 +66,7 @@ #include #include #include +#include #include #include @@ -830,9 +831,9 @@ awt::Rectangle SAL_CALL SfxBaseController::queryBorderedArea( const awt::Rectang SolarMutexGuard aGuard; if ( m_pData->m_pViewShell ) { - tools::Rectangle aTmpRect = VCLUnoHelper::ConvertToVCLRect(aPreliminaryRectangle); + tools::Rectangle aTmpRect = vcl::unohelper::ConvertToVCLRect(aPreliminaryRectangle); m_pData->m_pViewShell->QueryObjAreaPixel( aTmpRect ); - return VCLUnoHelper::ConvertToAWTRect(aTmpRect); + return vcl::unohelper::ConvertToAWTRect(aTmpRect); } return aPreliminaryRectangle; diff --git a/svtools/source/control/accessibleruler.cxx b/svtools/source/control/accessibleruler.cxx index c188895444f3..75df0c84c086 100644 --- a/svtools/source/control/accessibleruler.cxx +++ b/svtools/source/control/accessibleruler.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -70,9 +71,9 @@ uno::Reference< XAccessibleContext > SAL_CALL SvtRulerAccessible::getAccessibleC sal_Bool SAL_CALL SvtRulerAccessible::containsPoint( const awt::Point& rPoint ) { // no guard -> done in getBounds() -// return GetBoundingBox().IsInside( VCLUnoHelper::ConvertToVCLPoint( rPoint ) ); +// return GetBoundingBox().IsInside( vcl::unohelper::ConvertToVCLPoint( rPoint ) ); return tools::Rectangle(Point(0, 0), GetBoundingBox().GetSize()) - .Contains(VCLUnoHelper::ConvertToVCLPoint(rPoint)); + .Contains(vcl::unohelper::ConvertToVCLPoint(rPoint)); } uno::Reference< XAccessible > SAL_CALL SvtRulerAccessible::getAccessibleAtPoint( const awt::Point& ) @@ -86,25 +87,25 @@ uno::Reference< XAccessible > SAL_CALL SvtRulerAccessible::getAccessibleAtPoint( awt::Rectangle SAL_CALL SvtRulerAccessible::getBounds() { // no guard -> done in GetBoundingBox() - return VCLUnoHelper::ConvertToAWTRect(GetBoundingBox()); + return vcl::unohelper::ConvertToAWTRect(GetBoundingBox()); } awt::Point SAL_CALL SvtRulerAccessible::getLocation() { // no guard -> done in GetBoundingBox() - return VCLUnoHelper::ConvertToAWTPoint(GetBoundingBox().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(GetBoundingBox().TopLeft()); } awt::Point SAL_CALL SvtRulerAccessible::getLocationOnScreen() { // no guard -> done in GetBoundingBoxOnScreen() - return VCLUnoHelper::ConvertToAWTPoint(GetBoundingBoxOnScreen().TopLeft()); + return vcl::unohelper::ConvertToAWTPoint(GetBoundingBoxOnScreen().TopLeft()); } awt::Size SAL_CALL SvtRulerAccessible::getSize() { // no guard -> done in GetBoundingBox() - return VCLUnoHelper::ConvertToAWTSize(GetBoundingBox().GetSize()); + return vcl::unohelper::ConvertToAWTSize(GetBoundingBox().GetSize()); } //===== XAccessibleContext ================================================== diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx index 667fe8c76849..38a643a2b1f4 100644 --- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx +++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -425,7 +426,7 @@ void SAL_CALL SvxPixelCtlAccessibleChild::disposing() awt::Rectangle SvxPixelCtlAccessibleChild::implGetBounds() { // no guard necessary, because no one changes maBoundingBox after creating it - return VCLUnoHelper::ConvertToAWTRect(maBoundingBox); + return vcl::unohelper::ConvertToAWTRect(maBoundingBox); } OUString SvxPixelCtlAccessibleChild::GetName() const diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index b081c03a1e08..e3d736e45510 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -601,7 +601,7 @@ void SAL_CALL SvxRectCtlChildAccessibleContext::disposing() awt::Rectangle SvxRectCtlChildAccessibleContext::implGetBounds( ) { // no guard necessary, because no one changes maBoundingBox after creating it - return VCLUnoHelper::ConvertToAWTRect(maBoundingBox); + return vcl::unohelper::ConvertToAWTRect(maBoundingBox); } void SvxRectCtlChildAccessibleContext::setStateChecked( bool bChecked ) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index b6f8a92bbae3..67a30926a630 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -230,7 +231,7 @@ namespace sdr::contact { ::tools::Rectangle ControlHolder::getPosSize() const { // no check whether we're valid, this is the responsibility of the caller - return VCLUnoHelper::ConvertToVCLRect( m_xControlWindow->getPosSize() ); + return vcl::unohelper::ConvertToVCLRect( m_xControlWindow->getPosSize() ); } diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 9e87d9be3b74..dbcb73b2cbe3 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -59,6 +59,7 @@ #include #include +#include #include #include @@ -453,7 +454,7 @@ awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getPlacement() aContainerMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xParentVis->getMapUnit( mpObj->GetAspect() ) ); aLogicRect = Application::GetDefaultDevice()->LogicToPixel(aLogicRect, MapMode(aContainerMapUnit)); - return VCLUnoHelper::ConvertToAWTRect(aLogicRect); + return vcl::unohelper::ConvertToAWTRect(aLogicRect); } awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getClipRectangle() @@ -479,8 +480,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::changedPlacement( const awt::Rectangl // check if the change is at least one pixel in size awt::Rectangle aOldRect = getPlacement(); - tools::Rectangle aNewPixelRect = VCLUnoHelper::ConvertToVCLRect(aPosRect); - tools::Rectangle aOldPixelRect = VCLUnoHelper::ConvertToVCLRect(aOldRect); + tools::Rectangle aNewPixelRect = vcl::unohelper::ConvertToVCLRect(aPosRect); + tools::Rectangle aOldPixelRect = vcl::unohelper::ConvertToVCLRect(aOldRect); if ( aOldPixelRect == aNewPixelRect ) // nothing has changed return; diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index b3ec59e5768f..0a237988fed0 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -73,6 +73,7 @@ #include #include +#include #include #include @@ -839,7 +840,7 @@ void SwView::ExecSmartTagPopup( const Point& rPt ) if ( aToFill.HasArea() ) xPopupMenu->execute( m_pEditWin->GetComponentInterface(), - VCLUnoHelper::ConvertToAWTRect( m_pEditWin->LogicToPixel( aToFill.SVRect() ) ), css::awt::PopupMenuDirection::EXECUTE_DOWN ); + vcl::unohelper::ConvertToAWTRect( m_pEditWin->LogicToPixel( aToFill.SVRect() ) ), css::awt::PopupMenuDirection::EXECUTE_DOWN ); css::uno::Reference< css::lang::XComponent > xComponent( xPopupController, css::uno::UNO_QUERY ); if ( xComponent.is() ) diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 2f709a2329a8..33f86114bdca 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -28,12 +28,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -697,8 +697,8 @@ uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessi uno::Reference< accessibility::XAccessibleComponent > xComp( xAcc->getAccessibleContext(), uno::UNO_QUERY ); if ( xComp.is() ) { - tools::Rectangle aRect = VCLUnoHelper::ConvertToVCLRect(xComp->getBounds()); - Point aPos = VCLUnoHelper::ConvertToVCLPoint(rPoint); + tools::Rectangle aRect = vcl::unohelper::ConvertToVCLRect(xComp->getBounds()); + Point aPos = vcl::unohelper::ConvertToVCLPoint(rPoint); if ( aRect.Contains( aPos ) ) { xChild = std::move(xAcc); @@ -720,12 +720,12 @@ awt::Rectangle VCLXAccessibleComponent::implGetBounds() if ( pWindow ) { AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute(); - aBounds = VCLUnoHelper::ConvertToAWTRect(aRect); + aBounds = vcl::unohelper::ConvertToAWTRect(aRect); vcl::Window* pParent = pWindow->GetAccessibleParentWindow(); if ( pParent ) { AbsoluteScreenPixelRectangle aParentRect = pParent->GetWindowExtentsAbsolute(); - awt::Point aParentScreenLoc = VCLUnoHelper::ConvertToAWTPoint(aParentRect.TopLeft()); + awt::Point aParentScreenLoc = vcl::unohelper::ConvertToAWTPoint(aParentRect.TopLeft()); aBounds.X -= aParentScreenLoc.X; aBounds.Y -= aParentScreenLoc.Y; } diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx index 13acc4d270ec..96f2967b4a1e 100644 --- a/toolkit/source/awt/vclxdevice.cxx +++ b/toolkit/source/awt/vclxdevice.cxx @@ -32,6 +32,7 @@ #include #include #include +#include VCLXDevice::VCLXDevice() @@ -169,9 +170,9 @@ css::awt::Point SAL_CALL VCLXDevice::convertPointToLogic( const css::awt::Point& if( mpOutputDevice ) { MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(TargetUnit)); - ::Point aVCLPoint = VCLUnoHelper::ConvertToVCLPoint(aPoint); + ::Point aVCLPoint = vcl::unohelper::ConvertToVCLPoint(aPoint); ::Point aDevPoint = mpOutputDevice->PixelToLogic(aVCLPoint, aMode ); - aAWTPoint = VCLUnoHelper::ConvertToAWTPoint(aDevPoint); + aAWTPoint = vcl::unohelper::ConvertToAWTPoint(aDevPoint); } return aAWTPoint; @@ -193,9 +194,9 @@ css::awt::Point SAL_CALL VCLXDevice::convertPointToPixel( const css::awt::Point& if( mpOutputDevice ) { MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(SourceUnit)); - ::Point aVCLPoint = VCLUnoHelper::ConvertToVCLPoint(aPoint); + ::Point aVCLPoint = vcl::unohelper::ConvertToVCLPoint(aPoint); ::Point aDevPoint = mpOutputDevice->LogicToPixel(aVCLPoint, aMode ); - aAWTPoint = VCLUnoHelper::ConvertToAWTPoint(aDevPoint); + aAWTPoint = vcl::unohelper::ConvertToAWTPoint(aDevPoint); } return aAWTPoint; @@ -217,9 +218,9 @@ css::awt::Size SAL_CALL VCLXDevice::convertSizeToLogic( const css::awt::Size& aS if( mpOutputDevice ) { MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(TargetUnit)); - ::Size aVCLSize = VCLUnoHelper::ConvertToVCLSize(aSize); + ::Size aVCLSize = vcl::unohelper::ConvertToVCLSize(aSize); ::Size aDevSz = mpOutputDevice->PixelToLogic(aVCLSize, aMode ); - aAWTSize = VCLUnoHelper::ConvertToAWTSize(aDevSz); + aAWTSize = vcl::unohelper::ConvertToAWTSize(aDevSz); } return aAWTSize; @@ -240,9 +241,9 @@ css::awt::Size SAL_CALL VCLXDevice::convertSizeToPixel( const css::awt::Size& aS if( mpOutputDevice ) { MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(SourceUnit)); - ::Size aVCLSize = VCLUnoHelper::ConvertToVCLSize(aSize); + ::Size aVCLSize = vcl::unohelper::ConvertToVCLSize(aSize); ::Size aDevSz = mpOutputDevice->LogicToPixel(aVCLSize, aMode ); - aAWTSize = VCLUnoHelper::ConvertToAWTSize(aDevSz); + aAWTSize = vcl::unohelper::ConvertToAWTSize(aDevSz); } return aAWTSize; diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx index 6925fccb9fa5..2c0987e818d8 100644 --- a/toolkit/source/awt/vclxgraphics.cxx +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include using namespace com::sun::star; @@ -244,7 +245,7 @@ void VCLXGraphics::clear( if( mpOutputDevice ) { - const ::tools::Rectangle aVCLRect = VCLUnoHelper::ConvertToVCLRect( aRect ); + const ::tools::Rectangle aVCLRect = vcl::unohelper::ConvertToVCLRect( aRect ); mpOutputDevice->Erase( aVCLRect ); } } diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 14cd09d60514..fb12c14180b6 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -506,7 +507,7 @@ sal_Int16 VCLXMenu::execute( pPopupMenu->SetMenuFlags(nMenuFlags); // cannot call this with mutex locked because it will call back into us return pPopupMenu->Execute( - VCLUnoHelper::GetWindow(rxWindowPeer), VCLUnoHelper::ConvertToVCLRect(rPos), + VCLUnoHelper::GetWindow(rxWindowPeer), vcl::unohelper::ConvertToVCLRect(rPos), static_cast(nFlags) | PopupMenuFlags::NoMouseUpClose); } diff --git a/toolkit/source/awt/vclxregion.cxx b/toolkit/source/awt/vclxregion.cxx index 1d9eec4785dc..c30538b27695 100644 --- a/toolkit/source/awt/vclxregion.cxx +++ b/toolkit/source/awt/vclxregion.cxx @@ -19,6 +19,7 @@ #include #include +#include VCLXRegion::VCLXRegion() @@ -33,7 +34,7 @@ css::awt::Rectangle VCLXRegion::getBounds() { std::scoped_lock aGuard( maMutex ); - return VCLUnoHelper::ConvertToAWTRect(maRegion.GetBoundRect()); + return vcl::unohelper::ConvertToAWTRect(maRegion.GetBoundRect()); } void VCLXRegion::clear() @@ -54,28 +55,28 @@ void VCLXRegion::unionRectangle( const css::awt::Rectangle& rRect ) { std::scoped_lock aGuard( maMutex ); - maRegion.Union(VCLUnoHelper::ConvertToVCLRect(rRect)); + maRegion.Union(vcl::unohelper::ConvertToVCLRect(rRect)); } void VCLXRegion::intersectRectangle( const css::awt::Rectangle& rRect ) { std::scoped_lock aGuard( maMutex ); - maRegion.Intersect(VCLUnoHelper::ConvertToVCLRect(rRect)); + maRegion.Intersect(vcl::unohelper::ConvertToVCLRect(rRect)); } void VCLXRegion::excludeRectangle( const css::awt::Rectangle& rRect ) { std::scoped_lock aGuard( maMutex ); - maRegion.Exclude(VCLUnoHelper::ConvertToVCLRect(rRect)); + maRegion.Exclude(vcl::unohelper::ConvertToVCLRect(rRect)); } void VCLXRegion::xOrRectangle( const css::awt::Rectangle& rRect ) { std::scoped_lock aGuard( maMutex ); - maRegion.XOr(VCLUnoHelper::ConvertToVCLRect(rRect)); + maRegion.XOr(vcl::unohelper::ConvertToVCLRect(rRect)); } void VCLXRegion::unionRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion ) @@ -123,14 +124,14 @@ css::uno::Sequence< css::awt::Rectangle > VCLXRegion::getRectangles() for(const auto& rRect : aRectangles) { - aRects.getArray()[a++] = VCLUnoHelper::ConvertToAWTRect(rRect); + aRects.getArray()[a++] = vcl::unohelper::ConvertToAWTRect(rRect); } //Rectangle aRect; //sal_uInt32 nR = 0; //RegionHandle h = maRegion.BeginEnumRects(); //while ( maRegion.GetEnumRects( h, aRect ) ) - // aRects.getArray()[nR++] = VCLUnoHelper::ConvertToAWTRect( aRect ); + // aRects.getArray()[nR++] = vcl::unohelper::ConvertToAWTRect( aRect ); //maRegion.EndEnumRects( h ); return aRects; diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index c13d6c3fc8bb..46367dc8fffb 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -62,6 +62,7 @@ #include #include #include +#include #include #ifdef MACOSX @@ -1874,7 +1875,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( } else if ( !VCLUnoHelper::IsZero( rDescriptor.Bounds ) ) { - tools::Rectangle aRect = VCLUnoHelper::ConvertToVCLRect(rDescriptor.Bounds); + tools::Rectangle aRect = vcl::unohelper::ConvertToVCLRect(rDescriptor.Bounds); pNewWindow->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() ); } diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 79b21ebfa4d3..7dff40ed4763 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -448,7 +449,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { css::awt::PaintEvent aEvent; aEvent.Source = getXWeak(); - aEvent.UpdateRect = VCLUnoHelper::ConvertToAWTRect( + aEvent.UpdateRect = vcl::unohelper::ConvertToAWTRect( *static_cast(rVclWindowEvent.GetData())); aEvent.Count = 0; mpImpl->getPaintListeners().windowPaint( aEvent ); @@ -757,7 +758,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { css::awt::DockingEvent aEvent; aEvent.Source = getXWeak(); - aEvent.TrackingRectangle = VCLUnoHelper::ConvertToAWTRect(pData->maTrackRect); + aEvent.TrackingRectangle = vcl::unohelper::ConvertToAWTRect(pData->maTrackRect); aEvent.MousePos.X = pData->maMousePos.X(); aEvent.MousePos.Y = pData->maMousePos.Y(); aEvent.bLiveMode = false; @@ -778,7 +779,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { css::awt::DockingEvent aEvent; aEvent.Source = getXWeak(); - aEvent.TrackingRectangle = VCLUnoHelper::ConvertToAWTRect(pData->maTrackRect); + aEvent.TrackingRectangle = vcl::unohelper::ConvertToAWTRect(pData->maTrackRect); aEvent.MousePos.X = pData->maMousePos.X(); aEvent.MousePos.Y = pData->maMousePos.Y(); aEvent.bLiveMode = false; @@ -794,7 +795,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) css::awt::DockingData aDockingData = xFirstListener->docking( aEvent ); pData->maTrackRect - = VCLUnoHelper::ConvertToVCLRect(aDockingData.TrackingRectangle); + = vcl::unohelper::ConvertToVCLRect(aDockingData.TrackingRectangle); pData->mbFloating = aDockingData.bFloating; } } @@ -810,7 +811,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { css::awt::EndDockingEvent aEvent; aEvent.Source = getXWeak(); - aEvent.WindowRectangle = VCLUnoHelper::ConvertToAWTRect(pData->maWindowRect); + aEvent.WindowRectangle = vcl::unohelper::ConvertToAWTRect(pData->maWindowRect); aEvent.bFloating = pData->mbFloating; aEvent.bCancelled = pData->mbCancelled; mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking, aEvent ); @@ -983,10 +984,10 @@ css::awt::Rectangle VCLXWindow::getPosSize( ) if ( GetWindow() ) { if( vcl::Window::GetDockingManager()->IsDockable( GetWindow() ) ) - aBounds = VCLUnoHelper::ConvertToAWTRect( + aBounds = vcl::unohelper::ConvertToAWTRect( vcl::Window::GetDockingManager()->GetPosSizePixel(GetWindow())); else - aBounds = VCLUnoHelper::ConvertToAWTRect( + aBounds = vcl::unohelper::ConvertToAWTRect( tools::Rectangle(GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel())); } @@ -1186,7 +1187,7 @@ void VCLXWindow::invalidateRect( const css::awt::Rectangle& rRect, sal_Int16 nIn SolarMutexGuard aGuard; if ( GetWindow() ) - GetWindow()->Invalidate(VCLUnoHelper::ConvertToVCLRect(rRect), + GetWindow()->Invalidate(vcl::unohelper::ConvertToVCLRect(rRect), static_cast(nInvalidateFlags)); } @@ -2521,14 +2522,14 @@ void SAL_CALL VCLXWindow::setOutputSize( const css::awt::Size& aSize ) { SolarMutexGuard aGuard; if( VclPtr pWindow = GetWindow() ) - pWindow->SetOutputSizePixel(VCLUnoHelper::ConvertToVCLSize(aSize)); + pWindow->SetOutputSizePixel(vcl::unohelper::ConvertToVCLSize(aSize)); } css::awt::Size SAL_CALL VCLXWindow::getOutputSize( ) { SolarMutexGuard aGuard; if( VclPtr pWindow = GetWindow() ) - return VCLUnoHelper::ConvertToAWTSize(pWindow->GetOutputSizePixel()); + return vcl::unohelper::ConvertToAWTSize(pWindow->GetOutputSizePixel()); else return css::awt::Size(); } diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index ab98b6f52592..b64b326a7576 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -442,7 +443,7 @@ css::awt::Size VCLXButton::getMinimumSize( ) VclPtr< PushButton > pButton = GetAs< PushButton >(); if ( pButton ) aSz = pButton->CalcMinimumSize(); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXButton::getPreferredSize( ) @@ -457,7 +458,7 @@ css::awt::Size VCLXButton::calcAdjustedSize( const css::awt::Size& rNewSize ) { SolarMutexGuard aGuard; - Size aSz = VCLUnoHelper::ConvertToVCLSize(rNewSize); + Size aSz = vcl::unohelper::ConvertToVCLSize(rNewSize); VclPtr< PushButton > pButton = GetAs< PushButton >(); if ( pButton ) { @@ -478,7 +479,7 @@ css::awt::Size VCLXButton::calcAdjustedSize( const css::awt::Size& rNewSize ) aSz = aMinSz; } } - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } void VCLXButton::setProperty( const OUString& PropertyName, const css::uno::Any& Value) @@ -661,7 +662,7 @@ css::awt::Size VCLXImageControl::getMinimumSize( ) Size aSz = GetImage().GetSizePixel(); aSz = ImplCalcWindowSize( aSz ); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXImageControl::getPreferredSize( ) @@ -898,7 +899,7 @@ css::awt::Size VCLXCheckBox::getMinimumSize() VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >(); if ( pCheckBox ) aSz = pCheckBox->CalcMinimumSize(); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXCheckBox::getPreferredSize() @@ -910,7 +911,7 @@ css::awt::Size VCLXCheckBox::calcAdjustedSize( const css::awt::Size& rNewSize ) { SolarMutexGuard aGuard; - Size aSz = VCLUnoHelper::ConvertToVCLSize(rNewSize); + Size aSz = vcl::unohelper::ConvertToVCLSize(rNewSize); VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >(); if ( pCheckBox ) { @@ -920,7 +921,7 @@ css::awt::Size VCLXCheckBox::calcAdjustedSize( const css::awt::Size& rNewSize ) else aSz = aMinSz; } - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } void VCLXCheckBox::setProperty( const OUString& PropertyName, const css::uno::Any& Value) @@ -1223,7 +1224,7 @@ css::awt::Size VCLXRadioButton::getMinimumSize( ) VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >(); if ( pRadioButton ) aSz = pRadioButton->CalcMinimumSize(); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXRadioButton::getPreferredSize( ) @@ -1235,7 +1236,7 @@ css::awt::Size VCLXRadioButton::calcAdjustedSize( const css::awt::Size& rNewSize { SolarMutexGuard aGuard; - Size aSz = VCLUnoHelper::ConvertToVCLSize(rNewSize); + Size aSz = vcl::unohelper::ConvertToVCLSize(rNewSize); VclPtr< RadioButton > pRadioButton = GetAs< RadioButton >(); if ( pRadioButton ) { @@ -1245,7 +1246,7 @@ css::awt::Size VCLXRadioButton::calcAdjustedSize( const css::awt::Size& rNewSize else aSz = aMinSz; } - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) @@ -1963,7 +1964,7 @@ css::awt::Size VCLXListBox::getMinimumSize( ) VclPtr< ListBox > pListBox = GetAs< ListBox >(); if ( pListBox ) aSz = pListBox->CalcMinimumSize(); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXListBox::getPreferredSize( ) @@ -1977,17 +1978,17 @@ css::awt::Size VCLXListBox::getPreferredSize( ) if ( pListBox->GetStyle() & WB_DROPDOWN ) aSz.AdjustHeight(4 ); } - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXListBox::calcAdjustedSize( const css::awt::Size& rNewSize ) { SolarMutexGuard aGuard; - Size aSz = VCLUnoHelper::ConvertToVCLSize(rNewSize); + Size aSz = vcl::unohelper::ConvertToVCLSize(rNewSize); VclPtr< ListBox > pListBox = GetAs< ListBox >(); if ( pListBox ) aSz = pListBox->CalcAdjustedSize( aSz ); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXListBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) @@ -1997,7 +1998,7 @@ css::awt::Size VCLXListBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) VclPtr< ListBox > pListBox = GetAs< ListBox >(); if ( pListBox ) aSz = pListBox->CalcBlockSize( nCols, nLines ); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } void VCLXListBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) @@ -2880,7 +2881,7 @@ css::awt::Size VCLXFixedHyperlink::getMinimumSize( ) VclPtr< FixedText > pFixedText = GetAs< FixedText >(); if ( pFixedText ) aSz = pFixedText->CalcMinimumSize(); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXFixedHyperlink::getPreferredSize( ) @@ -2891,7 +2892,7 @@ css::awt::Size VCLXFixedHyperlink::getPreferredSize( ) css::awt::Size VCLXFixedHyperlink::calcAdjustedSize( const css::awt::Size& rNewSize ) { SolarMutexGuard aGuard; - Size aSz( VCLUnoHelper::ConvertToVCLSize( rNewSize )); + Size aSz( vcl::unohelper::ConvertToVCLSize( rNewSize )); VclPtr< FixedText > pFixedText = GetAs< FixedText >(); if (pFixedText) { @@ -2902,7 +2903,7 @@ css::awt::Size VCLXFixedHyperlink::calcAdjustedSize( const css::awt::Size& rNewS aSz = aMinSz; } - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } void VCLXFixedHyperlink::setProperty( const OUString& PropertyName, const css::uno::Any& Value) @@ -3102,7 +3103,7 @@ css::awt::Size VCLXFixedText::getMinimumSize( ) VclPtr< FixedText > pFixedText = GetAs< FixedText >(); if ( pFixedText ) aSz = pFixedText->CalcMinimumSize(); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXFixedText::getPreferredSize( ) @@ -3114,11 +3115,11 @@ css::awt::Size VCLXFixedText::calcAdjustedSize( const css::awt::Size& rMaxSize ) { SolarMutexGuard aGuard; - Size aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize ) ); + Size aAdjustedSize( vcl::unohelper::ConvertToVCLSize( rMaxSize ) ); VclPtr< FixedText > pFixedText = GetAs< FixedText >(); if ( pFixedText ) aAdjustedSize = pFixedText->CalcMinimumSize( rMaxSize.Width ); - return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize ); + return vcl::unohelper::ConvertToAWTSize( aAdjustedSize ); } @@ -3860,7 +3861,7 @@ css::awt::Size VCLXEdit::getMinimumSize( ) VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit ) aSz = pEdit->CalcMinimumSize(); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXEdit::getPreferredSize( ) @@ -3874,7 +3875,7 @@ css::awt::Size VCLXEdit::getPreferredSize( ) aSz = pEdit->CalcMinimumSize(); aSz.AdjustHeight(4 ); } - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXEdit::calcAdjustedSize( const css::awt::Size& rNewSize ) @@ -3902,7 +3903,7 @@ css::awt::Size VCLXEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 ) else aSz = pEdit->CalcMinimumSize(); } - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } void VCLXEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) @@ -4317,7 +4318,7 @@ css::awt::Size VCLXComboBox::getMinimumSize( ) VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) aSz = pComboBox->CalcMinimumSize(); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXComboBox::getPreferredSize( ) @@ -4332,18 +4333,18 @@ css::awt::Size VCLXComboBox::getPreferredSize( ) if ( pComboBox->GetStyle() & WB_DROPDOWN ) aSz.AdjustHeight(4 ); } - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXComboBox::calcAdjustedSize( const css::awt::Size& rNewSize ) { SolarMutexGuard aGuard; - Size aSz = VCLUnoHelper::ConvertToVCLSize(rNewSize); + Size aSz = vcl::unohelper::ConvertToVCLSize(rNewSize); VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) aSz = pComboBox->CalcAdjustedSize( aSz ); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } css::awt::Size VCLXComboBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) @@ -4354,7 +4355,7 @@ css::awt::Size VCLXComboBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) VclPtr< ComboBox > pComboBox = GetAs< ComboBox >(); if ( pComboBox ) aSz = pComboBox->CalcBlockSize( nCols, nLines ); - return VCLUnoHelper::ConvertToAWTSize(aSz); + return vcl::unohelper::ConvertToAWTSize(aSz); } void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) @@ -6455,7 +6456,7 @@ css::awt::Size VCLXFileControl::getMinimumSize() { Size aTmpSize = pControl->GetEdit().CalcMinimumSize(); aTmpSize.AdjustWidth(pControl->GetButton().CalcMinimumSize().Width() ); - aSz = VCLUnoHelper::ConvertToAWTSize(pControl->CalcWindowSize(aTmpSize)); + aSz = vcl::unohelper::ConvertToAWTSize(pControl->CalcWindowSize(aTmpSize)); } return aSz; } @@ -6490,7 +6491,7 @@ css::awt::Size VCLXFileControl::getMinimumSize( sal_Int16 nCols, sal_Int16 ) VclPtr< FileControl > pControl = GetAs< FileControl >(); if ( pControl ) { - aSz = VCLUnoHelper::ConvertToAWTSize(pControl->GetEdit().CalcSize(nCols)); + aSz = vcl::unohelper::ConvertToAWTSize(pControl->GetEdit().CalcSize(nCols)); aSz.Width += pControl->GetButton().CalcMinimumSize().Width(); } return aSz; @@ -7682,7 +7683,7 @@ css::awt::Size VCLXMultiLineEdit::getMinimumSize() css::awt::Size aSz; VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >(); if ( pEdit ) - aSz = VCLUnoHelper::ConvertToAWTSize(pEdit->CalcMinimumSize()); + aSz = vcl::unohelper::ConvertToAWTSize(pEdit->CalcMinimumSize()); return aSz; } @@ -7698,8 +7699,8 @@ css::awt::Size VCLXMultiLineEdit::calcAdjustedSize( const css::awt::Size& rNewSi css::awt::Size aSz = rNewSize; VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >(); if ( pEdit ) - aSz = VCLUnoHelper::ConvertToAWTSize( - pEdit->CalcAdjustedSize(VCLUnoHelper::ConvertToVCLSize(rNewSize))); + aSz = vcl::unohelper::ConvertToAWTSize( + pEdit->CalcAdjustedSize(vcl::unohelper::ConvertToVCLSize(rNewSize))); return aSz; } @@ -7710,7 +7711,7 @@ css::awt::Size VCLXMultiLineEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 nLi css::awt::Size aSz; VclPtr< MultiLineEdit > pEdit = GetAs< MultiLineEdit >(); if ( pEdit ) - aSz = VCLUnoHelper::ConvertToAWTSize(pEdit->CalcBlockSize(nCols, nLines)); + aSz = vcl::unohelper::ConvertToAWTSize(pEdit->CalcBlockSize(nCols, nLines)); return aSz; } diff --git a/toolkit/source/controls/tree/treecontrolpeer.cxx b/toolkit/source/controls/tree/treecontrolpeer.cxx index 4ad836db314a..ef2779f118a4 100644 --- a/toolkit/source/controls/tree/treecontrolpeer.cxx +++ b/toolkit/source/controls/tree/treecontrolpeer.cxx @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -39,6 +38,7 @@ #include #include #include +#include #include #include @@ -843,7 +843,7 @@ awt::Rectangle SAL_CALL TreeControlPeer::getNodeRect( const Reference< XTreeNode UnoTreeListEntry* pEntry = getEntry( i_Node ); ::tools::Rectangle aEntryRect( rTree.GetFocusRect( pEntry, rTree.GetEntryPosition( pEntry ).Y() ) ); - return VCLUnoHelper::ConvertToAWTRect( aEntryRect ); + return vcl::unohelper::ConvertToAWTRect( aEntryRect ); } @@ -1188,7 +1188,7 @@ css::awt::Size TreeControlPeer::getMinimumSize() /* todo MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow(); if ( pEdit ) - aSz = VCLUnoHelper::ConvertToAWTSize(pEdit->CalcMinimumSize()); + aSz = vcl::unohelper::ConvertToAWTSize(pEdit->CalcMinimumSize()); */ return aSz; } @@ -1206,7 +1206,7 @@ css::awt::Size TreeControlPeer::calcAdjustedSize( const css::awt::Size& rNewSize /* todo MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow(); if ( pEdit ) - aSz = VCLUnoHelper::ConvertToAWTSize(pEdit->CalcAdjustedSize(VCLUnoHelper::ConvertToVCLSize(rNewSize))); + aSz = vcl::unohelper::ConvertToAWTSize(pEdit->CalcAdjustedSize(vcl::unohelper::ConvertToVCLSize(rNewSize))); */ return aSz; } diff --git a/toolkit/source/hatchwindow/hatchwindow.cxx b/toolkit/source/hatchwindow/hatchwindow.cxx index ba7add58485f..b4ccadc84a10 100644 --- a/toolkit/source/hatchwindow/hatchwindow.cxx +++ b/toolkit/source/hatchwindow/hatchwindow.cxx @@ -23,11 +23,11 @@ #include "hatchwindow.hxx" #include "ipwin.hxx" -#include #include #include #include #include +#include using namespace ::com::sun::star; @@ -72,11 +72,11 @@ void VCLXHatchWindow::QueryObjAreaPixel( tools::Rectangle & aRect ) if ( !m_xController.is() ) return; - awt::Rectangle aUnoRequestRect = VCLUnoHelper::ConvertToAWTRect(aRect); + awt::Rectangle aUnoRequestRect = vcl::unohelper::ConvertToAWTRect(aRect); try { awt::Rectangle aUnoResultRect = m_xController->calcAdjustedRectangle( aUnoRequestRect ); - aRect = VCLUnoHelper::ConvertToVCLRect(aUnoResultRect); + aRect = vcl::unohelper::ConvertToVCLRect(aUnoResultRect); } catch( uno::Exception& ) { @@ -88,7 +88,7 @@ void VCLXHatchWindow::RequestObjAreaPixel( const tools::Rectangle & aRect ) { if ( m_xController.is() ) { - awt::Rectangle aUnoRequestRect = VCLUnoHelper::ConvertToAWTRect(aRect); + awt::Rectangle aUnoRequestRect = vcl::unohelper::ConvertToAWTRect(aRect); try { m_xController->requestPositioning( aUnoRequestRect ); diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 6976b8c0db5a..8e70456b1386 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -102,7 +102,7 @@ vcl::Region VCLUnoHelper::GetRegion( const css::uno::Reference< css::awt::XRegio { const css::uno::Sequence< css::awt::Rectangle > aRects = rxRegion->getRectangles(); for ( const auto& rRect : aRects ) - aRegion.Union(VCLUnoHelper::ConvertToVCLRect(rRect)); + aRegion.Union(vcl::unohelper::ConvertToVCLRect(rRect)); } return aRegion; } diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx index ed9f62a5df20..05ac38c4fa7e 100644 --- a/vcl/source/app/unohelp.cxx +++ b/vcl/source/app/unohelp.cxx @@ -209,5 +209,36 @@ FontItalic vcl::unohelper::ConvertFontSlant(css::awt::FontSlant eSlant) return eRet; } +Size vcl::unohelper::ConvertToVCLSize(const css::awt::Size& rAWTSize) +{ + return Size(rAWTSize.Width, rAWTSize.Height); +} + +css::awt::Size vcl::unohelper::ConvertToAWTSize(const Size& rVCLSize) +{ + return css::awt::Size(rVCLSize.Width(), rVCLSize.Height()); +} + +Point vcl::unohelper::ConvertToVCLPoint(const css::awt::Point& rAWTPoint) +{ + return Point(rAWTPoint.X, rAWTPoint.Y); +} + +css::awt::Point vcl::unohelper::ConvertToAWTPoint(const PointTemplateBase& rVCLPoint) +{ + return css::awt::Point(rVCLPoint.X(), rVCLPoint.Y()); +} + +tools::Rectangle vcl::unohelper::ConvertToVCLRect(const css::awt::Rectangle& rAWTRect) +{ + return ::tools::Rectangle(Point(rAWTRect.X, rAWTRect.Y), + Size(rAWTRect.Width, rAWTRect.Height)); +} + +css::awt::Rectangle vcl::unohelper::ConvertToAWTRect(const RectangleTemplateBase& rVCLRect) +{ + return css::awt::Rectangle(rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), + rVCLRect.GetHeight()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 739b0716504d2526fb7283100420e4bd5eacb7c2 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 15:48:51 +0100 Subject: [PATCH 103/155] a11y: Move menu a11y classes to vcl, no more use factory Other than most of the a11y implementations for vcl classes, VCLXAccessiblePopupMenu etc. do not make use of any VCLXWindow (i.e. UNO/toolkit wrapper of a vcl::Window) and thus do not depend on the toolkit module, which the accessibility module depends on. Therefore, there's also no need to use the accessible factory to create them (which is needed when toolkit classes are involved to avoid a dependency cycle). Move those classes from the accessibility module to vcl and add a new method Menu::CreateAccessible and move the logic from AccessibleFactory::createAccessible there. Drop the now unnecessary factory methods previously used for those classes. No change in behavior intended (yet), but this also simplifies the code involved for the tdf#164093 scenario. Change-Id: Ie3f6f1a02bf6662206d31383473cdc868e1f9164 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177812 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- accessibility/Library_acc.mk | 8 ------ accessibility/inc/pch/precompiled_acc.hxx | 2 -- accessibility/source/helper/acc_factory.cxx | 15 ----------- include/toolkit/helper/accessiblefactory.hxx | 5 ---- include/vcl/menu.hxx | 3 +++ include/vcl/toolkit/unowrap.hxx | 4 --- solenv/clang-format/excludelist | 26 +++++++++---------- toolkit/inc/helper/unowrapper.hxx | 4 --- toolkit/source/helper/unowrapper.cxx | 5 ---- vcl/Library_vcl.mk | 8 ++++++ .../accessiblemenubasecomponent.hxx | 0 .../accessiblemenucomponent.hxx | 3 ++- .../accessiblemenuitemcomponent.hxx | 2 +- .../inc/accessibility}/vclxaccessiblemenu.hxx | 2 +- .../accessibility}/vclxaccessiblemenubar.hxx | 2 +- .../accessibility}/vclxaccessiblemenuitem.hxx | 2 +- .../vclxaccessiblemenuseparator.hxx | 2 +- .../vclxaccessiblepopupmenu.hxx | 2 +- .../accessiblemenubasecomponent.cxx | 8 +++--- .../accessiblemenucomponent.cxx | 2 +- .../accessiblemenuitemcomponent.cxx | 2 +- .../accessibility}/vclxaccessiblemenu.cxx | 2 +- .../accessibility}/vclxaccessiblemenubar.cxx | 2 +- .../accessibility}/vclxaccessiblemenuitem.cxx | 3 ++- .../vclxaccessiblemenuseparator.cxx | 2 +- .../vclxaccessiblepopupmenu.cxx | 2 +- vcl/source/window/menu.cxx | 21 +++++++++++---- 27 files changed, 60 insertions(+), 79 deletions(-) rename {accessibility/inc/standard => vcl/inc/accessibility}/accessiblemenubasecomponent.hxx (100%) rename {accessibility/inc/standard => vcl/inc/accessibility}/accessiblemenucomponent.hxx (98%) rename {accessibility/inc/standard => vcl/inc/accessibility}/accessiblemenuitemcomponent.hxx (98%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblemenu.hxx (98%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblemenubar.hxx (97%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblemenuitem.hxx (98%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblemenuseparator.hxx (96%) rename {accessibility/inc/standard => vcl/inc/accessibility}/vclxaccessiblepopupmenu.hxx (96%) rename {accessibility/source/standard => vcl/source/accessibility}/accessiblemenubasecomponent.cxx (98%) rename {accessibility/source/standard => vcl/source/accessibility}/accessiblemenucomponent.cxx (99%) rename {accessibility/source/standard => vcl/source/accessibility}/accessiblemenuitemcomponent.cxx (99%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblemenu.cxx (99%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblemenubar.cxx (98%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblemenuitem.cxx (99%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblemenuseparator.cxx (96%) rename {accessibility/source/standard => vcl/source/accessibility}/vclxaccessiblepopupmenu.cxx (97%) diff --git a/accessibility/Library_acc.mk b/accessibility/Library_acc.mk index 7080203fccaf..5acdf2a7be99 100644 --- a/accessibility/Library_acc.mk +++ b/accessibility/Library_acc.mk @@ -72,9 +72,6 @@ $(eval $(call gb_Library_add_exception_objects,acc,\ accessibility/source/helper/acc_factory \ accessibility/source/helper/accresmgr \ accessibility/source/helper/IComboListBoxHelper \ - accessibility/source/standard/accessiblemenubasecomponent \ - accessibility/source/standard/accessiblemenucomponent \ - accessibility/source/standard/accessiblemenuitemcomponent \ accessibility/source/standard/floatingwindowaccessible \ accessibility/source/standard/svtaccessiblenumericfield \ accessibility/source/standard/vclxaccessiblebox \ @@ -91,11 +88,6 @@ $(eval $(call gb_Library_add_exception_objects,acc,\ accessibility/source/standard/vclxaccessiblelist \ accessibility/source/standard/vclxaccessiblelistbox \ accessibility/source/standard/vclxaccessiblelistitem \ - accessibility/source/standard/vclxaccessiblemenu \ - accessibility/source/standard/vclxaccessiblemenubar \ - accessibility/source/standard/vclxaccessiblemenuitem \ - accessibility/source/standard/vclxaccessiblemenuseparator \ - accessibility/source/standard/vclxaccessiblepopupmenu \ accessibility/source/standard/vclxaccessibleradiobutton \ accessibility/source/standard/vclxaccessiblescrollbar \ accessibility/source/standard/vclxaccessiblestatusbar \ diff --git a/accessibility/inc/pch/precompiled_acc.hxx b/accessibility/inc/pch/precompiled_acc.hxx index 7919e40b3c08..ca08b4d1858e 100644 --- a/accessibility/inc/pch/precompiled_acc.hxx +++ b/accessibility/inc/pch/precompiled_acc.hxx @@ -305,8 +305,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx index d95d47b214d9..191cc7528703 100644 --- a/accessibility/source/helper/acc_factory.cxx +++ b/accessibility/source/helper/acc_factory.cxx @@ -42,8 +42,6 @@ #include #include #include -#include -#include #include #include #include @@ -115,8 +113,6 @@ public: createAccessibleContext( SVTXNumericField* _pXWindow ) override; virtual css::uno::Reference< css::accessibility::XAccessibleContext > createAccessibleContext( VCLXWindow* _pXWindow ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessible( Menu* _pMenu, bool _bIsMenuBar ) override; // ::vcl::IAccessibleFactory virtual vcl::IAccessibleTabListBox* @@ -224,17 +220,6 @@ AccessibleFactory::~AccessibleFactory() { } -Reference< XAccessible > AccessibleFactory::createAccessible( Menu* _pMenu, bool _bIsMenuBar ) -{ - rtl::Reference pAccessible; - if ( _bIsMenuBar ) - pAccessible = new VCLXAccessibleMenuBar( _pMenu ); - else - pAccessible = new VCLXAccessiblePopupMenu( _pMenu ); - pAccessible->SetStates(); - return pAccessible; -} - Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXButton* _pXWindow ) { return new VCLXAccessibleButton( _pXWindow ); diff --git a/include/toolkit/helper/accessiblefactory.hxx b/include/toolkit/helper/accessiblefactory.hxx index 6c0532ce9edb..2b2c3455abd7 100644 --- a/include/toolkit/helper/accessiblefactory.hxx +++ b/include/toolkit/helper/accessiblefactory.hxx @@ -133,11 +133,6 @@ namespace toolkit virtual css::uno::Reference< css::accessibility::XAccessibleContext > createAccessibleContext( VCLXWindow* _pXWindow ) = 0; - /** creates an accessible component for the given menu - */ - virtual css::uno::Reference< css::accessibility::XAccessible > - createAccessible( Menu* _pMenu, bool _bIsMenuBar ) = 0; - protected: virtual ~IAccessibleFactory() override {} }; diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 19216d9585cc..e241609fcdb6 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -401,6 +401,9 @@ public: * Get the ID of the window. */ const OUString& get_id() const { return maID; } + +private: + css::uno::Reference CreateAccessible(); }; struct MenuBarButtonCallbackArg diff --git a/include/vcl/toolkit/unowrap.hxx b/include/vcl/toolkit/unowrap.hxx index 359810652e05..9d1231919229 100644 --- a/include/vcl/toolkit/unowrap.hxx +++ b/include/vcl/toolkit/unowrap.hxx @@ -65,10 +65,6 @@ public: virtual void WindowDestroyed( vcl::Window* pWindow ) = 0; - // Accessibility - virtual css::uno::Reference< css::accessibility::XAccessible > - CreateAccessible( Menu* pMenu, bool bIsMenuBar ) = 0; - /** Get the application's UNO wrapper object. Note that this static function will only ever try to create UNO wrapper object once, and diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index acffbef29a58..74614d7f5a58 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -46,9 +46,6 @@ accessibility/inc/extended/accessibletablistboxtable.hxx accessibility/inc/extended/textwindowaccessibility.hxx accessibility/inc/helper/IComboListBoxHelper.hxx accessibility/inc/helper/listboxhelper.hxx -accessibility/inc/standard/accessiblemenubasecomponent.hxx -accessibility/inc/standard/accessiblemenucomponent.hxx -accessibility/inc/standard/accessiblemenuitemcomponent.hxx accessibility/inc/standard/vclxaccessiblebox.hxx accessibility/inc/standard/vclxaccessiblebutton.hxx accessibility/inc/standard/vclxaccessiblecheckbox.hxx @@ -56,9 +53,6 @@ accessibility/inc/standard/vclxaccessibleedit.hxx accessibility/inc/standard/vclxaccessibleheaderbaritem.hxx accessibility/inc/standard/vclxaccessiblelist.hxx accessibility/inc/standard/vclxaccessiblelistitem.hxx -accessibility/inc/standard/vclxaccessiblemenu.hxx -accessibility/inc/standard/vclxaccessiblemenubar.hxx -accessibility/inc/standard/vclxaccessiblemenuitem.hxx accessibility/inc/standard/vclxaccessibleradiobutton.hxx accessibility/inc/standard/vclxaccessiblescrollbar.hxx accessibility/inc/standard/vclxaccessiblestatusbar.hxx @@ -99,9 +93,6 @@ accessibility/source/extended/accessibletablistbox.cxx accessibility/source/extended/accessibletablistboxtable.cxx accessibility/source/extended/textwindowaccessibility.cxx accessibility/source/helper/acc_factory.cxx -accessibility/source/standard/accessiblemenubasecomponent.cxx -accessibility/source/standard/accessiblemenucomponent.cxx -accessibility/source/standard/accessiblemenuitemcomponent.cxx accessibility/source/standard/floatingwindowaccessible.cxx accessibility/source/standard/vclxaccessiblebox.cxx accessibility/source/standard/vclxaccessiblebutton.cxx @@ -114,10 +105,6 @@ accessibility/source/standard/vclxaccessibleheaderbaritem.cxx accessibility/source/standard/vclxaccessiblelist.cxx accessibility/source/standard/vclxaccessiblelistbox.cxx accessibility/source/standard/vclxaccessiblelistitem.cxx -accessibility/source/standard/vclxaccessiblemenu.cxx -accessibility/source/standard/vclxaccessiblemenubar.cxx -accessibility/source/standard/vclxaccessiblemenuitem.cxx -accessibility/source/standard/vclxaccessiblepopupmenu.cxx accessibility/source/standard/vclxaccessibleradiobutton.cxx accessibility/source/standard/vclxaccessiblescrollbar.cxx accessibility/source/standard/vclxaccessiblestatusbar.cxx @@ -14173,6 +14160,12 @@ vcl/inc/IPrioritable.hxx vcl/inc/ResampleKernel.hxx vcl/inc/bitmap/bmpfast.hxx vcl/inc/accel.hxx +vcl/inc/accessibility/accessiblemenubasecomponent.hxx +vcl/inc/accessibility/accessiblemenucomponent.hxx +vcl/inc/accessibility/accessiblemenuitemcomponent.hxx +vcl/inc/accessibility/vclxaccessiblemenu.hxx +vcl/inc/accessibility/vclxaccessiblemenubar.hxx +vcl/inc/accessibility/vclxaccessiblemenuitem.hxx vcl/inc/accmgr.hxx vcl/inc/animate/AnimationRenderer.hxx vcl/inc/brdwin.hxx @@ -14522,6 +14515,13 @@ vcl/quartz/salgdicommon.cxx vcl/quartz/salvd.cxx vcl/quartz/utils.cxx vcl/source/accessibility/characterattributeshelper.cxx +vcl/source/accessibility/accessiblemenubasecomponent.cxx +vcl/source/accessibility/accessiblemenucomponent.cxx +vcl/source/accessibility/accessiblemenuitemcomponent.cxx +vcl/source/accessibility/vclxaccessiblemenu.cxx +vcl/source/accessibility/vclxaccessiblemenubar.cxx +vcl/source/accessibility/vclxaccessiblemenuitem.cxx +vcl/source/accessibility/vclxaccessiblepopupmenu.cxx vcl/source/animate/AnimationRenderer.cxx vcl/source/app/IconThemeInfo.cxx vcl/source/app/IconThemeScanner.cxx diff --git a/toolkit/inc/helper/unowrapper.hxx b/toolkit/inc/helper/unowrapper.hxx index dfed1b1215f1..274e60beb2c3 100644 --- a/toolkit/inc/helper/unowrapper.hxx +++ b/toolkit/inc/helper/unowrapper.hxx @@ -60,10 +60,6 @@ public: void WindowDestroyed( vcl::Window* pWindow ) override; - // Accessibility - virtual css::uno::Reference< css::accessibility::XAccessible > - CreateAccessible( Menu* pMenu, bool bIsMenuBar ) override; - private: virtual ~UnoWrapper(); }; diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 50e1c8e74d90..3c2b7dbaff7f 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -312,9 +312,4 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow ) } } -css::uno::Reference< css::accessibility::XAccessible > UnoWrapper::CreateAccessible( Menu* pMenu, bool bIsMenuBar ) -{ - return maAccessibleFactoryAccess.getFactory().createAccessible( pMenu, bIsMenuBar ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index ae12cf9cfda7..420024cc2ab2 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -99,6 +99,14 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/skia/SkiaHelper \ vcl/source/accessibility/AccessibleTextAttributeHelper \ vcl/source/accessibility/characterattributeshelper \ + vcl/source/accessibility/accessiblemenubasecomponent \ + vcl/source/accessibility/accessiblemenucomponent \ + vcl/source/accessibility/accessiblemenuitemcomponent \ + vcl/source/accessibility/vclxaccessiblemenu \ + vcl/source/accessibility/vclxaccessiblemenubar \ + vcl/source/accessibility/vclxaccessiblemenuitem \ + vcl/source/accessibility/vclxaccessiblemenuseparator \ + vcl/source/accessibility/vclxaccessiblepopupmenu \ vcl/source/animate/Animation \ vcl/source/animate/AnimationFrame \ vcl/source/animate/AnimationRenderer \ diff --git a/accessibility/inc/standard/accessiblemenubasecomponent.hxx b/vcl/inc/accessibility/accessiblemenubasecomponent.hxx similarity index 100% rename from accessibility/inc/standard/accessiblemenubasecomponent.hxx rename to vcl/inc/accessibility/accessiblemenubasecomponent.hxx diff --git a/accessibility/inc/standard/accessiblemenucomponent.hxx b/vcl/inc/accessibility/accessiblemenucomponent.hxx similarity index 98% rename from accessibility/inc/standard/accessiblemenucomponent.hxx rename to vcl/inc/accessibility/accessiblemenucomponent.hxx index e9d46dcfa70a..2954b52119e5 100644 --- a/accessibility/inc/standard/accessiblemenucomponent.hxx +++ b/vcl/inc/accessibility/accessiblemenucomponent.hxx @@ -19,7 +19,8 @@ #pragma once -#include +#include + #include #include diff --git a/accessibility/inc/standard/accessiblemenuitemcomponent.hxx b/vcl/inc/accessibility/accessiblemenuitemcomponent.hxx similarity index 98% rename from accessibility/inc/standard/accessiblemenuitemcomponent.hxx rename to vcl/inc/accessibility/accessiblemenuitemcomponent.hxx index fae6e577b590..58b819f8ad66 100644 --- a/accessibility/inc/standard/accessiblemenuitemcomponent.hxx +++ b/vcl/inc/accessibility/accessiblemenuitemcomponent.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include diff --git a/accessibility/inc/standard/vclxaccessiblemenu.hxx b/vcl/inc/accessibility/vclxaccessiblemenu.hxx similarity index 98% rename from accessibility/inc/standard/vclxaccessiblemenu.hxx rename to vcl/inc/accessibility/vclxaccessiblemenu.hxx index ce7b3f0580de..3f6903587166 100644 --- a/accessibility/inc/standard/vclxaccessiblemenu.hxx +++ b/vcl/inc/accessibility/vclxaccessiblemenu.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include #include #include diff --git a/accessibility/inc/standard/vclxaccessiblemenubar.hxx b/vcl/inc/accessibility/vclxaccessiblemenubar.hxx similarity index 97% rename from accessibility/inc/standard/vclxaccessiblemenubar.hxx rename to vcl/inc/accessibility/vclxaccessiblemenubar.hxx index c5b3984e0b7e..31e50c8b75ff 100644 --- a/accessibility/inc/standard/vclxaccessiblemenubar.hxx +++ b/vcl/inc/accessibility/vclxaccessiblemenubar.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include #include class VclSimpleEvent; diff --git a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx b/vcl/inc/accessibility/vclxaccessiblemenuitem.hxx similarity index 98% rename from accessibility/inc/standard/vclxaccessiblemenuitem.hxx rename to vcl/inc/accessibility/vclxaccessiblemenuitem.hxx index aa6a0afc814a..ddde3cda04b6 100644 --- a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx +++ b/vcl/inc/accessibility/vclxaccessiblemenuitem.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include #include #include diff --git a/accessibility/inc/standard/vclxaccessiblemenuseparator.hxx b/vcl/inc/accessibility/vclxaccessiblemenuseparator.hxx similarity index 96% rename from accessibility/inc/standard/vclxaccessiblemenuseparator.hxx rename to vcl/inc/accessibility/vclxaccessiblemenuseparator.hxx index 51071c19d130..ce971ca49ac0 100644 --- a/accessibility/inc/standard/vclxaccessiblemenuseparator.hxx +++ b/vcl/inc/accessibility/vclxaccessiblemenuseparator.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include class VCLXAccessibleMenuSeparator final : public OAccessibleMenuItemComponent { diff --git a/accessibility/inc/standard/vclxaccessiblepopupmenu.hxx b/vcl/inc/accessibility/vclxaccessiblepopupmenu.hxx similarity index 96% rename from accessibility/inc/standard/vclxaccessiblepopupmenu.hxx rename to vcl/inc/accessibility/vclxaccessiblepopupmenu.hxx index 8e93af22d8d9..6f099b722452 100644 --- a/accessibility/inc/standard/vclxaccessiblepopupmenu.hxx +++ b/vcl/inc/accessibility/vclxaccessiblepopupmenu.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include class VCLXAccessiblePopupMenu final : public OAccessibleMenuComponent { diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/vcl/source/accessibility/accessiblemenubasecomponent.cxx similarity index 98% rename from accessibility/source/standard/accessiblemenubasecomponent.cxx rename to vcl/source/accessibility/accessiblemenubasecomponent.cxx index dbedd1daff30..10f7dff9e6b5 100644 --- a/accessibility/source/standard/accessiblemenubasecomponent.cxx +++ b/vcl/source/accessibility/accessiblemenubasecomponent.cxx @@ -17,10 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/vcl/source/accessibility/accessiblemenucomponent.cxx similarity index 99% rename from accessibility/source/standard/accessiblemenucomponent.cxx rename to vcl/source/accessibility/accessiblemenucomponent.cxx index 7fe594721294..4163d096011e 100644 --- a/accessibility/source/standard/accessiblemenucomponent.cxx +++ b/vcl/source/accessibility/accessiblemenucomponent.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/vcl/source/accessibility/accessiblemenuitemcomponent.cxx similarity index 99% rename from accessibility/source/standard/accessiblemenuitemcomponent.cxx rename to vcl/source/accessibility/accessiblemenuitemcomponent.cxx index 0d171e64ccaa..a50415e9ab77 100644 --- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx +++ b/vcl/source/accessibility/accessiblemenuitemcomponent.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/vcl/source/accessibility/vclxaccessiblemenu.cxx similarity index 99% rename from accessibility/source/standard/vclxaccessiblemenu.cxx rename to vcl/source/accessibility/vclxaccessiblemenu.cxx index 5ba208d2f368..c38cc84ebed2 100644 --- a/accessibility/source/standard/vclxaccessiblemenu.cxx +++ b/vcl/source/accessibility/vclxaccessiblemenu.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenubar.cxx b/vcl/source/accessibility/vclxaccessiblemenubar.cxx similarity index 98% rename from accessibility/source/standard/vclxaccessiblemenubar.cxx rename to vcl/source/accessibility/vclxaccessiblemenubar.cxx index 9664254fa543..4e64803db783 100644 --- a/accessibility/source/standard/vclxaccessiblemenubar.cxx +++ b/vcl/source/accessibility/vclxaccessiblemenubar.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/vcl/source/accessibility/vclxaccessiblemenuitem.cxx similarity index 99% rename from accessibility/source/standard/vclxaccessiblemenuitem.cxx rename to vcl/source/accessibility/vclxaccessiblemenuitem.cxx index a1491c99bc4c..a8696f43e380 100644 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ b/vcl/source/accessibility/vclxaccessiblemenuitem.cxx @@ -17,8 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include + #include #include diff --git a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx b/vcl/source/accessibility/vclxaccessiblemenuseparator.cxx similarity index 96% rename from accessibility/source/standard/vclxaccessiblemenuseparator.cxx rename to vcl/source/accessibility/vclxaccessiblemenuseparator.cxx index d64ccb0baa25..7100d1972c39 100644 --- a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx +++ b/vcl/source/accessibility/vclxaccessiblemenuseparator.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include diff --git a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx b/vcl/source/accessibility/vclxaccessiblepopupmenu.cxx similarity index 97% rename from accessibility/source/standard/vclxaccessiblepopupmenu.cxx rename to vcl/source/accessibility/vclxaccessiblepopupmenu.cxx index d8b840eee784..95df37593bd2 100644 --- a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx +++ b/vcl/source/accessibility/vclxaccessiblepopupmenu.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include #include #include diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 6e7fc5494ca5..581279acd8bf 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include +#include + #include #include @@ -1317,6 +1321,17 @@ bool Menu::ImplIsSelectable( sal_uInt16 nPos ) const return bSelectable; } +css::uno::Reference Menu::CreateAccessible() +{ + rtl::Reference xAccessible; + if (IsMenuBar()) + xAccessible = new VCLXAccessibleMenuBar(this); + else + xAccessible = new VCLXAccessiblePopupMenu(this); + xAccessible->SetStates(); + return xAccessible; +} + css::uno::Reference Menu::GetAccessible() { // Since PopupMenu are sometimes shared by different instances of MenuBar, the mxAccessible member gets @@ -1340,11 +1355,7 @@ css::uno::Reference Menu::GetAccessible() } } else if ( !mxAccessible.is() ) - { - UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper(); - if ( pWrapper ) - mxAccessible = pWrapper->CreateAccessible(this, IsMenuBar()); - } + mxAccessible = CreateAccessible(); return mxAccessible; } From def785ee31bc71fc8edb4f717280265fa9f80b0a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 16:02:29 +0100 Subject: [PATCH 104/155] a11y: Use vcl::Window instead of VCLXWindow right away Use the vcl::Window for the null check instead of the corresponding VCLXWindow. There's no need to use a toolkit class here, in particular since the vcl::Window is used later anyway. Change-Id: Ia2c80f9634eadf33601af8c9ea1f628e7ea3e96b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177813 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- accessibility/source/standard/vclxaccessibleedit.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index 5cb259dddc08..e87ed8960503 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -108,12 +108,12 @@ void VCLXAccessibleEdit::FillAccessibleStateSet( sal_Int64& rStateSet ) { VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet ); - VCLXWindow* pVCLXWindow = GetVCLXWindow(); - if (pVCLXWindow) + vcl::Window* pWindow = GetWindow(); + if (pWindow) { rStateSet |= AccessibleStateType::FOCUSABLE; - if (GetWindow() && GetWindow()->GetType() == WindowType::MULTILINEEDIT) + if (pWindow->GetType() == WindowType::MULTILINEEDIT) rStateSet |= AccessibleStateType::MULTI_LINE; else rStateSet |= AccessibleStateType::SINGLE_LINE; From 1d2f37a93cb6746dfb08731579d269478943d2a0 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 16:17:03 +0100 Subject: [PATCH 105/155] a11y: Use FormattedField directly in SVTXAccessibleNumericField ... instead of using the toolkit/UNO wrapper SVTXNumericField. Change-Id: I86e274a06f210e2076e287087a1d4b979abe7c35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177814 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- .../standard/svtaccessiblenumericfield.cxx | 22 +++++++++---------- include/vcl/toolkit/fmtfield.hxx | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/accessibility/source/standard/svtaccessiblenumericfield.cxx b/accessibility/source/standard/svtaccessiblenumericfield.cxx index f3192d4212f0..50a17a1373ec 100644 --- a/accessibility/source/standard/svtaccessiblenumericfield.cxx +++ b/accessibility/source/standard/svtaccessiblenumericfield.cxx @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include @@ -50,9 +50,9 @@ css::uno::Any SAL_CALL SVTXAccessibleNumericField::getCurrentValue() OExternalLockGuard aGuard(this); double dValue = 0; - SVTXNumericField* pField = static_cast(GetVCLXWindow()); + VclPtr pField = GetAs(); if (pField) - dValue = pField->getValue(); + dValue = pField->GetFormatter().GetValue(); return css::uno::Any(dValue); } @@ -61,13 +61,13 @@ sal_Bool SVTXAccessibleNumericField::setCurrentValue(const css::uno::Any& aNumbe { OExternalLockGuard aGuard(this); - SVTXNumericField* pField = static_cast(GetVCLXWindow()); + VclPtr pField = GetAs(); if (!pField) return false; double dValue = 0; aNumber >>= dValue; - pField->setValue(dValue); + pField->GetFormatter().SetValue(dValue); return true; } @@ -76,9 +76,9 @@ css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMaximumValue() OExternalLockGuard aGuard(this); double dValue = 0; - SVTXNumericField* pField = static_cast(GetVCLXWindow()); + VclPtr pField = GetAs(); if (pField) - dValue = pField->getMax(); + dValue = pField->GetFormatter().GetMaxValue(); return css::uno::Any(dValue); } @@ -88,9 +88,9 @@ css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMinimumValue() OExternalLockGuard aGuard(this); double dValue = 0; - SVTXNumericField* pField = static_cast(GetVCLXWindow()); + VclPtr pField = GetAs(); if (pField) - dValue = pField->getMin(); + dValue = pField->GetFormatter().GetMinValue(); return css::uno::Any(dValue); } @@ -100,9 +100,9 @@ css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMinimumIncrement() OExternalLockGuard aGuard(this); double dValue = 0; - SVTXNumericField* pField = static_cast(GetVCLXWindow()); + VclPtr pField = GetAs(); if (pField) - dValue = pField->getSpinSize(); + dValue = pField->GetFormatter().GetSpinSize(); return css::uno::Any(dValue); } diff --git a/include/vcl/toolkit/fmtfield.hxx b/include/vcl/toolkit/fmtfield.hxx index f62c5a3a2517..34b7ea755707 100644 --- a/include/vcl/toolkit/fmtfield.hxx +++ b/include/vcl/toolkit/fmtfield.hxx @@ -26,7 +26,7 @@ #include #include -class UNLESS_MERGELIBS(VCL_DLLPUBLIC) FormattedField : public SpinField +class VCL_DLLPUBLIC FormattedField : public SpinField { public: FormattedField(vcl::Window* pParent, WinBits nStyle); From e3c9a06b7056e2b99628aef8005329c328bcab91 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 16:39:30 +0100 Subject: [PATCH 106/155] a11y: Use vcl CheckBox directly in VCLXAccessibleCheckBox ... instead of using the toolkit/UNO wrapper class VCLXCheckBox. Change-Id: I271535f3e2e46202e2ca3d2e3f9a1d05ac380c41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177815 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- .../standard/vclxaccessiblecheckbox.cxx | 40 +++++++------------ 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx index 46c3e8749e92..debdb086df1e 100644 --- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx +++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx @@ -19,7 +19,6 @@ #include -#include #include #include @@ -54,25 +53,15 @@ VCLXAccessibleCheckBox::VCLXAccessibleCheckBox( VCLXWindow* pVCLWindow ) bool VCLXAccessibleCheckBox::IsChecked() const { - bool bChecked = false; - - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox && pVCLXCheckBox->getState() == sal_Int16(1) ) - bChecked = true; - - return bChecked; + VclPtr pCheckBox = GetAs(); + return pCheckBox && pCheckBox->IsChecked(); } bool VCLXAccessibleCheckBox::IsIndeterminate() const { - bool bIndeterminate = false; - - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox && pVCLXCheckBox->getState() == sal_Int16(2) ) - bIndeterminate = true; - - return bIndeterminate; + VclPtr pCheckBox = GetAs(); + return pCheckBox && pCheckBox->GetState() == TRISTATE_INDET; } @@ -176,23 +165,22 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) if ( nIndex != 0 ) throw IndexOutOfBoundsException(); - VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >(); - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pCheckBox && pVCLXCheckBox ) + VclPtr pCheckBox = GetAs(); + if (pCheckBox) { sal_Int32 nValueMax = sal_Int32(1); if ( pCheckBox->IsTriStateEnabled() ) nValueMax = sal_Int32(2); - sal_Int32 nValue = static_cast(pVCLXCheckBox->getState()); + sal_Int32 nValue = static_cast(pCheckBox->GetState()); ++nValue; if ( nValue > nValueMax ) nValue = 0; - pVCLXCheckBox->setState( static_cast(nValue) ); + pCheckBox->SetState(static_cast(nValue)); } return true; @@ -259,9 +247,9 @@ Any VCLXAccessibleCheckBox::getCurrentValue( ) Any aValue; - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox ) - aValue <<= static_cast(pVCLXCheckBox->getState()); + VclPtr pCheckBox = GetAs(); + if (pCheckBox) + aValue <<= static_cast(pCheckBox->GetState()); return aValue; } @@ -273,8 +261,8 @@ sal_Bool VCLXAccessibleCheckBox::setCurrentValue( const Any& aNumber ) bool bReturn = false; - VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() ); - if ( pVCLXCheckBox ) + VclPtr pCheckBox = GetAs(); + if (pCheckBox) { sal_Int32 nValue = 0, nValueMin = 0, nValueMax = 0; OSL_VERIFY( aNumber >>= nValue ); @@ -285,7 +273,7 @@ sal_Bool VCLXAccessibleCheckBox::setCurrentValue( const Any& aNumber ) else if ( nValue > nValueMax ) nValue = nValueMax; - pVCLXCheckBox->setState( static_cast(nValue) ); + pCheckBox->SetState(static_cast(nValue)); bReturn = true; } From 393565203e9027fe3ed0ff64cd46fdc1332ec480 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 4 Dec 2024 12:49:08 +0100 Subject: [PATCH 107/155] sw: static_cast after dynamic_cast Change-Id: Ie50fd8bb2bbb26962ead459fe8014828c99fd755 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177789 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/source/core/layout/fly.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index cee12b59818b..8178a7e9e71d 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -2530,19 +2530,21 @@ Size SwFlyFrame::ChgSize( const Size& aNewSize ) // of the fly frame Size aAdjustedNewSize( aNewSize ); { - if ( dynamic_cast(this) && - Lower() && dynamic_cast(Lower()) && - static_cast(Lower())->GetNode()->GetOLENode() ) + if (dynamic_cast(this)) { - SwRect aClipRect; - ::CalcClipRect( GetVirtDrawObj(), aClipRect, false ); - if ( aAdjustedNewSize.Width() > aClipRect.Width() ) + auto pLower = dynamic_cast(Lower()); + if ( pLower && pLower->GetNode()->GetOLENode() ) { - aAdjustedNewSize.setWidth( aClipRect.Width() ); - } - if ( aAdjustedNewSize.Height() > aClipRect.Height() ) - { - aAdjustedNewSize.setWidth( aClipRect.Height() ); + SwRect aClipRect; + ::CalcClipRect( GetVirtDrawObj(), aClipRect, false ); + if ( aAdjustedNewSize.Width() > aClipRect.Width() ) + { + aAdjustedNewSize.setWidth( aClipRect.Width() ); + } + if ( aAdjustedNewSize.Height() > aClipRect.Height() ) + { + aAdjustedNewSize.setWidth( aClipRect.Height() ); + } } } } From 4ffd1e31b17965646fe4893e9a393fab3294b383 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 4 Dec 2024 20:02:54 +0100 Subject: [PATCH 108/155] gpgme: upgrade to 1.24.1 * external/gpgmepp/gettid.patch issue fixed upstream Downloaded from https://gnupg.org/ftp/gcrypt/gpgme/gpgme-1.24.1.tar.bz2 Change-Id: Id2d984f5e68b8681bf5e635a1afe5d90605711ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177821 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- download.lst | 4 ++-- external/gpgmepp/ExternalPackage_gpgmepp.mk | 4 ++-- external/gpgmepp/UnpackedTarball_gpgmepp.mk | 1 - external/gpgmepp/gettid.patch | 14 -------------- 4 files changed, 4 insertions(+), 19 deletions(-) delete mode 100644 external/gpgmepp/gettid.patch diff --git a/download.lst b/download.lst index fab3ac84243f..a5d34d046ba8 100644 --- a/download.lst +++ b/download.lst @@ -317,8 +317,8 @@ GLM_TARBALL := glm-1.0.1.zip # three static lines # so that git cherry-pick # will not run into conflicts -GPGME_SHA256SUM := 61e3a6ad89323fecfaff176bc1728fb8c3312f2faa83424d9d5077ba20f5f7da -GPGME_TARBALL := gpgme-1.24.0.tar.bz2 +GPGME_SHA256SUM := ea05d0258e71061d61716584ec34cef59330a91340571edc46b78374973ba85f +GPGME_TARBALL := gpgme-1.24.1.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts diff --git a/external/gpgmepp/ExternalPackage_gpgmepp.mk b/external/gpgmepp/ExternalPackage_gpgmepp.mk index 098df90cefd8..731e3a6a87bc 100644 --- a/external/gpgmepp/ExternalPackage_gpgmepp.mk +++ b/external/gpgmepp/ExternalPackage_gpgmepp.mk @@ -15,8 +15,8 @@ ifneq ($(DISABLE_DYNLOADING),TRUE) ifeq ($(OS),LINUX) -$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/libgpgmepp.so.6,lang/cpp/src/.libs/libgpgmepp.so.6.21.0)) -$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/libgpgme.so.11,src/.libs/libgpgme.so.11.33.0)) +$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/libgpgmepp.so.6,lang/cpp/src/.libs/libgpgmepp.so.6.21.1)) +$(eval $(call gb_ExternalPackage_add_file,gpgmepp,$(LIBO_LIB_FOLDER)/libgpgme.so.11,src/.libs/libgpgme.so.11.33.1)) else ifeq ($(OS),MACOSX) diff --git a/external/gpgmepp/UnpackedTarball_gpgmepp.mk b/external/gpgmepp/UnpackedTarball_gpgmepp.mk index 58126ba4a29d..30bef6435ee5 100644 --- a/external/gpgmepp/UnpackedTarball_gpgmepp.mk +++ b/external/gpgmepp/UnpackedTarball_gpgmepp.mk @@ -28,7 +28,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,gpgmepp, \ external/gpgmepp/w32-build-fixes-2.patch \ $(if $(filter LINUX,$(OS)),external/gpgmepp/asan.patch) \ $(if $(filter LINUX,$(OS)),external/gpgmepp/rpath.patch) \ - $(if $(filter LINUX,$(OS)),external/gpgmepp/gettid.patch) \ external/gpgmepp/ubsan.patch \ external/gpgmepp/c++20.patch \ external/gpgmepp/clang-cl.patch \ diff --git a/external/gpgmepp/gettid.patch b/external/gpgmepp/gettid.patch deleted file mode 100644 index 292cc4a4baa7..000000000000 --- a/external/gpgmepp/gettid.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- src/debug.c 2024-11-08 13:08:06.174085089 +0100 -+++ src/debug.c 2024-11-08 13:11:43.133601548 +0100 -@@ -152,8 +152,10 @@ - #ifdef HAVE_W32_SYSTEM - thread = (uintptr_t)GetCurrentThreadId (); - #elif defined(__linux) -+#ifdef SYS_gettid - thread = (uintptr_t)gettid (); - #endif -+#endif - if (sizeof (thread) < len) - { - int zerolen = len; - From abfbca2719767516d5a35ee641ddd0d96d93e4ea Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Thu, 21 Nov 2024 16:15:32 +0000 Subject: [PATCH 109/155] tdf#85428: Clip strokes Clip stroke paths coming from the PDF import. Similar to my previous patches for fills. (It's possible we might have to do something clever with cropping of arrows/etc but not sure yet) Change-Id: I9e46deac4a722e3ac510f0cc4bdb6b38b67c579e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176952 Tested-by: Jenkins Reviewed-by: David Gilbert --- sdext/source/pdfimport/tree/pdfiprocessor.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 02efb2f9e3ff..d81967b5e9be 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -452,8 +452,15 @@ void PDFIProcessor::tilingPatternFill(int nX0, int nY0, int nX1, int nY1, void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D >& rPath ) { basegfx::B2DPolyPolygon aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath); + basegfx::B2DPolyPolygon aCurClip = getCurrentContext().Clip; aPoly.transform(getCurrentContext().Transformation); + if( aCurClip.count() ) { + aPoly = basegfx::utils::clipPolyPolygonOnPolyPolygon( aPoly, aCurClip, + true, /* bInside, keep parts inside the clip */ + true /* bStroke, stroked */ ); + } + PolyPolyElement* pPoly = ElementFactory::createPolyPolyElement( m_pCurElement, getGCId(getCurrentContext()), From 112736d1ea5234a66c669e2b2999229f33f05c71 Mon Sep 17 00:00:00 2001 From: Andre Herbst Date: Sun, 3 Nov 2024 16:13:19 +0100 Subject: [PATCH 110/155] tdf#163752 fix: hide drag target border on cancellation of d&d operation Not relying on rData.pCellTransfer anymore since it is always null when rEvt.mbLeaving is true. Change-Id: I4755e8f9b62efacd2eb4d515e1993578beadef09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175970 Reviewed-by: Noel Grandin Tested-by: Jenkins --- sc/source/ui/view/gridwin.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index cdd7d2d7a464..2a73bc1857fa 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4228,10 +4228,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) if ( rEvt.mbLeaving ) { DrawMarkDropObj( nullptr ); - if ( rData.pCellTransfer ) - return AcceptPrivateDrop( rEvt, rData ); // hide drop marker for internal D&D - else - return rEvt.mnAction; + return AcceptPrivateDrop( rEvt, rData ); // hide drop marker for internal D&D } if ( mrViewData.GetDocShell()->IsReadOnly() ) From f5976b8d0b826c0273b616699d1af639beb9f2f1 Mon Sep 17 00:00:00 2001 From: Rosh Date: Sat, 30 Nov 2024 00:29:59 -0800 Subject: [PATCH 111/155] tdf#158237 Use C++20 contains() instead of find() and end() Change-Id: I54fbdebbd5287f1e832ed662986b8b3fa45fbe45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177583 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- svx/source/uitest/uiobject.cxx | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/svx/source/uitest/uiobject.cxx b/svx/source/uitest/uiobject.cxx index 0901a86dd933..2c15932a65f0 100644 --- a/svx/source/uitest/uiobject.cxx +++ b/svx/source/uitest/uiobject.cxx @@ -24,24 +24,29 @@ void SvxShowCharSetUIObject::execute(const OUString& rAction, { if (rAction == "SELECT") { - if (rParameters.find(u"INDEX"_ustr) != rParameters.end()) + auto itIndex = rParameters.find(u"INDEX"_ustr); + if (itIndex != rParameters.end()) { - OUString aIndexStr = rParameters.find(u"INDEX"_ustr)->second; + OUString aIndexStr = itIndex->second; sal_Int32 nIndex = aIndexStr.toInt32(); mpCharSet->OutputIndex(nIndex); } - else if (rParameters.find(u"COLUMN"_ustr) != rParameters.end() && - rParameters.find(u"ROW"_ustr) != rParameters.end()) + else { - OUString aColStr = rParameters.find(u"COLUMN"_ustr)->second; - OUString aRowStr = rParameters.find(u"ROW"_ustr)->second; + auto itColumn = rParameters.find(u"COLUMN"_ustr); + auto itRow = rParameters.find(u"ROW"_ustr); + if (itColumn != rParameters.end() && itRow != rParameters.end()) + { + OUString aColStr = itColumn->second; + OUString aRowStr = itRow->second; - sal_Int32 nColumn = aColStr.toInt32(); - sal_Int32 nRow = aRowStr.toInt32(); + sal_Int32 nColumn = aColStr.toInt32(); + sal_Int32 nRow = aRowStr.toInt32(); - sal_Int32 nIndex = nColumn * COLUMN_COUNT + nRow; - mpCharSet->OutputIndex(nIndex); + sal_Int32 nIndex = nColumn * COLUMN_COUNT + nRow; + mpCharSet->OutputIndex(nIndex); + } } } else @@ -70,9 +75,10 @@ void SvxNumValueSetUIObject::execute(const OUString& rAction, { if (rAction == "CHOOSE") { - if (rParameters.find(u"POS"_ustr) != rParameters.end()) + auto itPos = rParameters.find(u"POS"_ustr); + if (itPos != rParameters.end()) { - OUString aIndexStr = rParameters.find(u"POS"_ustr)->second; + OUString aIndexStr = itPos->second; sal_Int32 nIndex = aIndexStr.toInt32(); mpNumValueSet->SelectItem(nIndex); mpNumValueSet->Select(); From 9b4cbd876b5eba07bfb00bc4eeef1b179b37fbb6 Mon Sep 17 00:00:00 2001 From: Christopher Sherlock Date: Thu, 5 Dec 2024 01:35:22 +1100 Subject: [PATCH 112/155] vcl: move variables closer to first usage Change-Id: Ib09f054eca56d55ba6b91c8e2377f373fc615430 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177808 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/source/bitmap/BitmapEx.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx index 8ce9c47dee09..c46f1647aa39 100644 --- a/vcl/source/bitmap/BitmapEx.cxx +++ b/vcl/source/bitmap/BitmapEx.cxx @@ -1316,14 +1316,6 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect, if (!pAcc || !nWidth || !nHeight) return tools::Polygon(); - const tools::Long nStartX1 = aWorkRect.Left() + 1; - const tools::Long nEndX1 = aWorkRect.Right(); - const tools::Long nStartX2 = nEndX1 - 1; - const tools::Long nStartY1 = aWorkRect.Top() + 1; - const tools::Long nEndY1 = aWorkRect.Bottom(); - - sal_uInt16 nPolyPos = 0; - // tdf#161833 treat semi-transparent pixels as opaque // Limiting the contour wrapping polygon to only opaque pixels // causes clipping of any shadows or other semi-transparent @@ -1338,6 +1330,14 @@ tools::Polygon BitmapEx::GetContour( bool bContourEdgeDetect, pPoints1.reset(new Point[ nHeight ]); pPoints2.reset(new Point[ nHeight ]); + const tools::Long nStartX1 = aWorkRect.Left() + 1; + const tools::Long nEndX1 = aWorkRect.Right(); + const tools::Long nStartX2 = nEndX1 - 1; + const tools::Long nStartY1 = aWorkRect.Top() + 1; + const tools::Long nEndY1 = aWorkRect.Bottom(); + + sal_uInt16 nPolyPos = 0; + for (tools::Long nY = nStartY1; nY < nEndY1; nY++) { tools::Long nX = nStartX1; From 293d03e6803be57af7a3948e358e7ed9f8545c13 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Wed, 4 Dec 2024 14:09:25 +0100 Subject: [PATCH 113/155] tdf#160487 - PPTX export: fix "Fit height to text" attribute of drawing objects (placeholders) Export spAutoFit attribute correctly to ooxml. Change-Id: I57e5b21bd6c407bdb5d1b36b3c3674249fbd2f59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177798 Tested-by: Jenkins Reviewed-by: Balazs Varga --- oox/source/export/drawingml.cxx | 22 ++++++++++++++++++++-- sd/qa/unit/data/pptx/tdf160487.pptx | Bin 0 -> 9332 bytes sd/qa/unit/export-tests-ooxml4.cxx | 10 ++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 sd/qa/unit/data/pptx/tdf160487.pptx diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 18334ad0516a..d3bc81b08b26 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -4305,9 +4305,27 @@ void DrawingML::WriteText(const Reference& rXIface, bool bBodyPr, bo } else { - // tdf#127030: Only custom shapes obey the TextAutoGrowHeight option. + bool bAutoGrowHeightEnabled = false; + const SdrObject* pObj = xShape.is() ? SdrObject::getSdrObjectFromXShape(xShape) : nullptr; + if (pObj) + { + switch (pObj->GetObjIdentifier()) + { + case SdrObjKind::NONE: + case SdrObjKind::Text: + case SdrObjKind::TitleText: + case SdrObjKind::OutlineText: + case SdrObjKind::Caption: + case SdrObjKind::CustomShape: + bAutoGrowHeightEnabled = true; + break; + default: + bAutoGrowHeightEnabled = false; + } + } + bool bTextAutoGrowHeight = false; - if (dynamic_cast(rXIface.get()) && GetProperty(rXPropSet, u"TextAutoGrowHeight"_ustr)) + if (bAutoGrowHeightEnabled && GetProperty(rXPropSet, u"TextAutoGrowHeight"_ustr)) mAny >>= bTextAutoGrowHeight; mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? XML_spAutoFit : XML_noAutofit)); } diff --git a/sd/qa/unit/data/pptx/tdf160487.pptx b/sd/qa/unit/data/pptx/tdf160487.pptx new file mode 100644 index 0000000000000000000000000000000000000000..ac0f3fb553d1f7ee4db7b632f0b129b19f371410 GIT binary patch literal 9332 zcma)i1yq$?(>4tPQUU_f4TlCv>F$zl>FyS3i9BUFN2^P7|HqZj%IGis0kNdSCLyOdU9MoJ{H*d{b-J#^rJ8hON8zARx$ z0>!D&MB_BEk52G98XlL7DMk?lj_GeIsm?443ghcHKZ-D)j~esR0clB_c{ zr@CF9Ckc3>8a;8XtKmPR=lb(Fwzoa~2jFt$*zuERNeX=zh(9V9XDXay98 zhACEGlp8AaQ6kvS??7^Jwez3*6KrKW;SDD>vnB7^Debb1fA5!r+?ps?S4l!YRRc1%e zHTIav?&YhAq4=jK2Ezti3%Q%Uw%3mGhLvHl+67O$ zIzk^e^)=5^_azXhgTwu}zCN0zvk)L5Uy<7%dn>R$PxP_mTTZ`L6&;>A)lIDj>+*vb zdT)>C?FJ>q&s~s1K8V&dB8II#D8~JW8aX)J1vDd8R-v5**7MlB_*dJhnX6S z#1;DbM`;W_;mHuT9%uD+E!B|rKK&%L@RttrE!kU`FLm9)9VT2jX(ua`B@01~(Q;L# zL<3F%?zo;NNsJ8avXZI+(b%6sAeO59)0!3hI>d8${cN4_O)kc@dMx`nuE%p-Z@(tn zJ)U#lNj>1SF!PZ+{O%+~j3DNFn`wwh&2Y77R=08D{A-*Z-H(&8tFw!}?OmwyVuck0 zS@2#Td=JlepJ)?9gvLc&X)tjFHRF5raCu9E_Q#0Rc!m3mCnL`U?ms$&d&e0eiaTN(!rJ<%8 z_`u(4h$=7)m?%qNOIfjRW-uIB>N$&JV<=Leyflz)G#S6t{}4E z65a67`u31SiK4VX^-3kkQ#pv^D8MwqTj2PyK1bv}KkqvZO*l_{eg*^9?ZIf+2<&*f zZ;4BbyeY14=q2Gp_HAd~6bxeDVDB;I-@tr{RvPUbvzJX`5q}4kKF_Y>gPd`Or zFo(cmd#x=xQzl(6T2eK@gM&3SeMFSaxj=lyXdFrDmoLtJNw@IDfU*&m`vwzs0dgT` znd8}Q`-agRwd{B^-e|%X;1jgA8oAt=v|NTarfZem4hKy$=H+o%GYp#~-yo-$agQmE zk7W7xeLR32xQa}s>j}3cFS+37((PH=BBZ?{^Su|=yHMdZF`5okks9i;j?Ftm zRdX#H8DsK=GhPf;icO2qDrZ|vZoNRi)TC7?gT4l!jXW$J?u$2w>J#pa zJI#%Iu4$N4fM618rji5;{;-TcAblK=Tt=ftrfX%it&D3<9>A|J@?wS^ZN2lsJ`MRfZ zFVnd>y-cR1_0;qc3gW_xjyaaNFN%%~G|OK4CoN_V2Ibh2dY#^(DR-sphiJN(79HRWv^6fKFN4b~Qe$|9vsN2auMSau zWWc}_oJi%zY=T3Hi03~pA8a=Dx>mCU&gv7mOW4%Qo0Cm5pWOaZ8|G_Ok|^A8ld^_4 zgh@{Z@WK8Ic>hZUI(k&Jx&3}kwn$Ai=~}SXrzjmF_E7`)URM7)6Uuyh9@*?c77**C zcBB_S7DzP{a#r^V8I4TEu{yHoqaH_KZz`3&OgRI4kHtHUh04iEm8VI^+Zw_h{yXBz zM92|(lhFzF)<)0TnjT-s(+br@i@tA-VO0y4`7YyWSJ;K|fIv2P)x=T1M|-@0*0B|5 z|A?}rT%dT-Ce)T{vbZd*s&5UDIZK=O;H9Y4bbSs;Ru$#Z4pAZBt6}%I>{9i|OXrWJ|*l`HcpqdFU6BZ3#jXqwz7LnlBI>@xdIqYqp!n#W! zHoWnX#W^Q3nGJ}`6kjKOoel%St+jn(4Q`4GK!xu|yeg%b!bnN#cYRmRdlPvZ3EB|q zs*OS}d0^~Uklf1%W2N9!88vzpX~MgK>91)-n2}&laTRNQ79vp3Nd4BDPNgmUPm;y5zJB2FeK|7;gJtwCoFP!-ivRS0x<#QRGvz5QLAjW|=yq1w4SP9fySlTN_)@jX zcX)SazrU$zMf|(y(T;IJAndi>^rt#^>L*mJ=D27 zVPkuRK@`A0bexf)h$*~;BOh5*Lh$LU^0?cJ64AoBE|^ zNcBz0TXJ1G>CtDp-P6#U2%AmNyl&(h`nmRB%AR-hgz&*Ui}I<=13}C_;>{)EDRZ-&ARo_0JTaIvG>X z$Ai-3zGAS3#Zo2L&M)}&tFdYH=u!pZh8c&_S#Uh0aE#0y{~FQ3j$j-UMS>k=s~MUmpmF_sqFL zNXd5^LRk(eA!l6^-Z2IF1i3Jmz;6nHP(;QN`9- z7sOXGmjltFH7QfYxH+DofZZ~ZJSv?shdY>QH0AW=gqFM`2x)!f^{aBj5O=*J1_W<& z9qw$LEhe+^M1G^o9lF z)d3xcmm=Ky&`HOjsEQ&9XiLr)jT8miin3Ko21Ho6vDrxv$7$%WojSwVZ)kbExBp&m zFTmc;7YQx15LA)?*fj9QP?GLV=y?g>>@%l3KsJofhYe8y;k?WvnE$Xax0pv)klj)w z+t>ln#8YL&1a*XeY+?e??`f;k`$uLJ5#}K`YgPojOWo*{GNd*tE>jp`u86?&GKixQ z&a;f5?fv+1%(a#Np?^o4)77e<#`>h9|B{#FG5`Cj%n$HE#mpUF53IRuE;c6xwb#IW zA6nSg0h^yua*iL)z}Digu(?;&;>HLJO4PDMwBa4>4G?%66Utl2tu*o@wggS-Mfga9 zJ2@k@ZP3S1X>8t06P&@m9D2plwo=f9c$VEB^5`R}UcXni8J>IxWooR0Uo`K_XKggZ z3hgF-?%4tC=iGya*oY=IV17!#d5H8GIdX-`L>nLWc1F5{L7MS~)Z#(jjHaLL2mV~F zl*w?j6wO(pb(>;54?|BQ(t>h^DjaWi`xW>Tt%bKwg547FRcy))uf|14N#WJg2y{xH z3OD4|nt#T`^dS{N41$aIHF0kN)M1xJA#aC_!D}ATL_nC=6GsvEEOz25T#SS5mJKiA z)Pspc%pIFS{TDKy+vYTD%$y$DwSRax6Mv?eA31jFe%*RPKrK%Z8UF$5HKo&> zJ2ubSXolxVPz5FTKGoLQV4N)SL$R4%+%0Xdvlk+oMrwB{4_pt**QIlUmz=(6gy} zsYPO8q}DzEQc>PnTqEBZd$T5)P*G5CAp~CaKWXpIcIQ;)$D+As2L; z40gPT5a5^NgT=NG6;r6ic8TD8{_ZrMYhzpra+PFbVhiJk;U(5(VJY{tP19Uf8_S0p zK)+ZLQ$&eSZRPJQo(WaA%8k~JogDOFtV4r2tPFenIo=D>Ib+goD$-B1ni6HE>dAg< z!q{tQ&zZIIYUsp!&^@U762?BUn5Qy4q1El7DWdNo)W#;Bz&X~3#Uk-bn3hEbgn5+| zqZz6z^`|?UaejD)ogxoE$KLM{4)Y~P+n-G2k%g(-5JV^j3sqy`JDsycx|RldxJo@% zF?vy5nVA(92gwuHnzTZ{HQc-~iL+GEM{b6=#TiS4H%Mqqz>S*NkvgR{w*v+topNFd zrQNPqEA6UvoWkqT6~-IW-^vWS%=_MCQKYW~2HD`)_C|3HY1J=aj$4PNImV4d$89`^ zuSTr>YBlRa37xBx%D*inmEHX3M0bFU8Lx{hPW{wRhIva|uM#90_z2H_)@ z$$%RJqQ@=Vy3lRF8~NVmVZ{0B@iilARl0|2)#^htfE|I0zJ&A~I}gQ%;=cT&eQ6oy zMb}R1>$Mjc2JZuREX}8YD+*5dk{Nv_UUQ$NFSf>ysP`l^k_|>UF%i(AbC<)s`v&R- z=b8HJiQN6X+gPXg;JrUvrT`Ua2u#29&$I8jvRlI)lhZBDfyqt|qUR^RE3%xU-Q_l% zgGX58ZEkC!{w=qEgAV`6?R(JSUWWgG4w2CVx6lD2=oUIm)lW|ZhNhg5i=gZ03J6J6 z+m@e`h2_}WM=^RFa`ROzu)II9H9yHoiExLp(ubya-@s{y?Qp;hhOHb}cX_9^jwK!c zAS{t28BUHTgyMzDBdye0^wn_oGYeBDwkW(@ukKg}4K?owSp*IM^-iVV)E0r}&4VL! zFnXY}%gMH7&l(9%irKp@dewZ*a<-@hc!#EjGLfguIDV!~A5J(8?wl~SCaPY13lpgS z3KK~F!B0Q!{&Rlv&+xp}s{IZ!`5?dZUder8oWR|fAdDW!I)lg(6_-L?9XtD}@w#7q z#w-CO8g)VCbAd*$VIayJC1um7s${~0)(+^PjPYd`_{KwV7 zPGHWv;%|6n7nr;Drc0&EaVM8uVLL1l9ST}02o8o8s^?R46A;B!dN*ox{p~nx82ljd zKJl(dtyj$!mA3Ovka~O$FB3`!&bVB`dF~l+J%1f-3`C5TylOdqIjnwp?kE|+?iNSp zpl&BeExyr+Z@g>q#d|rbY6*El+tz!zwbHqt!4nRozg)*KtiuUkT8}0I{Q7xh)5;Ef)y&oeiRzp=z0DCtjRde;Ju$>n z?fp$qt^n!QmJZfVnBIqeOa}s~d`y+I_bK|U!KFFqaltk0?0ueig~y22#QlvKIaes< zLp$C;xIkXo7;=6acmHN+lbS%ws(E?crGp-5wwn`clLkxM=BgFc0)NhU7@0%5XJ41- z7d*s9*?cTB+b^^QyjLM+T=T6 z%zkD>^7!VeO+p^juBR(5riY|y3529}Ul~shxv!A9?U~jBPgXW8r5wNqkQ+e~i_DMU zkDl+C5a9x8u=p6^QBox-T$q|;aZAI}v2E~WP3#4eRz>qspJ>G{90;6(|^CC0pcm>{veNIg&1{asXI8%?E@4eY3#N-JPblmB*3-Q zIJ8Q36&JNi7V%N5F6kHT8dTYSve!w6R;ey1*uuaGX$QMxmeINbN8}CLklE-y>x}{R z*-x{8tSqvvDjc!zE&i|FCyAcT`g!p-C1vV}KWiT874_}td85$&6xC}S zJwDv}QA)MKPMj8R`$@|!t@yu((4@bYhkWL3l$F z_k0)p#u$b8+2G(VSAX91R9FKm^$Jl)n!3=ibXmkGVdk~1Z$S059x->AF1aNKS?sqJ ztPs`>2Q!8q%u=Z_M3+wdmzCs?@t>lIGzCex6%5vJO*Ytw}uz6I%m81ECg9;)B7cUwyCH&hq)_`yCQHdCAW6{y@}kB ziT@eD|6mmF2ELIojcB(w?I8EeoL)3KR3x=ZJq(H$eu(AT$r4uS-Dtk{(R8G(U8|bO zmo6KwJ`hniVcf?B91tx#wp{AUD1|&8;_A`F9!lsc7PvOhtg@V*{KUu5h=2srLg%4W zCn;oF`79NNlEi#TbT$-B=_;o3kX%5PO`n5W6Ui?5Q1V0|1>^)G_SpgwE^ zX+(R9nAhVqQQ*yRllPTaQDyGYQqfwbF=GD;4S&4V2}RV_OeFSsH)s zo_Ac1j;Otz%Pr|(@Z8hE)LHM&^hR|)`#=_q`Aa~|Byze-K@oD?+vvh*)Gb{t2aK9C zGO$=r^8r4al9;Lz7H%$N?zEO~np}Th4Bw_z^Mi@V`bY#EscNF57Uin(HQ{{h+A_WV z!P6-y>pc1HE*>AnLU}IIl*j~xuvA_AR>If$*=czTB~V`MZ{|SHr4d2FgU&JHS4cd? zGLN6_9oCMBb3Y(X<7H07$an2gU1yQ^Njh0ZO*lbv08~WPA1*S8nCKaE>4JBfaVi;j zVRX+1uRH~pWkm&Z6-d{KzSw#ow1(rKcERBeD=s{U9Gq3mQppD;D$guyql$e&^c5R= zCmJbcNEl)iF2%2}w8o$^W&S6tc;Q8l_s#-};s}I7H)7X=3I*wjqQ$YJ=5* zeGIuv#A}6BF-aALxS#^}vf=03u9G3_%oQ>IXxg$VE?4tT*IxR|OGRPmXdhl^-xxBy z`oYU}2aaX{Z{rw^beF!+FxXJPzBF*3Ex-HH!0+-ihks=5p9}AkvUlhImyq55tN)_b z|6G2bE4*WFe+lFkhy362e|X$KSKnvF?#|#Zc>{NE^)GhuPX+ghojdaEmmI+V%H{i1 z+MgQkkLSpKEx&!TMf|DZ-u&&q>7YN=-5+Y*0rOw7b$da-D=xpOyH{L)5>CHL?4O$N zU-W-B6$bsM=08Vde`>gYo%r2UDXe>Y`_C2P$42j69{yB!ADI7cDkbi}sJmzCJ*EG8 zChtSpJ7E7y=pO&n{8QP#!u&tCdB5r1q2FJkjCXIF_p$JwD(-g=(qHRupIiukQ*qD6 z{~gHtCHeP^vm^Sc?ar?M>py>P=6)6UJ!i~`|Fw!M$->``pP``8Z+`%{X~j-@_xAq) D(q!da literal 0 HcmV?d00001 diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index 9513b3ae5e61..55f1b5d5de2d 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -1263,6 +1263,16 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf163483_export_math_fallback) "id", cNvPr_id); } +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testPlaceHolderFitHeightToText) +{ + createSdImpressDoc("pptx/tdf160487.pptx"); + saveAndReload(u"Impress Office Open XML"_ustr); + uno::Reference xShape(getShapeFromPage(1, 0)); + bool bTextAutoGrowHeight = false; + xShape->getPropertyValue(u"TextAutoGrowHeight"_ustr) >>= bTextAutoGrowHeight; + CPPUNIT_ASSERT_MESSAGE("PlaceHolder Fit height to text should be true.", bTextAutoGrowHeight); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From 33c7d3a3e16c2c8db31e30d9daf302263449ed0d Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 21:03:50 +0100 Subject: [PATCH 114/155] tdf#130857 qt weld: Implement QtInstanceWidget::set_background Used e.g. by the "Find and Replace" dialog (Ctrl+H). Change-Id: Ie181eea1600616ddb6a8044864df221ac4bb108d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177826 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/inc/qt5/QtInstanceWidget.hxx | 2 +- vcl/qt5/QtInstanceWidget.cxx | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/vcl/inc/qt5/QtInstanceWidget.hxx b/vcl/inc/qt5/QtInstanceWidget.hxx index b63376208200..a98288908084 100644 --- a/vcl/inc/qt5/QtInstanceWidget.hxx +++ b/vcl/inc/qt5/QtInstanceWidget.hxx @@ -173,7 +173,7 @@ public: virtual void set_highlight_background() override; - virtual void set_background(const Color&) override; + virtual void set_background(const Color& rBackColor) override; virtual void draw(OutputDevice&, const Point&, const Size&) override; diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx index 6636e3f1c956..da0c0112dab0 100644 --- a/vcl/qt5/QtInstanceWidget.cxx +++ b/vcl/qt5/QtInstanceWidget.cxx @@ -545,7 +545,13 @@ void QtInstanceWidget::set_toolbar_background() { assert(false && "Not implement void QtInstanceWidget::set_highlight_background() { assert(false && "Not implemented yet"); } -void QtInstanceWidget::set_background(const Color&) { assert(false && "Not implemented yet"); } +void QtInstanceWidget::set_background(const Color& rBackColor) +{ + QPalette aPalette = getQWidget()->palette(); + aPalette.setColor(QPalette::Base, toQColor(rBackColor)); + getQWidget()->setPalette(aPalette); + getQWidget()->setBackgroundRole(QPalette::Base); +} void QtInstanceWidget::draw(OutputDevice&, const Point&, const Size&) { From d1243097a39375e98ef2fbc8a87be549e16275ff Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 21:19:02 +0100 Subject: [PATCH 115/155] tdf#130857 qt weld: Implement QtInstanceWindow::get_{size,position} These are needed e.g. for the "Find and Replace" dialog. Use the QWidget::geometry property [1] for now. An alternative to consider might be QWidget::frameGeometry [2]. At least on Wayland, screen positions are not available anyway, however. [1] https://doc.qt.io/qt-6/qwidget.html#geometry-prop [2] https://doc.qt.io/qt-6/qwidget.html#frameGeometry-prop Change-Id: I2449d8be688c17a4abb58ba424c966dde0e30e26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177827 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/qt5/QtInstanceWindow.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/vcl/qt5/QtInstanceWindow.cxx b/vcl/qt5/QtInstanceWindow.cxx index 262fe299a0c9..b911ac590de8 100644 --- a/vcl/qt5/QtInstanceWindow.cxx +++ b/vcl/qt5/QtInstanceWindow.cxx @@ -64,14 +64,21 @@ bool QtInstanceWindow::get_resizable() const Size QtInstanceWindow::get_size() const { - assert(false && "Not implemented yet"); - return Size(); + SolarMutexGuard g; + + Size aSize; + GetQtInstance().RunInMainThread([&] { aSize = toSize(getQWidget()->size()); }); + return aSize; } Point QtInstanceWindow::get_position() const { - assert(false && "Not implemented yet"); - return Point(); + SolarMutexGuard g; + + Point aPosition; + GetQtInstance().RunInMainThread( + [&] { aPosition = toPoint(getQWidget()->geometry().topLeft()); }); + return aPosition; } AbsoluteScreenPixelRectangle QtInstanceWindow::get_monitor_workarea() const From 4aa9b7a0bbcca4352a838962838c3311c44d7442 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 21:52:51 +0100 Subject: [PATCH 116/155] tdf#130857 qt weld: Implement QtInstanceWindow::{g,s}et_window_state Map to/from what looks like the corresponding QWidget equivalents. No explicit testing done. Change-Id: I47152c8789223372c49ea60f774d0a04a64db2b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177828 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/inc/qt5/QtInstanceWindow.hxx | 4 +- vcl/qt5/QtInstanceWindow.cxx | 66 +++++++++++++++++++++++++++++--- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/vcl/inc/qt5/QtInstanceWindow.hxx b/vcl/inc/qt5/QtInstanceWindow.hxx index b92b830c7b9b..151e6d47e6ad 100644 --- a/vcl/inc/qt5/QtInstanceWindow.hxx +++ b/vcl/inc/qt5/QtInstanceWindow.hxx @@ -32,8 +32,8 @@ public: virtual void change_default_widget(weld::Widget*, weld::Widget*) override; virtual bool is_default_widget(const weld::Widget*) const override; - virtual void set_window_state(const OUString&) override; - virtual OUString get_window_state(vcl::WindowDataMask) const override; + virtual void set_window_state(const OUString& rStr) override; + virtual OUString get_window_state(vcl::WindowDataMask eMask) const override; virtual css::uno::Reference GetXWindow() override; diff --git a/vcl/qt5/QtInstanceWindow.cxx b/vcl/qt5/QtInstanceWindow.cxx index b911ac590de8..4d1cde125cfb 100644 --- a/vcl/qt5/QtInstanceWindow.cxx +++ b/vcl/qt5/QtInstanceWindow.cxx @@ -115,12 +115,68 @@ bool QtInstanceWindow::is_default_widget(const weld::Widget*) const return true; } -void QtInstanceWindow::set_window_state(const OUString&) { assert(false && "Not implemented yet"); } - -OUString QtInstanceWindow::get_window_state(vcl::WindowDataMask) const +void QtInstanceWindow::set_window_state(const OUString& rStr) { - assert(false && "Not implemented yet"); - return OUString(); + SolarMutexGuard g; + + const vcl::WindowData aData(rStr); + const vcl::WindowDataMask eMask = aData.mask(); + + GetQtInstance().RunInMainThread([&] { + QRect aGeometry = getQWidget()->geometry(); + if (eMask & vcl::WindowDataMask::X) + aGeometry.setX(aData.x()); + if (eMask & vcl::WindowDataMask::Y) + aGeometry.setY(aData.y()); + if (eMask & vcl::WindowDataMask::Width) + aGeometry.setWidth(aData.width()); + if (eMask & vcl::WindowDataMask::Height) + aGeometry.setHeight(aData.height()); + + getQWidget()->setGeometry(aGeometry); + + if (eMask & vcl::WindowDataMask::State) + { + const vcl::WindowState eState = aData.state(); + if (eState & vcl::WindowState::Normal) + getQWidget()->showNormal(); + else if (eState & vcl::WindowState::Maximized) + getQWidget()->showMaximized(); + else if (eState & vcl::WindowState::Minimized) + getQWidget()->showMinimized(); + } + }); +} + +OUString QtInstanceWindow::get_window_state(vcl::WindowDataMask eMask) const +{ + SolarMutexGuard g; + + vcl::WindowData aData; + GetQtInstance().RunInMainThread([&] { + QRect aGeometry = getQWidget()->geometry(); + if (eMask & vcl::WindowDataMask::X) + aData.setX(aGeometry.x()); + if (eMask & vcl::WindowDataMask::Y) + aData.setY(aGeometry.y()); + if (eMask & vcl::WindowDataMask::Width) + aData.setWidth(aGeometry.width()); + if (eMask & vcl::WindowDataMask::Height) + aData.setHeight(aGeometry.height()); + if (eMask & vcl::WindowDataMask::State) + { + vcl::WindowState nState = vcl::WindowState::NONE; + if (getQWidget()->isMaximized()) + nState |= vcl::WindowState::Maximized; + else if (getQWidget()->isMinimized()) + nState |= vcl::WindowState::Minimized; + else + nState |= vcl::WindowState::Normal; + aData.setState(nState); + } + }); + + return aData.toStr(); } css::uno::Reference QtInstanceWindow::GetXWindow() From e6bf5124be8b898649b6221d23960aacb7602d0e Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 22:09:12 +0100 Subject: [PATCH 117/155] tdf#130857 qt weld: Implement QtInstanceComboBox::set_entry_message_type Reuse the logic previously implemented in QtInstanceEntry::set_message_type by moving it to a static helper method that takes a QLineEdit* param, and for QtInstanceComboBox::set_entry_message_type, pass the combo box's line edit. Change-Id: I8e81c9473da294d2a8c863ed143d735c30ade2a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177829 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/inc/qt5/QtInstanceEntry.hxx | 2 ++ vcl/qt5/QtInstanceComboBox.cxx | 6 ++++-- vcl/qt5/QtInstanceEntry.cxx | 18 +++++++++++------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/vcl/inc/qt5/QtInstanceEntry.hxx b/vcl/inc/qt5/QtInstanceEntry.hxx index 73a4e3fec9a3..987df275c31b 100644 --- a/vcl/inc/qt5/QtInstanceEntry.hxx +++ b/vcl/inc/qt5/QtInstanceEntry.hxx @@ -49,6 +49,8 @@ public: virtual void set_alignment(TxtAlign eXAlign) override; + static void setMessageType(QLineEdit& rLineEdit, weld::EntryMessageType eType); + protected Q_SLOTS: void handleTextChanged(); }; diff --git a/vcl/qt5/QtInstanceComboBox.cxx b/vcl/qt5/QtInstanceComboBox.cxx index 79563be87659..77e099b7c52a 100644 --- a/vcl/qt5/QtInstanceComboBox.cxx +++ b/vcl/qt5/QtInstanceComboBox.cxx @@ -10,6 +10,8 @@ #include #include +#include + #include #include @@ -219,9 +221,9 @@ bool QtInstanceComboBox::has_entry() const return bEditable; } -void QtInstanceComboBox::set_entry_message_type(weld::EntryMessageType) +void QtInstanceComboBox::set_entry_message_type(weld::EntryMessageType eType) { - assert(false && "Not implemented yet"); + QtInstanceEntry::setMessageType(*m_pComboBox->lineEdit(), eType); } void QtInstanceComboBox::set_entry_text(const OUString& rStr) diff --git a/vcl/qt5/QtInstanceEntry.cxx b/vcl/qt5/QtInstanceEntry.cxx index 49da357f6d8c..88f7a181f9f0 100644 --- a/vcl/qt5/QtInstanceEntry.cxx +++ b/vcl/qt5/QtInstanceEntry.cxx @@ -120,13 +120,13 @@ bool QtInstanceEntry::get_editable() const return bEditable; } -void QtInstanceEntry::set_message_type(weld::EntryMessageType eType) +void QtInstanceEntry::setMessageType(QLineEdit& rLineEdit, weld::EntryMessageType eType) { SolarMutexGuard g; GetQtInstance().RunInMainThread([&] { - for (QAction* pAction : m_pLineEdit->actions()) - m_pLineEdit->removeAction(pAction); + for (QAction* pAction : rLineEdit.actions()) + rLineEdit.removeAction(pAction); switch (eType) { @@ -134,12 +134,11 @@ void QtInstanceEntry::set_message_type(weld::EntryMessageType eType) // don't do anything special return; case weld::EntryMessageType::Warning: - m_pLineEdit->addAction(QIcon::fromTheme("dialog-warning"), - QLineEdit::TrailingPosition); + rLineEdit.addAction(QIcon::fromTheme("dialog-warning"), + QLineEdit::TrailingPosition); return; case weld::EntryMessageType::Error: - m_pLineEdit->addAction(QIcon::fromTheme("dialog-error"), - QLineEdit::TrailingPosition); + rLineEdit.addAction(QIcon::fromTheme("dialog-error"), QLineEdit::TrailingPosition); return; default: assert(false && "Unknown EntryMessageType"); @@ -148,6 +147,11 @@ void QtInstanceEntry::set_message_type(weld::EntryMessageType eType) }); } +void QtInstanceEntry::set_message_type(weld::EntryMessageType eType) +{ + setMessageType(*m_pLineEdit, eType); +} + void QtInstanceEntry::set_placeholder_text(const OUString& rText) { SolarMutexGuard g; From abfb229bbe90367f218c0a03d8ecb11b5c14488c Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 22:17:37 +0100 Subject: [PATCH 118/155] tdf#130857 qt weld: Hold SolarMutex when signalling checkbox toggle Not doing so would e.g. trigger an assert when toggling the "Match case" checkbox in the "Find and Replace" dialog in a WIP branch where support for that dialog with native widgets is declared. Change-Id: I5dc95e81e81bceaf258ecba6e55dfa280dfdd572 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177830 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/inc/qt5/QtInstanceCheckButton.hxx | 3 +++ vcl/qt5/QtInstanceCheckButton.cxx | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/vcl/inc/qt5/QtInstanceCheckButton.hxx b/vcl/inc/qt5/QtInstanceCheckButton.hxx index a13c883ac310..7a3a56137ce7 100644 --- a/vcl/inc/qt5/QtInstanceCheckButton.hxx +++ b/vcl/inc/qt5/QtInstanceCheckButton.hxx @@ -35,6 +35,9 @@ public: virtual void set_label(const OUString& rText) override; virtual OUString get_label() const override; virtual void set_label_wrap(bool bWrap) override; + +private Q_SLOTS: + void handleToggled(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtInstanceCheckButton.cxx b/vcl/qt5/QtInstanceCheckButton.cxx index 835dcd356196..1a5e63408de7 100644 --- a/vcl/qt5/QtInstanceCheckButton.cxx +++ b/vcl/qt5/QtInstanceCheckButton.cxx @@ -17,7 +17,7 @@ QtInstanceCheckButton::QtInstanceCheckButton(QCheckBox* pCheckBox) , m_pCheckBox(pCheckBox) { assert(m_pCheckBox); - connect(m_pCheckBox, &QCheckBox::toggled, this, [&] { signal_toggled(); }); + connect(m_pCheckBox, &QCheckBox::toggled, this, &QtInstanceCheckButton::handleToggled); } void QtInstanceCheckButton::set_active(bool bActive) @@ -73,4 +73,10 @@ void QtInstanceCheckButton::QtInstanceCheckButton::set_label_wrap(bool /*bWrap*/ assert(false && "Not implemented yet"); } +void QtInstanceCheckButton::handleToggled() +{ + SolarMutexGuard g; + signal_toggled(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ From 5614c39745e43ed105b2308dc4f4107fbf5f0fe3 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 22:44:55 +0100 Subject: [PATCH 119/155] tdf#130857 qt weld: Signal combobox text change As the comment for weld::ComboBox::connect_changed (in vcl/include/weld.hxx) says: /* m_aChangeHdl is called when the active item is changed. The can be due to the user selecting a different item from the list or while typing into the entry of a combo box with an entry. Use changed_by_direct_pick() to discover whether an item was actually explicitly selected, e.g. from the menu. */ void connect_changed(const Link& rLink) { m_aChangeHdl = rLink; } QComboBox::currentIndexChanged is not emitted while typing in an editable combobox, so connect to the QComboBox::editTextChanged signal in addition. Also, hold the SolarMutex when calling the signal handler. QtInstanceComboBox::changed_by_direct_pick isn't implemented yet, but would trigger an assert when called, so this doesn't go unnoticed at least. Witht this commit in change, typing in the "Find" combobox in the "Find and Replace" dialog in a WIP branch declaring support for that dialog now results in the buttons getting enabled or disabled as expected (disabled when text is empty, enabled when non-empty). Change-Id: I9b89b3a3c8b5ed7ebdeda7b486bdbf2f7e54fd86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177831 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/inc/qt5/QtInstanceComboBox.hxx | 2 +- vcl/qt5/QtInstanceComboBox.cxx | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/vcl/inc/qt5/QtInstanceComboBox.hxx b/vcl/inc/qt5/QtInstanceComboBox.hxx index 26e47f6e71c6..d21c61a3f086 100644 --- a/vcl/inc/qt5/QtInstanceComboBox.hxx +++ b/vcl/inc/qt5/QtInstanceComboBox.hxx @@ -87,7 +87,7 @@ private: void sortItems(); private slots: - void handleCurrentIndexChanged(); + void signalChanged(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtInstanceComboBox.cxx b/vcl/qt5/QtInstanceComboBox.cxx index 77e099b7c52a..b573edad0126 100644 --- a/vcl/qt5/QtInstanceComboBox.cxx +++ b/vcl/qt5/QtInstanceComboBox.cxx @@ -25,7 +25,9 @@ QtInstanceComboBox::QtInstanceComboBox(QComboBox* pComboBox) assert(pComboBox); QObject::connect(m_pComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, - &QtInstanceComboBox::handleCurrentIndexChanged); + &QtInstanceComboBox::signalChanged); + QObject::connect(m_pComboBox, &QComboBox::editTextChanged, this, + &QtInstanceComboBox::signalChanged); } void QtInstanceComboBox::insert(int nPos, const OUString& rStr, const OUString* pId, @@ -368,6 +370,10 @@ void QtInstanceComboBox::set_max_drop_down_rows(int) { assert(false && "Not impl void QtInstanceComboBox::sortItems() { m_pComboBox->model()->sort(0, Qt::AscendingOrder); } -void QtInstanceComboBox::handleCurrentIndexChanged() { signal_changed(); } +void QtInstanceComboBox::signalChanged() +{ + SolarMutexGuard g; + signal_changed(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ From 44b2a3d53646bd3c55993af29121d007fb177c55 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 23:15:41 +0100 Subject: [PATCH 120/155] tdf#130857 qt weld: Implement QtInstanceWidget::get_extents_relative_to This e.g. gets called when pressing the "Find Next" button in the "Find and Replace" dialog. Change-Id: I30e33d52d19b0afe44564486bfa79e3b500ae856 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177832 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/inc/qt5/QtInstanceWidget.hxx | 3 ++- vcl/qt5/QtInstanceWidget.cxx | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/vcl/inc/qt5/QtInstanceWidget.hxx b/vcl/inc/qt5/QtInstanceWidget.hxx index a98288908084..f50f4de1e84a 100644 --- a/vcl/inc/qt5/QtInstanceWidget.hxx +++ b/vcl/inc/qt5/QtInstanceWidget.hxx @@ -130,7 +130,8 @@ public: virtual void grab_remove() override; - virtual bool get_extents_relative_to(const Widget&, int&, int&, int&, int&) const override; + virtual bool get_extents_relative_to(const Widget& rRelative, int& rX, int& rY, int& rWidth, + int& rHeight) const override; virtual bool get_direction() const override; diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx index da0c0112dab0..5a770e4a479d 100644 --- a/vcl/qt5/QtInstanceWidget.cxx +++ b/vcl/qt5/QtInstanceWidget.cxx @@ -459,10 +459,27 @@ bool QtInstanceWidget::has_grab() const void QtInstanceWidget::grab_remove() { assert(false && "Not implemented yet"); } -bool QtInstanceWidget::get_extents_relative_to(const Widget&, int&, int&, int&, int&) const +bool QtInstanceWidget::get_extents_relative_to(const Widget& rRelative, int& rX, int& rY, + int& rWidth, int& rHeight) const { - assert(false && "Not implemented yet"); - return false; + SolarMutexGuard g; + + bool bRet = false; + GetQtInstance().RunInMainThread([&] { + QRect aGeometry = m_pWidget->geometry(); + rWidth = aGeometry.width(); + rHeight = aGeometry.height(); + const QtInstanceWidget* pRelativeWidget = dynamic_cast(&rRelative); + if (!pRelativeWidget) + return; + + QPoint aRelativePos = m_pWidget->mapTo(pRelativeWidget->getQWidget(), QPoint(0, 0)); + rX = aRelativePos.x(); + rY = aRelativePos.y(); + bRet = true; + }); + + return bRet; } bool QtInstanceWidget::get_direction() const From 2d0d3500c29a5e31a6e6ecf86aa7bc604a537a1c Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 4 Dec 2024 23:41:22 +0100 Subject: [PATCH 121/155] tdf#130857 qt weld: Let QtInstanceWidget derive from QObject Also add Q_OBJECT macros for all subclasses that didn't have them and run moc for them, too. Change-Id: Ia42ee7d02b68d54df308d33c88bf286468bfa68f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177833 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- vcl/CustomTarget_qt5_moc.mk | 4 ++++ vcl/CustomTarget_qt6_moc.mk | 4 ++++ vcl/inc/qt5/QtInstanceButton.hxx | 2 +- vcl/inc/qt5/QtInstanceCheckButton.hxx | 4 +--- vcl/inc/qt5/QtInstanceComboBox.hxx | 2 +- vcl/inc/qt5/QtInstanceContainer.hxx | 2 +- vcl/inc/qt5/QtInstanceDrawingArea.hxx | 4 +--- vcl/inc/qt5/QtInstanceEntry.hxx | 2 +- vcl/inc/qt5/QtInstanceExpander.hxx | 2 +- vcl/inc/qt5/QtInstanceImage.hxx | 2 ++ vcl/inc/qt5/QtInstanceLabel.hxx | 2 ++ vcl/inc/qt5/QtInstanceLevelBar.hxx | 2 +- vcl/inc/qt5/QtInstanceLinkButton.hxx | 4 +--- vcl/inc/qt5/QtInstanceNotebook.hxx | 2 +- vcl/inc/qt5/QtInstanceProgressBar.hxx | 4 +--- vcl/inc/qt5/QtInstanceRadioButton.hxx | 4 +--- vcl/inc/qt5/QtInstanceTextView.hxx | 2 ++ vcl/inc/qt5/QtInstanceTreeView.hxx | 2 +- vcl/inc/qt5/QtInstanceWidget.hxx | 4 +++- vcl/qt5/QtInstanceImage.cxx | 1 + vcl/qt5/QtInstanceLabel.cxx | 1 + vcl/qt5/QtInstanceTextView.cxx | 1 + vcl/qt5/QtInstanceWidget.cxx | 2 ++ 23 files changed, 35 insertions(+), 24 deletions(-) diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk index 3b7c6165e5ae..6e3d7dda89fd 100644 --- a/vcl/CustomTarget_qt5_moc.mk +++ b/vcl/CustomTarget_qt5_moc.mk @@ -23,6 +23,8 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceDrawingArea.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceEntry.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceExpander.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceImage.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLabel.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLevelBar.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLinkButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceMessageDialog.moc \ @@ -30,7 +32,9 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceProgressBar.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceRadioButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceSpinButton.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceTextView.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceTreeView.moc \ + $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceWidget.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceWindow.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtMainWindow.moc \ $(gb_CustomTarget_workdir)/vcl/qt5/QtMenu.moc \ diff --git a/vcl/CustomTarget_qt6_moc.mk b/vcl/CustomTarget_qt6_moc.mk index 63d90a3905e0..a45846b37ea5 100644 --- a/vcl/CustomTarget_qt6_moc.mk +++ b/vcl/CustomTarget_qt6_moc.mk @@ -23,6 +23,8 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceDrawingArea.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceEntry.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceExpander.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceImage.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLabel.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLevelBar.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLinkButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceMessageDialog.moc \ @@ -30,7 +32,9 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceProgressBar.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceRadioButton.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceSpinButton.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceTextView.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceTreeView.moc \ + $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceWidget.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceWindow.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtMainWindow.moc \ $(gb_CustomTarget_workdir)/vcl/qt6/QtMenu.moc \ diff --git a/vcl/inc/qt5/QtInstanceButton.hxx b/vcl/inc/qt5/QtInstanceButton.hxx index a302ba54e978..c25342e0bc83 100644 --- a/vcl/inc/qt5/QtInstanceButton.hxx +++ b/vcl/inc/qt5/QtInstanceButton.hxx @@ -14,7 +14,7 @@ #include #include -class QtInstanceButton : public QObject, public QtInstanceWidget, public virtual weld::Button +class QtInstanceButton : public QtInstanceWidget, public virtual weld::Button { QPushButton* m_pButton; diff --git a/vcl/inc/qt5/QtInstanceCheckButton.hxx b/vcl/inc/qt5/QtInstanceCheckButton.hxx index 7a3a56137ce7..a929dfe5e465 100644 --- a/vcl/inc/qt5/QtInstanceCheckButton.hxx +++ b/vcl/inc/qt5/QtInstanceCheckButton.hxx @@ -14,9 +14,7 @@ #include #include -class QtInstanceCheckButton : public QObject, - public QtInstanceWidget, - public virtual weld::CheckButton +class QtInstanceCheckButton : public QtInstanceWidget, public virtual weld::CheckButton { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceComboBox.hxx b/vcl/inc/qt5/QtInstanceComboBox.hxx index d21c61a3f086..15c91eb20915 100644 --- a/vcl/inc/qt5/QtInstanceComboBox.hxx +++ b/vcl/inc/qt5/QtInstanceComboBox.hxx @@ -13,7 +13,7 @@ #include -class QtInstanceComboBox : public QObject, public QtInstanceWidget, public virtual weld::ComboBox +class QtInstanceComboBox : public QtInstanceWidget, public virtual weld::ComboBox { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceContainer.hxx b/vcl/inc/qt5/QtInstanceContainer.hxx index dc38f2ae6e49..8fea34cd8d74 100644 --- a/vcl/inc/qt5/QtInstanceContainer.hxx +++ b/vcl/inc/qt5/QtInstanceContainer.hxx @@ -13,7 +13,7 @@ #include -class QtInstanceContainer : public QObject, public QtInstanceWidget, public virtual weld::Container +class QtInstanceContainer : public QtInstanceWidget, public virtual weld::Container { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceDrawingArea.hxx b/vcl/inc/qt5/QtInstanceDrawingArea.hxx index 866d39bdccea..c403662ef6f9 100644 --- a/vcl/inc/qt5/QtInstanceDrawingArea.hxx +++ b/vcl/inc/qt5/QtInstanceDrawingArea.hxx @@ -13,9 +13,7 @@ #include -class QtInstanceDrawingArea : public QObject, - public QtInstanceWidget, - public virtual weld::DrawingArea +class QtInstanceDrawingArea : public QtInstanceWidget, public virtual weld::DrawingArea { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceEntry.hxx b/vcl/inc/qt5/QtInstanceEntry.hxx index 987df275c31b..b7b1ef162d6a 100644 --- a/vcl/inc/qt5/QtInstanceEntry.hxx +++ b/vcl/inc/qt5/QtInstanceEntry.hxx @@ -13,7 +13,7 @@ #include -class QtInstanceEntry : public QObject, public QtInstanceWidget, public virtual weld::Entry +class QtInstanceEntry : public QtInstanceWidget, public virtual weld::Entry { Q_OBJECT; diff --git a/vcl/inc/qt5/QtInstanceExpander.hxx b/vcl/inc/qt5/QtInstanceExpander.hxx index d596acb9ba94..efafd8a7cf30 100644 --- a/vcl/inc/qt5/QtInstanceExpander.hxx +++ b/vcl/inc/qt5/QtInstanceExpander.hxx @@ -12,7 +12,7 @@ #include "QtInstanceWidget.hxx" #include "QtExpander.hxx" -class QtInstanceExpander : public QObject, public QtInstanceWidget, public virtual weld::Expander +class QtInstanceExpander : public QtInstanceWidget, public virtual weld::Expander { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceImage.hxx b/vcl/inc/qt5/QtInstanceImage.hxx index 4f6588d49867..ebef898bb011 100644 --- a/vcl/inc/qt5/QtInstanceImage.hxx +++ b/vcl/inc/qt5/QtInstanceImage.hxx @@ -15,6 +15,8 @@ class QtInstanceImage : public QtInstanceWidget, public virtual weld::Image { + Q_OBJECT + QLabel* m_pLabel; public: diff --git a/vcl/inc/qt5/QtInstanceLabel.hxx b/vcl/inc/qt5/QtInstanceLabel.hxx index 0feb6ce7ac2f..64fb09e6c399 100644 --- a/vcl/inc/qt5/QtInstanceLabel.hxx +++ b/vcl/inc/qt5/QtInstanceLabel.hxx @@ -16,6 +16,8 @@ class QtInstanceLabel : public QtInstanceWidget, public virtual weld::Label { + Q_OBJECT + QLabel* m_pLabel; public: diff --git a/vcl/inc/qt5/QtInstanceLevelBar.hxx b/vcl/inc/qt5/QtInstanceLevelBar.hxx index cb819b0da902..5d728335ae13 100644 --- a/vcl/inc/qt5/QtInstanceLevelBar.hxx +++ b/vcl/inc/qt5/QtInstanceLevelBar.hxx @@ -13,7 +13,7 @@ #include -class QtInstanceLevelBar : public QObject, public QtInstanceWidget, public virtual weld::LevelBar +class QtInstanceLevelBar : public QtInstanceWidget, public virtual weld::LevelBar { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceLinkButton.hxx b/vcl/inc/qt5/QtInstanceLinkButton.hxx index 43b91344eebf..425daf13849c 100644 --- a/vcl/inc/qt5/QtInstanceLinkButton.hxx +++ b/vcl/inc/qt5/QtInstanceLinkButton.hxx @@ -14,9 +14,7 @@ #include -class QtInstanceLinkButton : public QObject, - public QtInstanceWidget, - public virtual weld::LinkButton +class QtInstanceLinkButton : public QtInstanceWidget, public virtual weld::LinkButton { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceNotebook.hxx b/vcl/inc/qt5/QtInstanceNotebook.hxx index bf43ac39e54f..2a18a65784a0 100644 --- a/vcl/inc/qt5/QtInstanceNotebook.hxx +++ b/vcl/inc/qt5/QtInstanceNotebook.hxx @@ -16,7 +16,7 @@ #include -class QtInstanceNotebook : public QObject, public QtInstanceWidget, public virtual weld::Notebook +class QtInstanceNotebook : public QtInstanceWidget, public virtual weld::Notebook { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceProgressBar.hxx b/vcl/inc/qt5/QtInstanceProgressBar.hxx index 2efe6d126ed6..9f26a5cdeb73 100644 --- a/vcl/inc/qt5/QtInstanceProgressBar.hxx +++ b/vcl/inc/qt5/QtInstanceProgressBar.hxx @@ -13,9 +13,7 @@ #include -class QtInstanceProgressBar : public QObject, - public QtInstanceWidget, - public virtual weld::ProgressBar +class QtInstanceProgressBar : public QtInstanceWidget, public virtual weld::ProgressBar { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceRadioButton.hxx b/vcl/inc/qt5/QtInstanceRadioButton.hxx index 5dee84d36f01..56955c5f51d5 100644 --- a/vcl/inc/qt5/QtInstanceRadioButton.hxx +++ b/vcl/inc/qt5/QtInstanceRadioButton.hxx @@ -14,9 +14,7 @@ #include #include -class QtInstanceRadioButton : public QObject, - public QtInstanceWidget, - public virtual weld::RadioButton +class QtInstanceRadioButton : public QtInstanceWidget, public virtual weld::RadioButton { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceTextView.hxx b/vcl/inc/qt5/QtInstanceTextView.hxx index 36dfda0d3379..4fb8ca94c6c9 100644 --- a/vcl/inc/qt5/QtInstanceTextView.hxx +++ b/vcl/inc/qt5/QtInstanceTextView.hxx @@ -15,6 +15,8 @@ class QtInstanceTextView : public QtInstanceWidget, public virtual weld::TextView { + Q_OBJECT + QPlainTextEdit* m_pTextEdit; public: diff --git a/vcl/inc/qt5/QtInstanceTreeView.hxx b/vcl/inc/qt5/QtInstanceTreeView.hxx index a344c365a7c4..dd252c3e2b47 100644 --- a/vcl/inc/qt5/QtInstanceTreeView.hxx +++ b/vcl/inc/qt5/QtInstanceTreeView.hxx @@ -14,7 +14,7 @@ #include #include -class QtInstanceTreeView : public QObject, public QtInstanceWidget, public virtual weld::TreeView +class QtInstanceTreeView : public QtInstanceWidget, public virtual weld::TreeView { Q_OBJECT diff --git a/vcl/inc/qt5/QtInstanceWidget.hxx b/vcl/inc/qt5/QtInstanceWidget.hxx index f50f4de1e84a..a790ac81edf7 100644 --- a/vcl/inc/qt5/QtInstanceWidget.hxx +++ b/vcl/inc/qt5/QtInstanceWidget.hxx @@ -19,8 +19,10 @@ #include #include -class QtInstanceWidget : public virtual weld::Widget +class QtInstanceWidget : public QObject, public virtual weld::Widget { + Q_OBJECT + QWidget* m_pWidget; public: diff --git a/vcl/qt5/QtInstanceImage.cxx b/vcl/qt5/QtInstanceImage.cxx index 291ba1be7689..1d56edea08e9 100644 --- a/vcl/qt5/QtInstanceImage.cxx +++ b/vcl/qt5/QtInstanceImage.cxx @@ -8,6 +8,7 @@ */ #include +#include #include diff --git a/vcl/qt5/QtInstanceLabel.cxx b/vcl/qt5/QtInstanceLabel.cxx index ca12c3314e81..d498e2000e7e 100644 --- a/vcl/qt5/QtInstanceLabel.cxx +++ b/vcl/qt5/QtInstanceLabel.cxx @@ -8,6 +8,7 @@ */ #include +#include #include diff --git a/vcl/qt5/QtInstanceTextView.cxx b/vcl/qt5/QtInstanceTextView.cxx index 9106ee3f2095..dc85c9850d01 100644 --- a/vcl/qt5/QtInstanceTextView.cxx +++ b/vcl/qt5/QtInstanceTextView.cxx @@ -8,6 +8,7 @@ */ #include +#include #include diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx index 5a770e4a479d..0ecf4ffd6d14 100644 --- a/vcl/qt5/QtInstanceWidget.cxx +++ b/vcl/qt5/QtInstanceWidget.cxx @@ -8,6 +8,8 @@ */ #include +#include + #include #include From 4a309551927898f97d1a9b2dce8050e021bbfd34 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 00:29:05 +0100 Subject: [PATCH 122/155] weld: Add weld::Widget::signal_* methods to call handlers Similar to what already exists in most subclasses, add signal_ methods to call the handlers and use these in the subclasses instead of calling the handlers directly. Change-Id: I6b79ddd859b360e947d97ada57f1573a276d6177 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177834 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/vcl/weld.hxx | 20 +++++++++++++++++++ vcl/source/app/salvtables.cxx | 24 +++++++++++------------ vcl/unx/gtk3/gtkinst.cxx | 37 +++++++++++++++-------------------- 3 files changed, 48 insertions(+), 33 deletions(-) diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 715beb742a4e..e55cf8a205f0 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -95,6 +95,26 @@ protected: Link m_aMouseMotionHdl; Link m_aMouseReleaseHdl; + void signal_focus_in() { m_aFocusInHdl.Call(*this); } + void signal_focus_out() { m_aFocusOutHdl.Call(*this); } + bool signal_mnemonic_activate() { return m_aMnemonicActivateHdl.Call(*this); } + void signal_style_updated() { m_aStyleUpdatedHdl.Call(*this); } + void signal_size_allocate(const Size& rSize) { m_aSizeAllocateHdl.Call(rSize); } + bool signal_key_press(const KeyEvent& rKeyEvent) { return m_aKeyPressHdl.Call(rKeyEvent); } + bool signal_key_release(const KeyEvent& rKeyEvent) { return m_aKeyReleaseHdl.Call(rKeyEvent); } + bool signal_mouse_press(const MouseEvent& rMouseEvent) + { + return m_aMousePressHdl.Call(rMouseEvent); + } + bool signal_mouse_motion(const MouseEvent& rMouseEvent) + { + return m_aMouseMotionHdl.Call(rMouseEvent); + } + bool signal_mouse_release(const MouseEvent& rMouseEvent) + { + return m_aMouseReleaseHdl.Call(rMouseEvent); + } + public: virtual void set_sensitive(bool sensitive) = 0; virtual bool get_sensitive() const = 0; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 3b06cc0e05e6..8f0bb080accb 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -741,11 +741,11 @@ SystemWindow* SalInstanceWidget::getSystemWindow() { return m_xWidget->GetSystem void SalInstanceWidget::HandleEventListener(VclWindowEvent& rEvent) { if (rEvent.GetId() == VclEventId::WindowGetFocus) - m_aFocusInHdl.Call(*this); + signal_focus_in(); else if (rEvent.GetId() == VclEventId::WindowLoseFocus) - m_aFocusOutHdl.Call(*this); + signal_focus_out(); else if (rEvent.GetId() == VclEventId::WindowResize) - m_aSizeAllocateHdl.Call(m_xWidget->GetSizePixel()); + signal_size_allocate(m_xWidget->GetSizePixel()); } namespace @@ -766,14 +766,14 @@ void SalInstanceWidget::HandleMouseEventListener(VclWindowEvent& rWinEvent) if (m_xWidget == rWinEvent.GetWindow()) { const MouseEvent* pMouseEvent = static_cast(rWinEvent.GetData()); - m_aMousePressHdl.Call(*pMouseEvent); + signal_mouse_press(*pMouseEvent); } else if (m_xWidget->ImplIsChild(rWinEvent.GetWindow())) { const MouseEvent* pMouseEvent = static_cast(rWinEvent.GetData()); const MouseEvent aTransformedEvent( TransformEvent(*pMouseEvent, m_xWidget, rWinEvent.GetWindow())); - m_aMousePressHdl.Call(aTransformedEvent); + signal_mouse_press(aTransformedEvent); } } else if (rWinEvent.GetId() == VclEventId::WindowMouseButtonUp) @@ -781,14 +781,14 @@ void SalInstanceWidget::HandleMouseEventListener(VclWindowEvent& rWinEvent) if (m_xWidget == rWinEvent.GetWindow()) { const MouseEvent* pMouseEvent = static_cast(rWinEvent.GetData()); - m_aMouseReleaseHdl.Call(*pMouseEvent); + signal_mouse_release(*pMouseEvent); } else if (m_xWidget->ImplIsChild(rWinEvent.GetWindow())) { const MouseEvent* pMouseEvent = static_cast(rWinEvent.GetData()); const MouseEvent aTransformedEvent( TransformEvent(*pMouseEvent, m_xWidget, rWinEvent.GetWindow())); - m_aMouseReleaseHdl.Call(aTransformedEvent); + signal_mouse_release(aTransformedEvent); } } else if (rWinEvent.GetId() == VclEventId::WindowMouseMove) @@ -796,14 +796,14 @@ void SalInstanceWidget::HandleMouseEventListener(VclWindowEvent& rWinEvent) if (m_xWidget == rWinEvent.GetWindow()) { const MouseEvent* pMouseEvent = static_cast(rWinEvent.GetData()); - m_aMouseMotionHdl.Call(*pMouseEvent); + signal_mouse_motion(*pMouseEvent); } else if (m_xWidget->ImplIsChild(rWinEvent.GetWindow())) { const MouseEvent* pMouseEvent = static_cast(rWinEvent.GetData()); const MouseEvent aTransformedEvent( TransformEvent(*pMouseEvent, m_xWidget, rWinEvent.GetWindow())); - m_aMouseMotionHdl.Call(aTransformedEvent); + signal_mouse_motion(aTransformedEvent); } } } @@ -816,12 +816,12 @@ bool SalInstanceWidget::HandleKeyEventListener(VclWindowEvent& rEvent) if (rEvent.GetId() == VclEventId::WindowKeyInput) { const KeyEvent* pKeyEvent = static_cast(rEvent.GetData()); - return m_aKeyPressHdl.Call(*pKeyEvent); + return signal_key_press(*pKeyEvent); } else if (rEvent.GetId() == VclEventId::WindowKeyUp) { const KeyEvent* pKeyEvent = static_cast(rEvent.GetData()); - return m_aKeyReleaseHdl.Call(*pKeyEvent); + return signal_key_release(*pKeyEvent); } return false; } @@ -843,7 +843,7 @@ IMPL_LINK(SalInstanceWidget, MouseEventListener, VclWindowEvent&, rEvent, void) IMPL_LINK_NOARG(SalInstanceWidget, MnemonicActivateHdl, vcl::Window&, bool) { - return m_aMnemonicActivateHdl.Call(*this); + return signal_mnemonic_activate(); } namespace diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index f1ca1030e300..c837bd6dbb54 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2588,7 +2588,7 @@ protected: if (pTopLevel && g_object_get_data(G_OBJECT(pTopLevel), "g-lo-BlockFocusChange")) return; - m_aFocusInHdl.Call(*this); + weld::Widget::signal_focus_in(); } static gboolean signalMnemonicActivate(GtkWidget*, gboolean, gpointer widget) @@ -2598,11 +2598,6 @@ protected: return pThis->signal_mnemonic_activate(); } - bool signal_mnemonic_activate() - { - return m_aMnemonicActivateHdl.Call(*this); - } - #if GTK_CHECK_VERSION(4, 0, 0) static void signalFocusOut(GtkEventControllerFocus*, gpointer widget) { @@ -2638,7 +2633,7 @@ protected: if (pTopLevel && g_object_get_data(G_OBJECT(pTopLevel), "g-lo-BlockFocusChange")) return; - m_aFocusOutHdl.Call(*this); + weld::Widget::signal_focus_out(); } virtual void ensureMouseEventWidget() @@ -2990,10 +2985,10 @@ private: sal_uInt16 nCode = m_nLastMouseButton | (nModCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2)); MouseEvent aMEvt(aPos, n_press, ImplGetMouseButtonMode(m_nLastMouseButton, nModCode), nCode, nCode); - if (nEventType == SalEvent::MouseButtonDown && m_aMousePressHdl.Call(aMEvt)) + if (nEventType == SalEvent::MouseButtonDown && signal_mouse_press(aMEvt)) gtk_gesture_set_state(GTK_GESTURE(pGesture), GTK_EVENT_SEQUENCE_CLAIMED); - if (nEventType == SalEvent::MouseButtonUp && m_aMouseReleaseHdl.Call(aMEvt)) + if (nEventType == SalEvent::MouseButtonUp && signal_mouse_release(aMEvt)) gtk_gesture_set_state(GTK_GESTURE(pGesture), GTK_EVENT_SEQUENCE_CLAIMED); } @@ -3096,12 +3091,12 @@ private: { if (!m_aMousePressHdl.IsSet()) return false; - return m_aMousePressHdl.Call(aMEvt); + return signal_mouse_press(aMEvt); } if (!m_aMouseReleaseHdl.IsSet()) return false; - return m_aMouseReleaseHdl.Call(aMEvt); + return signal_mouse_release(aMEvt); } #endif @@ -3116,7 +3111,7 @@ private: sal_uInt32 nModCode = GtkSalFrame::GetMouseModCode(nState); MouseEvent aMEvt(aPos, 0, ImplGetMouseMoveMode(nModCode), nModCode, nModCode); - return m_aMouseMotionHdl.Call(aMEvt); + return signal_mouse_motion(aMEvt); } #if GTK_CHECK_VERSION(4, 0, 0) @@ -3178,7 +3173,7 @@ private: eModifiers = eModifiers | eMouseEventModifiers; MouseEvent aMEvt(aPos, 0, eModifiers, nModCode, nModCode); - m_aMouseMotionHdl.Call(aMEvt); + signal_mouse_motion(aMEvt); return false; } @@ -4100,7 +4095,7 @@ public: virtual void signal_size_allocate(guint nWidth, guint nHeight) { - m_aSizeAllocateHdl.Call(Size(nWidth, nHeight)); + weld::Widget::signal_size_allocate(Size(nWidth, nHeight)); } #if GTK_CHECK_VERSION(4, 0, 0) @@ -4109,7 +4104,7 @@ public: if (m_aKeyPressHdl.IsSet()) { SolarMutexGuard aGuard; - return m_aKeyPressHdl.Call(CreateKeyEvent(keyval, keycode, state, 0)); + return weld::Widget::signal_key_press(CreateKeyEvent(keyval, keycode, state, 0)); } return false; } @@ -4119,7 +4114,7 @@ public: if (m_aKeyReleaseHdl.IsSet()) { SolarMutexGuard aGuard; - return m_aKeyReleaseHdl.Call(CreateKeyEvent(keyval, keycode, state, 0)); + return weld::Widget::signal_key_release(CreateKeyEvent(keyval, keycode, state, 0)); } return false; } @@ -4130,7 +4125,7 @@ public: if (m_aKeyPressHdl.IsSet()) { SolarMutexGuard aGuard; - return m_aKeyPressHdl.Call(GtkToVcl(*pEvent)); + return weld::Widget::signal_key_press(GtkToVcl(*pEvent)); } return false; } @@ -4140,7 +4135,7 @@ public: if (m_aKeyReleaseHdl.IsSet()) { SolarMutexGuard aGuard; - return m_aKeyReleaseHdl.Call(GtkToVcl(*pEvent)); + return weld::Widget::signal_key_release(GtkToVcl(*pEvent)); } return false; } @@ -4611,7 +4606,7 @@ IMPL_LINK(GtkInstanceWidget, SettingsChangedHdl, VclWindowEvent&, rEvent, void) DataChangedEvent* pData = static_cast(rEvent.GetData()); if (pData->GetType() == DataChangedEventType::SETTINGS) - m_aStyleUpdatedHdl.Call(*this); + signal_style_updated(); } #if !GTK_CHECK_VERSION(4, 0, 0) @@ -19056,8 +19051,8 @@ public: virtual void click(const Point& rPos) override { MouseEvent aEvent(rPos); - m_aMousePressHdl.Call(aEvent); - m_aMouseReleaseHdl.Call(aEvent); + signal_mouse_press(aEvent); + signal_mouse_release(aEvent); } }; From 5776d98616a93b5e77326ddf205a239b2f8ca016 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 00:37:44 +0100 Subject: [PATCH 123/155] tdf#130857 qt weld: Notify when receiving/losing focus In QtInstanceWidget, connect to the QApplication::focusChanged signal [1] and when either the old or the new focus widget is the one belonging to this QtInstanceWidget, notify about the lost/gained focus. With this in place, SvxSearchDialog::FocusHdl_Impl now gets called in a WIP branch where support for the "Find and Replace" dialog is declared when moving focus into one of the comboboxes in that dialog. [1] https://doc.qt.io/qt-6/qapplication.html#focusChanged Change-Id: I15190cf9b0d2e72d78a57f58da7ff2ebd1e7a6d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177835 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/inc/qt5/QtInstanceWidget.hxx | 3 +++ vcl/qt5/QtInstanceWidget.cxx | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/vcl/inc/qt5/QtInstanceWidget.hxx b/vcl/inc/qt5/QtInstanceWidget.hxx index a790ac81edf7..fc84a4adda59 100644 --- a/vcl/inc/qt5/QtInstanceWidget.hxx +++ b/vcl/inc/qt5/QtInstanceWidget.hxx @@ -181,6 +181,9 @@ public: virtual void draw(OutputDevice&, const Point&, const Size&) override; static void setHelpId(QWidget& rWidget, const OUString& rHelpId); + +private Q_SLOTS: + void applicationFocusChanged(QWidget* pOldFocus, QWidget* pNewFocus); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx index 0ecf4ffd6d14..29cb929cb80d 100644 --- a/vcl/qt5/QtInstanceWidget.cxx +++ b/vcl/qt5/QtInstanceWidget.cxx @@ -22,6 +22,8 @@ QtInstanceWidget::QtInstanceWidget(QWidget* pWidget) : m_pWidget(pWidget) { assert(pWidget); + + connect(qApp, &QApplication::focusChanged, this, &QtInstanceWidget::applicationFocusChanged); } void QtInstanceWidget::set_sensitive(bool bSensitive) @@ -577,4 +579,14 @@ void QtInstanceWidget::draw(OutputDevice&, const Point&, const Size&) assert(false && "Not implemented yet"); } +void QtInstanceWidget::applicationFocusChanged(QWidget* pOldFocus, QWidget* pNewFocus) +{ + SolarMutexGuard g; + + if (pOldFocus == m_pWidget) + signal_focus_out(); + else if (pNewFocus == m_pWidget) + signal_focus_in(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ From dfa81bdb3a7956d631c8ccb1e00166289d37993e Mon Sep 17 00:00:00 2001 From: Jonathan Clark Date: Wed, 4 Dec 2024 01:43:37 -0700 Subject: [PATCH 124/155] tdf#162750 sw: Fix layout with small caps inside ligatures Previously, Writer was not correctly terminating layout contexts at the starts of small caps spans. This could cause incorrect character placement in certain cases. Regression since: Commit 30d376fb7ded4c96c85ad1112a0e44b5929657c9 "tdf#61444 Correct Writer text layout across formatting changes" and Commit ab0a4543cab77ae0c7c0a79feb8aebab71163dd7 "tdf#124116 Correct Writer text shaping across formatting changes" Change-Id: I863b9b66356eb0a9efb5bbdc75e80b43d56aaaf0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177839 Reviewed-by: Jonathan Clark Tested-by: Jenkins --- sw/source/core/text/itratr.cxx | 88 ++++++++++++++ sw/source/core/text/itratr.hxx | 1 + sw/source/core/text/itrform2.cxx | 4 +- vcl/qa/cppunit/pdfexport/data/tdf162750.fodt | 119 +++++++++++++++++++ vcl/qa/cppunit/pdfexport/pdfexport2.cxx | 36 ++++++ 5 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 vcl/qa/cppunit/pdfexport/data/tdf162750.fodt diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index fe94ad999ef5..bccc7377072d 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -838,6 +839,93 @@ TextFrameIndex SwAttrIter::GetNextAttr() const } } +namespace +{ +class FormatBreakTracker +{ +private: + std::optional m_nCaseMap; + + bool m_bNeedsBreak = false; + + void SetCaseMap(SvxCaseMap nValue) + { + if (m_nCaseMap != nValue) + m_bNeedsBreak = true; + + m_nCaseMap = nValue; + } + +public: + void HandleItemSet(const SfxItemSet& rSet) + { + if (const SvxCaseMapItem* pItem = rSet.GetItem(RES_CHRATR_CASEMAP)) + SetCaseMap(pItem->GetCaseMap()); + } + + void Reset() { m_bNeedsBreak = false; } + + bool NeedsBreak() const { return m_bNeedsBreak; } +}; + +bool HasFormatBreakAttribute(FormatBreakTracker* pTracker, const SwTextAttr* pAttr) +{ + pTracker->Reset(); + + switch (pAttr->Which()) + { + case RES_TXTATR_AUTOFMT: + case RES_TXTATR_CHARFMT: + { + const SfxItemSet& rSet((pAttr->Which() == RES_TXTATR_CHARFMT) + ? static_cast( + pAttr->GetCharFormat().GetCharFormat()->GetAttrSet()) + : *pAttr->GetAutoFormat().GetStyleHandle()); + + pTracker->HandleItemSet(rSet); + } + break; + } + + if (pAttr->IsFormatIgnoreStart() || pAttr->IsFormatIgnoreEnd()) + pTracker->Reset(); + + return pTracker->NeedsBreak(); +} +} + +TextFrameIndex SwAttrIter::GetNextLayoutBreakAttr() const +{ + size_t nStartIndex(m_nStartIndex); + SwTextNode const* pTextNode(m_pTextNode); + + sal_Int32 nNext = std::numeric_limits::max(); + + auto* pHints = pTextNode->GetpSwpHints(); + if (!pHints) + { + return TextFrameIndex{ nNext }; + } + + FormatBreakTracker stTracker; + stTracker.HandleItemSet(pTextNode->GetSwAttrSet()); + + for (size_t i = 0; i < pHints->Count(); ++i) + { + SwTextAttr* const pAttr(pHints->Get(i)); + if (HasFormatBreakAttribute(&stTracker, pAttr)) + { + if (i >= nStartIndex) + { + nNext = pAttr->GetStart(); + break; + } + } + } + + return TextFrameIndex{ nNext }; +} + namespace { class SwMinMaxArgs diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx index 91b3d4f9200c..d61d112404eb 100644 --- a/sw/source/core/text/itratr.hxx +++ b/sw/source/core/text/itratr.hxx @@ -87,6 +87,7 @@ public: // The parameter returns the position of the next change before or at the // char position. TextFrameIndex GetNextAttr() const; + TextFrameIndex GetNextLayoutBreakAttr() const; /// Enables the attributes used at char pos nPos in the logical font bool Seek(TextFrameIndex nPos); // Creates the font at the specified position via Seek() and checks diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index dd068364292a..8fc8764470b5 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1392,6 +1392,8 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf ) // until next attribute change: const TextFrameIndex nNextAttr = GetNextAttr(); + // until next layout-breaking attribute change: + const TextFrameIndex nNextLayoutBreakAttr = GetNextLayoutBreakAttr(); // end of script type: const TextFrameIndex nNextScript = m_pScriptInfo->NextScriptChg(rInf.GetIdx()); // end of direction: @@ -1401,7 +1403,7 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf ) // bookmarks const TextFrameIndex nNextBookmark = m_pScriptInfo->NextBookmark(rInf.GetIdx()); - auto nNextContext = std::min({ nNextChg, nNextScript, nNextDir }); + auto nNextContext = std::min({ nNextChg, nNextLayoutBreakAttr, nNextScript, nNextDir }); nNextChg = std::min({ nNextChg, nNextAttr, nNextScript, nNextDir, nNextHidden, nNextBookmark }); // Turbo boost: diff --git a/vcl/qa/cppunit/pdfexport/data/tdf162750.fodt b/vcl/qa/cppunit/pdfexport/data/tdf162750.fodt new file mode 100644 index 000000000000..be345551e91c --- /dev/null +++ b/vcl/qa/cppunit/pdfexport/data/tdf162750.fodt @@ -0,0 +1,119 @@ + + + 2024-12-04T21:34:47.4334348352024-12-04T21:37:36.661647530PT2M49S2LibreOfficeDev/25.2.0.0.alpha1$Linux_X86_64 LibreOffice_project/277d26808adc6812e17b910a6300006fe03f4614 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ffi + ffi + + + + \ No newline at end of file diff --git a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx index f1b8d1bb2219..3e36171f4ba0 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport2.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport2.cxx @@ -6041,6 +6041,42 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest2, testFormRoundtrip) } } +CPPUNIT_TEST_FIXTURE(PdfExportTest2, testTdf162750SmallCapsLigature) +{ + saveAsPDF(u"tdf162750.fodt"); + + auto pPdfDocument = parsePDFExport(); + CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount()); + + auto pPdfPage = pPdfDocument->openPage(/*nIndex*/ 0); + CPPUNIT_ASSERT(pPdfPage); + auto pTextPage = pPdfPage->getTextPage(); + CPPUNIT_ASSERT(pTextPage); + + int nPageObjectCount = pPdfPage->getObjectCount(); + + CPPUNIT_ASSERT_EQUAL(3, nPageObjectCount); + + std::vector aText; + for (int i = 0; i < nPageObjectCount; ++i) + { + auto pPageObject = pPdfPage->getObject(i); + CPPUNIT_ASSERT_MESSAGE("no object", pPageObject != nullptr); + if (pPageObject->getType() == vcl::pdf::PDFPageObjectType::Text) + { + aText.push_back(pPageObject->getText(pTextPage)); + } + } + + CPPUNIT_ASSERT_EQUAL(size_t(3), aText.size()); + CPPUNIT_ASSERT_EQUAL(u"ffi"_ustr, aText.at(0).trim()); + + // Without the fix, this will be "ffi" + CPPUNIT_ASSERT_EQUAL(u"f"_ustr, aText.at(1).trim()); + + CPPUNIT_ASSERT_EQUAL(u"FI"_ustr, aText.at(2).trim()); +} + } // end anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); From 139bb786bb4fe5cf2554f6016095ff1588f3994f Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Thu, 5 Dec 2024 09:25:22 +0100 Subject: [PATCH 125/155] Resolves tdf#164034 - Rename Non-breaking Spaces The option also affects hyphen and the label should reflect this Change-Id: I5e092f8c5d67c1c039de709d024c89481b40a82d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177841 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- sw/uiconfig/swriter/ui/optformataidspage.ui | 30 +++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sw/uiconfig/swriter/ui/optformataidspage.ui b/sw/uiconfig/swriter/ui/optformataidspage.ui index c461544ca92e..f9d0cce2b0b8 100644 --- a/sw/uiconfig/swriter/ui/optformataidspage.ui +++ b/sw/uiconfig/swriter/ui/optformataidspage.ui @@ -88,7 +88,7 @@ - Non-breaking s_paces + Non-breaking s_paces and hyphen True True False @@ -102,7 +102,8 @@ 1 - 3 + 7 + 2 @@ -121,7 +122,7 @@
1 - 4 + 3 @@ -140,7 +141,7 @@
1 - 5 + 4
@@ -160,6 +161,7 @@ 1 6 + 2 @@ -178,13 +180,14 @@
1 - 7 + 5 True False + start @@ -196,6 +199,7 @@ True False + start - @@ -207,6 +211,7 @@ True False + start · @@ -218,22 +223,24 @@ True False + start 2 - 4 + 3 True False + start 2 - 5 + 4 @@ -242,11 +249,12 @@ False ⌶ indicates a point bookmark, [ and ] indicate the start and end of a bookmark on a text range + start ⌶ […]
2 - 7 + 5
@@ -393,12 +401,6 @@ 7 - - - - - -
From 73a46895c5927d68a222b13dc811ea1cceb811a1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 5 Dec 2024 07:58:44 +0200 Subject: [PATCH 126/155] tdf#119840 speed up SearchForStyleAnchor no need to copy things to a std::deque, it is quite straightforward to just iterate over the SwNodes structure. Shaves off about 30% of the time spent processing post-load. Change-Id: I852079c18738299be04cec52b82e0f6949f2d81c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177837 Reviewed-by: Noel Grandin Tested-by: Jenkins --- sw/source/core/fields/reffld.cxx | 169 +++++++++++++------------------ 1 file changed, 70 insertions(+), 99 deletions(-) diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index cca05dcb4dec..99ef95713e1a 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -1212,56 +1212,47 @@ namespace Marginal, /* headers, footers */ }; - /// Picks the first text node with a matching style from a double ended queue, starting at the front - /// This allows us to use the deque either as a stack or as a queue depending on whether we want to search up or down - SwTextNode* SearchForStyleAnchor(SwTextNode* pSelf, const std::deque& pToSearch, + SwTextNode* SearchForStyleAnchor(SwTextNode* pSelf, SwNode* pCurrent, std::u16string_view rStyleName, sal_Int32 *const pStart, sal_Int32 *const pEnd, bool bCaseSensitive = true) { - std::deque pSearching(pToSearch); - while (!pSearching.empty()) + if (*pCurrent == *pSelf) + return nullptr; + + SwTextNode* pTextNode = pCurrent->GetTextNode(); + if (!pTextNode) + return nullptr; + + if (bCaseSensitive + ? pTextNode->GetFormatColl()->GetName() == rStyleName + : pTextNode->GetFormatColl()->GetName().equalsIgnoreAsciiCase(rStyleName)) { - SwNode* pCurrent = pSearching.front(); - pSearching.pop_front(); - - if (*pCurrent == *pSelf) - continue; - - SwTextNode* pTextNode = pCurrent->GetTextNode(); - if (!pTextNode) - continue; - - if (bCaseSensitive - ? pTextNode->GetFormatColl()->GetName() == rStyleName - : pTextNode->GetFormatColl()->GetName().equalsIgnoreAsciiCase(rStyleName)) + *pStart = 0; + if (pEnd) { - *pStart = 0; - if (pEnd) - { - *pEnd = pTextNode->GetText().getLength(); - } - return pTextNode; + *pEnd = pTextNode->GetText().getLength(); } + return pTextNode; + } - if (auto const pHints = pTextNode->GetpSwpHints()) + if (auto const pHints = pTextNode->GetpSwpHints()) + { + for (size_t i = 0; i < pHints->Count(); ++i) { - for (size_t i = 0; i < pHints->Count(); ++i) + auto const*const pHint(pHints->Get(i)); + if (pHint->Which() == RES_TXTATR_CHARFMT) { - auto const*const pHint(pHints->Get(i)); - if (pHint->Which() == RES_TXTATR_CHARFMT) + if (bCaseSensitive + ? pHint->GetCharFormat().GetCharFormat()->HasName(rStyleName) + : pHint->GetCharFormat().GetCharFormat()->GetName().equalsIgnoreAsciiCase(rStyleName)) { - if (bCaseSensitive - ? pHint->GetCharFormat().GetCharFormat()->HasName(rStyleName) - : pHint->GetCharFormat().GetCharFormat()->GetName().equalsIgnoreAsciiCase(rStyleName)) + *pStart = pHint->GetStart(); + if (pEnd) { - *pStart = pHint->GetStart(); - if (pEnd) - { - *pEnd = *pHint->End(); - } - return pTextNode; + *pEnd = *pHint->End(); } + return pTextNode; } } } @@ -1269,6 +1260,34 @@ namespace return nullptr; } + /// Picks the first text node with a matching style from the specified node range + SwTextNode* SearchForStyleAnchor(SwTextNode* pSelf, const SwNodes& rNodes, SwNodeOffset nNodeStart, SwNodeOffset nNodeEnd, bool bSearchBackward, + std::u16string_view rStyleName, + sal_Int32 *const pStart, sal_Int32 *const pEnd, + bool bCaseSensitive = true) + { + if (!bSearchBackward) + { + for (SwNodeOffset nCurrent = nNodeStart; nCurrent <= nNodeEnd; ++nCurrent) + { + SwNode* pCurrent = rNodes[nCurrent]; + SwTextNode* pFound = SearchForStyleAnchor(pSelf, pCurrent, rStyleName, pStart, pEnd, bCaseSensitive); + if (pFound) + return pFound; + } + } + else + { + for (SwNodeOffset nCurrent = nNodeEnd; nCurrent >= nNodeStart; --nCurrent) + { + SwNode* pCurrent = rNodes[nCurrent]; + SwTextNode* pFound = SearchForStyleAnchor(pSelf, pCurrent, rStyleName, pStart, pEnd, bCaseSensitive); + if (pFound) + return pFound; + } + } + return nullptr; + } } SwTextNode* SwGetRefFieldType::FindAnchor(SwDoc* pDoc, const OUString& rRefMark, @@ -1533,69 +1552,38 @@ SwTextNode* SwGetRefFieldType::FindAnchorRefStyleMarginal(SwDoc* pDoc, pPageEnd = pReference; } - std::deque pSearchSecond; - std::deque pInPage; /* or pSearchFirst */ - std::deque pSearchThird; - - bool beforeStart = true; - bool beforeEnd = true; - + SwNodeOffset nPageStart = pPageStart->GetIndex(); + SwNodeOffset nPageEnd = pPageEnd->GetIndex(); const SwNodes& nodes = pDoc->GetNodes(); - for (SwNodeOffset n(0); n < nodes.Count(); n++) - { - if (beforeStart && *pPageStart == *nodes[n]) - { - beforeStart = false; - } - if (beforeStart) - { - pSearchSecond.push_front(nodes[n]); - } - else if (beforeEnd) - { - if (bFlagFromBottom) - pInPage.push_front(nodes[n]); - else - pInPage.push_back(nodes[n]); - - if (*pPageEnd == *nodes[n]) - { - beforeEnd = false; - } - } - else - pSearchThird.push_back(nodes[n]); - } - - pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd); + pTextNd = SearchForStyleAnchor(pSelf, nodes, nPageStart, nPageEnd, bFlagFromBottom, styleName, pStt, pEnd); if (pTextNd) return pTextNd; // 2. Search up from the top of the page - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); + pTextNd = SearchForStyleAnchor(pSelf, nodes, SwNodeOffset(0), nPageStart - 1, /*bBackwards*/true, styleName, pStt, pEnd); if (pTextNd) return pTextNd; // 3. Search down from the bottom of the page - pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd); + pTextNd = SearchForStyleAnchor(pSelf, nodes, nPageEnd + 1, nodes.Count() - 1, /*bBackwards*/false, styleName, pStt, pEnd); if (pTextNd) return pTextNd; // Word has case insensitive styles. LO has case sensitive styles. If we didn't find // it yet, maybe we could with a case insensitive search. Let's do that - pTextNd = SearchForStyleAnchor(pSelf, pInPage, styleName, pStt, pEnd, + pTextNd = SearchForStyleAnchor(pSelf, nodes, nPageStart, nPageEnd, bFlagFromBottom, styleName, pStt, pEnd, false /* bCaseSensitive */); if (pTextNd) return pTextNd; - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, + pTextNd = SearchForStyleAnchor(pSelf, nodes, SwNodeOffset(0), nPageStart - 1, /*bBackwards*/true, styleName, pStt, pEnd, false /* bCaseSensitive */); if (pTextNd) return pTextNd; - pTextNd = SearchForStyleAnchor(pSelf, pSearchThird, styleName, pStt, pEnd, + pTextNd = SearchForStyleAnchor(pSelf, nodes, nPageEnd + 1, nodes.Count() - 1, /*bBackwards*/false, styleName, pStt, pEnd, false /* bCaseSensitive */); return pTextNd; } @@ -1609,47 +1597,30 @@ SwTextNode* SwGetRefFieldType::FindAnchorRefStyleOther(SwDoc* pDoc, // For references, styleref acts from the position of the reference not the field // Happily, the previous code saves either one into pReference, so the following is generic for both - SwTextNode* pTextNd = nullptr; - std::deque pSearchFirst; - std::deque pSearchSecond; - - bool beforeElement = true; - + SwNodeOffset nReference = pReference->GetIndex(); const SwNodes& nodes = pDoc->GetNodes(); - for (SwNodeOffset n(0); n < nodes.Count(); n++) - { - if (beforeElement) - { - pSearchFirst.push_front(nodes[n]); - - if (*pReference == *nodes[n]) - { - beforeElement = false; - } - } - pSearchSecond.push_back(nodes[n]); - } + SwTextNode* pTextNd = nullptr; // 1. Search up until we hit the top of the document - pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd); + pTextNd = SearchForStyleAnchor(pSelf, nodes, SwNodeOffset(0), nReference, /*bBackwards*/true, styleName, pStt, pEnd); if (pTextNd) return pTextNd; // 2. Search down until we hit the bottom of the document - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd); + pTextNd = SearchForStyleAnchor(pSelf, nodes, nReference + 1, nodes.Count() - 1, /*bBackwards*/false, styleName, pStt, pEnd); if (pTextNd) return pTextNd; // Again, we need to remember that Word styles are not case sensitive - pTextNd = SearchForStyleAnchor(pSelf, pSearchFirst, styleName, pStt, pEnd, + pTextNd = SearchForStyleAnchor(pSelf, nodes, SwNodeOffset(0), nReference, /*bBackwards*/true, styleName, pStt, pEnd, false /* bCaseSensitive */); if (pTextNd) return pTextNd; - pTextNd = SearchForStyleAnchor(pSelf, pSearchSecond, styleName, pStt, pEnd, + pTextNd = SearchForStyleAnchor(pSelf, nodes, nReference + 1, nodes.Count() - 1, /*bBackwards*/false, styleName, pStt, pEnd, false /* bCaseSensitive */); return pTextNd; } From a81c1e16516dccd0e4a37c4ea5d37e9c85b5a3d7 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 5 Dec 2024 16:04:43 +0500 Subject: [PATCH 127/155] Get SwFieldType after broadcast A crash was reported in HasOnlyOneListener, with the following call stack: ntdll.dll!KiUserExceptionDispatch() swlo.dll!SwModify::HasOnlyOneListener() Line 204 swlo.dll!SwFormatField::~SwFormatField() Line 142 swlo.dll!SwHistorySetTextField::`scalar deleting destructor'(unsigned int) swlo.dll!std::default_delete::operator()(SwHistoryHint *) Line 3090 swlo.dll!std::unique_ptr>::{dtor}() Line 3198 swlo.dll!std::destroy_at(std::unique_ptr> * const) Line 311 swlo.dll!std::_Default_allocator_traits>>>::destroy(std::allocator>> &) Line 688 swlo.dll!std::_Destroy_range(std::unique_ptr> * _First, std::unique_ptr> * const) Line 905 swlo.dll!std::vector>,std::allocator>>>::_Destroy(std::unique_ptr> * _Last, std::unique_ptr> *) Line 1667 swlo.dll!std::vector>,std::allocator>>>::_Tidy() Line 1751 swlo.dll!std::vector>,std::allocator>>>::~vector>,std::allocator>>>() Line 699 swlo.dll!SwUndoSaveContent::~SwUndoSaveContent() Line 740 swlo.dll!SwUndoDelete::~SwUndoDelete() Line 633 swlo.dll!SwUndoDelete::`scalar deleting destructor'(unsigned int) svllo.dll!std::default_delete::operator()(SfxUndoAction *) Line 3090 svllo.dll!std::unique_ptr>::{dtor}() Line 3198 svllo.dll!std::destroy_at(MarkedUndoAction * const) Line 311 svllo.dll!std::_Default_allocator_traits>::destroy(std::allocator &) Line 688 svllo.dll!std::_Destroy_range(MarkedUndoAction * _First, MarkedUndoAction * const) Line 905 svllo.dll!std::vector>::_Destroy(MarkedUndoAction * _Last, MarkedUndoAction *) Line 1667 svllo.dll!std::vector>::_Tidy() Line 1751 svllo.dll!std::vector>::~vector>() Line 699 svllo.dll!SfxUndoArray::{dtor}() Line 1389 svllo.dll!SfxListUndoAction::~SfxListUndoAction() Line 1318 svllo.dll!SfxListUndoAction::`vector deleting destructor'(unsigned int) svllo.dll!std::default_delete::operator()(SfxUndoAction *) Line 3090 svllo.dll!std::unique_ptr>::{dtor}() Line 3198 svllo.dll!std::destroy_at(MarkedUndoAction * const) Line 311 svllo.dll!std::_Default_allocator_traits>::destroy(std::allocator &) Line 688 svllo.dll!std::_Destroy_range(MarkedUndoAction * _First, MarkedUndoAction * const) Line 905 svllo.dll!std::vector>::_Destroy(MarkedUndoAction * _Last, MarkedUndoAction *) Line 1667 svllo.dll!std::vector>::_Tidy() Line 1751 svllo.dll!std::vector>::~vector>() Line 699 svllo.dll!SfxUndoArray::{dtor}() Line 1389 svllo.dll!SfxListUndoAction::~SfxListUndoAction() Line 1318 svllo.dll!SfxListUndoAction::`vector deleting destructor'(unsigned int) svllo.dll!std::default_delete::operator()(SfxUndoAction *) Line 3090 svllo.dll!std::unique_ptr>::{dtor}() Line 3198 svllo.dll!std::destroy_at(std::unique_ptr> * const) Line 311 svllo.dll!std::_Default_allocator_traits>>>::destroy(std::allocator>> &) Line 688 svllo.dll!std::_Destroy_range(std::unique_ptr> * _First, std::unique_ptr> * const) Line 905 svllo.dll!std::vector>,std::allocator>>>::_Destroy(std::unique_ptr> * _Last, std::unique_ptr> *) Line 1667 svllo.dll!std::vector>,std::allocator>>>::clear() Line 1442 svllo.dll!svl::undo::impl::UndoManagerGuard::~UndoManagerGuard() Line 325 svllo.dll!SfxUndoManager::ImplClearRedo_NoLock(const bool i_currentLevel) Line 468 swlo.dll!sw::DocumentContentOperationsManager::InsertPoolItem(const SwPaM & rRg, const SfxPoolItem & rHt, const SetAttrMode nFlags, const SwRootFrame * pLayout, SwTextAttr * * ppNewTextAttr) Line 3694 swlo.dll!SwXTextField::attach(const com::sun::star::uno::Reference & xTextRange) Line 1972 swlo.dll!SwXText::insertTextContent(const com::sun::star::uno::Reference & xRange, const com::sun::star::uno::Reference & xContent, unsigned char bAbsorb) Line 606 mscx_uno.dll!`anonymous namespace'::cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy * pThis, bridges::cpp_uno::shared::VtableSlot aVtableSlot, _typelib_TypeDescriptionReference * pReturnTypeRef, long nParams, _typelib_MethodParameter * pParams, void * pUnoReturn, void * * pUnoArgs, _uno_Any * * ppUnoExc) Line 214 mscx_uno.dll!unoInterfaceProxyDispatch(_uno_Interface * pUnoI, const _typelib_TypeDescription * pMemberTD, void * pReturn, void * * pArgs, _uno_Any * * ppException) Line 430 binaryurplo.dll!binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny * returnValue, std::vector> * outArguments) Line 239 binaryurplo.dll!binaryurp::IncomingRequest::execute() Line 79 binaryurplo.dll!request(void * pThreadSpecificData) Line 84 cppu3.dll!cppu_threadpool::JobQueue::enter(const void * nDisposeId, bool bReturnWhenNoJob) Line 101 cppu3.dll!cppu_threadpool::ORequestThread::run() Line 169 cppu3.dll!threadFunc(void * param) Line 190 sal3.dll!oslWorkerWrapperFunction(void * pData) Line 67 I don't know why pType->Which() succeeded before the broadcast and reset, and pType->HasOnlyOneListener() crashed; field destructors themselves do not seem to destroy their types (except SwDBField, which is handled here explicitly). My blind guess is, that a change could happen in broadcast. Change-Id: I5c7f07da2e1283510bce3a3e3e80b6f8d849f38b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177854 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/source/core/txtnode/atrfld.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 7155248d793f..9974c4db6ec3 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -133,12 +133,12 @@ SwFormatField::SwFormatField( const SwFormatField& rAttr ) SwFormatField::~SwFormatField() { - SwFieldType* pType = mpField ? mpField->GetTyp() : nullptr; + Broadcast( SwFormatFieldHint( this, SwFormatFieldHintWhich::REMOVED ) ); + SwFieldType* pType = mpField ? mpField->GetTyp() : nullptr; if (pType && pType->Which() == SwFieldIds::Database) pType = nullptr; // DB field types destroy themselves - Broadcast( SwFormatFieldHint( this, SwFormatFieldHintWhich::REMOVED ) ); mpField.reset(); // some fields need to delete their field type From 55e77a48fbafd47036d7bd3ba11579c5f15f2359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 5 Dec 2024 11:38:52 +0000 Subject: [PATCH 128/155] gtk4: GtkIconView doesn't have convert_widget_to_bin_window_coords MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit but still has the same problem as the gtk3 iconview with reporting positions when scrolled a problem since: commit a36a58933a1e07d3f54bacd5c2fe8ca53063a63a CommitDate: Wed Dec 4 07:40:30 2024 +0100 sd: convert sidebar masterpage panels from drawingview to iconview Change-Id: Ice549b40d88c5d2063e37ccb63490e3537736d39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177855 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/unx/gtk3/gtkinst.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index c837bd6dbb54..92b281e8ee2d 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -2263,17 +2263,22 @@ namespace rOutRect = GdkRectangle{static_cast(rInRect.Left()), static_cast(rInRect.Top()), static_cast(rInRect.GetWidth()), static_cast(rInRect.GetHeight())}; -#if !GTK_CHECK_VERSION(4, 0, 0) if (GTK_IS_ICON_VIEW(pWidget)) { // GtkIconView is a little weird in its positioning with scrolling, so adjust here to match what // it expects gint nOffsetX(0), nOffsetY(0); +#if !GTK_CHECK_VERSION(4, 0, 0) gtk_icon_view_convert_widget_to_bin_window_coords(GTK_ICON_VIEW(pWidget), 0, 0, &nOffsetX, &nOffsetY); +#else + GtkAdjustment* pVAdjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(pWidget)); + nOffsetY = pVAdjustment ? gtk_adjustment_get_value(pVAdjustment) : 0; + GtkAdjustment* pHAdjustment = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(pWidget)); + nOffsetX = pHAdjustment ? gtk_adjustment_get_value(pHAdjustment) : 0; +#endif rOutRect.x -= nOffsetX; rOutRect.y -= nOffsetY; } -#endif if (SwapForRTL(pWidget)) rOutRect.x = gtk_widget_get_allocated_width(pWidget) - rOutRect.width - 1 - rOutRect.x; @@ -17156,10 +17161,15 @@ private: gtk_icon_view_get_cell_rect(m_pIconView, path, nullptr, &aRect); gtk_tree_path_free(path); -#if !GTK_CHECK_VERSION(4, 0, 0) // GtkIconView is a little weird in its positioning with scrolling +#if !GTK_CHECK_VERSION(4, 0, 0) gtk_icon_view_convert_widget_to_bin_window_coords(m_pIconView, aRect.x, aRect.y, &aRect.x, &aRect.y); +#else + GtkAdjustment* pVAdjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(m_pIconView)); + aRect.y -= pVAdjustment ? gtk_adjustment_get_value(pVAdjustment) : 0; + GtkAdjustment* pHAdjustment = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE(m_pIconView)); + aRect.x -= pHAdjustment ? gtk_adjustment_get_value(pHAdjustment) : 0; #endif return tools::Rectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height); From c68d4501b9607536352e84d36066ec27e9471e7f Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Mon, 2 Dec 2024 16:23:14 +0100 Subject: [PATCH 129/155] Fix typo Change-Id: I8d9daaf14829e20dfd16817dcb7b90c18fb78939 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177703 Tested-by: Jenkins Reviewed-by: Simon Chenery Reviewed-by: Julien Nabet --- cui/source/dialogs/MacroManagerDialog.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cui/source/dialogs/MacroManagerDialog.cxx b/cui/source/dialogs/MacroManagerDialog.cxx index 0d070420fbb1..69b4df1d4489 100644 --- a/cui/source/dialogs/MacroManagerDialog.cxx +++ b/cui/source/dialogs/MacroManagerDialog.cxx @@ -2156,7 +2156,7 @@ OUString MacroManagerDialog::getListOfChildren( return result.makeStringAndClear(); } -// modified verson of void SvxScriptOrgDialog::deleteEntry(const weld::TreeIter& rEntry) +// modified version of void SvxScriptOrgDialog::deleteEntry(const weld::TreeIter& rEntry) // cui/source/dialogs/scriptdlg.cxx void MacroManagerDialog::ScriptingFrameworkScriptsDeleteEntry(weld::TreeView& rTreeView, const weld::TreeIter& rEntry) From 04de71cb67d913866a6377a35fb02ac6debc1e86 Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Mon, 2 Dec 2024 16:23:41 +0100 Subject: [PATCH 130/155] Fix typo Change-Id: Ia445fefad176685a8e4d3f78372b33e219c7832d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177704 Reviewed-by: Julien Nabet Tested-by: Jenkins --- cui/source/dialogs/MacroManagerDialog.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cui/source/dialogs/MacroManagerDialog.cxx b/cui/source/dialogs/MacroManagerDialog.cxx index 69b4df1d4489..a017e4da31fb 100644 --- a/cui/source/dialogs/MacroManagerDialog.cxx +++ b/cui/source/dialogs/MacroManagerDialog.cxx @@ -1153,7 +1153,7 @@ void MacroManagerDialog::CheckButtons() } } - // scripts list box state dependant buttons + // scripts list box state dependent buttons weld::TreeView& rScriptsTreeView = m_xScriptsListBox->get_widget(); std::unique_ptr xScriptsSelectedIter = rScriptsTreeView.make_iterator(); if (rScriptsTreeView.n_children() From bce744550d80b66a6889ebb9dc2814f9644f978e Mon Sep 17 00:00:00 2001 From: Andrea Gelmini Date: Wed, 4 Dec 2024 12:06:40 +0100 Subject: [PATCH 131/155] Fix typo Change-Id: I0b9be4ea10c3837007158771fde46ad70e5c52a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177785 Reviewed-by: Jean-Pierre Ledure Tested-by: Jenkins --- wizards/source/scriptforge/python/scriptforge.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wizards/source/scriptforge/python/scriptforge.pyi b/wizards/source/scriptforge/python/scriptforge.pyi index 1f4bc8f8f5e9..0fe33b7fef46 100644 --- a/wizards/source/scriptforge/python/scriptforge.pyi +++ b/wizards/source/scriptforge/python/scriptforge.pyi @@ -1798,7 +1798,7 @@ class SFScriptForge: ``calcfunction``: the name of the Calc function to be called, in English. ``args``: the arguments to be passed to the called Calc function. Each argument may be either - - a string, a numeric value, a bool or a datatime.datetime instance + - a string, a numeric value, a bool or a datetime.datetime instance - a tuple or a tuple of tuples combining those types - a com.sun.star.table.XCellRange UNO object Returns From acd9e2165c42f0d6977e1ffd883983fe33c5d073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 5 Dec 2024 12:56:34 +0000 Subject: [PATCH 132/155] crashtesting: HLINK embedded null import from ooo98294-1.doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit which causes problems on export to docx. Sanitize at the original import. Change-Id: I3b5521dac6a2b6926db6362d33500b11f0a69098 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177869 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/filter/ww8/ww8par.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 0ed8fcac0ca7..d3118ce913c7 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -217,6 +217,15 @@ namespace } } +// returns true if an embedded null was found +static bool clipToFirstNull(OUString& rStr) +{ + sal_Int32 nEmbeddedNullIdx = rStr.indexOf(0); + if (nEmbeddedNullIdx != -1) + rStr = rStr.copy(0, nEmbeddedNullIdx); + return nEmbeddedNullIdx != -1; +} + void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocShell, struct HyperLinksTable& hlStr) { // (0x01B8) HLINK @@ -348,6 +357,8 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS if (xLongName) { + if (clipToFirstNull(*xLongName)) + SAL_WARN("sw.ww8", "HLINK with embedded null, truncating to: " << *xLongName); if (xTextMark) { if (xLongName->isEmpty()) From 0a535147f9bed7856e7ab3513fe3f6c38549a099 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 21 Nov 2024 08:58:06 +0100 Subject: [PATCH 133/155] cool#9992 doc electronic sign: make return type for .uno:Signature consistent It turns out the majority of getCommandValues() return values specify a commandName and a commandValues key, which is helpful when we don't track the request for this reply. Fix .uno:Signature to do the same for consistency. Change-Id: I46ffe5c36047ef2b59113d0221a1874ba28d335b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177857 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sfx2/qa/cppunit/view.cxx | 13 +++++++++++-- sfx2/source/view/lokhelper.cxx | 5 ++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/sfx2/qa/cppunit/view.cxx b/sfx2/qa/cppunit/view.cxx index d2c81d6e9a6e..8c5be5920a07 100644 --- a/sfx2/qa/cppunit/view.cxx +++ b/sfx2/qa/cppunit/view.cxx @@ -132,8 +132,14 @@ CPPUNIT_TEST_FIXTURE(Sfx2ViewTest, testLokHelperCommandValuesSignature) std::stringstream aStream{ std::string(aJson) }; boost::property_tree::ptree aTree; boost::property_tree::read_json(aStream, aTree); + auto it = aTree.find("commandName"); + CPPUNIT_ASSERT(it != aTree.not_found()); + CPPUNIT_ASSERT_EQUAL(std::string(".uno:Signature"), it->second.get_value()); + it = aTree.find("commandValues"); + CPPUNIT_ASSERT(it != aTree.not_found()); + aTree = it->second; // Non-zero timestamp: - auto it = aTree.find("signatureTime"); + it = aTree.find("signatureTime"); CPPUNIT_ASSERT(it != aTree.not_found()); auto nSignatureTime = it->second.get_value(); CPPUNIT_ASSERT(nSignatureTime != 0); @@ -157,7 +163,10 @@ OUString GetSignatureHash() std::stringstream aStream{ std::string(aJson) }; boost::property_tree::ptree aTree; boost::property_tree::read_json(aStream, aTree); - auto it = aTree.find("digest"); + auto it = aTree.find("commandValues"); + CPPUNIT_ASSERT(it != aTree.not_found()); + aTree = it->second; + it = aTree.find("digest"); CPPUNIT_ASSERT(it != aTree.not_found()); return OUString::fromUtf8(it->second.get_value()); } diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 19891df77ce4..5eec80fba576 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -1030,7 +1030,7 @@ std::map SfxLokHelper::parseCommandParameters(std::u16string void SfxLokHelper::getCommandValues(tools::JsonWriter& rJsonWriter, std::string_view rCommand) { - static constexpr OStringLiteral aSignature(".uno:Signature"); + static constexpr OString aSignature(".uno:Signature"_ostr); if (!o3tl::starts_with(rCommand, aSignature)) { return; @@ -1052,6 +1052,9 @@ void SfxLokHelper::getCommandValues(tools::JsonWriter& rJsonWriter, std::string_ aSigningContext.m_nSignatureTime = it->second.toInt64(); } pObjectShell->SignDocumentContentUsingCertificate(aSigningContext); + // Set commandName, this is a reply to a request. + rJsonWriter.put("commandName", aSignature); + auto aCommandValues = rJsonWriter.startNode("commandValues"); rJsonWriter.put("signatureTime", aSigningContext.m_nSignatureTime); uno::Sequence aDigest(reinterpret_cast(aSigningContext.m_aDigest.data()), From ad5e52d266b95753b3b836c701a079ecc7ba33b4 Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Thu, 5 Dec 2024 11:33:48 +0100 Subject: [PATCH 134/155] Related tdf#164034 - Enable ProtectedSpace by default Make non-breaking space and hypen visible Change-Id: Ibe088c752b9d8378bb167133df3c8fdeacf1f1eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177850 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- officecfg/registry/schema/org/openoffice/Office/Writer.xcs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs index 1ca15926fec9..4265e09f7b8b 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs @@ -1035,7 +1035,7 @@ Specifies whether protected spaces are shown on the screen. - false + true From eea90af52e744d64c3d6ffd49c8859572450aed4 Mon Sep 17 00:00:00 2001 From: Avramoniu Calin Date: Wed, 27 Nov 2024 11:16:04 +0200 Subject: [PATCH 135/155] tdf#163419 Save import dialog window size and skip resizing separator options Signed-off-by: Avramoniu Calin Change-Id: Ib894b61edc15d4a89e7a83bb990a2819084879f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177397 Reviewed-by: Heiko Tietze Tested-by: Jenkins --- sc/source/ui/dbgui/scuiasciiopt.cxx | 7 ++++++ sc/uiconfig/scalc/ui/textimportcsv.ui | 31 ++++++++++++++------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index b35cf24ba7fb..c44bf2ad222d 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -43,6 +43,7 @@ #include #include #include +#include //! TODO make dynamic const SCSIZE ASCIIDLG_MAXROWS = MAXROWCOUNT; @@ -373,6 +374,10 @@ ScImportAsciiDlg::ScImportAsciiDlg(weld::Window* pParent, std::u16string_view aD , mxAltTitle(m_xBuilder->weld_label(u"textalttitle"_ustr)) , mxTableBox(new ScCsvTableBox(*m_xBuilder)) { + SvtViewOptions aDlgOpt(EViewType::Dialog, "TextImportCsvDialog"); + if (aDlgOpt.Exists()) + m_xDialog->set_window_state(aDlgOpt.GetWindowState()); + OUString aName = m_xDialog->get_title(); switch (meCall) { @@ -591,6 +596,8 @@ IMPL_STATIC_LINK_NOARG(ScImportAsciiDlg, InstallLOKNotifierHdl, void*, vcl::ILib ScImportAsciiDlg::~ScImportAsciiDlg() { + SvtViewOptions aDlgOpt(EViewType::Dialog, "TextImportCsvDialog"); + aDlgOpt.SetWindowState(m_xDialog->get_window_state(vcl::WindowDataMask::PosSize)); } bool ScImportAsciiDlg::GetLine( sal_uLong nLine, OUString &rText, sal_Unicode& rcDetectSep ) diff --git a/sc/uiconfig/scalc/ui/textimportcsv.ui b/sc/uiconfig/scalc/ui/textimportcsv.ui index 0f841c5e4910..943cfcc6415c 100644 --- a/sc/uiconfig/scalc/ui/textimportcsv.ui +++ b/sc/uiconfig/scalc/ui/textimportcsv.ui @@ -238,7 +238,7 @@ True False - True + False 0 none @@ -247,15 +247,16 @@ False 12 6 - True + False vertical 6 True False - True - True + False + False + 12 _Fixed width @@ -332,7 +333,7 @@ True False 12 - True + False 6 12 @@ -341,7 +342,7 @@ True True False - True + False True True @@ -362,7 +363,7 @@ True False start - True + False True True @@ -384,7 +385,7 @@ True False start - True + False True True @@ -405,7 +406,7 @@ True True False - True + False True True @@ -425,7 +426,7 @@ True True False - True + False True True @@ -445,7 +446,7 @@ True True False - True + False True True @@ -464,7 +465,7 @@ True False - True + False 12 @@ -492,7 +493,7 @@ True True - True + False 10 True 3 @@ -523,7 +524,7 @@ True False - True + False 12 @@ -543,7 +544,7 @@ True False - True + False True From c9763a9f160bd0e91a19cfb681556f49a28cbac5 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Thu, 21 Nov 2024 20:11:18 +0530 Subject: [PATCH 136/155] LOK: don't recreate the dialogs of an old view when loading new views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit follow up for f5ebf512ccd3d5ae3af5fe706b411a85fa19182d now same actions are performed on all the dialogs Change-Id: I6531a766327dda106770a2c513ebd492dea7c655 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176933 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara Tested-by: Jenkins CollaboraOffice (cherry picked from commit 2fba6df7242586870988b62909156538b42c2bc0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177892 Tested-by: Jenkins --- include/sfx2/childwin.hxx | 3 +++ sc/source/ui/app/scdll.cxx | 4 +--- sc/source/ui/view/tabvwshc.cxx | 2 +- sd/source/ui/app/sddll.cxx | 4 +--- sw/source/uibase/app/swmodule.cxx | 4 +--- test/source/lokcallback.cxx | 1 + 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index ff12fe30b3d0..216b101923d4 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -29,6 +29,7 @@ #include #include +#include namespace com::sun::star::frame { class XFrame; } @@ -184,6 +185,8 @@ const int nCloseResponseToJustHide = -42; { \ SfxChildWinFactory aFact( \ Class::CreateImpl, MyID, Pos ); \ + if (comphelper::LibreOfficeKit::isActive() && nFlags == SfxChildWindowFlags::NONE) \ + nFlags |= SfxChildWindowFlags::NEVERCLONE; \ aFact.aInfo.nFlags |= nFlags; \ aFact.aInfo.bVisible = bVis; \ SfxChildWindow::RegisterChildWindow(pMod, aFact); \ diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index c08e6a47c5f8..f581ad886bfd 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -223,9 +223,7 @@ void ScDLL::Init() SvxHlinkDlgWrapper ::RegisterChildWindow(false, pMod); SvxFontWorkChildWindow ::RegisterChildWindow(false, pMod); SvxIMapDlgChildWindow ::RegisterChildWindow(false, pMod); - ScSpellDialogChildWindow::RegisterChildWindow( - false, pMod, comphelper::LibreOfficeKit::isActive() ? SfxChildWindowFlags::NEVERCLONE - : SfxChildWindowFlags::NONE); + ScSpellDialogChildWindow ::RegisterChildWindow(false, pMod); ScValidityRefChildWin::RegisterChildWindow(false, pMod); sc::SearchResultsDlgWrapper::RegisterChildWindow(false, pMod); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 4cf74a88295b..8fc9fb1276cf 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -128,7 +128,7 @@ std::shared_ptr ScTabViewShell::CreateRefDialogCont if ( nCurRefDlgId != nSlotId ) { - if (!(comphelper::LibreOfficeKit::isActive() && nSlotId == SID_OPENDLG_FUNCTION)) + if (!comphelper::LibreOfficeKit::isActive()) { // the dialog has been opened in a different view // -> lock the dispatcher for this view (modal mode) diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx index 78646f8c049e..07a043c0828e 100644 --- a/sd/source/ui/app/sddll.cxx +++ b/sd/source/ui/app/sddll.cxx @@ -172,9 +172,7 @@ void SdDLL::RegisterControllers(SdModule* pMod) SvxBmpMaskChildWindow::RegisterChildWindow(false, pMod); SvxIMapDlgChildWindow::RegisterChildWindow(false, pMod); SvxHlinkDlgWrapper::RegisterChildWindow(false, pMod); - ::sd::SpellDialogChildWindow::RegisterChildWindow( - false, pMod, comphelper::LibreOfficeKit::isActive() ? SfxChildWindowFlags::NEVERCLONE - : SfxChildWindowFlags::NONE); + ::sd::SpellDialogChildWindow::RegisterChildWindow(false, pMod); #if HAVE_FEATURE_AVMEDIA ::avmedia::MediaPlayer::RegisterChildWindow(false, pMod); #endif diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index 98d4364fcdd9..ef814781bdd8 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -312,9 +312,7 @@ void SwDLL::RegisterControls() SwInsertAuthMarkWrapper::RegisterChildWindow( false, pMod ); SwWordCountWrapper::RegisterChildWindow( false, pMod ); SvxRubyChildWindow::RegisterChildWindow( false, pMod); - SwSpellDialogChildWindow::RegisterChildWindow( - false, pMod, comphelper::LibreOfficeKit::isActive() ? SfxChildWindowFlags::NEVERCLONE - : SfxChildWindowFlags::NONE); + SwSpellDialogChildWindow::RegisterChildWindow(false, pMod); DevelopmentToolChildWindow::RegisterChildWindow(false, pMod); SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod ); diff --git a/test/source/lokcallback.cxx b/test/source/lokcallback.cxx index 0914ea4db73c..0fb3cefef214 100644 --- a/test/source/lokcallback.cxx +++ b/test/source/lokcallback.cxx @@ -197,6 +197,7 @@ SfxChildWindow* TestLokCallbackWrapper::InitializeSidebar() assert(pViewShell); SfxViewFrame& rViewFrame = pViewShell->GetViewFrame(); + rViewFrame.ShowChildWindow(SID_SIDEBAR); SfxChildWindow* pSideBar = rViewFrame.GetChildWindow(SID_SIDEBAR); assert(pSideBar); From 0e88a69ff0e23b85b19e9566a7daba120796ad4f Mon Sep 17 00:00:00 2001 From: Mike Saunders Date: Thu, 5 Dec 2024 12:05:59 +0100 Subject: [PATCH 137/155] Change infobar donate message after discussions in Marketing Telegram group. Change-Id: Ib0ab77fafde0a7a5abc719a7eec9ef32615f15c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177853 Tested-by: Ilmari Lauhakangas Reviewed-by: Heiko Tietze Reviewed-by: Ilmari Lauhakangas --- include/sfx2/strings.hrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc index d44b05bd2049..dac3a61d6bb9 100644 --- a/include/sfx2/strings.hrc +++ b/include/sfx2/strings.hrc @@ -259,7 +259,7 @@ #define STR_NONCHECKEDOUT_DOCUMENT NC_("STR_NONCHECKEDOUT_DOCUMENT", "This document is not checked out on the server.") #define STR_GET_INVOLVED_TEXT NC_("STR_GET_INVOLVED_TEXT", "Help us make %PRODUCTNAME even better!") #define STR_GET_INVOLVED_BUTTON NC_("STR_GET_INVOLVED_BUTTON", "Get involved") -#define STR_DONATE_TEXT NC_("STR_DONATE_TEXT", "Your donations support our worldwide community.") +#define STR_DONATE_TEXT NC_("STR_DONATE_TEXT", "Support the development of %PRODUCTNAME.") // Translators: text will be abbreviated at >8 characters, eg. "Please D..." #define STR_DONATE_BUTTON NC_("STR_DONATE_BUTTON", "Donate") #define STR_WHATSNEW_TEXT NC_("STR_WHATSNEW", "You are running version %PRODUCTVERSION of %PRODUCTNAME for the first time. Do you want to learn what's new?") From ab38826d9005d206600bfc94d6b7b4986480ecce Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 10:20:14 +0100 Subject: [PATCH 138/155] vcl a11y: Use comphelper::disposeComponent Change-Id: Ifc63db272484e9a7986e6113989f2f6274f40349 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177846 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menu.cxx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index 581279acd8bf..a8c460629dd4 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -199,12 +200,7 @@ void Menu::dispose() } // dispose accessible components - if ( mxAccessible.is() ) - { - css::uno::Reference< css::lang::XComponent> xComponent( mxAccessible, css::uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } + comphelper::disposeComponent(mxAccessible); if ( nEventId ) Application::RemoveUserEvent( nEventId ); From 8a762c35ea517c1ac24d7ca20e190144d5413e71 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 10:28:17 +0100 Subject: [PATCH 139/155] a11y: Update comment wrt reference being (not) weak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was using a weak reference when the comment was added in commit 9b34eb7c8512ebc2a7788692a0c826d4e384d460 Author: Frank Schönheit Date: Thu Apr 25 10:24:33 2002 +0000 #98750# be an XEventListener at the AccessibleContext , but later changed to be a hard reference in commit 23d689d4e43986c10372da0dd756dbcecd82beb8 Author: Thomas Benisch Date: Thu Nov 7 16:19:24 2002 +0000 #103674# change the reference to the accessible context from weak to hard . Unfortunately that commit only references a StarDivision internal ticket, so the exact reason remains unclear, but at least update the comment. Change-Id: Icdc9aec97647ae05ae7fb3f2bdc1be43c3a62619 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177848 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- toolkit/source/awt/vclxwindow.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 7dff40ed4763..ed9e80e506fe 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -2418,8 +2418,7 @@ css::uno::Reference< css::accessibility::XAccessibleContext > VCLXWindow::getAcc mpImpl->mxAccessibleContext = CreateAccessibleContext(); // add as event listener to this component - // in case somebody disposes it, we do not want to have a (though weak) reference to a dead - // object + // in case somebody disposes it, we do not want to have a reference to a dead object uno::Reference< lang::XComponent > xComp( mpImpl->mxAccessibleContext, uno::UNO_QUERY ); if ( xComp.is() ) xComp->addEventListener( this ); From d1c40cfda530cc249ba1daa0bbb8dc71ffbc2d46 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 09:39:56 +0000 Subject: [PATCH 140/155] wina11y: Make these 2 methods non-virtual Change-Id: I791ec6d822573e18c981343d3ce8371acf0b3b38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177878 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- winaccessibility/inc/AccTopWindowListener.hxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/winaccessibility/inc/AccTopWindowListener.hxx b/winaccessibility/inc/AccTopWindowListener.hxx index d48ad035dd6a..9d8b46f95acc 100644 --- a/winaccessibility/inc/AccTopWindowListener.hxx +++ b/winaccessibility/inc/AccTopWindowListener.hxx @@ -55,10 +55,10 @@ public: // XEventListener virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; - virtual void AddAllListeners(css::accessibility::XAccessible* pAccessible, - css::accessibility::XAccessible* pParentXAcc, HWND pWND); + void AddAllListeners(css::accessibility::XAccessible* pAccessible, + css::accessibility::XAccessible* pParentXAcc, HWND pWND); //for On-Demand load. - virtual void HandleWindowOpened(css::accessibility::XAccessible* pAccessible); + void HandleWindowOpened(css::accessibility::XAccessible* pAccessible); sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam); }; From 5ce6b81d4dc599ed4470f164b221eeefd07f7fba Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 09:57:31 +0000 Subject: [PATCH 141/155] wina11y: Drop unnecessary cast to sal_uInt16 Application::GetTopWindow also takes a tools::Long param, so there's no reason to cast to sal_uInt16. Change-Id: Ic592262bee8173329986ccb83298a26deb3586b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177879 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- winaccessibility/source/service/msaaservice_impl.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx index 3891b6df4872..e858d2b367be 100644 --- a/winaccessibility/source/service/msaaservice_impl.cxx +++ b/winaccessibility/source/service/msaaservice_impl.cxx @@ -210,9 +210,8 @@ static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService > &xA */ static void AccessBridgeUpdateOldTopWindows( const Reference< XMSAAService > &xAccMgr ) { - sal_uInt16 nTopWindowCount = static_cast(Application::GetTopWindowCount()); - - for ( sal_uInt16 i = 0; i < nTopWindowCount; i++ ) + tools::Long nTopWindowCount = Application::GetTopWindowCount(); + for (tools::Long i = 0; i < nTopWindowCount; i++) { vcl::Window* pTopWindow = Application::GetTopWindow( i ); css::uno::Reference< css::accessibility::XAccessible > xAccessible = pTopWindow->GetAccessible(); From db366ebcde00ead8d2a37589c147bd867ed6e455 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 10:04:52 +0000 Subject: [PATCH 142/155] wina11y: Replace condition by by assert in AccessBridgeHandleExistingWindow The method only gets called from AccessBridgeUpdateOldTopWindows which always passes a non-null window. Change-Id: I7d6d4effb75c722af6176257b8f296b5a77734cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177880 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- .../source/service/msaaservice_impl.cxx | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx index e858d2b367be..8f60decddf1c 100644 --- a/winaccessibility/source/service/msaaservice_impl.cxx +++ b/winaccessibility/source/service/msaaservice_impl.cxx @@ -142,67 +142,67 @@ Sequence< OUString > MSAAServiceImpl::getSupportedServiceNames() static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService > &xAccMgr, vcl::Window *pWindow, bool bShow) { - if ( pWindow ) + assert(pWindow); + + css::uno::Reference xAccessible; + + SAL_INFO("iacc2", "Decide whether to register existing window with IAccessible2"); + + // Test for combo box - drop down floating windows first + vcl::Window* pParentWindow = pWindow->GetParent(); + + if (pParentWindow) { - css::uno::Reference< css::accessibility::XAccessible > xAccessible; - - SAL_INFO( "iacc2", "Decide whether to register existing window with IAccessible2" ); - - // Test for combo box - drop down floating windows first - vcl::Window * pParentWindow = pWindow->GetParent(); - - if ( pParentWindow ) + try { - try + // The parent window of a combo box floating window should have the role COMBO_BOX + css::uno::Reference xParentAccessible(pParentWindow->GetAccessible()); + if (xParentAccessible.is()) { - // The parent window of a combo box floating window should have the role COMBO_BOX - css::uno::Reference< css::accessibility::XAccessible > xParentAccessible(pParentWindow->GetAccessible()); - if ( xParentAccessible.is() ) + css::uno::Reference xParentAC(xParentAccessible->getAccessibleContext()); + if (xParentAC.is() + && (css::accessibility::AccessibleRole::COMBO_BOX + == xParentAC->getAccessibleRole())) { - css::uno::Reference< css::accessibility::XAccessibleContext > xParentAC( xParentAccessible->getAccessibleContext() ); - if ( xParentAC.is() && (css::accessibility::AccessibleRole::COMBO_BOX == xParentAC->getAccessibleRole()) ) + // O.k. - this is a combo box floating window corresponding to the child of role LIST of the parent. + // Let's not rely on a specific child order, just search for the child with the role LIST + sal_Int64 nCount = xParentAC->getAccessibleChildCount(); + for (sal_Int64 n = 0; (n < nCount) && !xAccessible.is(); n++) { - // O.k. - this is a combo box floating window corresponding to the child of role LIST of the parent. - // Let's not rely on a specific child order, just search for the child with the role LIST - sal_Int64 nCount = xParentAC->getAccessibleChildCount(); - for (sal_Int64 n = 0; (n < nCount) && !xAccessible.is(); n++) + css::uno::Reference xChild = xParentAC->getAccessibleChild(n); + if (xChild.is()) { - css::uno::Reference< css::accessibility::XAccessible > xChild = xParentAC->getAccessibleChild(n); - if ( xChild.is() ) + css::uno::Reference xChildAC = xChild->getAccessibleContext(); + if (xChildAC.is() && (css::accessibility::AccessibleRole::LIST == xChildAC->getAccessibleRole())) { - css::uno::Reference< css::accessibility::XAccessibleContext > xChildAC = xChild->getAccessibleContext(); - if ( xChildAC.is() && (css::accessibility::AccessibleRole::LIST == xChildAC->getAccessibleRole()) ) - { - xAccessible = xChild; - } + xAccessible = xChild; } } } } } - catch (css::uno::RuntimeException const&) - { - // Ignore show events that throw DisposedExceptions in getAccessibleContext(), - // but keep revoking these windows in hide(s). - if (bShow) - return; - } } - - // We have to rely on the fact that Window::GetAccessible()->getAccessibleContext() returns a valid XAccessibleContext - // also for other menus than menubar or toplevel popup window. Otherwise we had to traverse the hierarchy to find the - // context object to this menu floater. This makes the call to Window->IsMenuFloatingWindow() obsolete. - if ( ! xAccessible.is() ) - xAccessible = pWindow->GetAccessible(); - - assert( xAccMgr.is() ); - if ( xAccessible.is() ) + catch (css::uno::RuntimeException const&) { - xAccMgr->handleWindowOpened( - reinterpret_cast(xAccessible.get())); - SAL_INFO( "iacc2", "Decide whether to register existing window with IAccessible2" ); + // Ignore show events that throw DisposedExceptions in getAccessibleContext(), + // but keep revoking these windows in hide(s). + if (bShow) + return; } } + + // We have to rely on the fact that Window::GetAccessible()->getAccessibleContext() returns a valid XAccessibleContext + // also for other menus than menubar or toplevel popup window. Otherwise we had to traverse the hierarchy to find the + // context object to this menu floater. This makes the call to Window->IsMenuFloatingWindow() obsolete. + if (!xAccessible.is()) + xAccessible = pWindow->GetAccessible(); + + assert(xAccMgr.is()); + if (xAccessible.is()) + { + xAccMgr->handleWindowOpened(reinterpret_cast(xAccessible.get())); + SAL_INFO("iacc2", "Decide whether to register existing window with IAccessible2"); + } } /* From 9084c484c0596dc1dc17eef0247bd2475e060d4a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 10:09:37 +0000 Subject: [PATCH 143/155] wina11y: Drop always true bShow param Change-Id: I794e486b3e5e7d341a05cec20cc218dd2cd7e242 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177881 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- winaccessibility/source/service/msaaservice_impl.cxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx index 8f60decddf1c..43b0b49d8c6b 100644 --- a/winaccessibility/source/service/msaaservice_impl.cxx +++ b/winaccessibility/source/service/msaaservice_impl.cxx @@ -139,8 +139,8 @@ Sequence< OUString > MSAAServiceImpl::getSupportedServiceNames() return { "com.sun.star.accessibility.MSAAService" }; } -static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService > &xAccMgr, - vcl::Window *pWindow, bool bShow) +static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService>& xAccMgr, + vcl::Window* pWindow) { assert(pWindow); @@ -184,10 +184,8 @@ static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService > &xA } catch (css::uno::RuntimeException const&) { - // Ignore show events that throw DisposedExceptions in getAccessibleContext(), - // but keep revoking these windows in hide(s). - if (bShow) - return; + // Ignore show events that throw DisposedExceptions in getAccessibleContext() + return; } } @@ -221,7 +219,7 @@ static void AccessBridgeUpdateOldTopWindows( const Reference< XMSAAService > &xA if ( xAC.is()) { if ( !xAC->getAccessibleName().isEmpty() ) - AccessBridgeHandleExistingWindow( xAccMgr, pTopWindow, true ); + AccessBridgeHandleExistingWindow(xAccMgr, pTopWindow); } } } From 13a9a236adae972f360753a399bc47fda34a51d4 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 10:23:03 +0000 Subject: [PATCH 144/155] wina11y: Drop special combobox handling in AccessBridgeHandleExistingWindow It's unclear to me why the list child's accessible should be passed instead of the window's here. In addition, AccessBridgeHandleExistingWindow is only relevant when the AT brigde is started, i.e. for example when starting a screen reader while LO has been running already. This makes this look even less relevant and unclear to me why special handling would be applied for that case, but not when a combobox popup is shown when a11y has been active before already. Change-Id: Ie7b16de36889e2432f6ac9455ab297ca16d3b26e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177882 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- .../source/service/msaaservice_impl.cxx | 48 +------------------ 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx index 43b0b49d8c6b..955d30560c6c 100644 --- a/winaccessibility/source/service/msaaservice_impl.cxx +++ b/winaccessibility/source/service/msaaservice_impl.cxx @@ -144,56 +144,10 @@ static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService>& xAc { assert(pWindow); - css::uno::Reference xAccessible; - - SAL_INFO("iacc2", "Decide whether to register existing window with IAccessible2"); - - // Test for combo box - drop down floating windows first - vcl::Window* pParentWindow = pWindow->GetParent(); - - if (pParentWindow) - { - try - { - // The parent window of a combo box floating window should have the role COMBO_BOX - css::uno::Reference xParentAccessible(pParentWindow->GetAccessible()); - if (xParentAccessible.is()) - { - css::uno::Reference xParentAC(xParentAccessible->getAccessibleContext()); - if (xParentAC.is() - && (css::accessibility::AccessibleRole::COMBO_BOX - == xParentAC->getAccessibleRole())) - { - // O.k. - this is a combo box floating window corresponding to the child of role LIST of the parent. - // Let's not rely on a specific child order, just search for the child with the role LIST - sal_Int64 nCount = xParentAC->getAccessibleChildCount(); - for (sal_Int64 n = 0; (n < nCount) && !xAccessible.is(); n++) - { - css::uno::Reference xChild = xParentAC->getAccessibleChild(n); - if (xChild.is()) - { - css::uno::Reference xChildAC = xChild->getAccessibleContext(); - if (xChildAC.is() && (css::accessibility::AccessibleRole::LIST == xChildAC->getAccessibleRole())) - { - xAccessible = xChild; - } - } - } - } - } - } - catch (css::uno::RuntimeException const&) - { - // Ignore show events that throw DisposedExceptions in getAccessibleContext() - return; - } - } - // We have to rely on the fact that Window::GetAccessible()->getAccessibleContext() returns a valid XAccessibleContext // also for other menus than menubar or toplevel popup window. Otherwise we had to traverse the hierarchy to find the // context object to this menu floater. This makes the call to Window->IsMenuFloatingWindow() obsolete. - if (!xAccessible.is()) - xAccessible = pWindow->GetAccessible(); + css::uno::Reference xAccessible = pWindow->GetAccessible(); assert(xAccMgr.is()); if (xAccessible.is()) From 6708246e20ce522e673f539369cd38687d2dd16d Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 11:06:48 +0000 Subject: [PATCH 145/155] tdf#164093 tdf#157001 a11y: Improve menu window disposal In MenuFloatingWindow::dispose, unset the accessible before calling the base class implementation, to prevent the accessible from getting disposed there as well. This is necessary because the MenuFloatingWindow doesn't create (and therefore own) its accessible object, but returns that from its menu in MenuFloatingWindow::CreateAccessible. Therefore, the PopupMenu as the owner is responsible for disposing the accessible as well, not the MenuFloatingWindow. This logic was already implemented in Menu::dispose, but that doesn't help in cases where the MenuFloatingWindow gets disposed independently. In Menu::dispose, drop the extra logic and just call `m_pWindow.disposeAndClear` so that MenuFloatingWindow::dispose can take care of everything that's needed. (For the MenuBar case, MenuBar::dispose calls MenuBar::ImplDestroy, which unsets Menu::m_pWindow, so other than for PopupMenu, this change to MenuBar::ImplDestroy method doesn't make a difference for that class.) Don't dispose the current Menu::m_pWindow in PopupMenu::FinishRun, but instead in PopupMenu::ImplExecute (if set) before assigning a new one, to ensure that the old one gets disposed. Drop the SAL_WARN_IF(GetWindow(), "vcl", "Win?!"); because that case is handled fine now. Without this change in place, I saw that warning getting triggered while debugging (potentially because PopupMenu::FinishRun never got reached as the menu didn't show, maybe due to switching focus to the IDE when reaching a breakpoint or different timing,...). This commit by itself doesn't yet fix the crash from tdf#164093 seen on Windows with NVDA running because the menu's accessible still incorrectly gets disposed by the MenuFloatingWindow's VCLXWindow (toolkit window peer). That will be addressed in a separate commit. Change-Id: Ia2931bee23204395e8b3396927acf4fa1d0f077c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177883 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/source/window/menu.cxx | 14 +++----------- vcl/source/window/menufloatingwindow.cxx | 5 +++++ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index a8c460629dd4..12c4490aa9df 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -189,15 +189,7 @@ void Menu::dispose() { ImplCallEventListeners( VclEventId::ObjectDying, ITEMPOS_INVALID ); - // at the window free the reference to the accessible component - // and make sure the MenuFloatingWindow knows about our destruction - if (m_pWindow) - { - MenuFloatingWindow* pFloat = static_cast(m_pWindow.get()); - if( pFloat->pMenu.get() == this ) - pFloat->pMenu.clear(); - m_pWindow->SetAccessible( css::uno::Reference< css::accessibility::XAccessible >() ); - } + m_pWindow.disposeAndClear(); // dispose accessible components comphelper::disposeComponent(mxAccessible); @@ -2890,7 +2882,6 @@ sal_uInt16 PopupMenu::ImplExecute(const VclPtr& pParentWin, const t | FloatWinPopupEndFlags::CloseAll); } - SAL_WARN_IF(GetWindow(), "vcl", "Win?!"); tools::Rectangle aRect(rRect); aRect.SetPos(pParentWin->OutputToScreenPixel(aRect.TopLeft())); @@ -2951,6 +2942,8 @@ sal_uInt16 PopupMenu::ImplExecute(const VclPtr& pParentWin, const t pWin->SetBorderStyle( WindowBorderStyle::NOBORDER ); else pWin->SetBorderStyle( pWin->GetBorderStyle() | WindowBorderStyle::MENU ); + + m_pWindow.disposeAndClear(); m_pWindow = pWin; Size aSz = ImplCalcSize( pWin ); @@ -3084,7 +3077,6 @@ void PopupMenu::FinishRun(const VclPtr& pWin, const VclPtrStopExecute(); pWin->doShutdown(); - m_pWindow.disposeAndClear(); ImplClosePopupToolBox(pParentWin); ImplFlushPendingSelect(); } diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 8beb36be0760..d49469a7ab2c 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -125,6 +125,11 @@ void MenuFloatingWindow::dispose() pMenu.clear(); pActivePopup.clear(); xSaveFocusId.clear(); + + // unset accessible taken from the PopupMenu (s. CreateAccessible), + // it is owned and therefore disposed by the PopupMenu + SetAccessible(nullptr); + FloatingWindow::dispose(); } From 070b198961977ec0a3197d1ac85aa065b62c432c Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 11:42:25 +0000 Subject: [PATCH 146/155] wina11y: Drop duplicate variable + check No need to have `pAccessibleContext` as a raw pointer, just use the `xContext`. And that one has already been checked for being a non-empty Reference above. Change-Id: I15d7e70ddbc8b260e5e1bc0eb4e190c54d6a2ea2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177884 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- winaccessibility/source/service/AccTopWindowListener.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx index 3d51db848ece..40d9ba8755c1 100644 --- a/winaccessibility/source/service/AccTopWindowListener.cxx +++ b/winaccessibility/source/service/AccTopWindowListener.cxx @@ -61,9 +61,8 @@ void AccTopWindowListener::HandleWindowOpened( css::accessibility::XAccessible* if(!xContext.is()) return; - css::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); - //Only AccessibleContext exist, add all listeners - if(pAccessibleContext != nullptr && systemdata != nullptr) + // add all listeners + if (systemdata != nullptr) { m_aAccObjectManager.SaveTopWindowHandle(systemdata->hWnd, pAccessible); @@ -72,7 +71,7 @@ void AccTopWindowListener::HandleWindowOpened( css::accessibility::XAccessible* if( window->GetStyle() & WB_MOVEABLE ) m_aAccObjectManager.IncreaseState( pAccessible, static_cast(-1) /* U_MOVEBLE */ ); - short role = pAccessibleContext->getAccessibleRole(); + short role = xContext->getAccessibleRole(); if (role == css::accessibility::AccessibleRole::POPUP_MENU || role == css::accessibility::AccessibleRole::MENU ) From 4453b2f65b13d6b7c11344f89695a2a01aaf955d Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 12:58:37 +0100 Subject: [PATCH 147/155] vcl: Return reference in SalObject::GetSystemData ... instead of a pointer, to make clear that this is always non-null. Change-Id: Ic0f92e672b08494cf3bfaa9a956cb78170bc1ad5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177885 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/headless/svpdummies.cxx | 2 +- vcl/inc/headless/svpdummies.hxx | 2 +- vcl/inc/osx/salobj.h | 2 +- vcl/inc/qt5/QtObject.hxx | 2 +- vcl/inc/salobj.hxx | 2 +- vcl/inc/unx/gtk/gtkobject.hxx | 2 +- vcl/inc/unx/salobj.h | 2 +- vcl/inc/win/salobj.h | 2 +- vcl/osx/salobj.cxx | 4 ++-- vcl/source/window/syschild.cxx | 2 +- vcl/unx/generic/window/salobj.cxx | 18 +++++++++--------- vcl/unx/gtk3/gtkobject.cxx | 4 ++-- vcl/win/window/salobj.cxx | 4 ++-- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/vcl/headless/svpdummies.cxx b/vcl/headless/svpdummies.cxx index b0dd9c9438d4..cc12639d61fa 100644 --- a/vcl/headless/svpdummies.cxx +++ b/vcl/headless/svpdummies.cxx @@ -29,7 +29,7 @@ void SvpSalObject::UnionClipRegion( tools::Long, tools::Long, tools::Long, tools void SvpSalObject::EndSetClipRegion() {} void SvpSalObject::SetPosSize( tools::Long, tools::Long, tools::Long, tools::Long ) {} void SvpSalObject::Show( bool ) {} -const SystemEnvData* SvpSalObject::GetSystemData() const { return &m_aSystemChildData; } +const SystemEnvData& SvpSalObject::GetSystemData() const { return m_aSystemChildData; } // SalSystem SvpSalSystem::~SvpSalSystem() {} diff --git a/vcl/inc/headless/svpdummies.hxx b/vcl/inc/headless/svpdummies.hxx index 92958f8d5529..1049637a5de3 100644 --- a/vcl/inc/headless/svpdummies.hxx +++ b/vcl/inc/headless/svpdummies.hxx @@ -42,7 +42,7 @@ public: virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; virtual void Show( bool bVisible ) override; - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; }; class SvpSalSystem : public SalGenericSystem diff --git a/vcl/inc/osx/salobj.h b/vcl/inc/osx/salobj.h index 4c2ac88be6c1..0fc41c02d4c9 100644 --- a/vcl/inc/osx/salobj.h +++ b/vcl/inc/osx/salobj.h @@ -63,7 +63,7 @@ public: virtual void EndSetClipRegion() override; virtual void SetPosSize( tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight ) override; virtual void Show( bool bVisible ) override; - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; }; #endif // INCLUDED_VCL_INC_OSX_SALOBJ_H diff --git a/vcl/inc/qt5/QtObject.hxx b/vcl/inc/qt5/QtObject.hxx index 4a8d194a8435..68749129079f 100644 --- a/vcl/inc/qt5/QtObject.hxx +++ b/vcl/inc/qt5/QtObject.hxx @@ -66,7 +66,7 @@ public: virtual void SetForwardKey(bool bEnable) override; - virtual const SystemEnvData* GetSystemData() const override { return &m_aSystemData; } + virtual const SystemEnvData& GetSystemData() const override { return m_aSystemData; } virtual void Reparent(SalFrame* pFrame) override; }; diff --git a/vcl/inc/salobj.hxx b/vcl/inc/salobj.hxx index b5d9d64f82e4..c736957d3eeb 100644 --- a/vcl/inc/salobj.hxx +++ b/vcl/inc/salobj.hxx @@ -54,7 +54,7 @@ public: virtual void SetLeaveEnterBackgrounds(const css::uno::Sequence& /*rLeaveArgs*/, const css::uno::Sequence& /*rEnterArgs*/) {} - virtual const SystemEnvData* GetSystemData() const = 0; + virtual const SystemEnvData& GetSystemData() const = 0; virtual Size GetOptimalSize() const { return Size(); } diff --git a/vcl/inc/unx/gtk/gtkobject.hxx b/vcl/inc/unx/gtk/gtkobject.hxx index 63544f56f882..dc79de17c02d 100644 --- a/vcl/inc/unx/gtk/gtkobject.hxx +++ b/vcl/inc/unx/gtk/gtkobject.hxx @@ -43,7 +43,7 @@ public: virtual void SetForwardKey( bool bEnable ) override; - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; virtual Size GetOptimalSize() const override; diff --git a/vcl/inc/unx/salobj.h b/vcl/inc/unx/salobj.h index f14af351ebf9..2920d81ef693 100644 --- a/vcl/inc/unx/salobj.h +++ b/vcl/inc/unx/salobj.h @@ -81,7 +81,7 @@ public: virtual void SetLeaveEnterBackgrounds(const css::uno::Sequence& rLeaveArgs, const css::uno::Sequence& rEnterArgs) override; - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/win/salobj.h b/vcl/inc/win/salobj.h index 37bcf0317866..09a6b4ed182b 100644 --- a/vcl/inc/win/salobj.h +++ b/vcl/inc/win/salobj.h @@ -46,7 +46,7 @@ public: virtual void Show( bool bVisible ) override; virtual void Enable( bool bEnable ) override; virtual void GrabFocus() override; - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/osx/salobj.cxx b/vcl/osx/salobj.cxx index 6cf114f20c1b..43ce0521080f 100644 --- a/vcl/osx/salobj.cxx +++ b/vcl/osx/salobj.cxx @@ -284,9 +284,9 @@ void AquaSalObject::Show( bool bVisible ) [mpClipView setHidden: (bVisible ? NO : YES)]; } -const SystemEnvData* AquaSalObject::GetSystemData() const +const SystemEnvData& AquaSalObject::GetSystemData() const { - return &maSysData; + return maSysData; } namespace { diff --git a/vcl/source/window/syschild.cxx b/vcl/source/window/syschild.cxx index 644aa1f095f2..c03df17ba1d5 100644 --- a/vcl/source/window/syschild.cxx +++ b/vcl/source/window/syschild.cxx @@ -130,7 +130,7 @@ void SystemChildWindow::dispose() const SystemEnvData* SystemChildWindow::GetSystemData() const { if ( mpWindowImpl->mpSysObj ) - return mpWindowImpl->mpSysObj->GetSystemData(); + return &mpWindowImpl->mpSysObj->GetSystemData(); else return nullptr; } diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index e2571c7911a2..50090f053825 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -48,10 +48,10 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p { int error_base, event_base; X11SalObject* pObject = new X11SalObject(); - SystemEnvData* pObjData = const_cast(pObject->GetSystemData()); + SystemEnvData& rObjData = const_cast(pObject->GetSystemData()); - if ( ! XShapeQueryExtension( static_cast(pObjData->pDisplay), - &event_base, &error_base ) ) + if (!XShapeQueryExtension(static_cast(rObjData.pDisplay), + &event_base, &error_base)) { delete pObject; return nullptr; @@ -156,10 +156,10 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p XMapWindow( pDisp, pObject->maPrimary ); } - pObjData->pDisplay = pDisp; - pObjData->SetWindowHandle(pObject->maSecondary); - pObjData->pWidget = nullptr; - pObjData->pVisual = pVisual; + rObjData.pDisplay = pDisp; + rObjData.SetWindowHandle(pObject->maSecondary); + rObjData.pWidget = nullptr; + rObjData.pVisual = pVisual; XSync(pDisp, False); if( GetGenericUnixSalData()->ErrorTrapPop( false ) ) @@ -358,9 +358,9 @@ void X11SalObject::GrabFocus() CurrentTime ); } -const SystemEnvData* X11SalObject::GetSystemData() const +const SystemEnvData& X11SalObject::GetSystemData() const { - return &maSystemChildData; + return maSystemChildData; } static sal_uInt16 sal_GetCode( int state ) diff --git a/vcl/unx/gtk3/gtkobject.cxx b/vcl/unx/gtk3/gtkobject.cxx index bd553137a81b..2352c4eec425 100644 --- a/vcl/unx/gtk3/gtkobject.cxx +++ b/vcl/unx/gtk3/gtkobject.cxx @@ -239,9 +239,9 @@ Size GtkSalObjectBase::GetOptimalSize() const return Size(); } -const SystemEnvData* GtkSalObjectBase::GetSystemData() const +const SystemEnvData& GtkSalObjectBase::GetSystemData() const { - return &m_aSystemData; + return m_aSystemData; } #if !GTK_CHECK_VERSION(4, 0, 0) diff --git a/vcl/win/window/salobj.cxx b/vcl/win/window/salobj.cxx index 05ad16b0d4cd..ce39575b9341 100644 --- a/vcl/win/window/salobj.cxx +++ b/vcl/win/window/salobj.cxx @@ -671,9 +671,9 @@ void WinSalObject::GrabFocus() ::SetFocus( mhWndChild ); } -const SystemEnvData* WinSalObject::GetSystemData() const +const SystemEnvData& WinSalObject::GetSystemData() const { - return &maSysData; + return maSysData; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ From c82a5669bc996bc23baebb3838fbabc629ef5d75 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 13:14:33 +0100 Subject: [PATCH 148/155] vcl: Return reference in SalFrame::GetSystemData ... instead of a pointer, to make clear that this is always non-null. Change-Id: I4c8676913b2507f077d8a66973ab5f95e73cb497 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177886 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/headless/svpframe.cxx | 4 ++-- vcl/inc/headless/svpframe.hxx | 2 +- vcl/inc/osx/salframe.h | 2 +- vcl/inc/qt5/QtFrame.hxx | 2 +- vcl/inc/salframe.hxx | 3 +-- vcl/inc/unx/gtk/gtkframe.hxx | 2 +- vcl/inc/unx/salframe.h | 2 +- vcl/inc/win/salframe.h | 2 +- vcl/osx/salframe.cxx | 4 ++-- vcl/qt5/QtFilePicker.cxx | 4 ++-- vcl/source/window/window.cxx | 2 +- vcl/unx/generic/app/i18n_ic.cxx | 12 ++++++------ vcl/unx/generic/app/saldisp.cxx | 4 ++-- vcl/unx/generic/app/wmadaptor.cxx | 14 +++++++------- vcl/unx/generic/window/salframe.cxx | 4 ++-- vcl/unx/generic/window/salobj.cxx | 4 ++-- vcl/unx/gtk3/gtkdata.cxx | 6 +++--- vcl/unx/gtk3/gtkframe.cxx | 4 ++-- vcl/unx/gtk3/gtkinst.cxx | 5 ++--- vcl/win/window/salframe.cxx | 4 ++-- 20 files changed, 42 insertions(+), 44 deletions(-) diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx index bae2312f2478..00672935d256 100644 --- a/vcl/headless/svpframe.cxx +++ b/vcl/headless/svpframe.cxx @@ -449,9 +449,9 @@ void SvpSalFrame::Beep() { } -const SystemEnvData* SvpSalFrame::GetSystemData() const +const SystemEnvData& SvpSalFrame::GetSystemData() const { - return &m_aSystemChildData; + return m_aSystemChildData; } SalFrame::SalPointerState SvpSalFrame::GetPointerState() diff --git a/vcl/inc/headless/svpframe.hxx b/vcl/inc/headless/svpframe.hxx index 3789e44745e7..1c61236029dc 100644 --- a/vcl/inc/headless/svpframe.hxx +++ b/vcl/inc/headless/svpframe.hxx @@ -108,7 +108,7 @@ public: virtual LanguageType GetInputLanguage() override; virtual void UpdateSettings( AllSettings& rSettings ) override; virtual void Beep() override; - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; virtual SalPointerState GetPointerState() override; virtual KeyIndicatorState GetIndicatorState() override; virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override; diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h index 717e5f310178..7245a89c3447 100644 --- a/vcl/inc/osx/salframe.h +++ b/vcl/inc/osx/salframe.h @@ -145,7 +145,7 @@ public: virtual LanguageType GetInputLanguage() override; virtual void UpdateSettings( AllSettings& rSettings ) override; virtual void Beep() override; - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; virtual SalPointerState GetPointerState() override; virtual KeyIndicatorState GetIndicatorState() override; virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override; diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx index efb534825e29..4d1c0fd02cd5 100644 --- a/vcl/inc/qt5/QtFrame.hxx +++ b/vcl/inc/qt5/QtFrame.hxx @@ -204,7 +204,7 @@ public: virtual LanguageType GetInputLanguage() override; virtual void UpdateSettings(AllSettings& rSettings) override; virtual void Beep() override; - virtual const SystemEnvData* GetSystemData() const override { return &m_aSystemData; } + virtual const SystemEnvData& GetSystemData() const override { return m_aSystemData; } virtual SalPointerState GetPointerState() override; virtual KeyIndicatorState GetIndicatorState() override; virtual void SimulateKeyPress(sal_uInt16 nKeyCode) override; diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index 8b239491d469..3d83d861e069 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -219,8 +219,7 @@ public: virtual void FlashWindow() const {}; // returns system data (most prominent: window handle) - virtual const SystemEnvData* - GetSystemData() const = 0; + virtual const SystemEnvData& GetSystemData() const = 0; // tdf#139609 SystemEnvData::GetWindowHandle() calls this to on-demand fill the aWindow // member of SystemEnvData for backends that want to defer doing that diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index b8b10691843b..41790d893dba 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -573,7 +573,7 @@ public: virtual void Beep() override; // returns system data (most prominent: window handle) - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; virtual void ResolveWindowHandle(SystemEnvData& rData) const override; diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h index a6603f6777f3..3ff7a4ae4e11 100644 --- a/vcl/inc/unx/salframe.h +++ b/vcl/inc/unx/salframe.h @@ -239,7 +239,7 @@ public: virtual LanguageType GetInputLanguage() override; virtual void UpdateSettings( AllSettings& rSettings ) override; virtual void Beep() override; - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; virtual SalPointerState GetPointerState() override; virtual KeyIndicatorState GetIndicatorState() override; virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override; diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index ca3bbd8eb323..ada7f2f022fe 100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -130,7 +130,7 @@ public: virtual void UpdateSettings( AllSettings& rSettings ) override; virtual void Beep() override; virtual void FlashWindow() const override; - virtual const SystemEnvData* GetSystemData() const override; + virtual const SystemEnvData& GetSystemData() const override; virtual SalPointerState GetPointerState() override; virtual KeyIndicatorState GetIndicatorState() override; virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override; diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 73ea3ce2262a..9d85969363b6 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -1672,9 +1672,9 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH SAL_WNODEPRECATED_DECLARATIONS_POP } -const SystemEnvData* AquaSalFrame::GetSystemData() const +const SystemEnvData& AquaSalFrame::GetSystemData() const { - return &maSysData; + return maSysData; } void AquaSalFrame::Beep() diff --git a/vcl/qt5/QtFilePicker.cxx b/vcl/qt5/QtFilePicker.cxx index 807ba7ee853d..e97d8cb39608 100644 --- a/vcl/qt5/QtFilePicker.cxx +++ b/vcl/qt5/QtFilePicker.cxx @@ -873,8 +873,8 @@ void SAL_CALL QtFilePicker::initialize(const uno::Sequence& args) const tools::Long aWindowHandle = xSysWin.WindowHandle; const auto it = std::find_if(pFrames.begin(), pFrames.end(), [&aWindowHandle](auto pFrame) -> bool { - const SystemEnvData* pData = pFrame->GetSystemData(); - return pData && tools::Long(pData->GetWindowHandle(pFrame)) == aWindowHandle; + const SystemEnvData& rData = pFrame->GetSystemData(); + return tools::Long(rData.GetWindowHandle(pFrame)) == aWindowHandle; }); if (it != pFrames.end()) m_pParentWidget = static_cast(*it)->asChild(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 06e3e4db76cb..23df41fa50ce 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -3870,7 +3870,7 @@ void Window::ApplySettings(vcl::RenderContext& /*rRenderContext*/) const SystemEnvData* Window::GetSystemData() const { - return mpWindowImpl->mpFrame ? mpWindowImpl->mpFrame->GetSystemData() : nullptr; + return mpWindowImpl->mpFrame ? &mpWindowImpl->mpFrame->GetSystemData() : nullptr; } bool Window::SupportsDoubleBuffering() const diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index 32390a888864..1fd3454aeaa7 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -162,9 +162,9 @@ SalI18N_InputContext::SalI18N_InputContext ( SalFrame *pFrame ) : if (pInputMethod->UseMethod() && SupportInputMethodStyle( pInputMethod->GetSupportedStyles() ) ) { - const SystemEnvData* pEnv = pFrame->GetSystemData(); - ::Window aClientWindow = pEnv->aShellWindow; - ::Window aFocusWindow = pEnv->GetWindowHandle(pFrame); + const SystemEnvData& rEnv = pFrame->GetSystemData(); + ::Window aClientWindow = rEnv.aShellWindow; + ::Window aFocusWindow = rEnv.GetWindowHandle(pFrame); // for status callbacks and commit string callbacks #define PREEDIT_BUFSZ 16 @@ -546,9 +546,9 @@ SalI18N_InputContext::SetICFocus( SalFrame* pFocusFrame ) maClientData.pFrame = pFocusFrame; - const SystemEnvData* pEnv = pFocusFrame->GetSystemData(); - ::Window aClientWindow = pEnv->aShellWindow; - ::Window aFocusWindow = pEnv->GetWindowHandle(pFocusFrame); + const SystemEnvData& rEnv = pFocusFrame->GetSystemData(); + ::Window aClientWindow = rEnv.aShellWindow; + ::Window aFocusWindow = rEnv.GetWindowHandle(pFocusFrame); XSetICValues( maContext, XNFocusWindow, aFocusWindow, diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index a5f9c2f42e5d..46f97074bc26 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -1820,11 +1820,11 @@ int SalDisplay::CaptureMouse( SalFrame *pCapture ) m_pCapture = nullptr; // FIXME: get rid of X11SalFrame - const SystemEnvData* pEnvData = pCapture->GetSystemData(); + const SystemEnvData& rEnvData = pCapture->GetSystemData(); if( !pEnv || !*pEnv ) { int ret = XGrabPointer( GetDisplay(), - static_cast<::Window>(pEnvData->GetWindowHandle(pCapture)), + static_cast<::Window>(rEnvData.GetWindowHandle(pCapture)), False, PointerMotionMask| ButtonPressMask|ButtonReleaseMask, GrabModeAsync, diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 6de1fbd2e8e7..51c273e3c983 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -996,9 +996,9 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const Atom nType = aProp.nitems ? aProp.encoding : XA_STRING; int nFormat = aProp.nitems ? aProp.format : 8; int nBytes = aProp.nitems ? aProp.nitems : aTitle.getLength(); - const SystemEnvData* pEnv = pFrame->GetSystemData(); + const SystemEnvData& rEnv = pFrame->GetSystemData(); XChangeProperty( m_pDisplay, - static_cast<::Window>(pEnv->aShellWindow), + static_cast<::Window>(rEnv.aShellWindow), XA_WM_NAME, nType, nFormat, @@ -1006,7 +1006,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const pData, nBytes ); XChangeProperty( m_pDisplay, - static_cast<::Window>(pEnv->aShellWindow), + static_cast<::Window>(rEnv.aShellWindow), XA_WM_ICON_NAME, nType, nFormat, @@ -1014,7 +1014,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) const pData, nBytes ); XChangeProperty( m_pDisplay, - static_cast<::Window>(pEnv->aShellWindow), + static_cast<::Window>(rEnv.aShellWindow), m_aWMAtoms[ WM_LOCALE_NAME ], XA_STRING, 8, @@ -1037,10 +1037,10 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) con WMAdaptor::setWMName( pFrame, rWMName ); OString aTitle(OUStringToOString(rWMName, RTL_TEXTENCODING_UTF8)); - const SystemEnvData* pEnv = pFrame->GetSystemData(); + const SystemEnvData& rEnv = pFrame->GetSystemData(); if( m_aWMAtoms[ NET_WM_NAME ] ) XChangeProperty( m_pDisplay, - static_cast<::Window>(pEnv->aShellWindow), + static_cast<::Window>(rEnv.aShellWindow), m_aWMAtoms[ NET_WM_NAME ], m_aWMAtoms[ UTF8_STRING ], 8, @@ -1049,7 +1049,7 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const OUString& rWMName ) con aTitle.getLength() ); if( m_aWMAtoms[ NET_WM_ICON_NAME ] ) XChangeProperty( m_pDisplay, - static_cast<::Window>(pEnv->aShellWindow), + static_cast<::Window>(rEnv.aShellWindow), m_aWMAtoms[ NET_WM_ICON_NAME ], m_aWMAtoms[ UTF8_STRING ], 8, diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index dbd35f5417d9..d495d5bbe8bc 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -842,7 +842,7 @@ void X11SalFrame::SetExtendedFrameStyle( SalExtStyle nStyle ) } } -const SystemEnvData* X11SalFrame::GetSystemData() const +const SystemEnvData& X11SalFrame::GetSystemData() const { X11SalFrame *pFrame = const_cast(this); pFrame->maSystemChildData.pDisplay = GetXDisplay(); @@ -854,7 +854,7 @@ const SystemEnvData* X11SalFrame::GetSystemData() const pFrame->maSystemChildData.aShellWindow = pFrame->GetShellWindow(); pFrame->maSystemChildData.toolkit = SystemEnvData::Toolkit::Gen; pFrame->maSystemChildData.platform = SystemEnvData::Platform::Xcb; - return &maSystemChildData; + return maSystemChildData; } SalGraphics *X11SalFrame::AcquireGraphics() diff --git a/vcl/unx/generic/window/salobj.cxx b/vcl/unx/generic/window/salobj.cxx index 50090f053825..3879fdab3244 100644 --- a/vcl/unx/generic/window/salobj.cxx +++ b/vcl/unx/generic/window/salobj.cxx @@ -60,9 +60,9 @@ X11SalObject* X11SalObject::CreateObject( SalFrame* pParent, SystemWindowData* p pObject->mpParent = pParent; SalDisplay* pSalDisp = vcl_sal::getSalDisplay(GetGenericUnixSalData()); - const SystemEnvData* pEnv = pParent->GetSystemData(); + const SystemEnvData& rEnv = pParent->GetSystemData(); Display* pDisp = pSalDisp->GetDisplay(); - ::Window aObjectParent = static_cast<::Window>(pEnv->GetWindowHandle(pParent)); + ::Window aObjectParent = static_cast<::Window>(rEnv.GetWindowHandle(pParent)); pObject->maParentWin = aObjectParent; // find out on which screen that window is diff --git a/vcl/unx/gtk3/gtkdata.cxx b/vcl/unx/gtk3/gtkdata.cxx index 17ae4ec928b8..2f71818296c5 100644 --- a/vcl/unx/gtk3/gtkdata.cxx +++ b/vcl/unx/gtk3/gtkdata.cxx @@ -870,9 +870,9 @@ GtkWidget* GtkSalDisplay::findGtkWidgetForNativeHandle(sal_uIntPtr hWindow) cons { for (auto pSalFrame : m_aFrames ) { - const SystemEnvData* pEnvData = pSalFrame->GetSystemData(); - if (pEnvData->GetWindowHandle(pSalFrame) == hWindow) - return GTK_WIDGET(pEnvData->pWidget); + const SystemEnvData& rEnvData = pSalFrame->GetSystemData(); + if (rEnvData.GetWindowHandle(pSalFrame) == hWindow) + return GTK_WIDGET(rEnvData.pWidget); } return nullptr; } diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx index f101834627c5..8b96d7a321c0 100644 --- a/vcl/unx/gtk3/gtkframe.cxx +++ b/vcl/unx/gtk3/gtkframe.cxx @@ -3035,9 +3035,9 @@ void GtkSalFrame::Beep() gdk_display_beep( getGdkDisplay() ); } -const SystemEnvData* GtkSalFrame::GetSystemData() const +const SystemEnvData& GtkSalFrame::GetSystemData() const { - return &m_aSystemData; + return m_aSystemData; } void GtkSalFrame::ResolveWindowHandle(SystemEnvData& rData) const diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 92b281e8ee2d..13d33a19a30a 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -6385,9 +6385,8 @@ public: { GtkSalFrame* pFrame = GtkSalFrame::getFromWindow(GTK_WIDGET(m_pWindow)); assert(pFrame && "nothing should call this impl, yet anyway, if ever, except on result of GetFrameWeld()"); - const SystemEnvData* pEnvData = pFrame->GetSystemData(); - assert(pEnvData); - return *pEnvData; + const SystemEnvData& rEnvData = pFrame->GetSystemData(); + return rEnvData; } virtual Size get_size() const override diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 751e85012bff..9a3705c4d525 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -3017,9 +3017,9 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) WinSalGraphics::updateSettingsNative( rSettings ); } -const SystemEnvData* WinSalFrame::GetSystemData() const +const SystemEnvData& WinSalFrame::GetSystemData() const { - return &maSysData; + return maSysData; } void WinSalFrame::Beep() From f40a68f58dd1fc8b4cbd89434559c3400e7bd39b Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 12:23:41 +0000 Subject: [PATCH 149/155] wina11y: Drop unnecessary exception handling Window::GetSystemData should never throw an exception, so there's no need for exception handling here. Also, return early if the system data is null. Change-Id: I65794f10019d0c2fb5cc7150500b551c31cc2a08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177887 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- .../source/service/AccTopWindowListener.cxx | 56 ++++++++----------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx index 40d9ba8755c1..181d7d8f4fa2 100644 --- a/winaccessibility/source/service/AccTopWindowListener.cxx +++ b/winaccessibility/source/service/AccTopWindowListener.cxx @@ -47,45 +47,37 @@ void AccTopWindowListener::HandleWindowOpened( css::accessibility::XAccessible* else if (auto pvclxcomponent = dynamic_cast(pAccessible)) window = pvclxcomponent->GetWindow(); assert(window); - // The SalFrame of window may be destructed at this time - const SystemEnvData* systemdata = nullptr; - try - { - systemdata = window->GetSystemData(); - } - catch(...) - { - systemdata = nullptr; - } + + const SystemEnvData* pSystemData = window->GetSystemData(); + if (!pSystemData) + return; + Reference xContext = pAccessible->getAccessibleContext(); if(!xContext.is()) return; // add all listeners - if (systemdata != nullptr) + m_aAccObjectManager.SaveTopWindowHandle(pSystemData->hWnd, pAccessible); + + AddAllListeners(pAccessible, nullptr, pSystemData->hWnd); + + if( window->GetStyle() & WB_MOVEABLE ) + m_aAccObjectManager.IncreaseState( pAccessible, static_cast(-1) /* U_MOVEBLE */ ); + + short role = xContext->getAccessibleRole(); + + if (role == css::accessibility::AccessibleRole::POPUP_MENU || + role == css::accessibility::AccessibleRole::MENU ) { - m_aAccObjectManager.SaveTopWindowHandle(systemdata->hWnd, pAccessible); + m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::MENUPOPUPSTART); + } - AddAllListeners(pAccessible,nullptr,systemdata->hWnd); - - if( window->GetStyle() & WB_MOVEABLE ) - m_aAccObjectManager.IncreaseState( pAccessible, static_cast(-1) /* U_MOVEBLE */ ); - - short role = xContext->getAccessibleRole(); - - if (role == css::accessibility::AccessibleRole::POPUP_MENU || - role == css::accessibility::AccessibleRole::MENU ) - { - m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::MENUPOPUPSTART); - } - - if (role == css::accessibility::AccessibleRole::FRAME || - role == css::accessibility::AccessibleRole::DIALOG || - role == css::accessibility::AccessibleRole::WINDOW || - role == css::accessibility::AccessibleRole::ALERT) - { - m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::SHOW); - } + if (role == css::accessibility::AccessibleRole::FRAME || + role == css::accessibility::AccessibleRole::DIALOG || + role == css::accessibility::AccessibleRole::WINDOW || + role == css::accessibility::AccessibleRole::ALERT) + { + m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::SHOW); } } From eed855d70317ce25d267c28b28c0f40f8e7b69cb Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 13:07:06 +0000 Subject: [PATCH 150/155] wina11y: Use existing references + drop duplicate checks There's no need to have local raw pointer variables in addition to the existing References. Replace all uses of the former by using the latter and drop duplicate checks. Change-Id: I1339dabecbe8e1652e49df8ecd5ce2749b897f47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177888 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- .../source/service/AccTopWindowListener.cxx | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx index 181d7d8f4fa2..1b61a6436b15 100644 --- a/winaccessibility/source/service/AccTopWindowListener.cxx +++ b/winaccessibility/source/service/AccTopWindowListener.cxx @@ -173,34 +173,23 @@ void AccTopWindowListener::windowClosed( const css::lang::EventObject& e ) return; Reference< css::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY ); - css::accessibility::XAccessible* pAccessible = xAccessible.get(); - if ( pAccessible == nullptr) + if (!xAccessible.is()) return; - Reference xContext = pAccessible->getAccessibleContext(); + Reference xContext = xAccessible->getAccessibleContext(); if(!xContext.is()) - { return; - } - css::accessibility::XAccessibleContext* pAccessibleContext = xContext.get(); - short role = -1; - if(pAccessibleContext != nullptr) + short role = xContext->getAccessibleRole(); + if (role == css::accessibility::AccessibleRole::POPUP_MENU || + role == css::accessibility::AccessibleRole::MENU) { - role = pAccessibleContext->getAccessibleRole(); - - if (role == css::accessibility::AccessibleRole::POPUP_MENU || - role == css::accessibility::AccessibleRole::MENU) - { - m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::MENUPOPUPEND); - } + m_aAccObjectManager.NotifyAccEvent(xAccessible.get(), UnoMSAAEvent::MENUPOPUPEND); } - - m_aAccObjectManager.DeleteChildrenAccObj( pAccessible ); + m_aAccObjectManager.DeleteChildrenAccObj(xAccessible.get()); if( role != css::accessibility::AccessibleRole::POPUP_MENU ) - m_aAccObjectManager.DeleteAccObj( pAccessible ); - + m_aAccObjectManager.DeleteAccObj(xAccessible.get()); } void AccTopWindowListener::windowMinimized( const css::lang::EventObject& ) From b608604d0bbecdc24a17175374581b4e2d720658 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 14:07:52 +0000 Subject: [PATCH 151/155] tdf#164093 tdf#157001 wina11y: Use vcl::Window's actual XAccessible By default, a vcl::Window's XAccessible is its VCLXWindow (toolkit peer): css::uno::Reference< css::accessibility::XAccessible > Window::CreateAccessible() { css::uno::Reference< css::accessibility::XAccessible > xAcc( GetComponentInterface(), css::uno::UNO_QUERY ); return xAcc; } However, that's a virtual method and subclasses can return a different XAccessible. MenuFloatingWindow::CreateAccessible returns the accessible of its menu. However, winaccessibility's AccTopWindowListener code was relying on the Window's XAccessible always being its VCLXWindow. The VLCXWindow is passed as a param in the XTopWindowListener methods, and AccTopWindowListener was querying it for the XAccessible interface, and then calling XAccessible::getAccessibleContext in order to retrieve the XAccessibleContext for the window. This is incorrect if the Window actually has another XAccessible. For the df#164093 scenario with NVDA running, opening and closing the sidebar popup menu would result in the VCLXWindow's VCLXWindow::getAccessibleContext menu getting called, which calls VCLXWindow::CreateAccessibleContext and the VCLXWindow would keep a reference to the returned XAccessibleContext and dispose it when the VLCXWindow itself gets disposed. However, AccessibleFactory::createAccessibleContext (called by VCLXWindow::CreateAccessibleContext) doesn't actually create a new object for the MenuFloatingWindow's accessible, but returns the existing accessible object of the PopupMenu, which is owned by the PopupMenu, not the MenuFloatingWindow, s.a. previous commit Change-Id: Ia2931bee23204395e8b3396927acf4fa1d0f077c Author: Michael Weghorn Date: Thu Dec 5 11:06:48 2024 +0000 tdf#164093 tdf#157001 a11y: Improve menu window disposal for more details. Backtrace of how that accessible context was returned: 1 `anonymous namespace'::AccessibleFactory::createAccessibleContext acc_factory.cxx 305 0x7fffbc160767 2 VCLXWindow::CreateAccessibleContext vclxwindow.cxx 879 0x7fffc0b1bc67 3 VCLXWindow::getAccessibleContext vclxwindow.cxx 2418 0x7fffc0b2670b 4 AccTopWindowListener::HandleWindowOpened AccTopWindowListener.cxx 60 0x7fffe5c32ab6 5 AccTopWindowListener::windowOpened AccTopWindowListener.cxx 119 0x7fffe5c3375e 6 ``anonymous namespace'::VCLXToolkit::callTopWindowListeners'::`2'::::operator() vclxtoolkit.cxx 2364 0x7fffc0af27ef 7 comphelper::OInterfaceContainerHelper4::forEach<``anonymous namespace'::VCLXToolkit::callTopWindowListeners'::`2'::> interfacecontainer4.hxx 349 0x7fffc0ae7f9e 8 `anonymous namespace'::VCLXToolkit::callTopWindowListeners vclxtoolkit.cxx 2359 0x7fffc0afeaed 9 `anonymous namespace'::VCLXToolkit::eventListenerHandler vclxtoolkit.cxx 2295 0x7fffc0b02492 10 `anonymous namespace'::VCLXToolkit::LinkStubeventListenerHandler vclxtoolkit.cxx 2288 0x7fffc0afbdf6 11 Link::Call link.hxx 111 0x7fffbfba33d3 12 VclEventListeners::Call vclevent.cxx 47 0x7fffbfba35f1 13 Application::ImplCallEventListeners svapp.cxx 733 0x7fffbfb76dbb 14 vcl::Window::CallEventListeners event.cxx 229 0x7fffbf45f841 15 vcl::Window::ImplSetReallyVisible window.cxx 1331 0x7fffbf566bad 16 vcl::Window::ImplSetReallyVisible window.cxx 1344 0x7fffbf566c7d 17 vcl::Window::Show window.cxx 2336 0x7fffbf56a8d1 18 vcl::Window::Show window.cxx 2349 0x7fffbf56a9ce 19 FloatingWindow::StartPopupMode floatwin.cxx 825 0x7fffbf46a702 20 PopupMenu::Run menu.cxx 3018 0x7fffbf4a6f02 ... When the MenuFloatingWindow gets disposed, its VCLXWindow is also disposed. Since it incorrectly assumes it (or its Window) owns the XAccessibleContext, it disposes that as well: 1 OAccessibleMenuBaseComponent::disposing accessiblemenubasecomponent.cxx 608 0x7fffbf300c82 2 cppu::WeakComponentImplHelperBase::dispose implbase.cxx 104 0x7fffe199964a 3 cppu::PartialWeakComponentImplHelper::dispose compbase.hxx 90 0x7fffdb8d1820 4 VCLXWindow::dispose vclxwindow.cxx 938 0x7fffc0b24012 5 UnoWrapper::WindowDestroyed unowrapper.cxx 302 0x7fffc0cfddc6 6 vcl::Window::dispose window.cxx 220 0x7fffbf56e68f 7 SystemWindow::dispose syswin.cxx 107 0x7fffbf515606 8 FloatingWindow::dispose floatwin.cxx 225 0x7fffbf46b751 9 MenuFloatingWindow::dispose menufloatingwindow.cxx 134 0x7fffbf4bd766 10 VclReferenceBase::disposeOnce vclreferencebase.cxx 39 0x7fffbf7520d9 11 VclPtr::disposeAndClear vclptr.hxx 207 0x7fffbf3f98d2 12 PopupMenu::ImplExecute menu.cxx 2947 0x7fffbf4a0ee7 13 PopupMenu::Execute menu.cxx 2834 0x7fffbf49c392 14 MenuButton::ExecuteMenu menubtn.cxx 77 0x7fffbf639f1d 15 MenuButton::MouseButtonDown menubtn.cxx 214 0x7fffbf63a847 16 ImplHandleMouseEvent winproc.cxx 708 0x7fffbf57ca27 17 ImplHandleSalMouseButtonDown winproc.cxx 2338 0x7fffbf57e1af 18 ImplWindowFrameProc winproc.cxx 2683 0x7fffbf57fc07 19 SalFrame::CallCallback salframe.hxx 312 0x7fffbf3443c6 20 ImplHandleMouseMsg salframe.cxx 3415 0x7fffbc818e8f ... However, the Menu that actually owns the accessible may still be alive, and then opening the menu again results in an attempt to make use of the already disposed object, triggering a crash due to a DisposedException being thrown: 1 RaiseException KERNELBASE 0x7ff808e8b699 2 CxxThrowException VCRUNTIME140 0x7fffef535267 3 comphelper::OCommonAccessibleComponent::ensureAlive accessiblecomponenthelper.cxx 141 0x7fffdb8d1937 4 comphelper::OContextEntryGuard::OContextEntryGuard accessiblecontexthelper.hxx 64 0x7fffbf2fb8eb 5 comphelper::OExternalLockGuard::OExternalLockGuard accessiblecontexthelper.hxx 81 0x7fffbf2fb948 6 OAccessibleMenuBaseComponent::getAccessibleContext accessiblemenubasecomponent.cxx 641 0x7fffbf301337 7 VCLXAccessibleComponent::ProcessWindowChildEvent vclxaccessiblecomponent.cxx 165 0x7fffc0a9596d 8 VCLXAccessibleComponent::WindowChildEventListener vclxaccessiblecomponent.cxx 124 0x7fffc0a96669 9 VCLXAccessibleComponent::LinkStubWindowChildEventListener vclxaccessiblecomponent.cxx 114 0x7fffc0a957f6 10 Link::Call link.hxx 111 0x7fffbf45f7d3 11 vcl::Window::CallEventListeners event.cxx 300 0x7fffbf45fe0c 12 vcl::Window::ImplSetReallyVisible window.cxx 1331 0x7fffbf566bad 13 vcl::Window::ImplSetReallyVisible window.cxx 1344 0x7fffbf566c7d 14 vcl::Window::Show window.cxx 2336 0x7fffbf56a8d1 15 vcl::Window::Show window.cxx 2349 0x7fffbf56a9ce 16 FloatingWindow::StartPopupMode floatwin.cxx 825 0x7fffbf46a702 17 PopupMenu::Run menu.cxx 3018 0x7fffbf4a6f02 18 PopupMenu::ImplExecute menu.cxx 3005 0x7fffbf4a1707 19 PopupMenu::Execute menu.cxx 2834 0x7fffbf49c392 20 MenuButton::ExecuteMenu menubtn.cxx 77 0x7fffbf639f1d ... To fix that, adjust winaccessibility's AccTopWindowListener to no longer just use the VCLXWindow for the accessible, but get the vcl::Window for the VCLXWindow and query it's actual XAccessible using vcl::Window::GetAccessible(). This fixes the tdf#164093 crash. The problem of tdf#157001 where items in the popup menu of Calc's organize template dialog are only announced the first time the menu is opened still remains for now, but is also somehow related to the MenuFloatingWindow being disposed. (No longer reproducible when no longer calling the base class FloatingWindow::dispose from MenuFloatingWindow::dispose in a local test, still needs further analysis.) Change-Id: Ic96d2c95128af144c7769aac40707299b1c80f8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177889 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- winaccessibility/inc/AccTopWindowListener.hxx | 3 +- .../source/service/AccTopWindowListener.cxx | 53 ++++++++++--------- .../source/service/msaaservice_impl.cxx | 16 ++---- 3 files changed, 34 insertions(+), 38 deletions(-) diff --git a/winaccessibility/inc/AccTopWindowListener.hxx b/winaccessibility/inc/AccTopWindowListener.hxx index 9d8b46f95acc..2623dd2db737 100644 --- a/winaccessibility/inc/AccTopWindowListener.hxx +++ b/winaccessibility/inc/AccTopWindowListener.hxx @@ -24,6 +24,7 @@ #include #include +#include #include "AccObjectWinManager.hxx" @@ -58,7 +59,7 @@ public: void AddAllListeners(css::accessibility::XAccessible* pAccessible, css::accessibility::XAccessible* pParentXAcc, HWND pWND); //for On-Demand load. - void HandleWindowOpened(css::accessibility::XAccessible* pAccessible); + void HandleWindowOpened(vcl::Window* pWindow); sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam); }; diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx index 1b61a6436b15..f19a16b26acc 100644 --- a/winaccessibility/source/service/AccTopWindowListener.cxx +++ b/winaccessibility/source/service/AccTopWindowListener.cxx @@ -36,40 +36,38 @@ using namespace com::sun::star::uno; /** * For the new opened window, generate all the UNO accessible's object, COM object and add * accessible listener to monitor all these objects. - * @param pAccessible the accessible of the new opened window + * @param pWindow the new opened window */ -void AccTopWindowListener::HandleWindowOpened( css::accessibility::XAccessible* pAccessible ) +void AccTopWindowListener::HandleWindowOpened(vcl::Window* pWindow) { - //get SystemData from window - VclPtr window; - if (auto pvclwindow = dynamic_cast(pAccessible)) - window = pvclwindow->GetWindow(); - else if (auto pvclxcomponent = dynamic_cast(pAccessible)) - window = pvclxcomponent->GetWindow(); - assert(window); + assert(pWindow); - const SystemEnvData* pSystemData = window->GetSystemData(); + const SystemEnvData* pSystemData = pWindow->GetSystemData(); if (!pSystemData) return; - Reference xContext = pAccessible->getAccessibleContext(); + Reference xAccessible = pWindow->GetAccessible(); + if (!xAccessible.is()) + return; + + Reference xContext = xAccessible->getAccessibleContext(); if(!xContext.is()) return; // add all listeners - m_aAccObjectManager.SaveTopWindowHandle(pSystemData->hWnd, pAccessible); + m_aAccObjectManager.SaveTopWindowHandle(pSystemData->hWnd, xAccessible.get()); - AddAllListeners(pAccessible, nullptr, pSystemData->hWnd); + AddAllListeners(xAccessible.get(), nullptr, pSystemData->hWnd); - if( window->GetStyle() & WB_MOVEABLE ) - m_aAccObjectManager.IncreaseState( pAccessible, static_cast(-1) /* U_MOVEBLE */ ); + if (pWindow->GetStyle() & WB_MOVEABLE) + m_aAccObjectManager.IncreaseState(xAccessible.get(), static_cast(-1) /* U_MOVEBLE */ ); short role = xContext->getAccessibleRole(); if (role == css::accessibility::AccessibleRole::POPUP_MENU || role == css::accessibility::AccessibleRole::MENU ) { - m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::MENUPOPUPSTART); + m_aAccObjectManager.NotifyAccEvent(xAccessible.get(), UnoMSAAEvent::MENUPOPUPSTART); } if (role == css::accessibility::AccessibleRole::FRAME || @@ -77,7 +75,7 @@ void AccTopWindowListener::HandleWindowOpened( css::accessibility::XAccessible* role == css::accessibility::AccessibleRole::WINDOW || role == css::accessibility::AccessibleRole::ALERT) { - m_aAccObjectManager.NotifyAccEvent(pAccessible, UnoMSAAEvent::SHOW); + m_aAccObjectManager.NotifyAccEvent(xAccessible.get(), UnoMSAAEvent::SHOW); } } @@ -100,14 +98,15 @@ void AccTopWindowListener::windowOpened( const css::lang::EventObject& e ) if ( !e.Source.is()) return; - Reference< css::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY ); - css::accessibility::XAccessible* pAccessible = xAccessible.get(); - if ( !pAccessible ) - return; - SolarMutexGuard g; - HandleWindowOpened( pAccessible ); + VCLXWindow* pVCLXWindow = dynamic_cast(e.Source.get()); + assert(pVCLXWindow && "Window is not a VCLXWindow"); + + vcl::Window* pWindow = pVCLXWindow->GetWindow(); + assert(pWindow); + + HandleWindowOpened(pWindow); } /** @@ -172,7 +171,13 @@ void AccTopWindowListener::windowClosed( const css::lang::EventObject& e ) if ( !e.Source.is()) return; - Reference< css::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY ); + VCLXWindow* pVCLXWindow = dynamic_cast(e.Source.get()); + assert(pVCLXWindow && "Window is not a VCLXWindow"); + + vcl::Window* pWindow = pVCLXWindow->GetWindow(); + assert(pWindow); + + Reference xAccessible = pWindow->GetAccessible(); if (!xAccessible.is()) return; diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx index 955d30560c6c..823238215a25 100644 --- a/winaccessibility/source/service/msaaservice_impl.cxx +++ b/winaccessibility/source/service/msaaservice_impl.cxx @@ -109,7 +109,7 @@ void MSAAServiceImpl::handleWindowOpened(sal_Int64 nAcc) if (m_pTopWindowListener.is() && nAcc) { m_pTopWindowListener->HandleWindowOpened( - static_cast( + static_cast( reinterpret_cast(nAcc))); } } @@ -142,19 +142,9 @@ Sequence< OUString > MSAAServiceImpl::getSupportedServiceNames() static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService>& xAccMgr, vcl::Window* pWindow) { - assert(pWindow); - - // We have to rely on the fact that Window::GetAccessible()->getAccessibleContext() returns a valid XAccessibleContext - // also for other menus than menubar or toplevel popup window. Otherwise we had to traverse the hierarchy to find the - // context object to this menu floater. This makes the call to Window->IsMenuFloatingWindow() obsolete. - css::uno::Reference xAccessible = pWindow->GetAccessible(); - assert(xAccMgr.is()); - if (xAccessible.is()) - { - xAccMgr->handleWindowOpened(reinterpret_cast(xAccessible.get())); - SAL_INFO("iacc2", "Decide whether to register existing window with IAccessible2"); - } + assert(pWindow); + xAccMgr->handleWindowOpened(reinterpret_cast(pWindow)); } /* From f975b8418573b887cdc3269bcefa54bde6d60fa1 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Dec 2024 15:22:27 +0100 Subject: [PATCH 152/155] a11y: Drop SAL_LOPLUGIN_ANNOTATE("crosscast") Added in: commit d66a97d5622bfc7c8d68452eb5a3c2378b0b1820 Date: Thu Jan 12 08:29:24 2023 +0100 loplugin:crosscast (clang-cl) > winaccessibility/source/service/AccTopWindowListener.cxx(47,36): error: suspicious dynamic cross cast from 'css::accessibility::XAccessible *' to 'VCLXAccessibleComponent *' [loplugin:crosscast] > else if (auto pvclxcomponent = dynamic_cast(pAccessible)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: Iee7585dd2fa0d92af3be6b89d7d08326de3d1e7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145380 Tested-by: Jenkins Reviewed-by: Stephan Bergmann AccTopWindowListener::HandleWindowOpened no longer does that crosscast now, see Change-Id: Ic96d2c95128af144c7769aac40707299b1c80f8c Author: Michael Weghorn Date: Thu Dec 5 14:07:52 2024 +0000 tdf#164093 tdf#157001 wina11y: Use vcl::Window's actual XAccessible Change-Id: Ifca76a5d519099f9cbe06f8bde606e01871363fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177891 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- include/toolkit/awt/vclxaccessiblecomponent.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/toolkit/awt/vclxaccessiblecomponent.hxx b/include/toolkit/awt/vclxaccessiblecomponent.hxx index 9227f6958035..551c7dcb607b 100644 --- a/include/toolkit/awt/vclxaccessiblecomponent.hxx +++ b/include/toolkit/awt/vclxaccessiblecomponent.hxx @@ -41,7 +41,7 @@ class AccessibleRelationSetHelper; -class TOOLKIT_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") VCLXAccessibleComponent +class TOOLKIT_DLLPUBLIC VCLXAccessibleComponent :public cppu::ImplInheritanceHelper< comphelper::OAccessibleExtendedComponentHelper, css::lang::XServiceInfo> { From 2d7ab2b66bf1266246fcbab6e428faf0af94d913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Fri, 22 Nov 2024 15:04:03 +0100 Subject: [PATCH 153/155] jsdialog: weld::Menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - weld::Menu doesn't have base with weld::Widget - use separate container, only one menu per WindowId - first only send menu and cancel, when user activates option we will send another request and execute entry as menu can be blocking - there is connect_activated way of async setup too Change-Id: Iea03f82a91ecc19af67b91f85364675c119056ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177722 (cherry picked from commit efeb511607dacce991866bcf328c96a01ab594f9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177852 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- include/vcl/jsdialog/executor.hxx | 10 +++++ include/vcl/weld.hxx | 4 ++ vcl/inc/jsdialog/jsdialogbuilder.hxx | 16 +++++++ vcl/inc/salvtables.hxx | 5 ++- vcl/jsdialog/executor.cxx | 28 +++++++++++- vcl/jsdialog/jsdialogbuilder.cxx | 64 ++++++++++++++++++++++++++++ 6 files changed, 124 insertions(+), 3 deletions(-) diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx index ef667a70ce26..260be394d6b8 100644 --- a/include/vcl/jsdialog/executor.hxx +++ b/include/vcl/jsdialog/executor.hxx @@ -44,6 +44,16 @@ public: rTreeView.signal_row_activated(); } + static void trigger_popup_menu(weld::TreeView& rTreeView, const CommandEvent& rCommand) + { + rTreeView.signal_popup_menu(rCommand); + } + + static void trigger_activated(weld::Menu& rMenu, const OUString& rIdent) + { + rMenu.signal_activate(rIdent); + } + static void trigger_item_activated(weld::IconView& rIconView) { rIconView.signal_item_activated(); diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index e55cf8a205f0..74290a3c9ec7 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1009,6 +1009,8 @@ protected: return m_aEditingDoneHdl.Call(rIterText); } + void signal_popup_menu(const CommandEvent& rCommand) { m_aPopupMenuHdl.Call(rCommand); } + Link m_aQueryTooltipHdl; OUString signal_query_tooltip(const TreeIter& rIter) { return m_aQueryTooltipHdl.Call(rIter); } @@ -2449,6 +2451,8 @@ enum class Placement class VCL_DLLPUBLIC Menu { + friend class ::LOKTrigger; + Link m_aActivateHdl; protected: diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index ec8cef53e238..420722c9997b 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -309,6 +309,7 @@ public: virtual std::unique_ptr weld_radio_button(const OUString& id) override; virtual std::unique_ptr weld_frame(const OUString& id) override; virtual std::unique_ptr weld_menu_button(const OUString& id) override; + virtual std::unique_ptr weld_menu(const OUString& id) override; virtual std::unique_ptr weld_popover(const OUString& id) override; virtual std::unique_ptr weld_box(const OUString& id) override; virtual std::unique_ptr weld_widget(const OUString& id) override; @@ -330,6 +331,11 @@ public: static void ForgetPopup(const OUString& nWindowId); static vcl::Window* FindPopup(const OUString& nWindowId); + // menus in separate container as they don't share base class with weld::Widget + static void RememberMenu(const OUString& nWindowId, weld::Menu* pMenu); + static void ForgetMenu(const OUString& nWindowId); + static weld::Menu* FindMenu(const OUString& nWindowId); + private: const OUString& GetTypeOfJSON() const; VclPtr& GetContentWindow(); @@ -871,6 +877,16 @@ public: virtual void set_active(bool active) override; }; +class JSMenu final : public SalInstanceMenu +{ +public: + JSMenu(JSDialogSender* pSender, PopupMenu* pMenu, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual OUString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, + weld::Placement ePlace = weld::Placement::Under) override; +}; + class JSPopover : public JSWidget { vcl::LOKWindowId mnWindowId; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 534e158b4196..c183b7fdb57c 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -146,11 +146,12 @@ public: virtual ~SalInstanceBuilder() override; }; -class SAL_DLLPUBLIC_RTTI SalInstanceMenu final : public weld::Menu +class SAL_DLLPUBLIC_RTTI SalInstanceMenu : public weld::Menu { -private: +protected: VclPtr m_xMenu; +private: bool m_bTakeOwnership; sal_uInt16 m_nLastId; diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index c6ab95c293e3..bb000d3daa97 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -74,7 +74,21 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap } } - if (pWidget != nullptr) + if (pWidget == nullptr) + { + // weld::Menu doesn't have base of weld::Widget + if (sControlType == "menu") + { + weld::Menu* pMenu = JSInstanceBuilder::FindMenu(nWindowId); + if (pMenu && sAction == "activated") + { + LOKTrigger::trigger_activated(*pMenu, rData["data"]); + return true; + } + } + return false; + } + else { // shared actions @@ -558,6 +572,18 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap pTreeView->drag_end(); return true; } + else if (sAction == "contextmenu") + { + sal_Int32 nEntryAbsPos = o3tl::toInt32(rData["data"]); + + std::unique_ptr itEntry(pTreeView->make_iterator()); + pTreeView->get_iter_abs_pos(*itEntry, nEntryAbsPos); + + tools::Rectangle aRect = pTreeView->get_row_area(*itEntry); + CommandEvent aCommand(aRect.Center(), CommandEventId::ContextMenu); + + LOKTrigger::trigger_popup_menu(*pTreeView, aCommand); + } } } else if (sControlType == "iconview") diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index f5459f2e9a5c..5c1e82397f9f 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,14 @@ static std::map& GetLOKPopupsMap() return s_aLOKPopupsMap; } +static std::map& GetLOKMenusMap() +{ + // Map to remember the LOKWindowId <-> weld menu binding. + static std::map s_aLOKMenusMap; + + return s_aLOKMenusMap; +} + namespace { void response_help(vcl::Window* pWindow) @@ -318,7 +327,10 @@ JSDialogSender::~JSDialogSender() COVERITY_NOEXCEPT_FALSE void JSDialogSender::sendFullUpdate(bool bForce) { if (!mpIdleNotify) + { + assert(false); return; + } if (bForce) mpIdleNotify->forceUpdate(); @@ -798,6 +810,28 @@ void JSInstanceBuilder::ForgetPopup(const OUString& nWindowId) GetLOKPopupsMap().erase(it); } +void JSInstanceBuilder::RememberMenu(const OUString& nWindowId, weld::Menu* pMenu) +{ + GetLOKMenusMap()[nWindowId] = pMenu; +} + +void JSInstanceBuilder::ForgetMenu(const OUString& nWindowId) +{ + auto it = GetLOKMenusMap().find(nWindowId); + if (it != GetLOKMenusMap().end()) + GetLOKMenusMap().erase(it); +} + +weld::Menu* JSInstanceBuilder::FindMenu(const OUString& nWindowId) +{ + const auto it = GetLOKMenusMap().find(nWindowId); + + if (it != GetLOKMenusMap().end()) + return it->second; + + return nullptr; +} + vcl::Window* JSInstanceBuilder::FindPopup(const OUString& nWindowId) { const auto it = GetLOKPopupsMap().find(nWindowId); @@ -1201,6 +1235,20 @@ std::unique_ptr JSInstanceBuilder::weld_menu_button(const OUSt return pWeldWidget; } +std::unique_ptr JSInstanceBuilder::weld_menu(const OUString& id) +{ + PopupMenu* pPopupMenu = m_xBuilder->get_menu(id); + + JSMenu* pMenu = pPopupMenu ? new JSMenu(this, pPopupMenu, this, false) : nullptr; + + std::unique_ptr pWeldWidget(pMenu); + + if (pWeldWidget) + RememberMenu(getMapIdFromWindowId(), pWeldWidget.get()); + + return pWeldWidget; +} + std::unique_ptr JSInstanceBuilder::weld_popover(const OUString& id) { DockingWindow* pDockingWindow = m_xBuilder->get(id); @@ -2348,6 +2396,22 @@ void JSMenuButton::set_active(bool bActive) } } +JSMenu::JSMenu(JSDialogSender* /*pSender*/, PopupMenu* pPopupMenu, SalInstanceBuilder* /*pBuilder*/, + bool bTakeOwnership) + : SalInstanceMenu(pPopupMenu, bTakeOwnership) +{ +} + +OUString JSMenu::popup_at_rect(weld::Widget* /*pParent*/, const tools::Rectangle& /*rRect*/, + weld::Placement /*ePlace*/) +{ + // TODO: send message + + // first only send menu and cancel menu + // no return SalInstanceMenu::popup_at_rect(pParent, rRect, ePlace); + return ""; +} + JSPopover::JSPopover(JSDialogSender* pSender, DockingWindow* pDockingWindow, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget(pSender, pDockingWindow, pBuilder, bTakeOwnership) From f232952e727c50cc3a5927ff3b082f88e36c9bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 5 Dec 2024 20:05:43 +0000 Subject: [PATCH 154/155] crashtesting: HLINK_MARK embedded null import from forum-mso-en4-7137.doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit which causes problems on export to docx. Sanitize at the original import. Change-Id: I8b9fa86465c455fe872c41386889dc54e38eb9ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177904 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/filter/ww8/ww8par.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index d3118ce913c7..d2f67900b412 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -348,6 +348,8 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS if( ::get_flag( nFlags, WW8_HLINK_MARK ) ) { xTextMark.reset(new OUString(read_uInt32_lenPrefixed_uInt16s_ToOUString(rStrm))); + if (clipToFirstNull(*xTextMark)) + SAL_WARN("sw.ww8", "HLINK_MARK with embedded null, truncating to: " << *xTextMark); } if (!xLongName && xShortName) From 6926c820ceea1a1337a97b0afda95b072027a6ff Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 5 Dec 2024 19:17:54 +0100 Subject: [PATCH 155/155] Resolves: tdf#164124 Do not trap incomplete date 2021-6/1 as fraction In fact do not accept anything else than blanks after integer portion for a fraction. Change-Id: I29746bb7cd78ecc6a7810e8841bee748589a36e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177899 Reviewed-by: Eike Rathke Tested-by: Jenkins --- svl/source/numbers/zforfind.cxx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 9e3a7bc277a7..13cdcb3ca53b 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -2564,6 +2564,20 @@ bool ImpSvNumberInputScan::ScanStartString( const OUString& rString ) } +static bool lcl_isBlanks( const OUString& rStr ) +{ + if (rStr.isEmpty()) + return false; + + for (sal_Int32 i = rStr.getLength(); i-- > 0; ) + { + if (rStr[i] != ' ') + return false; + } + return true; +} + + /** * Analyze string in the middle * All gone => true @@ -2665,8 +2679,9 @@ bool ImpSvNumberInputScan::ScanMidString( const OUString& rString, sal_uInt16 nS (nNumericsCnt == 3 && // or 3 numbers (nStringPos == 3 || // and 4th string particle (nStringPos == 4 && nSign)) && // or 5th if signed - sStrArray[nStringPos-2].indexOf('/') == -1))) // and not 23/11/1999 - // that was not accepted as date yet + lcl_isBlanks(sStrArray[nStringPos-2])))) // and not 23/11/1999 + // that was not accepted as date yet, + // nor anything else than blanks after integer. { SkipBlanks(rString, nPos); if (nPos == rString.getLength())