Commits

vg  committed a33ee9e

CWS-TOOLING: integrate CWS calc32stopper3
2009-10-12 14:26:09 +0200 er r276833 : disable dump again
2009-10-12 13:46:57 +0200 er r276832 : #i102294# setValue: yet another DST glitch
2009-10-12 13:21:48 +0200 iha r276828 : #i105767# Y axis vanishes in case of zero rotated axis title
2009-10-08 01:49:20 +0200 er r276772 : NextSymbol: actually do reset ODF reference detection on file/sheet separator
2009-10-08 00:18:58 +0200 er r276771 : #i101639# use TabIDs in cached RangeArrays, not RefData Tabs
2009-10-07 19:25:47 +0200 er r276767 : #i105200# UpdateBroadcastAreas: hash key changes, remove area from all slots and reinsert
2009-10-05 17:20:44 +0200 er r276690 : #i105365# SI prefixes for ang, ang3, m/h, m/hr
2009-10-05 16:21:29 +0200 er r276686 : #i105161 intersection has higher precedence than union

  • Participants
  • Parent commits 44d4cbb

Comments (0)

Files changed (10)

File chart2/source/controller/chartapiwrapper/TitleWrapper.cxx

     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
     
     aWrappedProperties.push_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) );
-    aWrappedProperties.push_back( new WrappedTextRotationProperty() );
+    aWrappedProperties.push_back( new WrappedTextRotationProperty( m_eTitleType==TitleHelper::Y_AXIS_TITLE || m_eTitleType==TitleHelper::X_AXIS_TITLE ) );
     aWrappedProperties.push_back( new WrappedStackedTextProperty() );
     WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
     WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );

File chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx

 
 #include "WrappedTextRotationProperty.hxx"
 #include "macros.hxx"
+#include <com/sun/star/beans/XPropertyState.hpp>
 
+using namespace ::com::sun::star;
 using ::com::sun::star::uno::Any;
 using ::rtl::OUString;
 
 {
 //.............................................................................
 
-WrappedTextRotationProperty::WrappedTextRotationProperty()
+WrappedTextRotationProperty::WrappedTextRotationProperty( bool bDirectState )
     : ::chart::WrappedProperty( C2U( "TextRotation" ), C2U( "TextRotation" ) )
+    , m_bDirectState( bDirectState )
 {
 }
 WrappedTextRotationProperty::~WrappedTextRotationProperty()
 {
 }
+
+beans::PropertyState WrappedTextRotationProperty::getPropertyState( const uno::Reference< beans::XPropertyState >& xInnerPropertyState ) const
+                        throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+    if( m_bDirectState )
+        return beans::PropertyState_DIRECT_VALUE;
+    return WrappedProperty::getPropertyState( xInnerPropertyState );
+}
+
 Any WrappedTextRotationProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
 {
     Any aRet;

File chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx

 class WrappedTextRotationProperty : public WrappedProperty
 {
 public:
-    WrappedTextRotationProperty();
+    WrappedTextRotationProperty( bool bDirectState=false );
     virtual ~WrappedTextRotationProperty();
 
+    virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+                        throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
 protected:
     virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
     virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
+
+    bool m_bDirectState;
 };
 
 //.............................................................................

File formula/source/core/api/FormulaCompiler.cxx

 
 //---------------------------------------------------------------------------
 
-void FormulaCompiler::UnionLine()
+void FormulaCompiler::IntersectionLine()
 {
     RangeLine();
-    while (pToken->GetOpCode() == ocUnion)
+    while (pToken->GetOpCode() == ocIntersect)
     {
         FormulaTokenRef p = pToken;
         NextToken();
 
 //---------------------------------------------------------------------------
 
-void FormulaCompiler::IntersectionLine()
+void FormulaCompiler::UnionLine()
 {
-    UnionLine();
-    while (pToken->GetOpCode() == ocIntersect)
+    IntersectionLine();
+    while (pToken->GetOpCode() == ocUnion)
     {
         FormulaTokenRef p = pToken;
         NextToken();
-        UnionLine();
+        IntersectionLine();
         PutCode(p);
     }
 }
         PutCode( p );
     }
     else
-        IntersectionLine();
+        UnionLine();
 }
 
 //---------------------------------------------------------------------------

File i18npool/source/calendar/calendar_gregorian.cxx

 
         bool bNeedZone = !(fieldSet & (1 << CalendarFieldIndex::ZONE_OFFSET));
         bool bNeedDST  = !(fieldSet & (1 << CalendarFieldIndex::DST_OFFSET));
-        sal_Int32 nZone1, nDST1, nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone, nDST;
-        nZone1 = nDST1 = nZone = nDST = 0;
+        sal_Int32 nZone1, nDST1, nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone0, nDST0;
+        nZone1 = nDST1 = nZone0 = nDST0 = 0;
         nYear = nMonth = nDay = nHour = nMinute = nSecond = nMilliSecond = -1;
         if ( bNeedZone || bNeedDST )
         {
             }
             if ( !(fieldSet & (1 << CalendarFieldIndex::ZONE_OFFSET)) )
             {
-                nZone = body->get( UCAL_ZONE_OFFSET, status = U_ZERO_ERROR);
+                nZone0 = body->get( UCAL_ZONE_OFFSET, status = U_ZERO_ERROR);
                 if ( !U_SUCCESS(status) )
-                    nZone = 0;
+                    nZone0 = 0;
             }
             if ( !(fieldSet & (1 << CalendarFieldIndex::DST_OFFSET)) )
             {
-                nDST = body->get( UCAL_DST_OFFSET, status = U_ZERO_ERROR);
+                nDST0 = body->get( UCAL_DST_OFFSET, status = U_ZERO_ERROR);
                 if ( !U_SUCCESS(status) )
-                    nDST = 0;
+                    nDST0 = 0;
             }
 
             // Submit values to obtain a time zone and DST corresponding to the date/time.
-            submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone, nDST);
+            submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone0, nDST0);
 
             DUMP_ICU_CAL_MSG(("%s\n","setValue() in bNeedZone||bNeedDST after submitValues()"));
             DUMP_I18N_CAL_MSG(("%s\n","setValue() in bNeedZone||bNeedDST after submitValues()"));
                 nDST1 = 0;
         }
 
-        // The original submission, may lead to a different zone/DST.
+        // The original submission, may lead to a different zone/DST and 
+        // different date.
         submitFields();
         DUMP_ICU_CAL_MSG(("%s\n","setValue() after original submission"));
         DUMP_I18N_CAL_MSG(("%s\n","setValue() after original submission"));
             sal_Int32 nDST2 = body->get( UCAL_DST_OFFSET, status = U_ZERO_ERROR);
             if ( !U_SUCCESS(status) )
                 nDST2 = nDST1;
-            if ( nZone2 != nZone1 || nDST2 != nDST1 )
+            if ( nZone0 != nZone1 || nZone2 != nZone1 || nDST0 != nDST1 || nDST2 != nDST1 )
             {
                 // Due to different DSTs, resulting date values may differ if
                 // DST is onset at 00:00 and the very onsetRule date was
                 // is not what we want.
                 // Resubmit all values, this time including DST => date 01:00
                 // Similar for zone differences.
+                // If already the first full submission with nZone0 and nDST0 
+                // lead to date-1 23:00, the original submission was based on 
+                // that date if it wasn't a full date (nDST0 set, nDST1 not 
+                // set, nDST2==nDST1). If it was January 1st without year we're 
+                // even off by one year now. Resubmit all values including new 
+                // DST => date 00:00.
 
                 // Set field values accordingly in case they were used.
                 if (!bNeedZone)

File sc/source/core/data/bcaslot.cxx

 }
 
 
+void ScBroadcastAreaSlot::UpdateRemoveArea( ScBroadcastArea* pArea )
+{
+    ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.find( pArea));
+    if (aIter == aBroadcastAreaTbl.end())
+        return;
+    if (*aIter != pArea)
+        DBG_ERRORFILE( "UpdateRemoveArea: area pointer mismatch");
+    else
+    {
+        aBroadcastAreaTbl.erase( aIter);
+        pArea->DecRef();
+    }
+}
+
+
 void ScBroadcastAreaSlot::UpdateInsert( ScBroadcastArea* pArea )
 {
     ::std::pair< ScBroadcastAreas::iterator, bool > aPair = 
         }
     }
 
+    // Updating an area's range will modify the hash key, remove areas from all 
+    // affected slots. Will be reinserted later with the updated range.
+    ScBroadcastArea* pChain = pUpdateChain;
+    while (pChain)
+    {
+        ScBroadcastArea* pArea = pChain;
+        pChain = pArea->GetUpdateChainNext();
+        ScRange aRange( pArea->GetRange());
+        // remove from slots
+        for (SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab() && pArea->GetRef(); ++nTab)
+        {
+            TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab));
+            if (iTab == aTableSlotsMap.end())
+            {
+                DBG_ERRORFILE( "UpdateBroadcastAreas: Where's the TableSlot?!?");
+                continue;   // for
+            }
+            ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+            SCSIZE nStart, nEnd, nRowBreak;
+            ComputeAreaPoints( aRange, nStart, nEnd, nRowBreak );
+            SCSIZE nOff = nStart;
+            SCSIZE nBreak = nOff + nRowBreak;
+            ScBroadcastAreaSlot** pp = ppSlots + nOff;
+            while ( nOff <= nEnd && pArea->GetRef() )
+            {
+                if (*pp)
+                    (*pp)->UpdateRemoveArea( pArea);
+                if ( nOff < nBreak )
+                {
+                    ++nOff;
+                    ++pp;
+                }
+                else
+                {
+                    nStart += BCA_SLOTS_ROW;
+                    nOff = nStart;
+                    pp = ppSlots + nOff;
+                    nBreak = nOff + nRowBreak;
+                }
+            }
+        }
+        
+    }
+
     // shift sheets
     if (nDz)
     {

File sc/source/core/inc/bcaslot.hxx

 	void				UpdateRemove( UpdateRefMode eUpdateRefMode,
 										const ScRange& rRange,
 										SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+    void                UpdateRemoveArea( ScBroadcastArea* pArea );
 	void				UpdateInsert( ScBroadcastArea* pArea );
 };
 

File sc/source/core/tool/compiler.cxx

                     static const int kQuote     = (1 << 4);
                     // Past ' closing quote.
                     static const int kClose     = (1 << 5);
+                    // Encountered # file/sheet separator.
+                    static const int kFileSep   = (1 << 6);
                     // Past . sheet name separator.
-                    static const int kPast      = (1 << 6);
+                    static const int kPast      = (1 << 7);
                     // Marked name $$ follows sheet name separator, detected
                     // while we're still on the separator. Will be cleared when
                     // entering the name.
-                    static const int kMarkAhead = (1 << 7);
+                    static const int kMarkAhead = (1 << 8);
                     // In marked defined name.
-                    static const int kDefName   = (1 << 8);
+                    static const int kDefName   = (1 << 9);
 
                     bool bAddToSymbol = true;
                     if ((nMask & SC_COMPILER_C_ODF_RBRACKET) && !(nRefInName & kOpen))
                     {
                         // Not in col/row yet.
 
-                        if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen))
+                        if (SC_COMPILER_FILE_TAB_SEP == c && (nRefInName & kFileSep))
+                            nRefInName = 0;
+                        else if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen))
                         {
                             nRefInName &= ~kMarkAhead;
                             if (!(nRefInName & kDefName))
                             }
                             else
                             {
-                                if ('\'' == pSrc[0])
+                                switch (pSrc[0])
                                 {
-                                    // escapes embedded quote
-                                    nRefInName |= kQuote;
-                                }
-                                else
-                                {
-                                    // quote not followed by quote => close
-                                    nRefInName |= kClose;
-                                    nRefInName &= ~kOpen;
+                                    case '\'':
+                                        // escapes embedded quote
+                                        nRefInName |= kQuote;
+                                        break;
+                                    case SC_COMPILER_FILE_TAB_SEP:
+                                        // sheet name should follow
+                                        nRefInName |= kFileSep;
+                                        // fallthru
+                                    default:
+                                        // quote not followed by quote => close
+                                        nRefInName |= kClose;
+                                        nRefInName &= ~kOpen;
                                 }
                                 bAddToSymbol = !(nRefInName & kDefName);
                             }

File sc/source/ui/docshell/externalrefmgr.cxx

         return TokenArrayRef();
 
     DocItem& rDoc = itrDoc->second;
-    RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find(rRange);
-    if (itrRange != rDoc.maRangeArrays.end())
-    {
-        return itrRange->second;
-    }
 
     TableNameIndexMap::iterator itrTabId = rDoc.maTableNameIndex.find(
         ScGlobal::pCharClass->upper(rTabName));
         // not all tables are cached.
         return TokenArrayRef();
 
+    ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
+    RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find( aCacheRange);
+    if (itrRange != rDoc.maRangeArrays.end())
+    {
+        return itrRange->second;
+    }
+
     TokenArrayRef pArray(new ScTokenArray);
     bool bFirstTab = true;
     for (size_t nTab = nTabFirstId; nTab <= nTabLastId; ++nTab)
 
         bFirstTab = false;
     }
-    rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
+    rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray));
     return pArray;
 }
 
         return;
     }
 
-    size_t nTab1 = itrTabName->second;
+    size_t nTabFirstId = itrTabName->second;
     SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
     SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
     vector<SingleRangeData>::const_iterator itrDataBeg = rData.begin(), itrDataEnd = rData.end();
     for (vector<SingleRangeData>::const_iterator itrData = itrDataBeg; itrData != itrDataEnd; ++itrData)
     {
-        size_t i = nTab1 + ::std::distance(itrDataBeg, itrData);
+        size_t i = nTabFirstId + ::std::distance(itrDataBeg, itrData);
         TableTypeRef& pTabData = rDoc.maTables[i];
         if (!pTabData.get())
             pTabData.reset(new Table);
         }
     }
 
-    rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
+    size_t nTabLastId = nTabFirstId + rRange.aEnd.Tab() - rRange.aStart.Tab();
+    ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
+    rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray));
 }
 
 bool ScExternalRefCache::isDocInitialized(sal_uInt16 nFileId)

File scaddins/source/analysis/analysishelper.cxx

     NEWD( "in",         3.9370078740157480E01,  CDC_Length ); // Inch               39,37007874015748031496062992126
     NEWD( "ft",         3.2808398950131234E00,  CDC_Length ); // Foot               3,2808398950131233595800524934383
     NEWD( "yd",         1.0936132983377078E00,  CDC_Length ); // Yard               1,0936132983377077865266841644794
-    NEWD( "ang",        1.0000000000000000E10,  CDC_Length ); // Angstroem
+    NEWDP( "ang",       1.0000000000000000E10,  CDC_Length ); // Angstroem
     NEWD( "Pica",       2.8346456692913386E03,  CDC_Length ); // Pica (1/72 Inch)   2834,6456692913385826771653543307
     NEWD( "ell",        8.748906E-01,           CDC_Length ); // *** Ell
     NEWDP( "parsec",    3.240779E-17,           CDC_Length ); // *** Parsec
     NEWD( "in3",        6.1023744094732284E01,  CDC_Volume ); // *** Cubic Inch
     NEWD( "ft3",        3.5314666721488590E-02, CDC_Volume ); // *** Cubic Foot
     NEWD( "yd3",        1.3079506193143922E-03, CDC_Volume ); // *** Cubic Yard
-    NEWD( "ang3",       1.0000000000000000E27,  CDC_Volume ); // *** Cubic Angstroem
+    NEWDP( "ang3",      1.0000000000000000E27,  CDC_Volume ); // *** Cubic Angstroem
     NEWD( "Pica3",      2.2776990435870636E07,  CDC_Volume ); // *** Cubic Pica
     NEWD( "barrel",     6.289811E-03,           CDC_Volume ); // *** Barrel (=42gal?)
     NEWD( "bushel",     2.837759E-02,           CDC_Volume ); // *** Bushel
     // SPEED: 1 Meter per Second is...
     NEWDP( "m/s",   1.0000000000000000E00,  CDC_Speed ); // *** Meters per Second
     NEWDP( "m/sec", 1.0000000000000000E00,  CDC_Speed ); // *** Meters per Second also
-    NEWD( "m/h",    3.6000000000000000E03,  CDC_Speed ); // *** Meters per Hour
-    NEWD( "m/hr",   3.6000000000000000E03,  CDC_Speed ); // *** Meters per Hour also
+    NEWDP( "m/h",   3.6000000000000000E03,  CDC_Speed ); // *** Meters per Hour
+    NEWDP( "m/hr",  3.6000000000000000E03,  CDC_Speed ); // *** Meters per Hour also
     NEWD( "mph",    2.2369362920544023E00,  CDC_Speed ); // *** Britsh Miles per Hour
     NEWD( "kn",     1.9438444924406048E00,  CDC_Speed ); // *** Knot = Nautical Miles per Hour
     NEWD( "admkn",  1.9438446603753486E00,  CDC_Speed ); // *** Admiralty Knot