[ooo-build-commit] .: 3 commits - sc/inc sc/sdi sc/source sc/uiconfig

Fridrich Strba fridrich at kemper.freedesktop.org
Wed Sep 15 08:26:04 PDT 2010


 sc/inc/column.hxx                             |    1 
 sc/inc/document.hxx                           |    1 
 sc/inc/table.hxx                              |    1 
 sc/sdi/formatsh.sdi                           |   10 +-
 sc/source/core/data/column.cxx                |   16 +++
 sc/source/core/data/document.cxx              |   26 +++++
 sc/source/core/data/table2.cxx                |    8 +
 sc/source/core/data/table5.cxx                |   10 ++
 sc/source/ui/dbgui/pvlaydlg.cxx               |   36 +++++--
 sc/source/ui/inc/formatsh.hxx                 |    3 
 sc/source/ui/inc/pvlaydlg.hxx                 |    5 -
 sc/source/ui/view/formatsh.cxx                |  124 ++++++++++++++++++++++++--
 sc/source/ui/view/tabview3.cxx                |    7 +
 sc/source/ui/view/tabvwshc.cxx                |    7 +
 sc/uiconfig/scalc/toolbar/formatobjectbar.xml |    2 
 15 files changed, 227 insertions(+), 30 deletions(-)

New commits:
commit 4bf4083b86c093772e98fa8b9b7e208cb1dd5b0e
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 17:23:05 2010 +0200

    calc-dp-default-new-sheet.diff: default output to new sheet
    
    i#50886

diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 867277e..7372f9a 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -105,7 +105,7 @@ PointerStyle lclGetPointerForField( ScDPFieldType eType )
 //----------------------------------------------------------------------------
 
 ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
-                                    const ScDPObject& rDPObject )
+                                    const ScDPObject& rDPObject, bool bNewOutput )
     :	ScAnyRefDlg	( pB, pCW, pParent, RID_SCDLG_PIVOT_LAYOUT ),
         aFlLayout       ( this, ScResId( FL_LAYOUT ) ),
         aFtPage         ( this, ScResId( FT_PAGE ) ),
@@ -165,7 +165,7 @@ ScDPLayoutDlg::ScDPLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pPar
     xDlgDPObject->FillOldParam( thePivotData, FALSE );
     xDlgDPObject->FillLabelData( thePivotData );
 
-    Init();
+    Init(bNewOutput);
     FreeResource();
 }
 
@@ -200,7 +200,7 @@ ScDPFieldWindow& ScDPLayoutDlg::GetFieldWindow( ScDPFieldType eType )
     return aWndSelect;
 }
 
-void __EXPORT ScDPLayoutDlg::Init()
+void __EXPORT ScDPLayoutDlg::Init(bool bNewOutput)
 {
     DBG_ASSERT( pViewData && pDoc,
                 "Ctor-Initialisierung fehlgeschlagen!" );
@@ -301,19 +301,31 @@ void __EXPORT ScDPLayoutDlg::Init()
         }
     }
 
-    if ( thePivotData.nTab != MAXTAB+1 )
+    if (bNewOutput)
     {
-        String aStr;
-        ScAddress( thePivotData.nCol,
-                   thePivotData.nRow,
-                   thePivotData.nTab ).Format( aStr, STD_FORMAT, pDoc, pDoc->GetAddressConvention() );
-        aEdOutPos.SetText( aStr );
-        EdModifyHdl(0);
+        // Output to a new sheet by default for a brand-new output.
+        aLbOutPos.SelectEntryPos(1);
+        aEdOutPos.Disable();
+        aRbOutPos.Disable();
     }
     else
     {
-        aLbOutPos.SelectEntryPos( aLbOutPos.GetEntryCount()-1 );
-        SelAreaHdl(NULL);
+        // Modifying an existing dp output.
+
+        if ( thePivotData.nTab != MAXTAB+1 )
+        {
+            String aStr;
+            ScAddress( thePivotData.nCol,
+                       thePivotData.nRow,
+                       thePivotData.nTab ).Format( aStr, STD_FORMAT, pDoc, pDoc->GetAddressConvention() );
+            aEdOutPos.SetText( aStr );
+            EdModifyHdl(0);
+        }
+        else
+        {
+            aLbOutPos.SelectEntryPos( aLbOutPos.GetEntryCount()-1 );
+            SelAreaHdl(NULL);
+        }
     }
 
     aBtnIgnEmptyRows.Check( thePivotData.bIgnoreEmptyRows );
diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx
index b14501e..5f77de2 100644
--- a/sc/source/ui/inc/pvlaydlg.hxx
+++ b/sc/source/ui/inc/pvlaydlg.hxx
@@ -87,7 +87,8 @@ public:
                                 SfxBindings* pB,
                                 SfxChildWindow* pCW,
                                 Window* pParent,
-                                const ScDPObject& rDPObject );
+                                const ScDPObject& rDPObject,
+                                bool bNewOutput );
     virtual                 ~ScDPLayoutDlg();
 
     virtual void            SetReference( const ScRange& rRef, ScDocument* pDoc );
@@ -189,7 +190,7 @@ private:
 
 private:
     ScDPFieldWindow&        GetFieldWindow  ( ScDPFieldType eType );
-    void                    Init            ();
+    void                    Init            (bool bNewOutput);
     void                    InitWndSelect   ( const ::std::vector<ScDPLabelDataRef>& rLabels );
     void                    InitWnd         ( PivotField* pArr, long nCount, ScDPFieldType eType );
     void                    InitFocus       ();
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 1beb938..241b923 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -252,8 +252,13 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
 
             if( pDialogDPObject )
             {
+                // Check for an existing datapilot output.
+                ScViewData* pViewData = GetViewData();
+                ScDPObject* pObj = GetViewData()->GetDocument()->GetDPAtCursor(
+                    pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
+
                 GetViewData()->SetRefTabNo( GetViewData()->GetTabNo() );
-                pResult = new ScDPLayoutDlg( pB, pCW, pParent, *pDialogDPObject );
+                pResult = new ScDPLayoutDlg( pB, pCW, pParent, *pDialogDPObject, pObj == NULL);
             }
         }
         break;
commit 506ae185457f00ff390261301fada4620e120f00
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 17:18:15 2010 +0200

    sc-fit-to-width-height-skip-breaks.diff: Increase Excel compatibility
    
    n#404232, n#404563, i#94698
    
    ignore manual breaks when the "fit to x pages wide and x pages tall" option
    is used, for Excel interoperability.

diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 64e0577..3a19f00 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -135,6 +135,7 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea )
 
     bool bSkipColBreaks = false;
     bool bSkipRowBreaks = false;
+    bool bSkipBreaks = false;
 
     if ( pStyleSet->GetItemState( ATTR_PAGE_SCALETOPAGES, FALSE, &pItem ) == SFX_ITEM_SET )
     {
@@ -152,6 +153,15 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea )
             bSkipRowBreaks = true;
     }
 
+    if (!bSkipBreaks && pStyleSet->GetItemState(ATTR_PAGE_SCALETO, false, &pItem) == SFX_ITEM_SET)
+    {
+        const ScPageScaleToItem& rScaleToItem = static_cast<const ScPageScaleToItem&>(
+            pStyleSet->Get(ATTR_PAGE_SCALETO));
+        if (rScaleToItem.GetWidth() > 0 || rScaleToItem.GetHeight() > 0)
+            // when fitting to a fixed width x height, ignore manual breaks.
+            bSkipBreaks = true;
+    }
+
     //--------------------------------------------------------------------------
 
     long nPageSizeX = aPageSizeTwips.Width();
commit edd18ccae4cb396f85e167e13169672fdea300db
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 15 17:11:24 2010 +0200

    sc-cellformat-icon-toggle.diff:  Cell number format toolbar icons togglable
    
    n#358548, i#86377
    
    Make cell number format toolbar icons togglable & remove the standard format
    button.

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index c60fafc..7b8ec82 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -301,6 +301,7 @@ public:
     const ScPatternAttr*    GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
 
     ULONG		GetNumberFormat( SCROW nRow ) const;
+    sal_uInt32  GetNumberFormat( SCROW nStartRow, SCROW nEndRow ) const;
 
     void		MergeSelectionPattern( ScMergePatternState& rState, const ScMarkData& rMark, BOOL bDeep ) const;
     void		MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, BOOL bDeep ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 0458db3..80eaf2c 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -794,6 +794,7 @@ public:
     SC_DLLPUBLIC double			RoundValueAsShown( double fVal, ULONG nFormat );
     SC_DLLPUBLIC void			GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab,
                                      sal_uInt32& rFormat );
+    sal_uInt32      GetNumberFormat( const ScRange& rRange ) const;
     SC_DLLPUBLIC sal_uInt32		GetNumberFormat( const ScAddress& ) const;
                     /** If no number format attribute is set and the cell
                         pointer passed is of type formula cell, the calculated
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index faca8cb..96a9391 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -522,6 +522,7 @@ public:
                                         0;
                                 }
     ULONG					GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
+    sal_uInt32              GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
     void					MergeSelectionPattern( ScMergePatternState& rState,
                                                 const ScMarkData& rMark, BOOL bDeep ) const;
     void					MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
diff --git a/sc/sdi/formatsh.sdi b/sc/sdi/formatsh.sdi
index 1ea04c7..923b935 100644
--- a/sc/sdi/formatsh.sdi
+++ b/sc/sdi/formatsh.sdi
@@ -117,11 +117,11 @@ interface FormatForSelection
     SID_ATTR_NUMBERFORMAT_VALUE       [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState;]
     SID_NUMBER_FORMAT       [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState;]
     SID_NUMBER_TWODEC		[ ExecMethod = ExecuteNumFormat;]
-    SID_NUMBER_SCIENTIFIC	[ ExecMethod = ExecuteNumFormat;]
-    SID_NUMBER_DATE			[ ExecMethod = ExecuteNumFormat;]
-    SID_NUMBER_CURRENCY		[ ExecMethod = ExecuteNumFormat;]
-    SID_NUMBER_PERCENT		[ ExecMethod = ExecuteNumFormat;]
-    SID_NUMBER_TIME			[ ExecMethod = ExecuteNumFormat;]
+    SID_NUMBER_SCIENTIFIC   [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
+    SID_NUMBER_DATE         [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
+    SID_NUMBER_CURRENCY     [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
+    SID_NUMBER_PERCENT      [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
+    SID_NUMBER_TIME         [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
     SID_NUMBER_STANDARD		[ ExecMethod = ExecuteNumFormat;]
     SID_NUMBER_INCDEC		[ ExecMethod = ExecuteNumFormat;]
     SID_NUMBER_DECDEC		[ ExecMethod = ExecuteNumFormat;]
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index d6392d5..2f49e98 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -354,6 +354,22 @@ const ScPatternAttr* ScColumn::GetMostUsedPattern( SCROW nStartRow, SCROW nEndRo
     return pMaxPattern;
 }
 
+sal_uInt32 ScColumn::GetNumberFormat( SCROW nStartRow, SCROW nEndRow ) const
+{
+    SCROW nPatStartRow, nPatEndRow;
+    const ScPatternAttr* pPattern = pAttrArray->GetPatternRange(nPatStartRow, nPatEndRow, nStartRow);
+    sal_uInt32 nFormat = pPattern->GetNumberFormat(pDocument->GetFormatTable());
+    while (nEndRow > nPatEndRow)
+    {
+        nStartRow = nPatEndRow + 1;
+        pPattern = pAttrArray->GetPatternRange(nPatStartRow, nPatEndRow, nStartRow);
+        sal_uInt32 nTmpFormat = pPattern->GetNumberFormat(pDocument->GetFormatTable());
+        if (nFormat != nTmpFormat)
+            return 0;
+    }
+    return nFormat;
+}
+
 
 ULONG ScColumn::GetNumberFormat( SCROW nRow ) const
 {
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index abf7668..2d1ea48 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2723,6 +2723,32 @@ void ScDocument::GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab,
     rFormat = 0;
 }
 
+sal_uInt32 ScDocument::GetNumberFormat( const ScRange& rRange ) const
+{
+    SCTAB nTab1 = rRange.aStart.Tab(), nTab2 = rRange.aEnd.Tab();
+    SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
+    SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
+
+    if (!ValidTab(nTab1) || !ValidTab(nTab2) || !pTab[nTab1] || !pTab[nTab2])
+        return 0;
+
+    sal_uInt32 nFormat = 0;
+    bool bFirstItem = true;
+    for (SCTAB nTab = nTab1; nTab <= nTab2; ++nTab)
+        for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
+        {
+            sal_uInt32 nThisFormat = pTab[nTab]->GetNumberFormat(nCol, nRow1, nRow2);
+            if (bFirstItem)
+            {
+                nFormat = nThisFormat;
+                bFirstItem = false;
+            }
+            else if (nThisFormat != nFormat)
+                return 0;
+        }
+
+    return nFormat;
+}
 
 sal_uInt32 ScDocument::GetNumberFormat( const ScAddress& rPos ) const
 {
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 152fbe2..093a8a1 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -1329,6 +1329,14 @@ ULONG ScTable::GetNumberFormat( SCCOL nCol, SCROW nRow ) const
         return 0;
 }
 
+sal_uInt32 ScTable::GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const
+{
+    if (!ValidCol(nCol) || !ValidRow(nStartRow) || !ValidRow(nEndRow))
+        return 0;
+
+    return aCol[nCol].GetNumberFormat(nStartRow, nEndRow);
+}
+
 
 const ScPatternAttr* ScTable::GetPattern( SCCOL nCol, SCROW nRow ) const
 {
diff --git a/sc/source/ui/inc/formatsh.hxx b/sc/source/ui/inc/formatsh.hxx
index e22d492..1dfd724 100644
--- a/sc/source/ui/inc/formatsh.hxx
+++ b/sc/source/ui/inc/formatsh.hxx
@@ -74,6 +74,9 @@ public:
 
     void        ExecFormatPaintbrush( SfxRequest& rReq );
     void        StateFormatPaintbrush( SfxItemSet& rSet );
+
+private:
+    short       GetCurrentNumberFormatType();
 };
 
 #endif
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index ccf501a..62ddd35 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -55,6 +55,7 @@
 
 #include <sfx2/app.hxx>
 #include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/request.hxx>
 #include <svl/whiter.hxx>
@@ -925,6 +926,7 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
     ScTabViewShell*	pTabViewShell  	= GetViewData()->GetViewShell();
     const SfxItemSet*	pReqArgs	= rReq.GetArgs();
     USHORT				nSlot		= rReq.GetSlot();
+    SfxBindings& rBindings          = pTabViewShell->GetViewFrame()->GetBindings();
 
     pTabViewShell->HideListBox();					// Autofilter-DropDown-Listbox
 
@@ -957,6 +959,8 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
         }
     }
 
+    short nType = GetCurrentNumberFormatType();
+    SfxItemSet aSet( GetPool(), nSlot, nSlot );
     switch ( nSlot )
     {
         case SID_NUMBER_TWODEC:
@@ -964,23 +968,48 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
             rReq.Done();
             break;
         case SID_NUMBER_SCIENTIFIC:
-            pTabViewShell->SetNumberFormat( NUMBERFORMAT_SCIENTIFIC );
+            if ((nType & NUMBERFORMAT_SCIENTIFIC))
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER );
+            else
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_SCIENTIFIC );
+            aSet.Put( SfxBoolItem(nSlot, !(nType & NUMBERFORMAT_SCIENTIFIC)) );
+            rBindings.Invalidate( nSlot );
             rReq.Done();
             break;
         case SID_NUMBER_DATE:
-            pTabViewShell->SetNumberFormat( NUMBERFORMAT_DATE );
+            if ((nType & NUMBERFORMAT_DATE))
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER );
+            else
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_DATE );
+            aSet.Put( SfxBoolItem(nSlot, !(nType & NUMBERFORMAT_DATE)) );
+            rBindings.Invalidate( nSlot );
             rReq.Done();
             break;
         case SID_NUMBER_TIME:
-            pTabViewShell->SetNumberFormat( NUMBERFORMAT_TIME );
+            if ((nType & NUMBERFORMAT_TIME))
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER );
+            else
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_TIME );
+            aSet.Put( SfxBoolItem(nSlot, !(nType & NUMBERFORMAT_TIME)) );
+            rBindings.Invalidate( nSlot );
             rReq.Done();
             break;
         case SID_NUMBER_CURRENCY:
-            pTabViewShell->SetNumberFormat( NUMBERFORMAT_CURRENCY );
+            if ((nType & NUMBERFORMAT_CURRENCY))
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER );
+            else
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_CURRENCY );
+            aSet.Put( SfxBoolItem(nSlot, !(nType & NUMBERFORMAT_CURRENCY)) );
+            rBindings.Invalidate( nSlot );
             rReq.Done();
             break;
         case SID_NUMBER_PERCENT:
-            pTabViewShell->SetNumberFormat( NUMBERFORMAT_PERCENT );
+            if ((nType & NUMBERFORMAT_PERCENT))
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER );
+            else
+                pTabViewShell->SetNumberFormat( NUMBERFORMAT_PERCENT );
+            aSet.Put( SfxBoolItem(nSlot, !(nType & NUMBERFORMAT_PERCENT)) );
+            rBindings.Invalidate( nSlot );
             rReq.Done();
             break;
         case SID_NUMBER_STANDARD:
@@ -1986,9 +2015,8 @@ void ScFormatShell::GetAlignState( SfxItemSet& rSet )
 void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
 {
     ScTabViewShell*	pTabViewShell  	= GetViewData()->GetViewShell();
-
-    // ScViewData* pViewData   = GetViewData();
-    ScDocument* pDoc		= pViewData->GetDocument();
+    ScDocument* pDoc                = pViewData->GetDocument();
+    short nType                     = GetCurrentNumberFormatType();
 
     SfxWhichIter aIter(rSet);
     USHORT nWhich = aIter.FirstWhich();
@@ -2015,7 +2043,21 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
                     rSet.Put( SfxStringItem( nWhich, aFormatCode ) );
                 }
                 break;
-
+            case SID_NUMBER_SCIENTIFIC:
+                rSet.Put( SfxBoolItem(nWhich, (nType & NUMBERFORMAT_SCIENTIFIC)) );
+                break;
+            case SID_NUMBER_DATE:
+                rSet.Put( SfxBoolItem(nWhich, (nType & NUMBERFORMAT_DATE)) );
+                break;
+            case SID_NUMBER_CURRENCY:
+                rSet.Put( SfxBoolItem(nWhich, (nType & NUMBERFORMAT_CURRENCY)) );
+                break;
+            case SID_NUMBER_PERCENT:
+                rSet.Put( SfxBoolItem(nWhich, (nType & NUMBERFORMAT_PERCENT)) );
+                break;
+            case SID_NUMBER_TIME:
+                rSet.Put( SfxBoolItem(nWhich, (nType & NUMBERFORMAT_TIME)) );
+                break;
         }
         nWhich = aIter.NextWhich();
     }
@@ -2166,3 +2208,67 @@ void ScFormatShell::StateFormatPaintbrush( SfxItemSet& rSet )
         rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, pViewData->GetView()->HasPaintBrush() ) );
 }
 
+short ScFormatShell::GetCurrentNumberFormatType()
+{
+    short nType = NUMBERFORMAT_ALL;
+    ScDocument* pDoc = GetViewData()->GetDocument();
+    ScMarkData aMark(GetViewData()->GetMarkData());
+    const SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+    if (!pFormatter)
+        return nType;
+
+    // TODO: Find out how to get a selected table range in case multiple tables
+    // are selected.  Currently we only check for the current active table.
+
+    if ( aMark.IsMarked() || aMark.IsMultiMarked() )
+    {
+        aMark.MarkToMulti();
+        ScRange aRange;
+        aMark.GetMultiMarkArea(aRange);
+
+        const ScMarkArray* pArray = aMark.GetArray();
+        if (!pArray)
+            return nType;
+
+        short nComboType = NUMBERFORMAT_ALL;
+        bool bFirstItem = true;
+        for (SCCOL nCol = aRange.aStart.Col(); nCol <= aRange.aEnd.Col(); ++nCol)
+        {
+            const ScMarkArray& rColArray = pArray[nCol];
+            if (!rColArray.HasMarks())
+                continue;
+
+            SCROW nRow1, nRow2;
+            ScMarkArrayIter aMarkIter(&rColArray);
+            while (aMarkIter.Next(nRow1, nRow2))
+            {
+                ScRange aColRange(nCol, nRow1, aRange.aStart.Tab());
+                aColRange.aEnd.SetRow(nRow2);
+                sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aColRange);
+                const SvNumberformat* pEntry = pFormatter->GetEntry(nNumFmt);
+                if (!pEntry)
+                    return 0;
+
+                short nThisType = pEntry->GetType();
+                if (bFirstItem)
+                {
+                    bFirstItem = false;
+                    nComboType = nThisType;
+                }
+                else if (nComboType != nThisType)
+                    // mixed number format type.
+                    return NUMBERFORMAT_ALL;
+            }
+        }
+        nType = nComboType;
+    }
+    else
+    {
+        sal_uInt32 nNumFmt;
+        pDoc->GetNumberFormat( pViewData->GetCurX(), pViewData->GetCurY(),
+                               pViewData->GetTabNo(), nNumFmt );
+        const SvNumberformat* pEntry = pFormatter->GetEntry( nNumFmt );
+        nType = pEntry ? pEntry->GetType() : 0;
+    }
+    return nType;
+}
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 78e032a..0429368 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -264,6 +264,13 @@ void ScTabView::InvalidateAttribs()
     rBindings.Invalidate( SID_ALIGN_ANY_VCENTER );
     rBindings.Invalidate( SID_ALIGN_ANY_BOTTOM );
 
+    rBindings.Invalidate( SID_NUMBER_CURRENCY );
+    rBindings.Invalidate( SID_NUMBER_SCIENTIFIC );
+    rBindings.Invalidate( SID_NUMBER_DATE );
+    rBindings.Invalidate( SID_NUMBER_CURRENCY );
+    rBindings.Invalidate( SID_NUMBER_PERCENT );
+    rBindings.Invalidate( SID_NUMBER_TIME );
+
 //	rBindings.Invalidate( SID_RANGE_VALUE );
 //	rBindings.Invalidate( SID_RANGE_FORMULA );
 }
diff --git a/sc/uiconfig/scalc/toolbar/formatobjectbar.xml b/sc/uiconfig/scalc/toolbar/formatobjectbar.xml
index 13b6abc..49c31d7 100644
--- a/sc/uiconfig/scalc/toolbar/formatobjectbar.xml
+++ b/sc/uiconfig/scalc/toolbar/formatobjectbar.xml
@@ -33,7 +33,7 @@
  <toolbar:toolbaritem xlink:href=".uno:NumberFormatPercent" toolbar:helpid="helpid:26046"  />
  <toolbar:toolbaritem xlink:href=".uno:NumberFormatDate" toolbar:helpid="helpid:26053"  toolbar:visible="false" />
  <toolbar:toolbaritem xlink:href=".uno:NumberFormatScientific" toolbar:helpid="helpid:26055"  toolbar:visible="false" />
- <toolbar:toolbaritem xlink:href=".uno:NumberFormatStandard" toolbar:helpid="helpid:26052"  />
+ <toolbar:toolbaritem xlink:href=".uno:NumberFormatStandard" toolbar:helpid="helpid:26052"  toolbar:visible="false" />
  <toolbar:toolbaritem xlink:href=".uno:NumberFormatIncDecimals" toolbar:helpid="helpid:26057"  />
  <toolbar:toolbaritem xlink:href=".uno:NumberFormatDecDecimals" toolbar:helpid="helpid:26058"  />
  <toolbar:toolbarseparator/>


More information about the ooo-build-commit mailing list