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 <m.weghorn@posteo.de> Tested-by: Jenkins
This commit is contained in:
@@ -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: */
|
||||
+1
-123
@@ -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: */
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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: */
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user