Commits

Anonymous committed 0b48274

CWS-TOOLING: integrate CWS calc46_DEV300

  • Participants
  • Parent commits cb54593

Comments (0)

Files changed (8)

sc/source/core/tool/compiler.cxx

                     eState = ssStop;
             }
         }
+Label_MaskStateMachine:
         switch (eState)
         {
             case ssGetChar :
                             eState = ssStop;
                         }
                     }
+                    else
+                    {
+                        nMask &= ~SC_COMPILER_C_ODF_LABEL_OP;
+                        goto Label_MaskStateMachine;
+                    }
                 }
                 else if( nMask & SC_COMPILER_C_CHAR )
                 {
         if (!bRelRef && t->GetType() == svDoubleRef)
             bRelRef = rRef.Ref2.IsColRel() || rRef.Ref2.IsRowRel() ||
                 rRef.Ref2.IsTabRel();
-        bool bUpdate;
-        if (bSharedFormula)
+        bool bUpdate = !rRef.Ref1.IsColRel() || !rRef.Ref1.IsRowRel() ||
+            !rRef.Ref1.IsTabRel();
+        if (!bUpdate && t->GetType() == svDoubleRef)
+            bUpdate = !rRef.Ref2.IsColRel() || !rRef.Ref2.IsRowRel() ||
+                !rRef.Ref2.IsTabRel();
+        if (!bSharedFormula)
         {
-            bUpdate = !rRef.Ref1.IsColRel() || !rRef.Ref1.IsRowRel() ||
-                !rRef.Ref1.IsTabRel();
-            if (bUpdate)
-                rRef.Ref1.CalcAbsIfRel( aPos);
-            if (t->GetType() == svDoubleRef)
-            {
-                if (!bUpdate)
-                    bUpdate = !rRef.Ref2.IsColRel() || !rRef.Ref2.IsRowRel() ||
-                        !rRef.Ref2.IsTabRel();
-                if (bUpdate)
-                    rRef.Ref2.CalcAbsIfRel( aPos);
-            }
-        }
-        else
-        {
-            bUpdate = !bRelRef;
+            // We cannot update names with sheet-relative references, they may
+            // be used on other sheets as well and the resulting reference
+            // would be wrong. This is a dilemma if col/row would need to be
+            // updated for the current usage.
+            // TODO: seems the only way out of this would be to not allow
+            // relative sheet references and have sheet-local names that can be
+            // copied along with sheets.
+            bUpdate = bUpdate && !rRef.Ref1.IsTabRel() && !rRef.Ref2.IsTabRel();
         }
         if (bUpdate)
         {
+            rRef.CalcAbsIfRel( aPos);
             if (ScRefUpdate::Update( pDoc, eUpdateRefMode, aPos, r,
                         nDx, nDy, nDz, rRef, ScRefUpdate::ABSOLUTE)
                     != UR_NOTHING )

sc/source/core/tool/refdata.cxx

         lcl_adjustInOrder( aRef, Ref2, false);
         if (bInherit3Dtemp)
             Ref2.SetFlag3D( false);
+        aRef = rRef;
+        aRef.CalcAbsIfRel( rPos);
     }
+    // In Ref2 use absolute/relative addressing from non-extended parts if
+    // equal and therefor not adjusted.
+    // A$5:A5 => A$5:A$5:A5 => A$5:A5, and not A$5:A$5
+    // A$6:$A5 => A$6:A$6:$A5 => A5:$A$6
+    if (Ref2.nCol == aRef.nCol)
+        Ref2.SetColRel( aRef.IsColRel());
+    if (Ref2.nRow == aRef.nRow)
+        Ref2.SetRowRel( aRef.IsRowRel());
+    if (Ref2.nTab == aRef.nTab)
+        Ref2.SetTabRel( aRef.IsTabRel());
+    Ref2.CalcRelFromAbs( rPos);
     // Force 3D if necessary. References to other sheets always.
     if (Ref1.nTab != rPos.Tab())
         Ref1.SetFlag3D( true);
         Ref2.SetFlag3D( true);
     // Merge Flag3D to Ref2 in case there was nothing to inherit and/or range
     // wasn't extended as in A5:A5:Sheet1.A5 if on Sheet1.
-    if (!Ref1.IsFlag3D() && !Ref2.IsFlag3D() && rRef.IsFlag3D())
+    if (rRef.IsFlag3D())
         Ref2.SetFlag3D( true);
     return *this;
 }

sc/source/filter/xml/xmlcelli.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: xmlcelli.cxx,v $
- * $Revision: 1.96 $
+ * $Revision: 1.96.166.1 $
  *
  * This file is part of OpenOffice.org.
  *
 	    uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange());
 	    if ( xCellRange.is() )
 	    {
-		    table::CellRangeAddress aCellAddress;
-		    if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress))
-		    {
-			    //unmerge
-			    uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
-													    aCellAddress.EndColumn, aCellAddress.EndRow), uno::UNO_QUERY);
-			    if (xMergeable.is())
-				    xMergeable->merge(sal_False);
-		    }
+            // Stored merge range may actually be of a larger extend than what
+            // we support, in which case getCellRangeByPosition() throws
+            // IndexOutOfBoundsException. Do nothing then.
+            try
+            {
+                table::CellRangeAddress aCellAddress;
+                if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress))
+                {
+                    //unmerge
+                    uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
+                                aCellAddress.EndColumn, aCellAddress.EndRow), uno::UNO_QUERY);
+                    if (xMergeable.is())
+                        xMergeable->merge(sal_False);
+                }
 
-		    //merge
-		    uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
-												    aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY);
-		    if (xMergeable.is())
-			    xMergeable->merge(sal_True);
+                //merge
+                uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow,
+                            aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY);
+                if (xMergeable.is())
+                    xMergeable->merge(sal_True);
+            }
+            catch ( lang::IndexOutOfBoundsException & )
+            {
+                DBG_ERRORFILE("ScXMLTableRowCellContext::DoMerge: range to be merged larger than what we support");
+            }
 	    }
     }
 }

sc/source/ui/docshell/docsh4.cxx

 				rSet.Put( SfxUInt16Item( nWhich,
 					aDocument.GetDocOptions().GetYear2000() ) );
 			break;
+
+            case SID_SHARE_DOC:
+                {
+                    if ( IsReadOnly() )
+                    {
+                        rSet.DisableItem( nWhich );
+                    }
+                }
+                break;
+
+            default:
+                {
+                }
+                break;
 		}
 
 		nWhich = aIter.NextWhich();

sc/source/ui/docshell/docsh5.cxx

 {
 	ScDocShellModificator aModificator( *this );
 
+    // #i92477# be consistent with ScDocFunc::InsertTable: any index past the last sheet means "append"
+    if ( nDestTab >= aDocument.GetTableCount() )
+        nDestTab = SC_TAB_APPEND;
+
 	if (bCopy)
 	{
 		if (bRecord)

sc/source/ui/miscdlgs/sharedocdlg.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: sharedocdlg.cxx,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.134.1 $
  *
  * This file is part of OpenOffice.org.
  *
                             aUser += String::CreateFromInt32( nUnknownUser++ );
                         }
 
-                        String aDateTime = pUsersData[i][SHARED_EDITTIME_ID];
+                        // parse the edit time string of the format "DD.MM.YYYY hh:mm"
+                        ::rtl::OUString aDateTimeStr = pUsersData[i][SHARED_EDITTIME_ID];
+                        sal_Int32 nIndex = 0;
+                        ::rtl::OUString aDateStr = aDateTimeStr.getToken( 0, ' ', nIndex );
+                        ::rtl::OUString aTimeStr = aDateTimeStr.getToken( 0, ' ', nIndex );
+                        nIndex = 0;
+                        USHORT nDay = sal::static_int_cast< USHORT >( aDateStr.getToken( 0, '.', nIndex ).toInt32() );
+                        USHORT nMonth = sal::static_int_cast< USHORT >( aDateStr.getToken( 0, '.', nIndex ).toInt32() );
+                        USHORT nYear = sal::static_int_cast< USHORT >( aDateStr.getToken( 0, '.', nIndex ).toInt32() );
+                        nIndex = 0;
+                        USHORT nHours = sal::static_int_cast< USHORT >( aTimeStr.getToken( 0, ':', nIndex ).toInt32() );
+                        USHORT nMinutes = sal::static_int_cast< USHORT >( aTimeStr.getToken( 0, ':', nIndex ).toInt32() );
+                        Date aDate( nDay, nMonth, nYear );
+                        Time aTime( nHours, nMinutes );
+                        DateTime aDateTime( aDate, aTime );
 
                         String aString( aUser );
                         aString += '\t';
-                        aString += aDateTime;
+                        aString += ScGlobal::pLocaleData->getDate( aDateTime );
+                        aString += ' ';
+                        aString += ScGlobal::pLocaleData->getTime( aDateTime, FALSE );
+
                         maLbUsers.InsertEntry( aString, NULL );
                     }
                 }

sc/source/ui/unoobj/docuno.cxx

 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
 #include <com/sun/star/script/XLibraryContainer.hpp>
 #include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
 #include <comphelper/processfactory.hxx>
 
 #include "docuno.hxx"
 		//	alles was ich nicht kenn, werf ich der SvxFmMSFactory an den Hals,
 		//	da wird dann 'ne Exception geworfen, wenn's nicht passt...
 
+        try
 		{
 			xRet.set(SvxFmMSFactory::createInstance(aServiceSpecifier));
 			// extra block to force deletion of the temporary before ScShapeObj ctor (setDelegator)
 		}
+        catch ( lang::ServiceNotRegisteredException & )
+        {
+        }
 
 		//	#96117# if the drawing factory created a shape, a ScShapeObj has to be used
 		//	to support own properties like ImageMap:
 			bDone = pDocShell->MoveTable( nSource, nDestination, TRUE, TRUE );
 			if (bDone)
 			{
-				ScDocFunc aFunc(*pDocShell);
-				bDone = aFunc.RenameTable( nDestination, aNewStr, TRUE, TRUE );
+                // #i92477# any index past the last sheet means "append" in MoveTable
+                SCTAB nResultTab = static_cast<SCTAB>(nDestination);
+                SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount();    // count after copying
+                if (nResultTab >= nTabCount)
+                    nResultTab = nTabCount - 1;
+
+                ScDocFunc aFunc(*pDocShell);
+                bDone = aFunc.RenameTable( nResultTab, aNewStr, TRUE, TRUE );
 			}
 		}
 	}

svtools/source/numbers/zformat.cxx

  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: zformat.cxx,v $
- * $Revision: 1.78 $
+ * $Revision: 1.78.168.1 $
  *
  * This file is part of OpenOffice.org.
  *
                         ExpStr = String::CreateFromInt32( nExp );
                     }
                 }
-                USHORT j = nAnz-1;              // last symbol
-                xub_StrLen k;
+                USHORT j = nAnz-1;                  // last symbol
+                xub_StrLen k;                       // position in ExpStr
                 bRes |= ImpNumberFill(ExpStr, fNumber, k, j, nIx, NF_SYMBOLTYPE_EXP);
 
-                while (k > 0)                   // erase leading zeros
-                {
-                    k--;
-                    if (ExpStr.GetChar(k) == '0')
-                        ExpStr.Erase(0,1);
-                }
+                xub_StrLen nZeros = 0;              // erase leading zeros
+                while (nZeros < k && ExpStr.GetChar(nZeros) == '0')
+                    ++nZeros;
+                if (nZeros)
+                    ExpStr.Erase( 0, nZeros);
+
                 BOOL bCont = TRUE;
                 if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_EXP)
                 {