37#include <sfx2/strings.hrc>
49 css::uno::Reference< css::frame::XFrame >
mxFrame;
61 std::unique_ptr<SfxTabPage> xTabPage;
69 fnCreatePage( fnPage ),
70 fnGetRanges ( fnRanges ),
105 aData.reserve( nCnt );
111 const sal_uInt16
nCount = rArr.size();
113 for ( sal_uInt16
i = 0;
i <
nCount; ++
i )
115 Data_Impl* pObj = rArr[
i];
117 if ( pObj->sId == rId )
137 return css::uno::Reference< css::frame::XFrame >();
141 :
BuilderPage(pPage, pController, rUIXMLDescription, rID,
145 , mbHasExchangeSupport(false)
155 std::unique_ptr<weld::Container> xParent(
m_xContainer->weld_parent());
236 sal_uInt16 nWh = pPool->
GetWhich( nSlot, bDeep );
240 if ( !pItem && nWh != nSlot )
247 sal_uInt16 nSlot,
bool bDeep )
256 sal_uInt16 nWh =
GetWhich( nSlot, bDeep );
265 pItem =
GetItem( rOldSet, nSlot );
271 SAL_WARN(
"sfx.dialog",
"SfxTabPage::PageCreated should not be called");
280 mpImpl->mpSfxDialogController = pDialog;
286 return mpImpl->mpSfxDialogController;
305 if (
mpImpl->mpSfxDialogController)
306 return mpImpl->mpSfxDialogController->GetExampleSet();
313 const OUString& rUIXMLDescription,
const OUString& rID,
319 , m_xTabCtrl(m_xBuilder->weld_notebook(
"tabcontrol"))
320 , m_xOKBtn(m_xBuilder->weld_button(
"ok"))
321 , m_xApplyBtn(m_xBuilder->weld_button(
"apply"))
322 , m_xUserBtn(m_xBuilder->weld_button(
"user"))
323 , m_xCancelBtn(m_xBuilder->weld_button(
"cancel"))
324 , m_xResetBtn(m_xBuilder->weld_button(
"reset"))
325 , m_xBaseFmtBtn(m_xBuilder->weld_button(
"standard"))
326 , m_pSet(pItemSet ? new
SfxItemSet(*pItemSet) : nullptr)
327 , m_bStandardPushed(false)
372 if (PrepareLeaveCurrentPage())
387 if (PrepareLeaveCurrentPage())
413 Data_Impl* pDataObject =
Find(
m_pImpl->aData, m_xTabCtrl->get_current_page_ident());
414 assert(pDataObject &&
"Id not known");
416 pDataObject->xTabPage->Reset(m_pSet.get());
418 if (!pDataObject->fnGetRanges)
427 for (
const auto & rPair : pTmpRanges)
430 sal_uInt16 nTmp = rPair.first, nTmpEnd = rPair.second;
431 DBG_ASSERT(nTmp <= nTmpEnd,
"Range is sorted the wrong way");
436 std::swap(nTmp, nTmpEnd);
439 while (nTmp && nTmp <= nTmpEnd)
442 sal_uInt16 nWh = pPool->
GetWhich(nTmp);
444 if (SfxItemState::SET == m_pSet->GetItemState(nWh,
false, &pItem))
446 m_xExampleSet->Put(*pItem);
447 m_pOutSet->Put(*pItem);
451 m_xExampleSet->ClearItem(nWh);
452 m_pOutSet->ClearItem(nWh);
467 m_bStandardPushed =
true;
469 Data_Impl* pDataObject =
Find(
m_pImpl->aData, m_xTabCtrl->get_current_page_ident());
470 assert(pDataObject &&
"Id not known");
472 if (!pDataObject->fnGetRanges)
482 for (
const auto& rPair : pTmpRanges)
485 sal_uInt16 nTmp = rPair.first, nTmpEnd = rPair.second;
486 DBG_ASSERT( nTmp <= nTmpEnd,
"Range is sorted the wrong way" );
488 if ( nTmp > nTmpEnd )
491 std::swap(nTmp, nTmpEnd);
494 while ( nTmp && nTmp <= nTmpEnd )
497 sal_uInt16 nWh = pPool->
GetWhich(nTmp);
498 m_xExampleSet->ClearItem(nWh);
499 aTmpSet.ClearItem(nWh);
502 m_pOutSet->InvalidateItem(nWh);
507 assert(pDataObject->xTabPage &&
"the Page is gone");
508 pDataObject->xTabPage->Reset( &aTmpSet );
509 pDataObject->xTabPage->mpImpl->mbStandard =
true;
526 assert(!
m_pImpl->aData.empty() &&
"no Pages registered");
527 Data_Impl* pDataObject =
Find(
m_pImpl->aData, rPage);
530 SAL_WARN(
"sfx.dialog",
"Tab Page ID '" << rPage <<
"' not known, this is pretty serious and needs investigation");
534 SfxTabPage* pTabPage = pDataObject->xTabPage.get();
538 if (pDataObject->bRefresh)
540 pDataObject->bRefresh =
false;
553 return DeactivatePage(rPage);
567 assert(!
m_pImpl->aData.empty() &&
"no Pages registered");
568 Data_Impl* pDataObject =
Find(
m_pImpl->aData, aPage);
571 SAL_WARN(
"sfx.dialog",
"Tab Page ID not known, this is pretty serious and needs investigation");
575 SfxTabPage* pPage = pDataObject->xTabPage.get();
619 for (
auto const& elem :
m_pImpl->aData)
621 elem->bRefresh = ( elem->xTabPage.get() != pPage );
630 Data_Impl* pDataObject =
Find(
m_pImpl->aData, sId);
632 SfxTabPage* pPage = pDataObject ? pDataObject->xTabPage.get() :
nullptr;
686 SAL_WARN(
"sfx.dialog",
"Set already exists!" );
687 return m_pSet->GetRanges();
694 for (
auto const& elem :
m_pImpl->aData)
697 if ( elem->fnGetRanges )
701 for (
const auto & rPair : pTmpRanges)
703 sal_uInt16 nWidFrom = rPool.
GetWhich(rPair.first);
704 sal_uInt16 nWidTo = rPool.
GetWhich(rPair.second);
705 aUS.MergeRange(nWidFrom, nWidTo);
718 for (
auto & elem :
m_pImpl->aData)
720 if ( elem->xTabPage )
723 elem->xTabPage->FillUserData();
724 OUString aPageData( elem->xTabPage->GetUserData() );
725 if ( !aPageData.isEmpty() )
728 SvtViewOptions aPageOpt(EViewType::TabPage, elem->xTabPage->GetConfigId());
732 elem->xTabPage.reset();
767 bool bModified =
false;
769 for (
auto const& elem :
m_pImpl->aData)
809 SAL_INFO (
"sfx.dialog",
"RefreshInputSet not implemented" );
832 aDlgOpt.SetPageID(
m_xTabCtrl->get_current_page_ident());
843 m_pImpl->aData.push_back(
new Data_Impl(rName, pCreateFunc, pRangesFunc));
847 sal_uInt16 nPageCreateId )
862 const OUString& rRiderText,
865 assert(!
m_xTabCtrl->get_page(rName) &&
"Double Page-Ids in the Tabpage");
871 sal_uInt16 nPageCreateId )
873 assert(!
m_xTabCtrl->get_page(rName) &&
"Double Page-Ids in the Tabpage");
885 SAL_WARN(
"sfx.dialog",
"CreateInputItemSet not implemented" );
892 for (
auto pDataObject :
m_pImpl->aData)
894 if (pDataObject->xTabPage)
898 pDataObject->xTabPage = (pDataObject->fnCreatePage)(pPage,
this,
m_pSet.get());
900 pDataObject->xTabPage = (pDataObject->fnCreatePage)(pPage,
this,
CreateInputItemSet(pDataObject->sId));
901 pDataObject->xTabPage->SetDialogController(
this);
902 SvtViewOptions aPageOpt(EViewType::TabPage, pDataObject->xTabPage->GetConfigId());
906 if ( aUserItem >>= aTemp )
908 pDataObject->xTabPage->SetUserData(sUserData);
910 PageCreated(pDataObject->sId, *pDataObject->xTabPage);
911 if (pDataObject->xTabPage->DeferResetToFirstActivation())
912 pDataObject->bRefresh =
true;
914 pDataObject->xTabPage->Reset(
m_pSet.get());
924 std::vector<std::unique_ptr<weld::Widget>> aGrids;
925 for (
auto pDataObject :
m_pImpl->aData)
927 if (!pDataObject->xTabPage)
929 if (!pDataObject->xTabPage->m_xBuilder)
931 std::unique_ptr<weld::Widget> pGrid = pDataObject->xTabPage->m_xBuilder->weld_widget(
"maingrid");
934 aGrids.emplace_back(std::move(pGrid));
939 if (aGrids.size() <= 1)
944 for (
auto& rGrid : aGrids)
962 if ( pDataObject->xTabPage )
964 pDataObject->xTabPage->FillUserData();
965 OUString aPageData( pDataObject->xTabPage->GetUserData() );
966 if ( !aPageData.isEmpty() )
969 SvtViewOptions aPageOpt(EViewType::TabPage, pDataObject->xTabPage->GetConfigId());
973 pDataObject->xTabPage.reset();
981 SAL_INFO(
"sfx.dialog",
"TabPage-Id not known" );
992 &&
"not all pages registered");
999 if (aDlgOpt.Exists())
1000 m_xTabCtrl->set_current_page(aDlgOpt.GetPageID());
1036 const std::function<
void(sal_Int32)>& rFunc)
1038 rController->Start_Impl();
1050 bool bSet = (
m_pSet != nullptr );
1075 m_pImpl->bHideResetBtn =
true;
1091 Data_Impl* pDataObject =
Find(
m_pImpl->aData, rPageId);
1093 return pDataObject->xTabPage.get();
1106 bool bApplied =
false;
1112 for (
auto pDataObject :
m_pImpl->aData)
1114 if (!pDataObject->xTabPage)
1116 pDataObject->xTabPage->ChangesApplied();
1125 std::vector<OUString> aRet;
1126 aRet.reserve(nPages);
1127 for (
int i = 0;
i < nPages; ++
i)
1128 aRet.push_back(
m_xTabCtrl->get_page_ident(i));
1135 return m_xTabCtrl->get_current_page_ident() == rUIXMLDescription;
1147 return xDialogSurface->GetBitmapEx(
Point(), xDialogSurface->GetOutputSizePixel());
1153 Data_Impl* pDataObject =
Find(
m_pImpl->aData, sId);
1154 SfxTabPage* pPage = pDataObject ? pDataObject->xTabPage.get() :
nullptr;
1158 if (!sHelpId.isEmpty())
SfxApplication * SfxGetpApp()
IMPL_LINK(SfxEventAsyncer_Impl, IdleHdl, Timer *, pAsyncIdle, void)
Reference< XExecutableDialog > m_xDialog
WhichRangesContainer(* GetTabPageRanges)()
std::unique_ptr< weld::Builder > m_xBuilder
weld::DialogController * m_pDialogController
std::unique_ptr< weld::Container > m_xContainer
virtual GetTabPageRanges GetTabPageRangesFunc(sal_uInt16 nId)=0
static SfxAbstractDialogFactory * Create()
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
const SfxItemSet * GetParent() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< SfxItemSet > m_pSet
bool PrepareLeaveCurrentPage()
prepare to leave the current page.
SfxTabPage * GetTabPage(std::u16string_view rPageId) const
void SetCurPageId(const OUString &rName)
OUString GetCurPageId() const
void AddTabPage(const OUString &rName, CreateTabPage pCreateFunc, GetTabPageRanges pRangesFunc)
void SetInputSet(const SfxItemSet *pInSet)
std::unique_ptr< TabDlg_Impl > m_pImpl
void SavePosAndId()
save the position of the TabDialog and which tab page is the currently active one
std::unique_ptr< weld::Button > m_xCancelBtn
SfxTabDialogController(weld::Widget *pParent, const OUString &rUIXMLDescription, const OUString &rID, const SfxItemSet *=nullptr, bool bEditFmt=false)
SAL_DLLPRIVATE void Start_Impl()
std::unique_ptr< weld::Button > m_xResetBtn
std::unique_ptr< SfxItemSet > m_pOutSet
void RemoveTabPage(const OUString &rName)
std::unique_ptr< SfxAllItemSet > m_xItemSet
std::unique_ptr< weld::Button > m_xUserBtn
virtual short run() override
std::unique_ptr< SfxItemSet > m_xExampleSet
OUString GetScreenshotId() const
void RemoveStandardButton()
std::unique_ptr< weld::Button > m_xBaseFmtBtn
WhichRangesContainer m_pRanges
std::unique_ptr< weld::Notebook > m_xTabCtrl
virtual void ActivatePage(const OUString &rPage)
std::unique_ptr< weld::Button > m_xOKBtn
virtual SfxItemSet * CreateInputItemSet(const OUString &rName)
virtual void PageCreated(const OUString &rName, SfxTabPage &rPage)
SAL_DLLPRIVATE void setPreviewsToSamePlace()
virtual void RefreshInputSet()
std::vector< OUString > getAllPageUIXMLDescriptions() const
void SetApplyHandler(const Link< weld::Button &, void > &_rHdl)
const SfxItemSet * GetOutputItemSet() const
BitmapEx createScreenshot() const
void ShowPage(const OUString &rName)
std::unique_ptr< weld::Button > m_xApplyBtn
const WhichRangesContainer & GetInputRanges(const SfxItemPool &)
std::unique_ptr< weld::SizeGroup > m_xSizeGroup
SAL_DLLPRIVATE void CreatePages()
static bool runAsync(const std::shared_ptr< SfxTabDialogController > &rController, const std::function< void(sal_Int32)> &)
SfxItemSet * GetInputSetImpl()
virtual ~SfxTabDialogController() override
bool selectPageByUIXMLDescription(const OUString &rUIXMLDescription)
bool DeactivatePage(std::u16string_view aPage)
virtual SfxTabDialogItem * Clone(SfxItemPool *pToPool=nullptr) const override
SfxTabDialogItem(sal_uInt16 nId, const SfxItemSet &rItemSet)
bool HasExchangeSupport() const
virtual void Reset(const SfxItemSet *)
SfxTabPage(weld::Container *pPage, weld::DialogController *pController, const OUString &rUIXMLDescription, const OUString &rID, const SfxItemSet *rAttrSet)
void SetDialogController(SfxOkDialogController *pDialog)
virtual void FillUserData()
virtual bool DeferResetToFirstActivation()
std::unique_ptr< TabPageImpl > mpImpl
virtual void PageCreated(const SfxAllItemSet &aSet)
virtual ~SfxTabPage() override
const SfxItemSet & GetItemSet() const
SfxOkDialogController * GetDialogController() const
css::uno::Reference< css::frame::XFrame > GetFrame() const
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet)
const SfxItemSet * GetDialogExampleSet() const
virtual bool FillItemSet(SfxItemSet *)
virtual bool IsReadOnly() const
void SetFrame(const css::uno::Reference< css::frame::XFrame > &xFrame)
virtual void ChangesApplied()
static const SfxPoolItem * GetItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
weld::Window * GetFrameWeld() const
virtual void ActivatePage(const SfxItemSet &)
OUString GetHelpId() const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
virtual Dialog * getDialog()=0
std::shared_ptr< weld::Dialog > m_xDialog
std::unique_ptr< weld::Builder > m_xBuilder
#define DBG_ASSERT(sCon, aError)
IMPL_LINK_NOARG(SvFileObject, LoadGrfReady_Impl, void *, void)
constexpr OUStringLiteral HID_TABDLG_RESET_BTN
constexpr OUStringLiteral HID_TABDLG_STANDARD_BTN
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
OUString SfxResId(TranslateId aId)
TabDlg_Impl(sal_uInt8 nCnt)
css::uno::Reference< css::frame::XFrame > mxFrame
SfxOkDialogController * mpSfxDialogController
bool empty() const noexcept
Reference< XFrame > xFrame
std::vector< Data_Impl * > SfxTabDlgData_Impl
constexpr OUStringLiteral USERITEM_NAME
static Data_Impl * Find(const SfxTabDlgData_Impl &rArr, std::u16string_view rId, sal_uInt16 *pPos=nullptr)
std::unique_ptr< SfxTabPage >(* CreateTabPage)(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)