include/sfx2/SfxTabPage.hxx       |  155 ++++++++++++++++++++++++++
 include/sfx2/tabdlg.hxx           |  122 ---------------------
 sfx2/Library_sfx.mk               |    1 
 sfx2/source/dialog/SfxTabPage.cxx |  219 ++++++++++++++++++++++++++++++++++++++
 sfx2/source/dialog/tabdlg.cxx     |  215 -------------------------------------
 solenv/clang-format/excludelist   |    2 
 6 files changed, 379 insertions(+), 335 deletions(-)

New commits:
commit 97c85cae6516ec01d7370b594902d1bd862cfd62
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri Mar 6 13:13:41 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat Mar 7 07:21:54 2026 +0100

    sfx2: Move SfxTabPage to own header/source
    
    Move SfxTabPage out of the header/source file
    used for SfxTabDialogController into an own
    header and source file, to make it easier to
    keep an overview.
    
    Change-Id: I9b9e700ab70cd4b511f6152c78e38c018b777289
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201124
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/include/sfx2/SfxTabPage.hxx b/include/sfx2/SfxTabPage.hxx
new file mode 100644
index 000000000000..5d6143261436
--- /dev/null
+++ b/include/sfx2/SfxTabPage.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * 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 <memory>
+#include <unordered_map>
+
+#include <sal/config.h>
+#include <sfx2/dllapi.h>
+#include <sfx2/basedlgs.hxx>
+#include <sal/types.h>
+#include <vcl/builderpage.hxx>
+#include <svl/itempool.hxx>
+#include <svl/itemset.hxx>
+#include <svl/setitem.hxx>
+#include <o3tl/typed_flags_set.hxx>
+
+namespace com::sun::star::frame { class XFrame; }
+
+enum class DeactivateRC {
+    KeepPage   = 0x00,      // Error handling; page does not change
+    // 2. Fill an itemset for update
+    // parent examples, this pointer can be NULL all the time!
+    LeavePage  = 0x01,
+    // Set, refresh and update other Page
+    RefreshSet = 0x02
+};
+namespace o3tl {
+template<> struct typed_flags<DeactivateRC> : is_typed_flags<DeactivateRC, 
0x03> {};
+}
+
+class SFX2_DLLPUBLIC SfxTabPage : public BuilderPage
+{
+    friend class SfxTabDialog;
+    friend class SfxTabDialogController;
+
+private:
+    const SfxItemSet* mpSet;
+    OUString maUserString;
+    bool mbHasExchangeSupport;
+    bool mbCancel;
+    std::unordered_map<OUString, css::uno::Any> maAdditionalProperties;
+
+    bool mbStandard;
+    SfxOkDialogController* mpSfxDialogController;
+    css::uno::Reference<css::frame::XFrame> mxFrame;
+
+protected:
+    SfxTabPage(weld::Container* pPage, weld::DialogController* pController, 
const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet 
*rAttrSet);
+
+    sal_uInt16          GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const
+    {
+        return mpSet->GetPool()->GetWhichIDFromSlotID(nSlot, bDeep);
+    }
+    template<class T>
+    TypedWhichId<T> GetWhich( TypedWhichId<T> nSlot, bool bDeep = true ) const
+    {
+        return TypedWhichId<T>(GetWhich(sal_uInt16(nSlot), bDeep));
+    }
+
+    const SfxPoolItem*  GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, 
bool bDeep = true );
+    template<class T> const T* GetOldItem( const SfxItemSet& rSet, 
TypedWhichId<T> nSlot, bool bDeep = true )
+    {
+        return static_cast<const T*>(GetOldItem(rSet, sal_uInt16(nSlot), 
bDeep));
+    }
+
+    SfxOkDialogController* GetDialogController() const;
+public:
+    void                SetDialogController(SfxOkDialogController* pDialog);
+public:
+    virtual             ~SfxTabPage() override;
+
+    void set_visible(bool bVisible)
+    {
+        m_xContainer->set_visible(bVisible);
+    }
+
+    const SfxItemSet& GetItemSet() const
+    {
+        return *mpSet;
+    }
+
+    virtual bool        FillItemSet( SfxItemSet* );
+    virtual void        Reset( const SfxItemSet* );
+    // Allows to postpone some initialization to the first activation
+    virtual bool        DeferResetToFirstActivation();
+
+    bool HasExchangeSupport() const
+    {
+        return mbHasExchangeSupport;
+    }
+
+    void SetExchangeSupport()
+    {
+        mbHasExchangeSupport = true;
+    }
+
+    virtual void            ActivatePage( const SfxItemSet& );
+    virtual DeactivateRC    DeactivatePage( SfxItemSet* pSet );
+    void SetUserData(const OUString& rString)
+    {
+        maUserString = rString;
+    }
+    const OUString& GetUserData() const
+    {
+        return maUserString;
+    }
+    virtual void            FillUserData();
+    virtual bool            IsReadOnly() const;
+    // Whether the user has canceled the dialog. Allows to restore settings, 
etc.
+    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 );
+    template<class T> static const T* GetItem( const SfxItemSet& rSet, 
TypedWhichId<T> nSlot, bool bDeep = true )
+    {
+        return static_cast<const T*>(GetItem(rSet, sal_uInt16(nSlot), bDeep));
+    }
+
+    virtual OUString GetAllStrings();
+    void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame);
+    css::uno::Reference< css::frame::XFrame > GetFrame() const;
+
+    const SfxItemSet* GetDialogExampleSet() const;
+
+    OUString        GetHelpId() const;
+    OUString        GetConfigId() const { return GetHelpId(); }
+    bool            IsVisible() const { return m_xContainer->get_visible(); }
+
+    weld::Window*   GetFrameWeld() const;
+
+    std::unordered_map<OUString, css::uno::Any>& getAdditionalProperties()
+    {
+        return maAdditionalProperties;
+    }
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index e9aba9e8a0ff..e0a7013e1294 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -19,11 +19,11 @@
 #pragma once
 
 #include <memory>
-#include <unordered_map>
 #include <string_view>
 #include <set>
 
 #include <sal/config.h>
+#include <sfx2/SfxTabPage.hxx>
 #include <sfx2/dllapi.h>
 #include <sfx2/basedlgs.hxx>
 #include <sal/types.h>
@@ -39,14 +39,11 @@ class SfxTabPage;
 
 typedef std::unique_ptr<SfxTabPage> (*CreateTabPage)(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet *rAttrSet);
 typedef const WhichRangesContainer & (*GetTabPageRanges)(); // provides 
international Which-value
-struct TabPageImpl;
 
 struct TabDlg_Impl;
 
 namespace weld { class Notebook; }
 
-namespace com::sun::star::frame { class XFrame; }
-
 #define RET_USER        100
 
 class SFX2_DLLPUBLIC SfxTabDialogItem final : public SfxSetItem
@@ -210,123 +207,4 @@ public:
     OUString GetScreenshotId() const;
 };
 
-enum class DeactivateRC {
-    KeepPage   = 0x00,      // Error handling; page does not change
-    // 2. Fill an itemset for update
-    // parent examples, this pointer can be NULL all the time!
-    LeavePage  = 0x01,
-    // Set, refresh and update other Page
-    RefreshSet = 0x02
-};
-namespace o3tl {
-    template<> struct typed_flags<DeactivateRC> : is_typed_flags<DeactivateRC, 
0x03> {};
-}
-
-class SFX2_DLLPUBLIC SfxTabPage : public BuilderPage
-{
-friend class SfxTabDialog;
-friend class SfxTabDialogController;
-
-private:
-    const SfxItemSet* mpSet;
-    OUString maUserString;
-    bool mbHasExchangeSupport;
-    bool mbCancel;
-    std::unordered_map<OUString, css::uno::Any> maAdditionalProperties;
-
-    bool mbStandard;
-    SfxOkDialogController* mpSfxDialogController;
-    css::uno::Reference<css::frame::XFrame> mxFrame;
-
-protected:
-    SfxTabPage(weld::Container* pPage, weld::DialogController* pController, 
const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet 
*rAttrSet);
-
-    sal_uInt16          GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const
-    {
-        return mpSet->GetPool()->GetWhichIDFromSlotID(nSlot, bDeep);
-    }
-    template<class T>
-    TypedWhichId<T> GetWhich( TypedWhichId<T> nSlot, bool bDeep = true ) const
-    {
-        return TypedWhichId<T>(GetWhich(sal_uInt16(nSlot), bDeep));
-    }
-
-    const SfxPoolItem*  GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, 
bool bDeep = true );
-    template<class T> const T* GetOldItem( const SfxItemSet& rSet, 
TypedWhichId<T> nSlot, bool bDeep = true )
-    {
-        return static_cast<const T*>(GetOldItem(rSet, sal_uInt16(nSlot), 
bDeep));
-    }
-
-    SfxOkDialogController* GetDialogController() const;
-public:
-    void                SetDialogController(SfxOkDialogController* pDialog);
-public:
-    virtual             ~SfxTabPage() override;
-
-    void set_visible(bool bVisible)
-    {
-        m_xContainer->set_visible(bVisible);
-    }
-
-    const SfxItemSet& GetItemSet() const
-    {
-        return *mpSet;
-    }
-
-    virtual bool        FillItemSet( SfxItemSet* );
-    virtual void        Reset( const SfxItemSet* );
-    // Allows to postpone some initialization to the first activation
-    virtual bool        DeferResetToFirstActivation();
-
-    bool HasExchangeSupport() const
-    {
-        return mbHasExchangeSupport;
-    }
-
-    void SetExchangeSupport()
-    {
-        mbHasExchangeSupport = true;
-    }
-
-    virtual void            ActivatePage( const SfxItemSet& );
-    virtual DeactivateRC    DeactivatePage( SfxItemSet* pSet );
-    void SetUserData(const OUString& rString)
-    {
-        maUserString = rString;
-    }
-    const OUString& GetUserData() const
-    {
-        return maUserString;
-    }
-    virtual void            FillUserData();
-    virtual bool            IsReadOnly() const;
-    // Whether the user has canceled the dialog. Allows to restore settings, 
etc.
-    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 );
-    template<class T> static const T* GetItem( const SfxItemSet& rSet, 
TypedWhichId<T> nSlot, bool bDeep = true )
-    {
-        return static_cast<const T*>(GetItem(rSet, sal_uInt16(nSlot), bDeep));
-    }
-
-    virtual OUString GetAllStrings();
-    void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame);
-    css::uno::Reference< css::frame::XFrame > GetFrame() const;
-
-    const SfxItemSet* GetDialogExampleSet() const;
-
-    OUString        GetHelpId() const;
-    OUString        GetConfigId() const { return GetHelpId(); }
-    bool            IsVisible() const { return m_xContainer->get_visible(); }
-
-    weld::Window*   GetFrameWeld() const;
-
-    std::unordered_map<OUString, css::uno::Any>& getAdditionalProperties()
-    {
-        return maAdditionalProperties;
-    }
-};
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 669744b8fe7d..b0fb8d00fe9c 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -175,6 +175,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/devtools/ObjectInspectorTreeHandler \
     sfx2/source/devtools/ObjectInspectorWidgets \
     sfx2/source/dialog/AdditionsDialogHelper \
+    sfx2/source/dialog/SfxTabPage \
     sfx2/source/dialog/basedlgs \
     sfx2/source/dialog/checkin \
     sfx2/source/dialog/dialoghelper \
diff --git a/sfx2/source/dialog/SfxTabPage.cxx 
b/sfx2/source/dialog/SfxTabPage.cxx
new file mode 100644
index 000000000000..5e8ca1289b14
--- /dev/null
+++ b/sfx2/source/dialog/SfxTabPage.cxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * 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 <comphelper/lok.hxx>
+#include <sfx2/SfxTabPage.hxx>
+#include <sfx2/viewsh.hxx>
+#include <vcl/weld/Builder.hxx>
+#include <vcl/weld/Dialog.hxx>
+
+void SfxTabPage::SetFrame(const css::uno::Reference< css::frame::XFrame >& 
xFrame)
+{
+    mxFrame = xFrame;
+}
+
+css::uno::Reference< css::frame::XFrame > SfxTabPage::GetFrame() const
+{
+    return mxFrame;
+}
+
+static bool isLOKMobilePhone()
+{
+    if (!comphelper::LibreOfficeKit::isActive())
+        return false;
+    const SfxViewShell* pCurrentShell = SfxViewShell::Current();
+    return pCurrentShell && pCurrentShell->isLOKMobilePhone();
+}
+
+SfxTabPage::SfxTabPage(weld::Container* pPage, weld::DialogController* 
pController, const OUString& rUIXMLDescription, const OUString& rID, const 
SfxItemSet *rAttrSet)
+    : BuilderPage(pPage, pController, rUIXMLDescription, rID, 
isLOKMobilePhone())
+    , mpSet(rAttrSet)
+    , mbHasExchangeSupport(false)
+    , mbCancel(false)
+    , mbStandard(false)
+    , mpSfxDialogController(nullptr)
+{
+    mpSfxDialogController = 
dynamic_cast<SfxOkDialogController*>(m_pDialogController);
+}
+
+SfxTabPage::~SfxTabPage()
+{
+    if (m_xContainer)
+    {
+        std::unique_ptr<weld::Container> xParent(m_xContainer->weld_parent());
+        if (xParent)
+            xParent->move(m_xContainer.get(), nullptr);
+    }
+    m_xContainer.reset();
+    m_xBuilder.reset();
+}
+
+bool SfxTabPage::FillItemSet( SfxItemSet* )
+{
+    return false;
+}
+
+/*
+Returns the visible strings of a dialog.
+
+Supported items:
+- label
+- check button
+- radio button
+- toggle button
+- link button
+- button
+*/
+OUString SfxTabPage::GetAllStrings() { return OUString(); }
+
+void SfxTabPage::Reset( const SfxItemSet* )
+{
+}
+
+bool SfxTabPage::DeferResetToFirstActivation() { return false; }
+
+void SfxTabPage::ActivatePage( const SfxItemSet& )
+/*  [Description]
+
+    Default implementation of the virtual ActivatePage method. This method is
+    called when a page of dialogue supports the exchange of data between pages.
+    <SfxTabPage::DeactivatePage(SfxItemSet *)>
+*/
+{
+}
+
+DeactivateRC SfxTabPage::DeactivatePage( SfxItemSet* )
+
+/*  [Description]
+
+    Default implementation of the virtual DeactivatePage method. This method is
+    called by Sfx when leaving a page; the application can, through the return
+    value, control whether to leave the page. If the page is displayed through
+    bHasExchangeSupport which supports data exchange between pages, then a
+    pointer to the exchange set is passed as parameter. This takes on data for
+    the exchange, then the set is available as a parameter in
+    <SfxTabPage::ActivatePage(const SfxItemSet &)>.
+
+    [Return value]
+
+    DeactivateRC::LeavePage; Allow leaving the page
+*/
+{
+    return DeactivateRC::LeavePage;
+}
+
+void SfxTabPage::FillUserData()
+
+/*  [Description]
+
+    Virtual method is called by the base class in the destructor to save
+    specific information of the TabPage in the ini-file. When overriding a
+    string must be compiled, which is then flushed with the <SetUserData()>.
+*/
+{
+}
+
+bool SfxTabPage::IsReadOnly() const
+{
+    return false;
+}
+
+const SfxPoolItem* SfxTabPage::GetItem( const SfxItemSet& rSet, sal_uInt16 
nSlot, bool bDeep )
+
+/*  [Description]
+
+    static Method: hereby are the implementations of the TabPage code
+    being simplified.
+*/
+{
+    const SfxItemPool* pPool = rSet.GetPool();
+    sal_uInt16 nWh = pPool->GetWhichIDFromSlotID( nSlot, bDeep );
+    const SfxPoolItem* pItem = nullptr;
+    rSet.GetItemState( nWh, true, &pItem );
+
+    if ( !pItem && nWh != nSlot )
+        pItem = &pPool->GetUserOrPoolDefaultItem( nWh );
+    return pItem;
+}
+
+const SfxPoolItem* SfxTabPage::GetOldItem( const SfxItemSet& rSet,
+                                          sal_uInt16 nSlot, bool bDeep )
+
+/*  [Description]
+
+    This method returns an attribute for comparison of the old value.
+*/
+{
+    const SfxItemSet& rOldSet = GetItemSet();
+    sal_uInt16 nWh = GetWhich( nSlot, bDeep );
+    const SfxPoolItem* pItem = nullptr;
+
+    if (mbStandard && rOldSet.GetParent())
+        pItem = GetItem( *rOldSet.GetParent(), nSlot );
+    else if ( rSet.GetParent() &&
+             SfxItemState::INVALID == rSet.GetItemState( nWh ) )
+        pItem = GetItem( *rSet.GetParent(), nSlot );
+    else
+        pItem = GetItem( rOldSet, nSlot );
+    return pItem;
+}
+
+void SfxTabPage::PageCreated( const SfxAllItemSet& /*aSet*/ )
+{
+    SAL_WARN( "sfx.dialog", "SfxTabPage::PageCreated should not be called");
+}
+
+void SfxTabPage::ChangesApplied()
+{
+}
+
+void SfxTabPage::SetDialogController(SfxOkDialogController* pDialog)
+{
+    mpSfxDialogController = pDialog;
+    m_pDialogController = mpSfxDialogController;
+}
+
+SfxOkDialogController* SfxTabPage::GetDialogController() const
+{
+    return mpSfxDialogController;
+}
+
+OUString SfxTabPage::GetHelpId() const
+{
+    if (m_xContainer)
+        return m_xContainer->get_help_id();
+    return {};
+}
+
+weld::Window* SfxTabPage::GetFrameWeld() const
+{
+    if (m_pDialogController)
+        return m_pDialogController->getDialog();
+    return nullptr;
+}
+
+const SfxItemSet* SfxTabPage::GetDialogExampleSet() const
+{
+    if (mpSfxDialogController)
+        return mpSfxDialogController->GetExampleSet();
+    return nullptr;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 8a4e2b9ede60..ae478c892a78 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -113,206 +113,6 @@ static auto Find(const SfxTabDlgData_Impl& rArr, 
std::u16string_view rId)
                         [rId](const auto& item) { return item->sId == rId; });
 }
 
-void SfxTabPage::SetFrame(const css::uno::Reference< css::frame::XFrame >& 
xFrame)
-{
-    mxFrame = xFrame;
-}
-
-css::uno::Reference< css::frame::XFrame > SfxTabPage::GetFrame() const
-{
-    return mxFrame;
-}
-
-static bool isLOKMobilePhone()
-{
-    if (!comphelper::LibreOfficeKit::isActive())
-        return false;
-    const SfxViewShell* pCurrentShell = SfxViewShell::Current();
-    return pCurrentShell && pCurrentShell->isLOKMobilePhone();
-}
-
-SfxTabPage::SfxTabPage(weld::Container* pPage, weld::DialogController* 
pController, const OUString& rUIXMLDescription, const OUString& rID, const 
SfxItemSet *rAttrSet)
-    : BuilderPage(pPage, pController, rUIXMLDescription, rID, 
isLOKMobilePhone())
-    , mpSet(rAttrSet)
-    , mbHasExchangeSupport(false)
-    , mbCancel(false)
-    , mbStandard(false)
-    , mpSfxDialogController(nullptr)
-{
-    mpSfxDialogController = 
dynamic_cast<SfxOkDialogController*>(m_pDialogController);
-}
-
-SfxTabPage::~SfxTabPage()
-{
-    if (m_xContainer)
-    {
-        std::unique_ptr<weld::Container> xParent(m_xContainer->weld_parent());
-        if (xParent)
-            xParent->move(m_xContainer.get(), nullptr);
-    }
-    m_xContainer.reset();
-    m_xBuilder.reset();
-}
-
-bool SfxTabPage::FillItemSet( SfxItemSet* )
-{
-    return false;
-}
-
-/*
-Returns the visible strings of a dialog.
-
-Supported items:
-- label
-- check button
-- radio button
-- toggle button
-- link button
-- button
-*/
-OUString SfxTabPage::GetAllStrings() { return OUString(); }
-
-void SfxTabPage::Reset( const SfxItemSet* )
-{
-}
-
-bool SfxTabPage::DeferResetToFirstActivation() { return false; }
-
-void SfxTabPage::ActivatePage( const SfxItemSet& )
-/*  [Description]
-
-    Default implementation of the virtual ActivatePage method. This method is
-    called when a page of dialogue supports the exchange of data between pages.
-    <SfxTabPage::DeactivatePage(SfxItemSet *)>
-*/
-{
-}
-
-DeactivateRC SfxTabPage::DeactivatePage( SfxItemSet* )
-
-/*  [Description]
-
-    Default implementation of the virtual DeactivatePage method. This method is
-    called by Sfx when leaving a page; the application can, through the return
-    value, control whether to leave the page. If the page is displayed through
-    bHasExchangeSupport which supports data exchange between pages, then a
-    pointer to the exchange set is passed as parameter. This takes on data for
-    the exchange, then the set is available as a parameter in
-    <SfxTabPage::ActivatePage(const SfxItemSet &)>.
-
-    [Return value]
-
-    DeactivateRC::LeavePage; Allow leaving the page
-*/
-
-{
-    return DeactivateRC::LeavePage;
-}
-
-
-void SfxTabPage::FillUserData()
-
-/*  [Description]
-
-    Virtual method is called by the base class in the destructor to save
-    specific information of the TabPage in the ini-file. When overriding a
-    string must be compiled, which is then flushed with the <SetUserData()>.
-*/
-
-{
-}
-
-
-bool SfxTabPage::IsReadOnly() const
-{
-    return false;
-}
-
-
-const SfxPoolItem* SfxTabPage::GetItem( const SfxItemSet& rSet, sal_uInt16 
nSlot, bool bDeep )
-
-/*  [Description]
-
-    static Method: hereby are the implementations of the TabPage code
-    being simplified.
-*/
-
-{
-    const SfxItemPool* pPool = rSet.GetPool();
-    sal_uInt16 nWh = pPool->GetWhichIDFromSlotID( nSlot, bDeep );
-    const SfxPoolItem* pItem = nullptr;
-    rSet.GetItemState( nWh, true, &pItem );
-
-    if ( !pItem && nWh != nSlot )
-        pItem = &pPool->GetUserOrPoolDefaultItem( nWh );
-    return pItem;
-}
-
-
-const SfxPoolItem* SfxTabPage::GetOldItem( const SfxItemSet& rSet,
-                                           sal_uInt16 nSlot, bool bDeep )
-
-/*  [Description]
-
-    This method returns an attribute for comparison of the old value.
-*/
-
-{
-    const SfxItemSet& rOldSet = GetItemSet();
-    sal_uInt16 nWh = GetWhich( nSlot, bDeep );
-    const SfxPoolItem* pItem = nullptr;
-
-    if (mbStandard && rOldSet.GetParent())
-        pItem = GetItem( *rOldSet.GetParent(), nSlot );
-    else if ( rSet.GetParent() &&
-              SfxItemState::INVALID == rSet.GetItemState( nWh ) )
-        pItem = GetItem( *rSet.GetParent(), nSlot );
-    else
-        pItem = GetItem( rOldSet, nSlot );
-    return pItem;
-}
-
-void SfxTabPage::PageCreated( const SfxAllItemSet& /*aSet*/ )
-{
-    SAL_WARN( "sfx.dialog", "SfxTabPage::PageCreated should not be called");
-}
-
-void SfxTabPage::ChangesApplied()
-{
-}
-
-void SfxTabPage::SetDialogController(SfxOkDialogController* pDialog)
-{
-    mpSfxDialogController = pDialog;
-    m_pDialogController = mpSfxDialogController;
-}
-
-SfxOkDialogController* SfxTabPage::GetDialogController() const
-{
-    return mpSfxDialogController;
-}
-
-OUString SfxTabPage::GetHelpId() const
-{
-    if (m_xContainer)
-        return m_xContainer->get_help_id();
-    return {};
-}
-
-weld::Window* SfxTabPage::GetFrameWeld() const
-{
-    if (m_pDialogController)
-        return m_pDialogController->getDialog();
-    return nullptr;
-}
-
-const SfxItemSet* SfxTabPage::GetDialogExampleSet() const
-{
-    if (mpSfxDialogController)
-        return mpSfxDialogController->GetExampleSet();
-    return nullptr;
-}
-
 SfxTabDialogController::SfxTabDialogController
 (
     weld::Widget* pParent,              // Parent Window
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 2b195b12088a..71849a8b4afe 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -5297,6 +5297,7 @@ include/sax/tools/converter.hxx
 include/sax/tools/documenthandleradapter.hxx
 include/sfx2/DocumentMetadataAccess.hxx
 include/sfx2/Metadatable.hxx
+include/sfx2/SfxTabPage.hxx
 include/sfx2/StyleManager.hxx
 include/sfx2/StylePreviewRenderer.hxx
 include/sfx2/XmlIdRegistry.hxx
@@ -10004,6 +10005,7 @@ sfx2/source/control/thumbnailviewitemacc.cxx
 sfx2/source/control/thumbnailviewitemacc.hxx
 sfx2/source/control/thumbnailviewitem.cxx
 sfx2/source/control/unoctitm.cxx
+sfx2/source/dialog/SfxTabPage.cxx
 sfx2/source/dialog/backingcomp.cxx
 sfx2/source/dialog/backingwindow.cxx
 sfx2/source/dialog/basedlgs.cxx
commit 001abaa43e40088934e96cbc439401c28c481169
Author:     Michael Weghorn <[email protected]>
AuthorDate: Fri Mar 6 13:33:44 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Sat Mar 7 07:21:42 2026 +0100

    sfx2: Merge TabPageImpl into SfxTabPage
    
    Move the three extra members directly into SfxTabPage
    instead of having an impl class that holds only some
    of the data.
    
    SfxTabPage::mpImpl was previously allocated in the ctor
    and only reset in the dtor, i.e. it was always non-null
    during the lifetime of the SfxTabpage and the extra
    null checks in SfxTabPage::{G,S}etFrame were
    unnecessary.
    
    Change-Id: I59019064649f4d505cd8c4b7ccb7a7ea83e085e8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201123
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index adae4b8b7559..e9aba9e8a0ff 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -234,7 +234,9 @@ private:
     bool mbCancel;
     std::unordered_map<OUString, css::uno::Any> maAdditionalProperties;
 
-    std::unique_ptr<TabPageImpl> mpImpl;
+    bool mbStandard;
+    SfxOkDialogController* mpSfxDialogController;
+    css::uno::Reference<css::frame::XFrame> mxFrame;
 
 protected:
     SfxTabPage(weld::Container* pPage, weld::DialogController* pController, 
const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet 
*rAttrSet);
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index a1309761d351..8a4e2b9ede60 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -51,16 +51,6 @@ using namespace ::com::sun::star::uno;
 
 constexpr OUString USERITEM_NAME = u"UserItem"_ustr;
 
-
-struct TabPageImpl
-{
-    bool                        mbStandard;
-    SfxOkDialogController*      mpSfxDialogController;
-    css::uno::Reference< css::frame::XFrame > mxFrame;
-
-    TabPageImpl() : mbStandard(false), mpSfxDialogController(nullptr) {}
-};
-
 namespace {
 
 struct Data_Impl
@@ -125,15 +115,12 @@ static auto Find(const SfxTabDlgData_Impl& rArr, 
std::u16string_view rId)
 
 void SfxTabPage::SetFrame(const css::uno::Reference< css::frame::XFrame >& 
xFrame)
 {
-    if (mpImpl)
-        mpImpl->mxFrame = xFrame;
+    mxFrame = xFrame;
 }
 
 css::uno::Reference< css::frame::XFrame > SfxTabPage::GetFrame() const
 {
-    if (mpImpl)
-        return mpImpl->mxFrame;
-    return css::uno::Reference< css::frame::XFrame >();
+    return mxFrame;
 }
 
 static bool isLOKMobilePhone()
@@ -149,9 +136,10 @@ SfxTabPage::SfxTabPage(weld::Container* pPage, 
weld::DialogController* pControll
     , mpSet(rAttrSet)
     , mbHasExchangeSupport(false)
     , mbCancel(false)
-    , mpImpl(new TabPageImpl)
+    , mbStandard(false)
+    , mpSfxDialogController(nullptr)
 {
-    mpImpl->mpSfxDialogController = 
dynamic_cast<SfxOkDialogController*>(m_pDialogController);
+    mpSfxDialogController = 
dynamic_cast<SfxOkDialogController*>(m_pDialogController);
 }
 
 SfxTabPage::~SfxTabPage()
@@ -163,7 +151,6 @@ SfxTabPage::~SfxTabPage()
             xParent->move(m_xContainer.get(), nullptr);
     }
     m_xContainer.reset();
-    mpImpl.reset();
     m_xBuilder.reset();
 }
 
@@ -275,7 +262,7 @@ const SfxPoolItem* SfxTabPage::GetOldItem( const 
SfxItemSet& rSet,
     sal_uInt16 nWh = GetWhich( nSlot, bDeep );
     const SfxPoolItem* pItem = nullptr;
 
-    if (mpImpl->mbStandard && rOldSet.GetParent())
+    if (mbStandard && rOldSet.GetParent())
         pItem = GetItem( *rOldSet.GetParent(), nSlot );
     else if ( rSet.GetParent() &&
               SfxItemState::INVALID == rSet.GetItemState( nWh ) )
@@ -296,13 +283,13 @@ void SfxTabPage::ChangesApplied()
 
 void SfxTabPage::SetDialogController(SfxOkDialogController* pDialog)
 {
-    mpImpl->mpSfxDialogController = pDialog;
-    m_pDialogController = mpImpl->mpSfxDialogController;
+    mpSfxDialogController = pDialog;
+    m_pDialogController = mpSfxDialogController;
 }
 
 SfxOkDialogController* SfxTabPage::GetDialogController() const
 {
-    return mpImpl->mpSfxDialogController;
+    return mpSfxDialogController;
 }
 
 OUString SfxTabPage::GetHelpId() const
@@ -321,8 +308,8 @@ weld::Window* SfxTabPage::GetFrameWeld() const
 
 const SfxItemSet* SfxTabPage::GetDialogExampleSet() const
 {
-    if (mpImpl->mpSfxDialogController)
-        return mpImpl->mpSfxDialogController->GetExampleSet();
+    if (mpSfxDialogController)
+        return mpSfxDialogController->GetExampleSet();
     return nullptr;
 }
 
@@ -524,7 +511,7 @@ IMPL_LINK_NOARG(SfxTabDialogController, BaseFmtHdl, 
weld::Button&, void)
     // Set all Items as new  -> the call the current Page Reset()
     assert((*it)->xTabPage && "the Page is gone");
     (*it)->xTabPage->Reset(&aTmpSet);
-    (*it)->xTabPage->mpImpl->mbStandard = true;
+    (*it)->xTabPage->mbStandard = true;
 }
 
 IMPL_LINK(SfxTabDialogController, ActivatePageHdl, const OUString&, rPage, 
void)

Reply via email to