diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2008-11-20 13:27:25 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2008-11-20 13:27:25 +0000 |
commit | 60f8b3a3249c2865514a62df516526f8d411f15a (patch) | |
tree | 37b2f6c1f77a0f54a4f7894ecc0630a6cde5619f /sc | |
parent | 20ef27b8996295b648672249ddcf5c1e545588a9 (diff) |
CWS-TOOLING: integrate CWS calc46_DEV300
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 39 | ||||
-rw-r--r-- | sc/source/core/tool/refdata.cxx | 15 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 34 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh5.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/sharedocdlg.cxx | 23 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 13 |
7 files changed, 107 insertions, 35 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index b8533cce8..a7a3534a8 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -1896,6 +1896,7 @@ xub_StrLen ScCompiler::NextSymbol() eState = ssStop; } } +Label_MaskStateMachine: switch (eState) { case ssGetChar : @@ -1926,6 +1927,11 @@ xub_StrLen ScCompiler::NextSymbol() eState = ssStop; } } + else + { + nMask &= ~SC_COMPILER_C_ODF_LABEL_OP; + goto Label_MaskStateMachine; + } } else if( nMask & SC_COMPILER_C_CHAR ) { @@ -4885,28 +4891,25 @@ BOOL ScCompiler::UpdateNameReference(UpdateRefMode eUpdateRefMode, if (!bRelRef && t->GetType() == svDoubleRef) bRelRef = rRef.Ref2.IsColRel() || rRef.Ref2.IsRowRel() || rRef.Ref2.IsTabRel(); - bool bUpdate; - 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 + 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 = !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 ) diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx index 29080f7b0..b3b635aa5 100644 --- a/sc/source/core/tool/refdata.cxx +++ b/sc/source/core/tool/refdata.cxx @@ -335,7 +335,20 @@ ComplRefData& ComplRefData::Extend( const SingleRefData & rRef, const ScAddress 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); @@ -344,7 +357,7 @@ ComplRefData& ComplRefData::Extend( const SingleRefData & rRef, const ScAddress 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; } diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 8a0091950..704dab70c 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -7,7 +7,7 @@ * 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. * @@ -607,21 +607,31 @@ void ScXMLTableRowCellContext::DoMerge(const com::sun::star::table::CellAddress& uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange()); if ( xCellRange.is() ) { - table::CellRangeAddress aCellAddress; - if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress)) + // Stored merge range may actually be of a larger extend than what + // we support, in which case getCellRangeByPosition() throws + // IndexOutOfBoundsException. Do nothing then. + try { - //unmerge + 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, aCellAddress.EndRow), uno::UNO_QUERY); + aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY); if (xMergeable.is()) - xMergeable->merge(sal_False); + xMergeable->merge(sal_True); + } + catch ( lang::IndexOutOfBoundsException & ) + { + DBG_ERRORFILE("ScXMLTableRowCellContext::DoMerge: range to be merged larger than what we support"); } - - //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); } } } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 78eeb5ed6..f343cf713 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2209,6 +2209,20 @@ void ScDocShell::GetState( SfxItemSet &rSet ) rSet.Put( SfxUInt16Item( nWhich, aDocument.GetDocOptions().GetYear2000() ) ); break; + + case SID_SHARE_DOC: + { + if ( IsReadOnly() ) + { + rSet.DisableItem( nWhich ); + } + } + break; + + default: + { + } + break; } nWhich = aIter.NextWhich(); diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index fff3837f2..fef661817 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -806,6 +806,10 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTab, SCTAB nDestTab, BOOL bCopy, BOOL bRec { 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) diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index 73a99d9d0..d17c77d8d 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -7,7 +7,7 @@ * 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. * @@ -155,11 +155,28 @@ void ScShareDocumentDlg::UpdateView() 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 ); } } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 20fe49860..ed851e5e2 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -59,6 +59,7 @@ #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" @@ -1647,10 +1648,14 @@ uno::Reference<uno::XInterface> SAL_CALL ScModelObj::createInstance( // 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: @@ -1998,8 +2003,14 @@ void SAL_CALL ScTableSheetsObj::copyByName( const rtl::OUString& aName, bDone = pDocShell->MoveTable( nSource, nDestination, TRUE, TRUE ); if (bDone) { + // #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( nDestination, aNewStr, TRUE, TRUE ); + bDone = aFunc.RenameTable( nResultTab, aNewStr, TRUE, TRUE ); } } } |