[Libreoffice-commits] core.git: sc/source

Tor Lillqvist tml at collabora.com
Tue Mar 7 13:09:53 UTC 2017


 sc/source/filter/excel/excdoc.cxx   |    7 ++++---
 sc/source/filter/inc/biffhelper.hxx |   12 +++++-------
 2 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 74df76d6ac91fae02ef0d20ce863cb753ba953cb
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Mar 7 13:55:53 2017 +0200

    Use symbolic constants instead of hardcoded numbers
    
    The constants were commented out, so uncomment them.
    
    Probably lots of the same left.
    
    Change-Id: Iac87bef3bc331ae126741efbb4d58cc539e5a42a

diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 1788f8f..a3d1334 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -55,6 +55,7 @@
 #include "excdoc.hxx"
 #include "namebuff.hxx"
 #include "xeextlst.hxx"
+#include "biffhelper.hxx"
 
 #include "xcl97rec.hxx"
 #include "xcl97esc.hxx"
@@ -105,7 +106,7 @@ static void lcl_AddCalcPr( XclExpRecordList<>& aRecList, ExcTable& self )
     aRecList.AppendNewRecord( new XclRefmode( rDoc ) );
     aRecList.AppendNewRecord( new XclIteration( rDoc ) );
     aRecList.AppendNewRecord( new XclDelta( rDoc ) );
-    aRecList.AppendNewRecord( new XclExpBoolRecord(0x005F, true) ); // SAVERECALC
+    aRecList.AppendNewRecord( new XclExpBoolRecord(oox::xls::BIFF_ID_SAVERECALC, true) );
     aRecList.AppendNewRecord( new XclExpXmlEndSingleElementRecord() );  // XML_calcPr
 }
 
@@ -489,9 +490,9 @@ void ExcTable::FillAsTableBinary( SCTAB nCodeNameIdx )
     if (pTabProtect && pTabProtect->isProtected())
     {
         Add( new XclExpProtection(true) );
-        Add( new XclExpBoolRecord(0x00DD, pTabProtect->isOptionEnabled(ScTableProtection::SCENARIOS)) );
+        Add( new XclExpBoolRecord(oox::xls::BIFF_ID_SCENPROTECT, pTabProtect->isOptionEnabled(ScTableProtection::SCENARIOS)) );
         if (pTabProtect->isOptionEnabled(ScTableProtection::OBJECTS))
-            Add( new XclExpBoolRecord(0x0063, true ));
+            Add( new XclExpBoolRecord(oox::xls::BIFF_ID_OBJECTPROTECT, true ));
         Add( new XclExpPassHash(pTabProtect->getPasswordHash(PASSHASH_XL)) );
     }
 
diff --git a/sc/source/filter/inc/biffhelper.hxx b/sc/source/filter/inc/biffhelper.hxx
index c0d95907..f988598 100644
--- a/sc/source/filter/inc/biffhelper.hxx
+++ b/sc/source/filter/inc/biffhelper.hxx
@@ -253,7 +253,6 @@ const sal_Int32 BIFF12_ID_XF                = 0x002F;
     BIFF_UNKNOWN               /// Unknown BIFF version.
 */
 
-/** unused -- keep for documentation */
 //const sal_uInt16 BIFF2_MAXRECSIZE           = 2080;
 //const sal_uInt16 BIFF8_MAXRECSIZE           = 8224;
 
@@ -282,7 +281,10 @@ const sal_uInt16 BIFF_ID_PCITEM_STRING      = 0x00CD;
 
 const sal_uInt16 BIFF_ID_UNKNOWN            = SAL_MAX_UINT16;
 
-/** unused -- keep for documentation
+/* Many of thse constants might be unused, but please keep for documentation. If you notice
+ * hardcoded numbers in the code that actually correspond in meaning in the context (not just value)
+ * to one of the named constants, feel free to change it to use the constant instead, of course.
+ */
 const sal_uInt16 BIFF2_ID_ARRAY             = 0x0021;
 const sal_uInt16 BIFF3_ID_ARRAY             = 0x0221;
 const sal_uInt16 BIFF_ID_AUTOFILTER         = 0x009D;
@@ -532,10 +534,8 @@ const sal_uInt16 BIFF4_ID_XF                = 0x0443;
 const sal_uInt16 BIFF5_ID_XF                = 0x00E0;
 const sal_uInt16 BIFF_ID_XFCRC              = 0x087C;
 const sal_uInt16 BIFF_ID_XFEXT              = 0x087D;
-*/
 
 // OBJ subrecord identifiers --------------------------------------------------
-/**  unused -- keep for documentation
 const sal_uInt16 BIFF_ID_OBJEND             = 0x0000;   /// End of OBJ.
 const sal_uInt16 BIFF_ID_OBJMACRO           = 0x0004;   /// Macro link.
 const sal_uInt16 BIFF_ID_OBJBUTTON          = 0x0005;   /// Button data.
@@ -555,7 +555,7 @@ const sal_uInt16 BIFF_ID_OBJCBLSDATA        = 0x0012;   /// Check box/radio butt
 const sal_uInt16 BIFF_ID_OBJLBSDATA         = 0x0013;   /// List box/combo box data.
 const sal_uInt16 BIFF_ID_OBJCBLSFMLA        = 0x0014;   /// Check box/radio button cell link.
 const sal_uInt16 BIFF_ID_OBJCMO             = 0x0015;   /// Common object settings.
-*/
+
 // record constants -----------------------------------------------------------
 
 const sal_uInt8 BIFF_ERR_NULL               = 0x00;
@@ -566,7 +566,6 @@ const sal_uInt8 BIFF_ERR_NAME               = 0x1D;
 const sal_uInt8 BIFF_ERR_NUM                = 0x24;
 const sal_uInt8 BIFF_ERR_NA                 = 0x2A;
 
-/**  unused -- keep for documentation
 const sal_uInt16 BIFF_BOF_BIFF2             = 0x0200;
 const sal_uInt16 BIFF_BOF_BIFF3             = 0x0300;
 const sal_uInt16 BIFF_BOF_BIFF4             = 0x0400;
@@ -588,7 +587,6 @@ const sal_uInt8 BIFF_STRF_16BIT             = 0x01;
 const sal_uInt8 BIFF_STRF_PHONETIC          = 0x04;
 const sal_uInt8 BIFF_STRF_RICH              = 0x08;
 const sal_uInt8 BIFF_STRF_UNKNOWN           = 0xF2;
-*/
 
 /** Static helper functions for BIFF filters. */
 class BiffHelper


More information about the Libreoffice-commits mailing list