ooo-build r12003 - in trunk: . patches/src680



Author: kyoshida
Date: Tue Mar 25 17:34:16 2008
New Revision: 12003
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12003&view=rev

Log:
2008-03-25  Kohei Yoshida  <kyoshida novell com>

	* patches/src680/sc-formula-syntax.diff: query the current decimal 
	separator and fall back to the semicolon-based separators if a comma is
	used as the decimal separator for the current locale (only affects 
	Excel A1 and R1C1 modes) (n#373479), and make address and range parsing 
	for Excel A1 more strict so that any trailing invalid character would 
	invalidate the whole string.



Modified:
   trunk/ChangeLog
   trunk/patches/src680/sc-formula-syntax.diff

Modified: trunk/patches/src680/sc-formula-syntax.diff
==============================================================================
--- trunk/patches/src680/sc-formula-syntax.diff	(original)
+++ trunk/patches/src680/sc-formula-syntax.diff	Tue Mar 25 17:34:16 2008
@@ -1,7 +1,7 @@
 Only in sc: Debug
 diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/inc/compiler.hxx sc/inc/compiler.hxx
 --- sc.clean/inc/compiler.hxx	2008-03-03 11:24:43.000000000 -0500
-+++ sc/inc/compiler.hxx	2008-03-03 16:16:53.000000000 -0500
++++ sc/inc/compiler.hxx	2008-03-25 11:53:47.000000000 -0400
 @@ -236,26 +236,6 @@ typedef ::std::hash_map< String, String,
  class SC_DLLPUBLIC ScCompiler
  {
@@ -78,7 +78,15 @@
  	BOOL IsOpCode2( const String& );
  	BOOL IsString();
  	BOOL IsReference( const String& );
-@@ -539,7 +543,8 @@ public:
+@@ -465,6 +469,7 @@ public:
+     {
+         return mxSymbolsNative.get() && mxSymbolsEnglish.get();
+     }
++    static void InitConventions();      /// hack only for 2.4 codebase!
+ 	static void InitSymbolsNative();    /// only SymbolsNative, on first document creation
+ 	static void InitSymbolsEnglish();   /// only SymbolsEnglish, maybe later
+ private:
+@@ -539,7 +544,8 @@ public:
      const ScDocument* GetDoc() const { return pDoc; }
      const ScAddress& GetPos() const { return aPos; }
  
@@ -519,8 +527,50 @@
  			}
 diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/tool/address.cxx sc/source/core/tool/address.cxx
 --- sc.clean/source/core/tool/address.cxx	2008-03-03 11:24:50.000000000 -0500
-+++ sc/source/core/tool/address.cxx	2008-03-22 02:23:37.000000000 -0400
-@@ -1334,9 +1334,12 @@ void ScAddress::Format( String& r, USHOR
++++ sc/source/core/tool/address.cxx	2008-03-25 13:07:48.000000000 -0400
+@@ -623,10 +623,24 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
+     // prepare as if it's a singleton, in case we want to fall back */
+     r.aEnd.SetCol( r.aStart.Col() );
+     r.aEnd.SetRow( r.aStart.Row() );    // don't overwrite sheet number as parsed in lcl_ScRange_Parse_XL_Header
++
++    if ( bOnlyAcceptSingle )
++    {
++        if ( *tmp2 == 0 )
++            return lcl_XL_LinkSheetRef( r, pDoc,
++                aExternDocName, aStartTabName, aEndTabName, nFlags );
++        else
++        {
++            // any trailing invalid character must invalidate the address.
++            nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB);
++            return nFlags;
++        }
++    }
++
+     if( *tmp2 != ':' )
+     {
+-        if ( !bOnlyAcceptSingle )
+-            nFlags &= ~SCA_VALID;   // when looking for a double ref, a single-cell ref must not be accepted
++        nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB |
++                    SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2);
+         return nFlags;
+     }
+ 
+@@ -640,6 +654,14 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
+         return lcl_XL_LinkSheetRef( r, pDoc,
+             aExternDocName, aStartTabName, aEndTabName, nFlags );
+ 
++    if ( *tmp2 != 0 )
++    {
++        // any trailing invalid character must invalidate the range.
++        nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB |
++                    SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2);
++        return nFlags;
++    }
++
+     nFlags |= (nFlags2 << 4);
+     return lcl_XL_LinkSheetRef( r, pDoc,
+         aExternDocName, aStartTabName, aEndTabName, nFlags );
+@@ -1334,9 +1356,12 @@ void ScAddress::Format( String& r, USHOR
  
              case CONV_XL_A1:
              case CONV_XL_R1C1:
@@ -536,7 +586,7 @@
                  r += aTabName;
                  r += '!';
                  break;
-@@ -1434,6 +1437,7 @@ lcl_ScRange_Format_XL_Header( String& r,
+@@ -1434,6 +1459,7 @@ lcl_ScRange_Format_XL_Header( String& r,
  void ScRange::Format( String& r, USHORT nFlags, ScDocument* pDoc,
                        const ScAddress::Details& rDetails ) const
  {
@@ -546,8 +596,17 @@
          r = ScGlobal::GetRscString( STR_NOREF_STR );
 diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
 --- sc.clean/source/core/tool/compiler.cxx	2008-03-03 11:24:50.000000000 -0500
-+++ sc/source/core/tool/compiler.cxx	2008-03-20 10:18:34.000000000 -0400
-@@ -439,6 +439,7 @@ void ScCompiler::SetCompileEnglish( BOOL
++++ sc/source/core/tool/compiler.cxx	2008-03-25 13:20:18.000000000 -0400
+@@ -305,6 +305,8 @@ void ScCompiler::InitSymbolsNative()
+     if (mxSymbolsNative.get())
+         return;
+ 
++    InitConventions();
++
+     // Not English (even if localization is English), Core, no ODF
+     mxSymbolsNative.reset( new OpCodeMap( SC_OPCODE_LAST_OPCODE_ID + 1, false, true, false));
+     ScOpCodeList aOpCodeListNative( RID_SC_FUNCTION_NAMES, mxSymbolsNative);
+@@ -439,6 +441,7 @@ void ScCompiler::SetCompileEnglish( BOOL
          if (!pCharClassEnglish)
              InitCharClassEnglish();
          pCharClass = pCharClassEnglish;
@@ -555,7 +614,7 @@
      }
      else
      {
-@@ -928,7 +929,7 @@ for (i = 97; i < 123; i++)
+@@ -928,7 +931,7 @@ for (i = 97; i < 123; i++)
  /* ) */     t[41] |=   SC_COMPILER_C_WORD;
  /* * */     t[42] |=   SC_COMPILER_C_WORD;
  /* + */     t[43] |=   SC_COMPILER_C_WORD;
@@ -564,7 +623,7 @@
  /* , */     t[44]  =   SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP;
  #else
  /* , */     t[44] |=   SC_COMPILER_C_WORD;
-@@ -980,6 +981,20 @@ struct Convention_A1 : public ScCompiler
+@@ -980,6 +983,20 @@ struct Convention_A1 : public ScCompiler
          return pCharClass->parseAnyToken( rFormula,
                  nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed );
      }
@@ -585,18 +644,35 @@
  };
  
  String Convention_A1::MakeColStr( SCCOL nCol )
-@@ -1232,6 +1247,10 @@ static const ScCompiler::Convention *pCo
+@@ -1232,6 +1249,27 @@ static const ScCompiler::Convention *pCo
  
  struct ConventionXL
  {
-+    static const String maSep;
-+    static const String maArrayRowSep;
-+    static const String maArrayColSep;
++    static String maSep;
++    static String maArrayRowSep;
++    static String maArrayColSep;
++
++    static void Init()
++    {
++        const rtl::OUString& aDecSep = ScGlobal::pSysLocale->GetLocaleData().getLocaleItem().decimalSeparator;
++        if (aDecSep.equalsAscii(","))
++        {
++            maSep         = String::CreateFromAscii(";");
++            maArrayRowSep = String::CreateFromAscii("|");
++            maArrayColSep = String::CreateFromAscii(";");
++        }
++        else
++        {
++            maSep         = String::CreateFromAscii(",");
++            maArrayRowSep = String::CreateFromAscii(";");
++            maArrayColSep = String::CreateFromAscii(",");
++        }
++    }
 +
      static bool GetDocAndTab( const ScCompiler& rComp,
                                const SingleRefData& rRef,
                                String& rDocName,
-@@ -1314,8 +1333,50 @@ struct ConventionXL
+@@ -1314,8 +1352,50 @@ struct ConventionXL
              rBuf.append( sal_Unicode( '!' ) );
          }
      }
@@ -640,14 +716,14 @@
 +    }
  };
  
-+const String ConventionXL::maSep = String::CreateFromAscii(",");
-+const String ConventionXL::maArrayRowSep = String::CreateFromAscii(";");
-+const String ConventionXL::maArrayColSep = String::CreateFromAscii(",");
++String ConventionXL::maSep = String::CreateFromAscii(",");
++String ConventionXL::maArrayRowSep = String::CreateFromAscii(";");
++String ConventionXL::maArrayColSep = String::CreateFromAscii(",");
 +
  struct ConventionXL_A1 : public Convention_A1, public ConventionXL
  {
      ConventionXL_A1() : Convention_A1( ScAddress::CONV_XL_A1 ) { }
-@@ -1326,11 +1387,12 @@ struct ConventionXL_A1 : public Conventi
+@@ -1326,11 +1406,12 @@ struct ConventionXL_A1 : public Conventi
      {
          ComplRefData aRef( rRef );
  
@@ -662,7 +738,7 @@
          if( aRef.Ref1.IsColDeleted() || aRef.Ref1.IsRowDeleted() )
          {
              rBuf.append(ScGlobal::GetRscString(STR_NO_REF_TABLE));
-@@ -1389,6 +1451,25 @@ struct ConventionXL_A1 : public Conventi
+@@ -1389,6 +1470,25 @@ struct ConventionXL_A1 : public Conventi
              MakeRowStr( rBuf, aRef.Ref2.nRow );
          }
      }
@@ -688,7 +764,7 @@
  };
  
  static const ConventionXL_A1 ConvXL_A1;
-@@ -1508,6 +1589,25 @@ struct ConventionXL_R1C1 : public ScComp
+@@ -1508,11 +1608,36 @@ struct ConventionXL_R1C1 : public ScComp
          return pCharClass->parseAnyToken( rFormula,
                  nSrcPos, nStartFlags, aAddAllowed, nContFlags, aAddAllowed );
      }
@@ -714,7 +790,18 @@
  };
  
  static const ConventionXL_R1C1 ConvXL_R1C1;
-@@ -1626,7 +1726,8 @@ void ScCompiler::CheckTabQuotes( String&
+ static const ScCompiler::Convention *pConvXL_R1C1 = &ConvXL_R1C1;
+ 
++// static
++void ScCompiler::InitConventions()
++{
++    ConventionXL::Init();
++}
++
+ //-----------------------------------------------------------------------------
+ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,
+                         const ScTokenArray& rArr )
+@@ -1626,7 +1751,8 @@ void ScCompiler::CheckTabQuotes( String&
  
  void ScCompiler::SetCompileXML( BOOL bVal )
  {
@@ -724,7 +811,7 @@
  }
  void ScCompiler::SetRefConvention( ScAddress::Convention eConv )
  {
-@@ -1968,15 +2069,16 @@ xub_StrLen ScCompiler::NextSymbol()
+@@ -1968,15 +2094,16 @@ xub_StrLen ScCompiler::NextSymbol()
  // Convert symbol to token
  //---------------------------------------------------------------------------
  
@@ -746,7 +833,7 @@
      }
      else
      {
-@@ -2776,8 +2878,9 @@ void ScCompiler::AutoCorrectParsedSymbol
+@@ -2776,8 +2903,9 @@ void ScCompiler::AutoCorrectParsedSymbol
      }
  }
  
@@ -757,7 +844,7 @@
      xub_StrLen nSpaces = NextSymbol();
  
  #if 0
-@@ -2836,7 +2939,7 @@ BOOL ScCompiler::NextNewToken( bool bAll
+@@ -2836,7 +2964,7 @@ BOOL ScCompiler::NextNewToken( bool bAll
              // IsReference().
              // IsBoolean before isValue to catch inline bools without the kludge
              //    for inline arrays.
@@ -766,7 +853,7 @@
                && !IsReference( aOrg )
                && !(bAllowBooleans && IsBoolean( aUpper ))
                && !IsValue( aUpper )
-@@ -2988,7 +3091,7 @@ ScTokenArray* ScCompiler::CompileString(
+@@ -2988,7 +3116,7 @@ ScTokenArray* ScCompiler::CompileString(
                  SetError(errCodeOverflow);
              }
              else if ( bAutoCorrect )
@@ -775,7 +862,7 @@
          }
  
          ScByteToken aToken( ocClose );
-@@ -2999,7 +3102,7 @@ ScTokenArray* ScCompiler::CompileString(
+@@ -2999,7 +3127,7 @@ ScTokenArray* ScCompiler::CompileString(
                  SetError(errCodeOverflow); break;
              }
              if ( bAutoCorrect )
@@ -784,7 +871,7 @@
          }
      }
      if ( nForced >= 2 )
-@@ -5001,9 +5104,17 @@ ScRangeData* ScCompiler::UpdateMoveTab( 
+@@ -5001,9 +5129,17 @@ ScRangeData* ScCompiler::UpdateMoveTab( 
  }
  
  
@@ -804,7 +891,7 @@
  }
  
  ScToken* ScCompiler::CreateStringFromToken( String& rFormula, ScToken* pTokenP,
-@@ -5046,7 +5157,7 @@ ScToken* ScCompiler::CreateStringFromTok
+@@ -5046,7 +5182,7 @@ ScToken* ScCompiler::CreateStringFromTok
      else if( eOp >= ocInternalBegin && eOp <= ocInternalEnd )
          rBuffer.appendAscii( pInternal[ eOp - ocInternalBegin ] );
      else if( (USHORT) eOp < mxSymbolsNative->getSymbolCount())        // Keyword:
@@ -813,7 +900,7 @@
      else
      {
          DBG_ERROR("Unbekannter OpCode");
-@@ -5175,20 +5286,19 @@ void ScCompiler::CreateStringFromScMatri
+@@ -5175,20 +5311,19 @@ void ScCompiler::CreateStringFromScMatri
      SCSIZE nC, nMaxC, nR, nMaxR;
  
      pMatrix->GetDimensions( nMaxC, nMaxR);
@@ -837,7 +924,7 @@
              }
  
              if( pMatrix->IsValue( nC, nR ) )
-@@ -5213,7 +5323,7 @@ void ScCompiler::CreateStringFromScMatri
+@@ -5213,7 +5348,7 @@ void ScCompiler::CreateStringFromScMatri
                  AppendString( rBuffer, pMatrix->GetString( nC, nR ) );
          }
      }
@@ -2042,7 +2129,7 @@
  	{
 diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/pagedlg/areasdlg.cxx sc/source/ui/pagedlg/areasdlg.cxx
 --- sc.clean/source/ui/pagedlg/areasdlg.cxx	2008-03-03 11:24:50.000000000 -0500
-+++ sc/source/ui/pagedlg/areasdlg.cxx	2008-03-22 02:27:34.000000000 -0400
++++ sc/source/ui/pagedlg/areasdlg.cxx	2008-03-25 13:09:04.000000000 -0400
 @@ -61,6 +61,7 @@
  #include "docsh.hxx"
  #include "globstr.hrc"
@@ -2051,20 +2138,43 @@
  
  // STATIC DATA ---------------------------------------------------------------
  
-@@ -85,10 +86,8 @@ const USHORT SC_AREASDLG_RR_OFFSET  = 2;
+@@ -85,10 +86,32 @@ const USHORT SC_AREASDLG_RR_OFFSET  = 2;
  
  // globale Funktionen (->am Ende der Datei):
  
 -BOOL	lcl_CheckRepeatString( const String& rStr, BOOL bIsRow, ScRange* pRange );
 -void	lcl_GetRepeatRangeString( const ScRange* pRange, BOOL bIsRow, String& rStr );
 -void	lcl_CheckEqual( String& rStr );
--
 +bool    lcl_CheckRepeatString( const String& rStr, ScDocument* pDoc, bool bIsRow, ScRange* pRange );
 +void	lcl_GetRepeatRangeString( const ScRange* pRange, ScDocument* pDoc, bool bIsRow, String& rStr );
  
++static void printAddressFlags(USHORT nFlag)
++{
++    if ((nFlag & SCA_COL_ABSOLUTE  ) == SCA_COL_ABSOLUTE  )  printf("SCA_COL_ABSOLUTE \n");
++    if ((nFlag & SCA_ROW_ABSOLUTE  ) == SCA_ROW_ABSOLUTE  )  printf("SCA_ROW_ABSOLUTE \n");
++    if ((nFlag & SCA_TAB_ABSOLUTE  ) == SCA_TAB_ABSOLUTE  )  printf("SCA_TAB_ABSOLUTE \n");
++    if ((nFlag & SCA_TAB_3D        ) == SCA_TAB_3D        )  printf("SCA_TAB_3D       \n");
++    if ((nFlag & SCA_COL2_ABSOLUTE ) == SCA_COL2_ABSOLUTE )  printf("SCA_COL2_ABSOLUTE\n");
++    if ((nFlag & SCA_ROW2_ABSOLUTE ) == SCA_ROW2_ABSOLUTE )  printf("SCA_ROW2_ABSOLUTE\n");
++    if ((nFlag & SCA_TAB2_ABSOLUTE ) == SCA_TAB2_ABSOLUTE )  printf("SCA_TAB2_ABSOLUTE\n");
++    if ((nFlag & SCA_TAB2_3D       ) == SCA_TAB2_3D       )  printf("SCA_TAB2_3D      \n");
++    if ((nFlag & SCA_VALID_ROW     ) == SCA_VALID_ROW     )  printf("SCA_VALID_ROW    \n");
++    if ((nFlag & SCA_VALID_COL     ) == SCA_VALID_COL     )  printf("SCA_VALID_COL    \n");
++    if ((nFlag & SCA_VALID_TAB     ) == SCA_VALID_TAB     )  printf("SCA_VALID_TAB    \n");
++    if ((nFlag & SCA_FORCE_DOC     ) == SCA_FORCE_DOC     )  printf("SCA_FORCE_DOC    \n");
++    if ((nFlag & SCA_VALID_ROW2    ) == SCA_VALID_ROW2    )  printf("SCA_VALID_ROW2   \n");
++    if ((nFlag & SCA_VALID_COL2    ) == SCA_VALID_COL2    )  printf("SCA_VALID_COL2   \n");
++    if ((nFlag & SCA_VALID_TAB2    ) == SCA_VALID_TAB2    )  printf("SCA_VALID_TAB2   \n");
++    if ((nFlag & SCA_VALID         ) == SCA_VALID         )  printf("SCA_VALID        \n");
++    if ((nFlag & SCA_ABS           ) == SCA_ABS           )  printf("SCA_ABS          \n");
++    if ((nFlag & SCR_ABS           ) == SCR_ABS           )  printf("SCR_ABS          \n");
++    if ((nFlag & SCA_ABS_3D        ) == SCA_ABS_3D        )  printf("SCA_ABS_3D       \n");
++    if ((nFlag & SCR_ABS_3D        ) == SCR_ABS_3D        )  printf("SCR_ABS_3D       \n");
++}
+ 
  //============================================================================
  //	class ScPrintAreasDlg
-@@ -190,11 +189,11 @@ void ScPrintAreasDlg::SetReference( cons
+@@ -190,11 +213,11 @@ void ScPrintAreasDlg::SetReference( cons
  			RefInputStart( pRefInputEdit );
  
  		String	aStr;
@@ -2078,7 +2188,7 @@
  
  //			aEdPrintArea.ReplaceSelected( aStr );
  
-@@ -210,7 +209,7 @@ void ScPrintAreasDlg::SetReference( cons
+@@ -210,7 +233,7 @@ void ScPrintAreasDlg::SetReference( cons
  		else
  		{
  			BOOL bRow = ( &aEdRepeatRow == pRefInputEdit );
@@ -2087,7 +2197,7 @@
  			pRefInputEdit->SetRefString( aStr );
  		}
  	}
-@@ -225,8 +224,9 @@ void ScPrintAreasDlg::AddRefEntry()
+@@ -225,8 +248,9 @@ void ScPrintAreasDlg::AddRefEntry()
  {
  	if ( pRefInputEdit == &aEdPrintArea )
  	{
@@ -2098,7 +2208,7 @@
  		aEdPrintArea.SetText(aVal);
  
  		xub_StrLen nLen = aVal.Len();
-@@ -296,6 +296,8 @@ void ScPrintAreasDlg::Impl_Reset()
+@@ -296,6 +320,8 @@ void ScPrintAreasDlg::Impl_Reset()
  	//-------------------------
  	aStrRange.Erase();
      String aOne;
@@ -2107,7 +2217,7 @@
      USHORT nRangeCount = pDoc->GetPrintRangeCount( nCurTab );
      for (USHORT i=0; i<nRangeCount; i++)
      {
-@@ -303,9 +305,8 @@ void ScPrintAreasDlg::Impl_Reset()
+@@ -303,9 +329,8 @@ void ScPrintAreasDlg::Impl_Reset()
          if (pPrintRange)
          {
              if ( aStrRange.Len() )
@@ -2119,7 +2229,7 @@
              aStrRange += aOne;
          }
      }
-@@ -314,13 +315,13 @@ void ScPrintAreasDlg::Impl_Reset()
+@@ -314,13 +339,13 @@ void ScPrintAreasDlg::Impl_Reset()
  	//-------------------------------
  	// Wiederholungszeile
  	//-------------------------------
@@ -2135,7 +2245,7 @@
  	aEdRepeatCol.SetText( aStrRange );
  
  	Impl_ModifyHdl( &aEdPrintArea );
-@@ -345,9 +346,9 @@ BOOL ScPrintAreasDlg::Impl_GetItem( Edit
+@@ -345,9 +370,9 @@ BOOL ScPrintAreasDlg::Impl_GetItem( Edit
  	if ( (aRangeStr.Len() > 0) && &aEdPrintArea != pEd )
  	{
  		ScRange aRange;
@@ -2148,25 +2258,42 @@
  	}
  
  	rItem.SetValue( aRangeStr );
-@@ -369,24 +370,26 @@ BOOL ScPrintAreasDlg::Impl_CheckRefStrin
+@@ -368,25 +393,41 @@ BOOL ScPrintAreasDlg::Impl_CheckRefStrin
+ 	BOOL bPrintAreaOk = TRUE;
  	if ( aStrPrintArea.Len() )
  	{
++        const USHORT nValidAddr  = SCA_VALID | SCA_VALID_ROW | SCA_VALID_COL;
++        const USHORT nValidRange = nValidAddr | SCA_VALID_ROW2 | SCA_VALID_COL2;
++        const ScAddress::Convention eConv = pDoc->GetAddressConvention();
++        const sal_Unicode sep  = ScCompiler::GetStringFromOpCode(ocSep, false, eConv).GetChar(0);
++        const sal_Unicode rsep = ScCompiler::GetStringFromOpCode(ocRange, false, eConv).GetChar(0);
++
++        ScAddress aAddr;
  		ScRange aRange;
 -		xub_StrLen nTCount = aStrPrintArea.GetTokenCount();
-+        const USHORT nValid = SCA_VALID | SCA_VALID_ROW | SCA_VALID_COL | SCA_VALID_ROW2 | SCA_VALID_COL2;
-+        const ScAddress::Convention eConv = pDoc->GetAddressConvention();
-+        const sal_Unicode sep = ScCompiler::GetStringFromOpCode(ocSep, false, eConv).GetChar(0);
-+		xub_StrLen nTCount = aStrPrintArea.GetTokenCount(sep);
- 		for ( xub_StrLen i=0; i<nTCount && bPrintAreaOk; i++ )
+-		for ( xub_StrLen i=0; i<nTCount && bPrintAreaOk; i++ )
++		xub_StrLen nSepCount = aStrPrintArea.GetTokenCount(sep);
++		for ( xub_StrLen i = 0; i < nSepCount && bPrintAreaOk; ++i )
  		{
 -			String aOne = aStrPrintArea.GetToken(i);
 -			lcl_CheckEqual( aOne );
 -			USHORT nResult = aRange.ParseAny( aOne, pDoc );
 -			if (!(nResult & SCA_VALID))
+-				bPrintAreaOk = FALSE;
 +			String aOne = aStrPrintArea.GetToken(i, sep);
-+			USHORT nResult = aRange.ParseAny( aOne, pDoc, eConv );
-+			if ((nResult & nValid) != nValid)
- 				bPrintAreaOk = FALSE;
++            bool bIsRange = (aOne.Search(rsep, 0) != STRING_NOTFOUND);
++            if (bIsRange)
++            {
++                USHORT nResult = aRange.Parse( aOne, pDoc, eConv );
++                if ((nResult & nValidRange) != nValidRange)
++                    bPrintAreaOk = FALSE;
++            }
++            else
++            {
++                USHORT nResult = aAddr.Parse( aOne, pDoc, eConv );
++                if ((nResult & nValidAddr) != nValidAddr)
++                    bPrintAreaOk = FALSE;
++            }
  		}
  	}
  
@@ -2182,7 +2309,7 @@
  
  	// Fehlermeldungen
  
-@@ -418,17 +421,18 @@ void ScPrintAreasDlg::Impl_FillLists()
+@@ -418,17 +459,18 @@ void ScPrintAreasDlg::Impl_FillLists()
  	ScRange	aRange;
  	String	aStrRange;
  	BOOL bSimple = TRUE;
@@ -2203,7 +2330,7 @@
  	}
  
      aLbPrintArea.SetEntryData( SC_AREASDLG_PR_SELECT, new String( aStrRange ) );
-@@ -457,11 +461,11 @@ void ScPrintAreasDlg::Impl_FillLists()
+@@ -457,11 +499,11 @@ void ScPrintAreasDlg::Impl_FillLists()
  				{
  					pData->GetName( aName );
  					pData->GetSymbol( aSymbol );
@@ -2217,7 +2344,7 @@
  							aLbPrintArea.SetEntryData(
  								aLbPrintArea.InsertEntry( aName ),
  								new String( aSymbol ) );
-@@ -469,7 +473,7 @@ void ScPrintAreasDlg::Impl_FillLists()
+@@ -469,7 +511,7 @@ void ScPrintAreasDlg::Impl_FillLists()
  
  						if ( pData->HasType( RT_ROWHEADER ) )
  						{
@@ -2226,7 +2353,7 @@
  							aLbRepeatRow.SetEntryData(
  								aLbRepeatRow.InsertEntry( aName ),
  								new String( aSymbol ) );
-@@ -477,7 +481,7 @@ void ScPrintAreasDlg::Impl_FillLists()
+@@ -477,7 +519,7 @@ void ScPrintAreasDlg::Impl_FillLists()
  
  						if ( pData->HasType( RT_COLHEADER ) )
  						{
@@ -2235,21 +2362,21 @@
  							aLbRepeatCol.SetEntryData(
  								aLbRepeatCol.InsertEntry( aName ),
  								new String( aSymbol ) );
-@@ -669,9 +673,11 @@ IMPL_LINK( ScPrintAreasDlg, Impl_ModifyH
+@@ -669,9 +711,11 @@ IMPL_LINK( ScPrintAreasDlg, Impl_ModifyH
  //============================================================================
  // globale Funktionen:
  
 -//----------------------------------------------------------------------------
 +// ----------------------------------------------------------------------------
-+
-+// TODO: It might make sense to move these functions to address.?xx. -kohei
  
 -BOOL lcl_CheckRepeatOne( const String& rStr, BOOL bIsRow, SCCOLROW& rVal )
++// TODO: It might make sense to move these functions to address.?xx. -kohei
++
 +bool lcl_CheckOne_OOO( const String& rStr, bool bIsRow, SCCOLROW& rVal )
  {
  	// Zulaessige Syntax fuer rStr:
  	// Row: [$]1-MAXTAB
-@@ -713,115 +719,160 @@ BOOL lcl_CheckRepeatOne( const String& r
+@@ -713,115 +757,160 @@ BOOL lcl_CheckRepeatOne( const String& r
  	return bStrOk;
  }
  
@@ -2471,7 +2598,7 @@
 +            }
 +        }
 +    }
-+
+ 
 +    return true;
 +}
  
@@ -2486,7 +2613,7 @@
 +    const ScAddress::Convention eConv = pDoc->GetAddressConvention();
 +    const ScAddress& rStart = pRange->aStart;
 +    const ScAddress& rEnd   = pRange->aEnd;
- 
++
 +    const USHORT nFmt = bIsRow ? (SCA_VALID_ROW | SCA_ROW_ABSOLUTE) : (SCA_VALID_COL | SCA_COL_ABSOLUTE);
 +    String aTmpStr;
 +    rStart.Format(aTmpStr, nFmt, pDoc, eConv);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]