Kaydet (Commit) 8d09602d authored tarafından Caolán McNamara's avatar Caolán McNamara

identify tab pages by name for save/storing active tab

Change-Id: Id66f8ff62ed08724702572f457b9fc857d567e89
Reviewed-on: https://gerrit.libreoffice.org/53465Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 9739749b
......@@ -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
......
......@@ -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>
......
......@@ -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();
......
......@@ -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()));
}
......
......@@ -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();
......
......@@ -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
......
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