include/unotools/viewoptions.hxx | 4 - officecfg/registry/schema/org/openoffice/Office/Views.xcs | 2 sfx2/source/appl/newhelp.cxx | 8 +-- sfx2/source/dialog/tabdlg.cxx | 4 - svx/source/form/datanavi.cxx | 8 +-- unotools/source/config/viewoptions.cxx | 29 ++++++-------- 6 files changed, 27 insertions(+), 28 deletions(-)
New commits: commit 8d09602d3382596facd716d8261a83d6883aa734 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Apr 25 13:04:43 2018 +0100 identify tab pages by name for save/storing active tab Change-Id: Id66f8ff62ed08724702572f457b9fc857d567e89 Reviewed-on: https://gerrit.libreoffice.org/53465 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/unotools/viewoptions.hxx b/include/unotools/viewoptions.hxx index 77e495d807fc..83bc1922b965 100644 --- a/include/unotools/viewoptions.hxx +++ b/include/unotools/viewoptions.hxx @@ -174,8 +174,8 @@ class SAL_WARN_UNUSED UNOTOOLS_DLLPUBLIC SvtViewOptions : public utl::detail::Op @onerror An assertion is thrown in debug version. Otherwise we do nothing! *//*-*****************************************************************************************************/ - sal_Int32 GetPageID( ) const; - void SetPageID( sal_Int32 nID ); + OString GetPageID() const; + void SetPageID(const OString& rID); /*-**************************************************************************************************** @short use it to set/get the visual state of a window diff --git a/officecfg/registry/schema/org/openoffice/Office/Views.xcs b/officecfg/registry/schema/org/openoffice/Office/Views.xcs index 63524a1d3815..a5e1998c090f 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Views.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Views.xcs @@ -46,7 +46,7 @@ <desc>Includes information (position,size, and states) about the used vcl window.</desc> </info> </prop> - <prop oor:name="PageID" oor:type="xs:int"> + <prop oor:name="PageID" oor:type="xs:string"> <info> <desc>Represents the number of an active tab page inside a dialog.</desc> </info> diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 8a561d3b471f..a8234eaa99bf 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -1427,11 +1427,11 @@ SfxHelpIndexWindow_Impl::SfxHelpIndexWindow_Impl(SfxHelpWindow_Impl* _pParent) m_pTabCtrl->SetActivatePageHdl( LINK( this, SfxHelpIndexWindow_Impl, ActivatePageHdl ) ); - sal_Int32 nPageId = m_pTabCtrl->GetPageId("index"); + OString sPageId("index"); SvtViewOptions aViewOpt( EViewType::TabDialog, CONFIGNAME_INDEXWIN ); if ( aViewOpt.Exists() ) - nPageId = aViewOpt.GetPageID(); - m_pTabCtrl->SetCurPageId( static_cast<sal_uInt16>(nPageId) ); + sPageId = aViewOpt.GetPageID(); + m_pTabCtrl->SetCurPageId(m_pTabCtrl->GetPageId(sPageId)); ActivatePageHdl( m_pTabCtrl ); m_pActiveLB->SetSelectHdl( LINK( this, SfxHelpIndexWindow_Impl, SelectHdl ) ); @@ -1460,7 +1460,7 @@ void SfxHelpIndexWindow_Impl::dispose() delete static_cast<OUString*>(m_pActiveLB->GetEntryData(i)); SvtViewOptions aViewOpt( EViewType::TabDialog, CONFIGNAME_INDEXWIN ); - aViewOpt.SetPageID( static_cast<sal_Int32>(m_pTabCtrl->GetCurPageId()) ); + aViewOpt.SetPageID(m_pTabCtrl->GetPageName(m_pTabCtrl->GetCurPageId())); disposeBuilder(); m_pActiveLB.clear(); diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index f31e12784316..afc827db416d 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -591,7 +591,7 @@ void SfxTabDialog::Start_Impl() SetWindowState(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_ASCII_US)); // initial TabPage from Program/Help/config - nActPage = static_cast<sal_uInt16>(aDlgOpt.GetPageID()); + nActPage = m_pTabCtrl->GetPageId(aDlgOpt.GetPageID()); if ( USHRT_MAX != m_nAppPageId ) nActPage = m_nAppPageId; @@ -775,7 +775,7 @@ void SfxTabDialog::SavePosAndId() SvtViewOptions aDlgOpt(EViewType::TabDialog, OStringToOUString(GetHelpId(),RTL_TEXTENCODING_UTF8)); aDlgOpt.SetWindowState(OStringToOUString(GetWindowState(WindowStateMask::Pos),RTL_TEXTENCODING_ASCII_US)); // to-do replace with name of page when all pages are converted to .ui - aDlgOpt.SetPageID( m_pTabCtrl->GetCurPageId() ); + aDlgOpt.SetPageID(m_pTabCtrl->GetPageName(m_pTabCtrl->GetCurPageId())); } diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index cdaabee98f10..3a7f2a2e7b40 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1377,11 +1377,11 @@ namespace svxform // init tabcontrol m_pTabCtrl->Show(); - sal_Int32 nPageId = m_pTabCtrl->GetPageId("instance"); + OString sPageId("instance"); SvtViewOptions aViewOpt( EViewType::TabDialog, CFGNAME_DATANAVIGATOR ); if ( aViewOpt.Exists() ) { - nPageId = aViewOpt.GetPageID(); + sPageId = aViewOpt.GetPageID(); aViewOpt.GetUserItem(CFGNAME_SHOWDETAILS) >>= m_bShowDetails; } @@ -1390,7 +1390,7 @@ namespace svxform pMenu->SetItemBits(nInstancesDetailsId, MenuItemBits::CHECKABLE ); pMenu->CheckItem(nInstancesDetailsId, m_bShowDetails ); - m_pTabCtrl->SetCurPageId( static_cast< sal_uInt16 >( nPageId ) ); + m_pTabCtrl->SetCurPageId(m_pTabCtrl->GetPageId(sPageId)); ActivatePageHdl(m_pTabCtrl); // get our frame @@ -1416,7 +1416,7 @@ namespace svxform void DataNavigatorWindow::dispose() { SvtViewOptions aViewOpt( EViewType::TabDialog, CFGNAME_DATANAVIGATOR ); - aViewOpt.SetPageID( static_cast< sal_Int32 >( m_pTabCtrl->GetCurPageId() ) ); + aViewOpt.SetPageID(m_pTabCtrl->GetPageName(m_pTabCtrl->GetCurPageId())); aViewOpt.SetUserItem(CFGNAME_SHOWDETAILS, Any(m_bShowDetails)); m_pInstPage.disposeAndClear(); diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx index 318b021ab90b..2bef4bb8463c 100644 --- a/unotools/source/config/viewoptions.cxx +++ b/unotools/source/config/viewoptions.cxx @@ -96,9 +96,9 @@ class SvtViewOptionsBase_Impl final css::uno::Sequence< css::beans::NamedValue > GetUserData ( const OUString& sName ); void SetUserData ( const OUString& sName , const css::uno::Sequence< css::beans::NamedValue >& lData ); - sal_Int32 GetPageID ( const OUString& sName ); + OString GetPageID ( const OUString& sName ); void SetPageID ( const OUString& sName , - sal_Int32 nID ); + const OString& sID ); State GetVisible ( const OUString& sName ); void SetVisible ( const OUString& sName , bool bVisible ); @@ -433,32 +433,31 @@ void SvtViewOptionsBase_Impl::SetUserItem( const OUString& sName , } } -sal_Int32 SvtViewOptionsBase_Impl::GetPageID( const OUString& sName ) +OString SvtViewOptionsBase_Impl::GetPageID( const OUString& sName ) { #ifdef DEBUG_VIEWOPTIONS ++m_nReadCount; #endif - sal_Int32 nID = 0; + OUString sID; try { css::uno::Reference< css::beans::XPropertySet > xNode( impl_getSetNode(sName, false), css::uno::UNO_QUERY); if (xNode.is()) - xNode->getPropertyValue(PROPERTY_PAGEID) >>= nID; + xNode->getPropertyValue(PROPERTY_PAGEID) >>= sID; } catch(const css::uno::Exception& ex) { - nID = 0; SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex) } - return nID; + return sID.toUtf8(); } void SvtViewOptionsBase_Impl::SetPageID( const OUString& sName , - sal_Int32 nID ) + const OString& sID ) { #ifdef DEBUG_VIEWOPTIONS ++m_nWriteCount; @@ -469,7 +468,7 @@ void SvtViewOptionsBase_Impl::SetPageID( const OUString& sName , css::uno::Reference< css::beans::XPropertySet > xNode( impl_getSetNode(sName, true), css::uno::UNO_QUERY_THROW); - xNode->setPropertyValue(PROPERTY_PAGEID, css::uno::makeAny(nID)); + xNode->setPropertyValue(PROPERTY_PAGEID, css::uno::makeAny(OUString::fromUtf8(sID))); ::comphelper::ConfigurationHelper::flush(m_xRoot); } catch(const css::uno::Exception& ex) @@ -792,7 +791,7 @@ void SvtViewOptions::SetWindowState( const OUString& sState ) // public method -sal_Int32 SvtViewOptions::GetPageID() const +OString SvtViewOptions::GetPageID() const { // Ready for multithreading ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); @@ -801,15 +800,15 @@ sal_Int32 SvtViewOptions::GetPageID() const // These call isn't allowed for dialogs, tab-pages or windows! OSL_ENSURE( !(m_eViewType==EViewType::Dialog||m_eViewType==EViewType::TabPage||m_eViewType==EViewType::Window), "SvtViewOptions::GetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!" ); - sal_Int32 nID = 0; + OString sID; if( m_eViewType == EViewType::TabDialog ) - nID = m_pDataContainer_TabDialogs->GetPageID( m_sViewName ); - return nID; + sID = m_pDataContainer_TabDialogs->GetPageID( m_sViewName ); + return sID; } // public method -void SvtViewOptions::SetPageID( sal_Int32 nID ) +void SvtViewOptions::SetPageID(const OString& rID) { // Ready for multithreading ::osl::MutexGuard aGuard( GetOwnStaticMutex() ); @@ -819,7 +818,7 @@ void SvtViewOptions::SetPageID( sal_Int32 nID ) OSL_ENSURE( !(m_eViewType==EViewType::Dialog||m_eViewType==EViewType::TabPage||m_eViewType==EViewType::Window), "SvtViewOptions::SetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!" ); if( m_eViewType == EViewType::TabDialog ) - m_pDataContainer_TabDialogs->SetPageID( m_sViewName, nID ); + m_pDataContainer_TabDialogs->SetPageID(m_sViewName, rID); } // public method _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits