[Libreoffice-commits] core.git: include/sfx2 include/vcl sfx2/source vcl/source
Caolán McNamara
caolanm at redhat.com
Wed Apr 2 08:18:36 PDT 2014
include/sfx2/tabdlg.hxx | 1 -
include/vcl/tabpage.hxx | 2 ++
sfx2/source/dialog/tabdlg.cxx | 35 ++++++++++++++++++++++++++++-------
vcl/source/window/tabpage.cxx | 8 ++++++++
4 files changed, 38 insertions(+), 8 deletions(-)
New commits:
commit 6fa98a08f2f4b57b660fc39542a9ceb20779d769
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Apr 2 16:15:59 2014 +0100
Related: fdo#75307 use the unique auto help id to identify tabpages
and dialogs that are loaded from the .ui format
Change-Id: Id8abff6d89818ca7384d9691a05eacd378a5905c
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 4bc1138..54baa7a 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -91,7 +91,6 @@ friend class SfxTabDialogController;
SfxItemSet* pOutSet;
TabDlg_Impl* pImpl;
sal_uInt16* pRanges;
- sal_uInt32 nResId;
sal_uInt16 nAppPageId;
bool bItemsReset;
sal_Bool bFmt; // sal_True, sal_False or 2(some kind of hack)
diff --git a/include/vcl/tabpage.hxx b/include/vcl/tabpage.hxx
index a8ac279..88a1ead 100644
--- a/include/vcl/tabpage.hxx
+++ b/include/vcl/tabpage.hxx
@@ -53,6 +53,8 @@ public:
virtual void ActivatePage();
virtual void DeactivatePage();
+ OString GetConfigId() const;
+
//To-Do, consider inheriting from VclContainer
virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize) SAL_OVERRIDE;
virtual void SetPosPixel(const Point& rNewPos) SAL_OVERRIDE;
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index d12b5c4..853c806 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -405,7 +405,6 @@ SfxTabDialog::SfxTabDialog
, pSet(pItemSet)
, pOutSet(0)
, pRanges(0)
- , nResId(0)
, nAppPageId(USHRT_MAX)
, bItemsReset(false)
, bFmt(bEditFmt)
@@ -436,7 +435,6 @@ SfxTabDialog::SfxTabDialog
, pSet(pItemSet)
, pOutSet(0)
, pRanges(0)
- , nResId(0)
, nAppPageId(USHRT_MAX)
, bItemsReset(false)
, bFmt(bEditFmt)
@@ -464,7 +462,15 @@ SfxTabDialog::~SfxTabDialog()
if ( !aPageData.isEmpty() )
{
// save settings of all pages (user data)
- SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( pDataObject->nId ) );
+ OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(),
+ RTL_TEXTENCODING_UTF8);
+ if (sConfigId.isEmpty())
+ {
+ SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format");
+ sConfigId = OUString::number(pDataObject->nId);
+ }
+
+ SvtViewOptions aPageOpt(E_TABPAGE, sConfigId);
aPageOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aPageData ) ) );
}
@@ -685,7 +691,7 @@ void SfxTabDialog::Start_Impl()
sal_uInt16 nActPage = m_pTabCtrl->GetPageId( 0 );
// load old settings, when exists
- SvtViewOptions aDlgOpt( E_TABDIALOG, OUString::number( nResId ) );
+ SvtViewOptions aDlgOpt(E_TABDIALOG, OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8));
if ( aDlgOpt.Exists() )
{
SetWindowState(OUStringToOString(aDlgOpt.GetWindowState().getStr(), RTL_TEXTENCODING_ASCII_US));
@@ -806,7 +812,15 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId )
if ( !aPageData.isEmpty() )
{
// save settings of this page (user data)
- SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( pDataObject->nId ) );
+ OUString sConfigId = OStringToOUString(pDataObject->pTabPage->GetConfigId(),
+ RTL_TEXTENCODING_UTF8);
+ if (sConfigId.isEmpty())
+ {
+ SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format");
+ sConfigId = OUString::number(pDataObject->nId);
+ }
+
+ SvtViewOptions aPageOpt(E_TABPAGE, sConfigId);
aPageOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aPageData ) ) );
}
@@ -882,8 +896,9 @@ SfxTabPage* SfxTabDialog::GetTabPage( sal_uInt16 nPageId ) const
void SfxTabDialog::SavePosAndId()
{
// save settings (screen position and current page)
- SvtViewOptions aDlgOpt( E_TABDIALOG, OUString::number( nResId ) );
+ SvtViewOptions aDlgOpt(E_TABDIALOG, OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8));
aDlgOpt.SetWindowState(OStringToOUString(GetWindowState(WINDOWSTATE_MASK_POS),RTL_TEXTENCODING_ASCII_US));
+ // to-do replace with name of page when all pages are converted to .ui
aDlgOpt.SetPageID( m_pTabCtrl->GetCurPageId() );
}
@@ -1252,7 +1267,13 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl )
DBG_ASSERT( NULL == pDataObject->pTabPage, "create TabPage more than once" );
pDataObject->pTabPage = pTabPage;
- SvtViewOptions aPageOpt( E_TABPAGE, OUString::number( pDataObject->nId ) );
+ OUString sConfigId = OStringToOUString(pTabPage->GetConfigId(), RTL_TEXTENCODING_UTF8);
+ if (sConfigId.isEmpty())
+ {
+ SAL_WARN("sfx.config", "Tabpage needs to be converted to .ui format");
+ sConfigId = OUString::number(pDataObject->nId);
+ }
+ SvtViewOptions aPageOpt(E_TABPAGE, sConfigId);
OUString sUserData;
Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME );
OUString aTemp;
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index a733824..5e5526d 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -181,6 +181,14 @@ void TabPage::DeactivatePage()
{
}
+OString TabPage::GetConfigId() const
+{
+ OString sId(GetHelpId());
+ if (sId.isEmpty() && isLayoutEnabled(this))
+ sId = GetWindow(WINDOW_FIRSTCHILD)->GetHelpId();
+ return sId;
+}
+
Size TabPage::GetOptimalSize() const
{
if (isLayoutEnabled(this))
More information about the Libreoffice-commits
mailing list