summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-04-02 16:15:59 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-04-02 16:18:05 +0100
commit6fa98a08f2f4b57b660fc39542a9ceb20779d769 (patch)
treed8a1c426ffed351c4403ceb936eb0dd5189550db
parent31e4419ac7581aa7864905bcd4ce42e14df6c9bb (diff)
Related: fdo#75307 use the unique auto help id to identify tabpages
and dialogs that are loaded from the .ui format Change-Id: Id8abff6d89818ca7384d9691a05eacd378a5905c
-rw-r--r--include/sfx2/tabdlg.hxx1
-rw-r--r--include/vcl/tabpage.hxx2
-rw-r--r--sfx2/source/dialog/tabdlg.cxx35
-rw-r--r--vcl/source/window/tabpage.cxx8
4 files changed, 38 insertions, 8 deletions
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 4bc1138e71db..54baa7a023ba 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 a8ac279af746..88a1ead9b343 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 d12b5c4de1ff..853c806df913 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 a733824ece12..5e5526d6607d 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))