Kaydet (Commit) 75a271fd authored tarafından Caolán McNamara's avatar Caolán McNamara

can now remove ResId based config id scheme

Change-Id: Id1ad413dacc7eb07269debba65426236bef28610
Reviewed-on: https://gerrit.libreoffice.org/52259Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 840be9fd
...@@ -45,7 +45,6 @@ class FixedLine; ...@@ -45,7 +45,6 @@ class FixedLine;
class SFX2_DLLPUBLIC SfxModalDialog: public ModalDialog class SFX2_DLLPUBLIC SfxModalDialog: public ModalDialog
{ {
sal_uInt32 nUniqId;
OUString aExtraData; OUString aExtraData;
const SfxItemSet* pInputSet; const SfxItemSet* pInputSet;
SfxItemSet* pOutputSet; SfxItemSet* pOutputSet;
...@@ -61,8 +60,6 @@ protected: ...@@ -61,8 +60,6 @@ protected:
SfxModalDialog(vcl::Window *pParent, const OUString& rID, const OUString& rUIXMLDescription); SfxModalDialog(vcl::Window *pParent, const OUString& rID, const OUString& rUIXMLDescription);
OUString& GetExtraData() { return aExtraData; } OUString& GetExtraData() { return aExtraData; }
sal_uInt32 GetUniqId() const { return nUniqId; }
void SetUniqId(sal_uInt32 nSettingsId) { nUniqId = nSettingsId; }
void CreateOutputItemSet( SfxItemPool& rPool ); void CreateOutputItemSet( SfxItemPool& rPool );
void CreateOutputItemSet( const SfxItemSet& rInput ); void CreateOutputItemSet( const SfxItemSet& rInput );
void SetInputSet( const SfxItemSet* pInSet ) { pInputSet = pInSet; } void SetInputSet( const SfxItemSet* pInSet ) { pInputSet = pInSet; }
...@@ -177,7 +174,7 @@ public: ...@@ -177,7 +174,7 @@ public:
virtual ~SfxSingleTabDialog() override; virtual ~SfxSingleTabDialog() override;
virtual void dispose() override; virtual void dispose() override;
void SetTabPage(SfxTabPage* pTabPage, sal_uInt32 nSettingsId = 0); void SetTabPage(SfxTabPage* pTabPage);
SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; } SfxTabPage* GetTabPage() const { return pImpl->m_pSfxPage; }
OKButton* GetOKButton() const { return pOKBtn; } OKButton* GetOKButton() const { return pOKBtn; }
......
...@@ -201,7 +201,6 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void) ...@@ -201,7 +201,6 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void)
{ {
OUString aText; OUString aText;
VclPtrInstance< SfxSingleTabDialog > pDlg(this, aDataSet); VclPtrInstance< SfxSingleTabDialog > pDlg(this, aDataSet);
const int nSettingsId = 42;
bool bRightPage = m_pCntSharedBox->IsChecked() bool bRightPage = m_pCntSharedBox->IsChecked()
|| ( SvxPageUsage::Left != nPageUsage ); || ( SvxPageUsage::Left != nPageUsage );
...@@ -209,17 +208,17 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void) ...@@ -209,17 +208,17 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void)
{ {
aText = ScGlobal::GetRscString( STR_PAGEHEADER ); aText = ScGlobal::GetRscString( STR_PAGEHEADER );
if ( bRightPage ) if ( bRightPage )
pDlg->SetTabPage( ScRightHeaderEditPage::Create( pDlg->get_content_area(), &aDataSet ), nSettingsId ); pDlg->SetTabPage( ScRightHeaderEditPage::Create( pDlg->get_content_area(), &aDataSet ) );
else else
pDlg->SetTabPage( ScLeftHeaderEditPage::Create( pDlg->get_content_area(), &aDataSet ), nSettingsId ); pDlg->SetTabPage( ScLeftHeaderEditPage::Create( pDlg->get_content_area(), &aDataSet ) );
} }
else else
{ {
aText = ScGlobal::GetRscString( STR_PAGEFOOTER ); aText = ScGlobal::GetRscString( STR_PAGEFOOTER );
if ( bRightPage ) if ( bRightPage )
pDlg->SetTabPage( ScRightFooterEditPage::Create( pDlg->get_content_area(), &aDataSet ), nSettingsId ); pDlg->SetTabPage( ScRightFooterEditPage::Create( pDlg->get_content_area(), &aDataSet ) );
else else
pDlg->SetTabPage( ScLeftFooterEditPage::Create( pDlg->get_content_area(), &aDataSet ), nSettingsId ); pDlg->SetTabPage( ScLeftFooterEditPage::Create( pDlg->get_content_area(), &aDataSet ) );
} }
SvxNumType eNumType = aDataSet.Get(ATTR_PAGE).GetNumType(); SvxNumType eNumType = aDataSet.Get(ATTR_PAGE).GetNumType();
......
...@@ -93,15 +93,7 @@ void SfxFloatingWindow_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) ...@@ -93,15 +93,7 @@ void SfxFloatingWindow_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint )
void SfxModalDialog::SetDialogData_Impl() void SfxModalDialog::SetDialogData_Impl()
{ {
// save settings (position and user data) // save settings (position and user data)
OUString sConfigId; OUString sConfigId = OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8);
if (isLayoutEnabled())
sConfigId = OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8);
else
{
SAL_WARN("sfx.config", "Dialog needs to be converted to .ui format");
sConfigId = OUString::number(nUniqId);
}
SvtViewOptions aDlgOpt(EViewType::Dialog, sConfigId); SvtViewOptions aDlgOpt(EViewType::Dialog, sConfigId);
aDlgOpt.SetWindowState(OStringToOUString( aDlgOpt.SetWindowState(OStringToOUString(
GetWindowState(WindowStateMask::Pos), RTL_TEXTENCODING_ASCII_US)); GetWindowState(WindowStateMask::Pos), RTL_TEXTENCODING_ASCII_US));
...@@ -119,15 +111,7 @@ void SfxModalDialog::GetDialogData_Impl() ...@@ -119,15 +111,7 @@ void SfxModalDialog::GetDialogData_Impl()
*/ */
{ {
OUString sConfigId; OUString sConfigId = OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8);
if (isLayoutEnabled())
sConfigId = OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8);
else
{
SAL_WARN("sfx.config", "Dialog needs to be converted to .ui format");
sConfigId = OUString::number(nUniqId);
}
SvtViewOptions aDlgOpt(EViewType::Dialog, sConfigId); SvtViewOptions aDlgOpt(EViewType::Dialog, sConfigId);
if ( aDlgOpt.Exists() ) if ( aDlgOpt.Exists() )
{ {
...@@ -142,7 +126,6 @@ void SfxModalDialog::GetDialogData_Impl() ...@@ -142,7 +126,6 @@ void SfxModalDialog::GetDialogData_Impl()
SfxModalDialog::SfxModalDialog(vcl::Window *pParent, const OUString& rID, const OUString& rUIXMLDescription ) SfxModalDialog::SfxModalDialog(vcl::Window *pParent, const OUString& rID, const OUString& rUIXMLDescription )
: ModalDialog(pParent, rID, rUIXMLDescription), : ModalDialog(pParent, rID, rUIXMLDescription),
nUniqId(0), //todo: remove this member when the ResId using ctor is removed
pInputSet(nullptr), pInputSet(nullptr),
pOutputSet(nullptr) pOutputSet(nullptr)
{ {
...@@ -682,12 +665,6 @@ IMPL_LINK_NOARG(SfxSingleTabDialog, OKHdl_Impl, Button*, void) ...@@ -682,12 +665,6 @@ IMPL_LINK_NOARG(SfxSingleTabDialog, OKHdl_Impl, Button*, void)
OUString sConfigId = OStringToOUString(pImpl->m_pSfxPage->GetConfigId(), OUString sConfigId = OStringToOUString(pImpl->m_pSfxPage->GetConfigId(),
RTL_TEXTENCODING_UTF8); RTL_TEXTENCODING_UTF8);
if (sConfigId.isEmpty())
{
SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format");
sConfigId = OUString::number(GetUniqId());
}
SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId);
aPageOpt.SetUserItem( USERITEM_NAME, makeAny( sData ) ); aPageOpt.SetUserItem( USERITEM_NAME, makeAny( sData ) );
EndDialog( RET_OK ); EndDialog( RET_OK );
...@@ -737,31 +714,21 @@ void SfxSingleTabDialog::dispose() ...@@ -737,31 +714,21 @@ void SfxSingleTabDialog::dispose()
SfxModalDialog::dispose(); SfxModalDialog::dispose();
} }
void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage,
sal_uInt32 nSettingsId)
/* [Description] /* [Description]
Insert a (new) TabPage; an existing page is deleted. Insert a (new) TabPage; an existing page is deleted.
The passed on page is initialized with the initially given Itemset The passed on page is initialized with the initially given Itemset
through calling Reset(). through calling Reset().
*/ */
void SfxSingleTabDialog::SetTabPage(SfxTabPage* pTabPage)
{ {
SetUniqId(nSettingsId);
pImpl->m_pSfxPage.disposeAndClear(); pImpl->m_pSfxPage.disposeAndClear();
pImpl->m_pSfxPage = pTabPage; pImpl->m_pSfxPage = pTabPage;
if ( pImpl->m_pSfxPage ) if ( pImpl->m_pSfxPage )
{ {
// First obtain the user data, only then Reset() // First obtain the user data, only then Reset()
OUString sConfigId = OStringToOUString(pImpl->m_pSfxPage->GetConfigId(), OUString sConfigId = OStringToOUString(pImpl->m_pSfxPage->GetConfigId(), RTL_TEXTENCODING_UTF8);
RTL_TEXTENCODING_UTF8);
if (sConfigId.isEmpty())
{
SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format");
sConfigId = OUString::number(GetUniqId());
}
SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId); SvtViewOptions aPageOpt(EViewType::TabPage, sConfigId);
Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME ); Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME );
OUString sUserData; OUString sUserData;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment