[Libreoffice-commits] core.git: sfx2/inc sfx2/source

Tor Lillqvist tml at iki.fi
Tue Apr 2 09:06:45 PDT 2013


 sfx2/inc/sfx2/app.hxx            |    5 +-
 sfx2/inc/sfx2/dispatch.hxx       |    1 
 sfx2/source/appl/appmisc.cxx     |   82 ---------------------------------------
 sfx2/source/control/dispatch.cxx |   65 ------------------------------
 4 files changed, 3 insertions(+), 150 deletions(-)

New commits:
commit a2bf98857b675b2d10a4fd93a0413229abebf3f1
Author: Tor Lillqvist <tml at iki.fi>
Date:   Fri Mar 29 11:52:00 2013 +0200

    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
    Reviewed-on: https://gerrit.libreoffice.org/3118
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

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 @@ public:
     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 @@ public:
     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 @@ SfxProgress* SfxApplication::GetProgress() const
     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 @@ struct SfxDispatcher_Impl
                                         // 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 @@ void SfxDispatcher::Construct_Impl( SfxDispatcher* pParent )
 {
     pImp = new SfxDispatcher_Impl;
     bFlushed = sal_True;
-    SfxApplication *pSfxApp = SFX_APP();
 
     pImp->pCachedServ1 = 0;
     pImp->pCachedServ2 = 0;
@@ -324,7 +322,6 @@ void SfxDispatcher::Construct_Impl( SfxDispatcher* pParent )
     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 @@ sal_Bool SfxDispatcher::_FindServer
                 pSlot = 0;
         }
 
-        if ( pSlot && !IsAllowed( nSlot ) )
-        {
-            pSlot = NULL;
-        }
-
         if ( pSlot )
         {
             rServer.SetSlot(pSlot);
@@ -2313,63 +2305,6 @@ void SfxDispatcher::RemoveShell_Impl( SfxShell& rShell )
     }
 }
 
-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 )
 {
     // App-Dispatcher?


More information about the Libreoffice-commits mailing list