Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3118
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/18/3118/1
Get rid of the slots.cfg mechanism
I very much doubt anybody is using it. It has never been documented as far as
I can see for OpenOffice.org and even less for LibreOffice. I only found it
mentioned in the "StarOffice 6.0 Software Administration Guide".
Change-Id: I03f272427ef6717e3e3ff957f32ffe1f696d93c9
---
M sfx2/inc/sfx2/app.hxx
M sfx2/inc/sfx2/dispatch.hxx
M sfx2/source/appl/appmisc.cxx
M sfx2/source/control/dispatch.cxx
4 files changed, 3 insertions(+), 150 deletions(-)
diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx
index ab88440..bc8613f 100644
--- a/sfx2/inc/sfx2/app.hxx
+++ b/sfx2/inc/sfx2/app.hxx
@@ -251,8 +251,9 @@
SAL_DLLPRIVATE void Registrations_Impl();
SAL_DLLPRIVATE SfxWorkWindow* GetWorkWindow_Impl(const SfxViewFrame *pFrame=0) const;
- // TODO/CLEANUP: still needed?
- SAL_DLLPRIVATE std::vector<sal_uInt16>* GetDisabledSlotList_Impl();
+ // TODO/CLEANUP: still needed? -- unclear whether this comment
+ // refers to the GetDisabledSlotList_Impl() method which was
+ // already removed, or the below methods?
SAL_DLLPRIVATE SfxSlotPool& GetAppSlotPool_Impl() const;
SAL_DLLPRIVATE SfxModule* GetModule_Impl();
SAL_DLLPRIVATE ResMgr* GetOffResManager_Impl();
diff --git a/sfx2/inc/sfx2/dispatch.hxx b/sfx2/inc/sfx2/dispatch.hxx
index f871838..c7aaae3 100644
--- a/sfx2/inc/sfx2/dispatch.hxx
+++ b/sfx2/inc/sfx2/dispatch.hxx
@@ -182,7 +182,6 @@
SfxItemState QueryState( sal_uInt16 nSID, const SfxPoolItem* &rpState );
SfxItemState QueryState( sal_uInt16 nSID, ::com::sun::star::uno::Any& rAny );
- sal_Bool IsAllowed( sal_uInt16 nSlot ) const;
::com::sun::star::frame::XDispatch* GetDispatchInterface( const String& );
void SetDisableFlags( sal_uInt32 nFlags );
sal_uInt32 GetDisableFlags() const;
diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx
index bd55b24..2cd1336 100644
--- a/sfx2/source/appl/appmisc.cxx
+++ b/sfx2/source/appl/appmisc.cxx
@@ -155,88 +155,6 @@
return pAppData_Impl->pProgress;
}
-//------------------------------------------------------------------------
-
-std::vector<sal_uInt16>* SfxApplication::GetDisabledSlotList_Impl()
-{
- sal_Bool bError = sal_False;
- std::vector<sal_uInt16>* pList = pAppData_Impl->pDisabledSlotList;
- if ( !pList )
- {
- // Is there a slot file?
- INetURLObject aUserObj( SvtPathOptions().GetUserConfigPath() );
- aUserObj.insertName( "slots.cfg" );
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aUserObj.GetMainURL(
INetURLObject::NO_DECODE ), STREAM_STD_READ );
- if ( !pStream || pStream->GetError() == ERRCODE_IO_NOTEXISTS )
- {
- delete pStream;
- INetURLObject aObj( SvtPathOptions().GetConfigPath() );
- aObj.insertName( "slots.cfg" );
- pStream = ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL(
INetURLObject::NO_DECODE ), STREAM_STD_READ );
- }
-
- sal_Bool bSlotsEnabled = SvtInternalOptions().SlotCFGEnabled();
- sal_Bool bSlots = ( pStream && !pStream->GetError() );
- if( bSlots && bSlotsEnabled )
- {
- // Read Slot file
- String aTitle = pStream->ReadUniOrByteString(pStream->GetStreamCharSet());
- if ( aTitle.CompareToAscii("SfxSlotFile" ) == COMPARE_EQUAL )
- {
- sal_uInt16 nCount;
- (*pStream) >> nCount;
- pList = pAppData_Impl->pDisabledSlotList =
- new std::vector<sal_uInt16>;
-
- sal_uInt16 nSlot;
- for ( sal_uInt16 n=0; n<nCount; n++ )
- {
- (*pStream) >> nSlot;
- pList->push_back( nSlot );
- }
-
- aTitle = pStream->ReadUniOrByteString(pStream->GetStreamCharSet());
- if ( aTitle.CompareToAscii("END" ) != COMPARE_EQUAL || pStream->GetError() )
- {
- // Read failed
- DELETEZ( pList );
- bError = sal_True;
- }
- }
- else
- {
- // Stream detection failure
- bError = sal_True;
- }
- }
- else if ( bSlots != bSlotsEnabled )
- {
- // If no slot list entry, then no slot file shall exist
- bError = sal_True;
- }
-
- delete pStream;
- }
- else if ( pList == (std::vector<sal_uInt16>*) -1L )
- {
- return NULL;
- }
-
- if ( !pList )
- pAppData_Impl->pDisabledSlotList = (std::vector<sal_uInt16>*) -1L;
-
- if ( bError )
- {
- // If an entry slot is present, but no or faulty slot file, or a slot
- // file, but no slot entry, then this is considered to be a
- // misconfiguration
- new SfxSpecialConfigError_Impl( SfxResId( RID_SPECIALCONFIG_ERROR ).toString() );
- }
-
- return pList;
-}
-
-
SfxModule* SfxApplication::GetModule_Impl()
{
SfxModule* pModule = SfxModule::GetActiveModule();
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 00d4849..17394c7 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -146,7 +146,6 @@
// 2==ReadOnlyDoc overturned
sal_uInt16 nFilterCount; // Number of SIDs in pFilterSIDs
const sal_uInt16* pFilterSIDs; // sorted Array of SIDs
- std::vector<sal_uInt16>* pDisableList;
sal_uInt32 nDisableFlags;
};
@@ -307,7 +306,6 @@
{
pImp = new SfxDispatcher_Impl;
bFlushed = sal_True;
- SfxApplication *pSfxApp = SFX_APP();
pImp->pCachedServ1 = 0;
pImp->pCachedServ2 = 0;
@@ -324,7 +322,6 @@
pImp->bFilterEnabling = sal_False;
pImp->nFilterCount = 0;
pImp->pFilterSIDs = 0;
- pImp->pDisableList = pSfxApp->GetDisabledSlotList_Impl();
pImp->nDisableFlags = 0;
pImp->pParent = pParent;
@@ -1970,11 +1967,6 @@
pSlot = 0;
}
- if ( pSlot && !IsAllowed( nSlot ) )
- {
- pSlot = NULL;
- }
-
if ( pSlot )
{
rServer.SetSlot(pSlot);
@@ -2311,63 +2303,6 @@
pImp->pCachedServ2 = 0;
InvalidateBindings_Impl(sal_True);
}
-}
-
-sal_Bool SfxDispatcher::IsAllowed
-(
- sal_uInt16 nSlot
-) const
-/*
- [Description]
-
- The method checks whether the access is allowed on this interface.
- */
-{
- if ( !pImp->pDisableList )
- {
- return sal_True;
- }
-
- // BinSearch in the disable list
- std::vector<sal_uInt16>& rList = *pImp->pDisableList;
- sal_uInt16 nCount = rList.size();
- sal_uInt16 nLow = 0, nMid = 0, nHigh;
- sal_Bool bFound = sal_False;
- nHigh = nCount - 1;
-
- while ( !bFound && nLow <= nHigh )
- {
- nMid = (nLow + nHigh) >> 1;
- DBG_ASSERT( nMid < nCount, "bsearch is buggy" );
-
- int nDiff = (int) nSlot - (int) rList[nMid];
- if ( nDiff < 0)
- {
- if ( nMid == 0 )
- break;
- nHigh = nMid - 1;
- }
- else if ( nDiff > 0 )
- {
- nLow = nMid + 1;
- if ( nLow == 0 )
- break;
- }
- else
- bFound = sal_True;
- }
-
-#ifdef _DEBUG
- // Slot found in the List?
- sal_uInt16 nPos = bFound ? nMid : nLow;
-
- DBG_ASSERT( nPos <= nCount, "" );
- DBG_ASSERT( nPos == nCount || nSlot <= rList[nPos], "" );
- DBG_ASSERT( nPos == 0 || nSlot > rList[nPos-1], "" );
- DBG_ASSERT( ( (nPos+1) >= nCount ) || nSlot < rList[nPos+1], "" );
-#endif
-
- return !bFound;
}
void SfxDispatcher::InvalidateBindings_Impl( sal_Bool bModify )
--
To view, visit https://gerrit.libreoffice.org/3118
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I03f272427ef6717e3e3ff957f32ffe1f696d93c9
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Tor Lillqvist <tml@iki.fi>
Context
- [PATCH] Get rid of the slots.cfg mechanism · Tor Lillqvist (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.