[Libreoffice-commits] core.git: Branch 'private/jmux/libreoffice-4-1-6+backports' - 3 commits - include/vcl padmin/source sc/source vcl/unx

Katarina Behrens Katarina.Behrens at cib.de
Thu Oct 29 09:45:57 UTC 2015


 include/vcl/ppdparser.hxx                     |    4 +-
 padmin/source/prtsetup.cxx                    |   10 +++++
 sc/source/filter/excel/excdoc.cxx             |   12 +++++-
 sc/source/ui/unoobj/confuno.cxx               |   28 +++++++++-------
 vcl/unx/generic/printer/ppdparser.cxx         |   45 +++++++++++++++++++++++---
 vcl/unx/kde4/tst_exclude_socket_notifiers.hxx |    3 +
 6 files changed, 81 insertions(+), 21 deletions(-)

New commits:
commit 6d18ec7dc756cf6f14b4945afe75f58c65705f21
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed Oct 28 15:00:51 2015 +0100

    tdf#92256: Don't save CONV_UNSPECIFIED string ref syntax value
    
    The following scenario is how it breaks:
    1. user has ExcelA1 as her formula syntax setting, CONV_UNSPECIFIED
    (that means "same as formula syntax") as her string ref syntax setting
    2. she saves the document, it will now contain CONV_UNSPECIFIED value
    3. someone else with CalcA1 formula syntax setting opens the document
    ... since it contains CONV_UNSPECIFIED "same as formula syntax" value,
    it will use his CalcA1 formula syntax value to evaluate INDIRECT func
    => #REF!
    
    Avoid this by reading formula syntax/grammar value, mapping it to
    matching string ref syntax and saving that instead of CONV_UNSPECIFIED
    
    Change-Id: I3cf08878ed8badc8719ee5be535c8fdbb7ba6d42

diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 81cd99d..7feb78a 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -823,15 +823,23 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
         pExpChangeTrack->WriteXml( rStrm );
 
     const ScCalcConfig& rCalcConfig = GetDoc().GetCalcConfig();
+    formula::FormulaGrammar::AddressConvention eConv = rCalcConfig.meStringRefAddressSyntax;
+
+    // don't save "unspecified" string ref syntax ... query formula grammar
+    // and save that instead
+    if( eConv == formula::FormulaGrammar::CONV_UNSPECIFIED)
+    {
+        eConv = GetDoc().GetAddressConvention();
+    }
 
     // write if it has been read|imported or explicitly changed
     // or if ref syntax isn't what would be native for our file format
     // i.e. ExcelA1 in this case
     if ( rCalcConfig.mbHasStringRefSyntax ||
-         (rCalcConfig.meStringRefAddressSyntax != formula::FormulaGrammar::CONV_XL_A1) )
+         (eConv != formula::FormulaGrammar::CONV_XL_A1) )
     {
         XclExtLstRef xExtLst( new XclExtLst( GetRoot()  ) );
-        xExtLst->AddRecord( XclExpExtRef( new XclExpExtCalcPr( GetRoot(), rCalcConfig.meStringRefAddressSyntax ))  );
+        xExtLst->AddRecord( XclExpExtRef( new XclExpExtCalcPr( GetRoot(), eConv ))  );
         xExtLst->SaveXml(rStrm);
     }
 
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index abcbdbc..9a9078f 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -459,22 +459,28 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr
             else if ( aPropertyName.compareToAscii( SC_UNO_SYNTAXSTRINGREF ) == 0 )
             {
                 ScCalcConfig aCalcConfig = pDoc->GetCalcConfig();
+                formula::FormulaGrammar::AddressConvention eConv = aCalcConfig.meStringRefAddressSyntax;
 
-            // write if it has been read|imported or explicitly changed
-            // or if ref syntax isn't what would be native for our file format
-            // i.e. CalcA1 in this case
-            if ( aCalcConfig.mbHasStringRefSyntax ||
-                 (aCalcConfig.meStringRefAddressSyntax != formula::FormulaGrammar::CONV_OOO) )
-            {
-                    formula::FormulaGrammar::AddressConvention aConv = aCalcConfig.meStringRefAddressSyntax;
+                // don't save "unspecified" string ref syntax ... query formula grammar
+                // and save that instead
+                if( eConv == formula::FormulaGrammar::CONV_UNSPECIFIED)
+                {
+                    eConv = pDoc->GetAddressConvention();
+                }
 
-                    switch (aConv)
+                // write if it has been read|imported or explicitly changed
+                // or if ref syntax isn't what would be native for our file format
+                // i.e. CalcA1 in this case
+                if ( aCalcConfig.mbHasStringRefSyntax ||
+                     (eConv != formula::FormulaGrammar::CONV_OOO) )
+                {
+                    switch (eConv)
                     {
                         case formula::FormulaGrammar::CONV_OOO:
                         case formula::FormulaGrammar::CONV_XL_A1:
                         case formula::FormulaGrammar::CONV_XL_R1C1:
                         case formula::FormulaGrammar::CONV_A1_XL_A1:
-                             aRet <<= static_cast<sal_Int16>( aConv );
+                             aRet <<= static_cast<sal_Int16>( eConv );
                              break;
 
                         case formula::FormulaGrammar::CONV_UNSPECIFIED:
@@ -485,8 +491,8 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr
                             aRet <<= sal_Int16(9999);
                             break;
                     }
-                }
-            }
+                 }
+              }
 
             else
             {
commit 53ab6304ec3e25e8347fcbbbbe3d77d3fce067eb
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 26 16:30:26 2015 +0000

    KDE4: don't ignore write(2) return value
    
    Silence the glibc compile warning and actually handle a wrong
    return value.
    
    Change-Id: Icdbc8e655d4b8ad20699dfd0abdbf3405a49f898
    (cherry picked from commit e4a3bf0625e4fb608ffdf0fdce67d9d7cabe6822)

diff --git a/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx b/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx
index acf4d36..47fc093 100644
--- a/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx
+++ b/vcl/unx/kde4/tst_exclude_socket_notifiers.hxx
@@ -74,7 +74,8 @@ static int tst_processEventsExcludeSocket()
     QSocketNotifier notifier( pipes[ 0 ], QSocketNotifier::Read );
     QObject::connect( &notifier, SIGNAL( activated( int )), &test, SLOT( slotReceived()));
     char dummy = 'a';
-    write( pipes[ 1 ], &dummy, 1 );
+    if( 1 != write( pipes[ 1 ], &dummy, 1 ) )
+        return 1;
     QEventLoop loop;
     loop.processEvents( QEventLoop::ExcludeSocketNotifiers );
     QVERIFY( !test.received );
commit 07329e9c952153a3c1520507f40ec62a23440a45
Author: Michael Weghorn <m.weghorn at posteo.de>
Date:   Tue Oct 27 11:06:22 2015 +0100

    tdf#94022 Print dialog: hide Installable Options
    
    Options specified in PPD files can be grouped using the
    keywords "OpenGroup" and "CloseGroup".
    The keyword "InstallableOptions" is used as a group name
    for a group containing options that define
    optional hardware features of the printer that can
    be present or not (s. section 5.4 in version 4.3 of
    the PPD specification).
    
    As they are not print job specific, it is recommended
    not to show them in the print dialog.
    
    To be able to distinguish those options, the
    PPD group name was added as an attribute to the PPDKey
    class.
    
    Reviewed-on: https://gerrit.libreoffice.org/19623
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    (cherry picked from commit f8d0dc09e15b36ae83a5e89280d1f7fbc01da48b)
    
    Conflicts:
    
    	include/vcl/ppdparser.hxx
    	vcl/generic/print/prtsetup.cxx
    	vcl/unx/generic/printer/ppdparser.cxx
    
    Change-Id: I4a3abf23a711ad98556c0b608a07ef0a91e77e2b

diff --git a/include/vcl/ppdparser.hxx b/include/vcl/ppdparser.hxx
index 80fbeaf..ae5f85f 100644
--- a/include/vcl/ppdparser.hxx
+++ b/include/vcl/ppdparser.hxx
@@ -66,6 +66,7 @@ class VCL_DLLPUBLIC PPDKey
     const PPDValue*     m_pDefaultValue;
     bool                m_bQueryValue;
     PPDValue            m_aQueryValue;
+    String              m_aGroup;
 
 public:
     enum UIType { PickOne, PickMany, Boolean };
@@ -90,6 +91,7 @@ public:
     const PPDValue*         getValue( const String& rOption ) const;
     const PPDValue*         getValueCaseInsensitive( const String& rOption ) const;
     const PPDValue*         getDefaultValue() const { return m_pDefaultValue; }
+    const String&       getGroup() const { return m_aGroup; }
     const PPDValue*     getQueryValue() const { return m_bQueryValue ? &m_aQueryValue : NULL; }
 
     const String&       getKey() const { return m_aKey; }
@@ -179,7 +181,7 @@ private:
     ~PPDParser();
 
     void parseOrderDependency(const OString& rLine);
-    void parseOpenUI(const OString& rLine);
+    void parseOpenUI(const OString& rLine, const OString& rPPDGroup);
     void parseConstraint(const OString& rLine);
     void parse( std::list< OString >& rLines );
 
diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx
index 02dfaa0..a857793 100644
--- a/padmin/source/prtsetup.cxx
+++ b/padmin/source/prtsetup.cxx
@@ -397,11 +397,19 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent )
         for( int i = 0; i < m_pParent->m_aJobData.m_pParser->getKeys(); i++ )
         {
             const PPDKey* pKey = m_pParent->m_aJobData.m_pParser->getKey( i );
+
+            // skip options already shown somewhere else
+            // also skip options from the "InstallableOptions" PPD group
+            // Options in that group define hardware features that are not
+            // job-specific and should better be handled in the system-wide
+            // printer configuration. Keyword is defined in PPD specification
+            // (version 4.3), section 5.4.
             if( pKey->isUIKey()                                 &&
                 ! pKey->getKey().EqualsAscii( "PageSize" )      &&
                 ! pKey->getKey().EqualsAscii( "InputSlot" )     &&
                 ! pKey->getKey().EqualsAscii( "PageRegion" )    &&
-                ! pKey->getKey().EqualsAscii( "Duplex" )
+                ! pKey->getKey().EqualsAscii( "Duplex" )        &&
+                ! pKey->getGroup().EqualsAscii( "InstallableOptions" )
                 )
             {
                 String aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 6b464e9..4bf46e4 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -956,8 +956,22 @@ namespace
 
 void PPDParser::parse( ::std::list< OString >& rLines )
 {
+    // Name for PPD group into which all options are put for which the PPD
+    // does not explicitly define a group.
+    // This is similar to how CUPS handles it,
+    // s. Sweet, Michael R. (2001): Common UNIX Printing System, p. 251:
+    // "Each option in turn is associated with a group stored in the
+    // ppd_group_t structure. Groups can be specified in the PPD file; if an
+    // option is not associated with a group, it is put in a "General" or
+    // "Extra" group depending on the option.
+    static const OString aDefaultPPDGroupName("General");
+
     std::list< OString >::iterator line = rLines.begin();
     PPDParser::hash_type::const_iterator keyit;
+
+    // name of the PPD group that is currently being processed
+    OString aCurrentGroup = aDefaultPPDGroupName;
+
     while( line != rLines.end() )
     {
         OString aCurrentLine( *line );
@@ -971,11 +985,13 @@ void PPDParser::parse( ::std::list< OString >& rLines )
         sal_Int32 nPos = aKey.indexOf('/');
         if (nPos != -1)
             aKey = aKey.copy(0, nPos);
+        if (aKey.isEmpty())
+            continue;
         aKey = aKey.copy(1); // remove the '*'
+        if (aKey.isEmpty())
+            continue;
 
         if (aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("CloseUI")) ||
-            aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("OpenGroup")) ||
-            aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("CloseGroup")) ||
             aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("End")) ||
             aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("OpenSubGroup")) ||
             aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("CloseSubGroup")))
@@ -983,9 +999,26 @@ void PPDParser::parse( ::std::list< OString >& rLines )
             continue;
         }
 
-        if (aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("OpenUI")))
+        if (aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("CloseGroup")))
         {
-            parseOpenUI( aCurrentLine );
+            aCurrentGroup = aDefaultPPDGroupName;
+            continue;
+        }
+        else if (aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("OpenGroup")))
+        {
+            OString aGroupName = aCurrentLine;
+            sal_Int32 nPosition = aGroupName.indexOf('/');
+            if (nPosition != -1)
+            {
+                aGroupName = aGroupName.copy(0, nPosition);
+            }
+
+            aCurrentGroup = GetCommandLineToken(1, aGroupName);
+            continue;
+        }
+        else if (aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("OpenUI")))
+        {
+            parseOpenUI( aCurrentLine, aCurrentGroup);
             continue;
         }
         else if (aKey.equalsL(RTL_CONSTASCII_STRINGPARAM("OrderDependency")))
@@ -1220,7 +1253,7 @@ void PPDParser::parse( ::std::list< OString >& rLines )
     }
 }
 
-void PPDParser::parseOpenUI(const OString& rLine)
+void PPDParser::parseOpenUI(const OString& rLine, const OString& rPPDGroup)
 {
     String aTranslation;
     OString aKey = rLine;
@@ -1259,6 +1292,8 @@ void PPDParser::parseOpenUI(const OString& rLine)
         pKey->m_eUIType = PPDKey::PickMany;
     else
         pKey->m_eUIType = PPDKey::PickOne;
+
+    pKey->m_aGroup = OStringToOUString(rPPDGroup, RTL_TEXTENCODING_MS_1252);
 }
 
 void PPDParser::parseOrderDependency(const OString& rLine)


More information about the Libreoffice-commits mailing list