[Libreoffice-commits] core.git: 3 commits - idl/inc idl/source sc/sdi sw/sdi

Noel Grandin noel at peralex.com
Tue Feb 23 08:07:36 UTC 2016


 idl/inc/database.hxx        |    5 ++-
 idl/inc/parser.hxx          |    2 -
 idl/source/objects/slot.cxx |    2 -
 idl/source/prj/database.cxx |   32 ++++++++++++++---------
 idl/source/prj/parser.cxx   |   59 +++++++++++++++++---------------------------
 sc/sdi/docsh.sdi            |    6 ----
 sc/sdi/formatsh.sdi         |    8 +----
 sc/sdi/tabvwsh.sdi          |    8 ++---
 sw/sdi/_viewsh.sdi          |    8 -----
 9 files changed, 56 insertions(+), 74 deletions(-)

New commits:
commit 799eab3b3499be5846e13e6360cc01741a241f89
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Feb 23 08:43:39 2016 +0200

    methods in .SDI files don't use attributes
    
    so simplify the parser and drop the square brackets
    
    Change-Id: I3bab5f5b14e57d0cd1ed1a383fe21968f97b243a

diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index f9e2f0f..dc3340a 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -397,31 +397,25 @@ void SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr
         throw SvParseException( rInStm, "no value for identifier <" + rAttr.aSlotId.getString() + "> " );
     rAttr.aSlotId.SetValue(n);
 
-    if( ReadIf( '(' ) )
+    Read( '(' );
+    // read method arguments
+    tools::SvRef<SvMetaType> xT(new SvMetaType() );
+    xT->SetRef(rAttr.GetType() );
+    rAttr.aType = xT;
+    sal_uInt32 nBeginPos = 0; // can not happen with Tell
+    while( nBeginPos != rInStm.Tell() )
     {
-        // read method arguments
-        tools::SvRef<SvMetaType> xT(new SvMetaType() );
-        xT->SetRef(rAttr.GetType() );
-        rAttr.aType = xT;
-        sal_uInt32 nBeginPos = 0; // can not happen with Tell
-        while( nBeginPos != rInStm.Tell() )
+        nBeginPos = rInStm.Tell();
+        tools::SvRef<SvMetaAttribute> xAttr( new SvMetaAttribute() );
+        if( xAttr->ReadSvIdl( rBase, rInStm ) )
         {
-            nBeginPos = rInStm.Tell();
-            tools::SvRef<SvMetaAttribute> xAttr( new SvMetaAttribute() );
-            if( xAttr->ReadSvIdl( rBase, rInStm ) )
-            {
-                if( xAttr->Test( rInStm ) )
-                    rAttr.aType->GetAttrList().push_back( xAttr );
-            }
-            ReadIfDelimiter();
+            if( xAttr->Test( rInStm ) )
+                rAttr.aType->GetAttrList().push_back( xAttr );
         }
-        Read( ')' );
-        rAttr.aType->SetType( MetaTypeType::Method );
-    }
-    if( ReadIf( '[' ) )
-    {
-        Read( ']' );
+        ReadIfDelimiter();
     }
+    Read( ')' );
+    rAttr.aType->SetType( MetaTypeType::Method );
 }
 
 SvMetaClass * SvIdlParser::ReadKnownClass()
diff --git a/sc/sdi/docsh.sdi b/sc/sdi/docsh.sdi
index 6964d6b..25852fb 100644
--- a/sc/sdi/docsh.sdi
+++ b/sc/sdi/docsh.sdi
@@ -29,11 +29,7 @@ interface TableSelection
         INT16   Column      SID_SC_CELLS,
         INT32   Row         FN_PARAM_1
     )
-    [
-    ]
-    UINT16 Index FID_TAB_INDEX
-    [
-    ]
+    UINT16 Index FID_TAB_INDEX ()
     FID_PROTECT_TABLE       [ ExecMethod = Execute; StateMethod = GetState; ]
     FID_PROTECT_DOC         [ ExecMethod = Execute; StateMethod = GetState; ]
 
diff --git a/sc/sdi/formatsh.sdi b/sc/sdi/formatsh.sdi
index 782f99b..2c90f60 100644
--- a/sc/sdi/formatsh.sdi
+++ b/sc/sdi/formatsh.sdi
@@ -39,12 +39,8 @@ interface TableFont
 interface FormatForSelection
 {
     //Auch das Basic muss wieder laufen
-    SbxObject Font SID_PROP_FONT
-    [
-    ]
-    SbxObject Interior SID_PROP_INTERIOR // status(Final)
-    [
-    ]
+    SbxObject Font SID_PROP_FONT ()
+    SbxObject Interior SID_PROP_INTERIOR () // status(Final)
 
     // Slot's die in der DrawShell disabled werden. {
     SID_STYLE_FAMILY2           [ ExecMethod = ExecuteStyle; StateMethod = GetStyleState; ]
diff --git a/sc/sdi/tabvwsh.sdi b/sc/sdi/tabvwsh.sdi
index 3a25e81..43a8e58 100644
--- a/sc/sdi/tabvwsh.sdi
+++ b/sc/sdi/tabvwsh.sdi
@@ -212,7 +212,7 @@ interface DataPilotTables
 
 interface DataPilotTable
 {
-    SbxObject DataPilotFields SID_PIVOT_FIELDS
+    SbxObject DataPilotFields SID_PIVOT_FIELDS ()
 }
 
 interface DataPilotFields
@@ -221,9 +221,9 @@ interface DataPilotFields
 
 interface DataPilotField
 {
-    String FieldName SID_PFIELD_NAME
-    UINT16 Orientation SID_PFIELD_ORIENTATION
-    UINT16 Function SID_PFIELD_FUNCTION
+    String FieldName SID_PFIELD_NAME ()
+    UINT16 Orientation SID_PFIELD_ORIENTATION ()
+    UINT16 Function SID_PFIELD_FUNCTION ()
 }
 
 
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 7aed0a1..183f752 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -806,24 +806,18 @@ interface GlobalContents
     (
         UINT16  Position        FN_COLL_TYPE
     )
-    [
-    ]
 
     // Areaname, Index-Titel or Empty String
     String  Title FN_COLL_TITLE
     (
         UINT16  Position        FN_COLL_TITLE
     )
-    [
-    ]
+
     // Without a FileName an area of the text is inserted at this location.
     BOOL    InsertDocument  FN_COLL_ADD
     (
         UINT16  Position        FN_COLL_ADD,
         UINT16  FileName        FN_PARAM_1
     )
-    [
-    ]
-
 }
 
commit 1e6dfe458079620a7192381dce9505e94a83518a
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Feb 23 08:18:13 2016 +0200

    cid#1353438 Logically dead code
    
    Change-Id: Ib444a1941e2bec03394c4e8eb7a5a34adbe3f4f6

diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx
index fd1a352..c24fdfb 100644
--- a/idl/inc/parser.hxx
+++ b/idl/inc/parser.hxx
@@ -45,7 +45,7 @@ public:
     void         ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType );
     void         ReadInterfaceOrShellEntry( SvMetaClass& rClass );
     bool         ReadInterfaceOrShellSlot( SvMetaSlot& rSlot );
-    bool         ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr );
+    void         ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr );
     void         ReadItem();
     void         ReadStruct();
     void         ReadEnum();
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index b889931..f9e2f0f 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -323,7 +323,8 @@ void SvIdlParser::ReadInterfaceOrShellEntry(SvMetaClass& rClass)
         else
         {
             xAttr = new SvMetaAttribute( pType );
-            bOk = ReadInterfaceOrShellMethodOrAttribute(*xAttr);
+            ReadInterfaceOrShellMethodOrAttribute(*xAttr);
+            bOk = true;
         }
         if( bOk )
             bOk = xAttr->Test( rInStm );
@@ -387,10 +388,8 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot)
     return bOk;
 }
 
-bool SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr )
+void SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr )
 {
-    sal_uInt32  nTokPos     = rInStm.Tell();
-    bool bOk = false;
     rAttr.SetName( ReadIdentifier() );
     rAttr.aSlotId.setString( ReadIdentifier() );
     sal_uLong n;
@@ -398,7 +397,6 @@ bool SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr
         throw SvParseException( rInStm, "no value for identifier <" + rAttr.aSlotId.getString() + "> " );
     rAttr.aSlotId.SetValue(n);
 
-    bOk = true;
     if( ReadIf( '(' ) )
     {
         // read method arguments
@@ -420,14 +418,10 @@ bool SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr
         Read( ')' );
         rAttr.aType->SetType( MetaTypeType::Method );
     }
-    if( bOk && ReadIf( '[' ) )
+    if( ReadIf( '[' ) )
     {
         Read( ']' );
     }
-
-    if( !bOk )
-        rInStm.Seek( nTokPos );
-    return bOk;
 }
 
 SvMetaClass * SvIdlParser::ReadKnownClass()
commit 20276795b7a3b968fca873f29bbb971afc9fc0a8
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Feb 22 15:59:13 2016 +0200

    small cleanups in .SDI parser
    
    Change-Id: Ic7122e3ecfe2914e27945fd508199f7ec1d6bdab

diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx
index 71e77b4..eb43e5f 100644
--- a/idl/inc/database.hxx
+++ b/idl/inc/database.hxx
@@ -123,7 +123,7 @@ public:
     sal_uInt32              GetUniqueId() { return ++nUniqueId; }
     bool                    FindId( const OString& rIdName, sal_uLong * pVal );
     bool                    InsertId( const OString& rIdName, sal_uLong nVal );
-    bool                    ReadIdFile( const OUString & rFileName );
+    bool                    ReadIdFile( const OString& rFileName );
 
     SvMetaType *            FindType( const OString& rName );
     static SvMetaType *     FindType( const SvMetaType *, SvRefMemberList<SvMetaType *>& );
@@ -131,8 +131,9 @@ public:
     SvMetaType *            ReadKnownType( SvTokenStream & rInStm );
     SvMetaAttribute *       ReadKnownAttr( SvTokenStream & rInStm,
                                             SvMetaType * pType = nullptr );
-    SvMetaAttribute *       SearchKnownAttr( const SvIdentifier& );
+    SvMetaAttribute *       FindKnownAttr( const SvIdentifier& );
     SvMetaClass *           ReadKnownClass( SvTokenStream & rInStm );
+    SvMetaClass *           FindKnownClass( const OString& aName );
     void AddDepFile(OUString const& rFileName);
     void WriteDepFile(SvFileStream & rStream, OUString const& rTarget);
 };
diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx
index 35920f9..2b2e23c 100644
--- a/idl/source/objects/slot.cxx
+++ b/idl/source/objects/slot.cxx
@@ -377,7 +377,7 @@ bool SvMetaSlot::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
     {
         bOk = SvMetaAttribute::ReadSvIdl( rBase, rInStm );
 
-        SvMetaAttribute *pAttr2 = rBase.SearchKnownAttr( GetSlotId() );
+        SvMetaAttribute *pAttr2 = rBase.FindKnownAttr( GetSlotId() );
         if( pAttr2 )
         {
             // for testing purposes: reference in case of complete definition
diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
index 00f2ab1..4926b59 100644
--- a/idl/source/prj/database.cxx
+++ b/idl/source/prj/database.cxx
@@ -139,8 +139,9 @@ bool SvIdlDataBase::InsertId( const OString& rIdName, sal_uLong nVal )
     return false;
 }
 
-bool SvIdlDataBase::ReadIdFile( const OUString & rFileName )
+bool SvIdlDataBase::ReadIdFile( const OString& rOFileName )
 {
+    OUString rFileName = OStringToOUString(rOFileName, RTL_TEXTENCODING_ASCII_US);
     OUString aFullName;
     osl::File::searchFileURL( rFileName, GetPath(), aFullName);
     osl::FileBase::getSystemPathFromFileURL( aFullName, aFullName );
@@ -236,8 +237,7 @@ bool SvIdlDataBase::ReadIdFile( const OUString & rFileName )
                             throw SvParseException("unexpected eof in #include", rTok);
                         }
                     }
-                    if (!ReadIdFile(OStringToOUString(aName.toString(),
-                        RTL_TEXTENCODING_ASCII_US)))
+                    if (!ReadIdFile(aName.toString()))
                     {
                         throw SvParseException("cannot read file: " + aName, rTok);
                     }
@@ -328,10 +328,7 @@ SvMetaAttribute * SvIdlDataBase::ReadKnownAttr
     return nullptr;
 }
 
-SvMetaAttribute* SvIdlDataBase::SearchKnownAttr
-(
-    const SvIdentifier& rId
-)
+SvMetaAttribute* SvIdlDataBase::FindKnownAttr( const SvIdentifier& rId )
 {
     sal_uLong n;
     if( FindId( rId.getString(), &n ) )
@@ -353,17 +350,26 @@ SvMetaClass * SvIdlDataBase::ReadKnownClass( SvTokenStream & rInStm )
     SvToken& rTok = rInStm.GetToken_Next();
 
     if( rTok.IsIdentifier() )
-        for( sal_uLong n = 0; n < aClassList.size(); n++ )
-        {
-            SvMetaClass * pClass = aClassList[n];
-            if( pClass->GetName().equals(rTok.GetString()) )
-                return pClass;
-        }
+    {
+        SvMetaClass* p = FindKnownClass(rTok.GetString());
+        if (p)
+            return p;
+    }
 
     rInStm.Seek( nTokPos );
     return nullptr;
 }
 
+SvMetaClass * SvIdlDataBase::FindKnownClass( const OString& aName )
+{
+    for( sal_uLong n = 0; n < aClassList.size(); n++ )
+    {
+        SvMetaClass * pClass = aClassList[n];
+        if( pClass->GetName() == aName )
+            return pClass;
+    }
+    return nullptr;
+}
 void SvIdlDataBase::Write(const OString& rText)
 {
     if( nVerbosity != 0 )
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index fe1e2b9..b889931 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -47,8 +47,8 @@ void SvIdlParser::ReadSvIdl( bool bImported, const OUString & rPath )
 void SvIdlParser::ReadModuleHeader(SvMetaModule& rModule)
 {
     OString aName = ReadIdentifier();
-    rBase.Push( &rModule ); // onto the context stack
     rModule.SetName( aName );
+    rBase.Push( &rModule ); // onto the context stack
     ReadModuleBody(rModule);
     rBase.GetStack().pop_back(); // remove from stack
 }
@@ -62,7 +62,7 @@ void SvIdlParser::ReadModuleBody(SvMetaModule& rModule)
             OString aSlotIdFile;
             if( !ReadStringSvIdl( SvHash_SlotIdFile(), rInStm, aSlotIdFile ) )
                 break;
-            if( !rBase.ReadIdFile( OStringToOUString(aSlotIdFile, RTL_TEXTENCODING_ASCII_US)) )
+            if( !rBase.ReadIdFile( aSlotIdFile ) )
             {
                 throw SvParseException( rInStm, "cannot read file: " + aSlotIdFile );
             }
@@ -368,7 +368,7 @@ bool SvIdlParser::ReadInterfaceOrShellSlot(SvMetaSlot& rSlot)
     else
     {
         bOk = rSlot.SvMetaAttribute::ReadSvIdl( rBase, rInStm );
-        SvMetaAttribute *pAttr2 = rBase.SearchKnownAttr( rSlot.GetSlotId() );
+        SvMetaAttribute *pAttr2 = rBase.FindKnownAttr( rSlot.GetSlotId() );
         if( pAttr2 )
         {
             SvMetaSlot * pKnownSlot = dynamic_cast<SvMetaSlot*>( pAttr2 );
@@ -419,7 +419,7 @@ bool SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr
         }
         Read( ')' );
         rAttr.aType->SetType( MetaTypeType::Method );
-   }
+    }
     if( bOk && ReadIf( '[' ) )
     {
         Read( ']' );
@@ -432,7 +432,8 @@ bool SvIdlParser::ReadInterfaceOrShellMethodOrAttribute( SvMetaAttribute& rAttr
 
 SvMetaClass * SvIdlParser::ReadKnownClass()
 {
-    SvMetaClass* pClass = rBase.ReadKnownClass( rInStm );
+    OString aName(ReadIdentifier());
+    SvMetaClass* pClass = rBase.FindKnownClass( aName );
     if( !pClass )
         throw SvParseException( rInStm, "unknown class" );
     return pClass;
@@ -443,7 +444,7 @@ SvMetaType * SvIdlParser::ReadKnownType()
     OString aName = ReadIdentifier();
     for( const auto& aType : rBase.GetTypeList() )
     {
-        if( aType->GetName().equals(aName) )
+        if( aType->GetName() == aName )
         {
             return aType;
         }


More information about the Libreoffice-commits mailing list