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



Author: kyoshida
Date: Fri Feb 22 21:12:10 2008
New Revision: 11689
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11689&view=rev

Log:
2008-02-22  Kohei Yoshida  <kyoshida novell com>

	* patches/src680/sc-cellformat-icon-toggle.diff: make the cell number
	format toolbar buttons (currency, percent, date and scientific) 
	toggleable & remove the standard format button.  This way, those buttons
	work much like the bold and italic buttons.
	
	* patches/src680/apply: apply the new patch.


Added:
   trunk/patches/src680/sc-cellformat-icon-toggle.diff
Modified:
   trunk/ChangeLog
   trunk/patches/src680/apply

Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply	(original)
+++ trunk/patches/src680/apply	Fri Feb 22 21:12:10 2008
@@ -798,6 +798,10 @@
 # Have cell background paint over the gridlines.
 sc-cellbackground-over-gridlines.diff, n#361360, i#3907, kohei
 
+# Make cell number format toolbar icons togglable & remove the standard format
+# button.
+sc-cellformat-icon-toggle.diff, n#358548, kohei
+
 [ LinuxOnly ]
 # accelerate linking, by extreme cunning i#63927
 speed-local-link-except.diff, i#63927, michael

Added: trunk/patches/src680/sc-cellformat-icon-toggle.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/sc-cellformat-icon-toggle.diff	Fri Feb 22 21:12:10 2008
@@ -0,0 +1,192 @@
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/sdi/formatsh.sdi sc/sdi/formatsh.sdi
+--- sc.clean/sdi/formatsh.sdi	2008-02-05 11:16:54.000000000 -0500
++++ sc/sdi/formatsh.sdi	2008-02-22 15:20:31.000000000 -0500
+@@ -124,11 +124,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 -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/inc/formatsh.hxx sc/source/ui/inc/formatsh.hxx
+--- sc.clean/source/ui/inc/formatsh.hxx	2008-02-05 11:16:55.000000000 -0500
++++ sc/source/ui/inc/formatsh.hxx	2008-02-22 13:00:00.000000000 -0500
+@@ -91,6 +91,9 @@ public:
+ 
+     void        ExecFormatPaintbrush( SfxRequest& rReq );
+     void        StateFormatPaintbrush( SfxItemSet& rSet );
++
++private:
++    short       GetCurrentNumberFormatType() const;
+ };
+ 
+ #endif
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/view/formatsh.cxx sc/source/ui/view/formatsh.cxx
+--- sc.clean/source/ui/view/formatsh.cxx	2008-02-05 11:16:56.000000000 -0500
++++ sc/source/ui/view/formatsh.cxx	2008-02-22 15:22:45.000000000 -0500
+@@ -72,6 +72,7 @@
+ 
+ #include <sfx2/app.hxx>
+ #include <sfx2/viewfrm.hxx>
++#include <sfx2/bindings.hxx>
+ #include <sfx2/objface.hxx>
+ #include <sfx2/request.hxx>
+ #include <svtools/whiter.hxx>
+@@ -935,6 +936,7 @@ void ScFormatShell::ExecuteNumFormat( Sf
+ 	ScTabViewShell*	pTabViewShell  	= GetViewData()->GetViewShell();
+ 	const SfxItemSet*	pReqArgs	= rReq.GetArgs();
+ 	USHORT				nSlot		= rReq.GetSlot();
++    SfxBindings& rBindings          = pTabViewShell->GetViewFrame()->GetBindings();
+ 
+ 	pTabViewShell->HideListBox();					// Autofilter-DropDown-Listbox
+ 
+@@ -967,6 +969,8 @@ void ScFormatShell::ExecuteNumFormat( Sf
+ 		}
+ 	}
+ 
++    short nType = GetCurrentNumberFormatType();
++    SfxItemSet aSet( GetPool(), nSlot, nSlot );
+ 	switch ( nSlot )
+ 	{
+ 		case SID_NUMBER_TWODEC:
+@@ -974,23 +978,48 @@ void ScFormatShell::ExecuteNumFormat( Sf
+ 			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:
+@@ -2006,9 +2035,8 @@ void ScFormatShell::GetBckColState( SfxI
+ 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();
+@@ -2035,7 +2063,21 @@ void ScFormatShell::GetNumFormatState( S
+ 					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();
+ 	}
+@@ -2186,3 +2228,13 @@ void ScFormatShell::StateFormatPaintbrus
+         rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, pViewData->GetView()->HasPaintBrush() ) );
+ }
+ 
++short ScFormatShell::GetCurrentNumberFormatType() const
++{
++	ScDocument* pDoc = pViewData->GetDocument();
++    sal_uInt32 nCurrentNumberFormat;
++    pDoc->GetNumberFormat( pViewData->GetCurX(), pViewData->GetCurY(), 
++                           pViewData->GetTabNo(), nCurrentNumberFormat );
++    const SvNumberformat* pEntry = pDoc->GetFormatTable()->GetEntry( nCurrentNumberFormat );
++    return pEntry->GetType();
++}
++
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/view/tabview3.cxx sc/source/ui/view/tabview3.cxx
+--- sc.clean/source/ui/view/tabview3.cxx	2008-02-05 11:16:56.000000000 -0500
++++ sc/source/ui/view/tabview3.cxx	2008-02-22 12:17:51.000000000 -0500
+@@ -355,6 +355,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 -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/uiconfig/scalc/toolbar/formatobjectbar.xml sc/uiconfig/scalc/toolbar/formatobjectbar.xml
+--- sc.clean/uiconfig/scalc/toolbar/formatobjectbar.xml	2008-02-05 11:16:54.000000000 -0500
++++ sc/uiconfig/scalc/toolbar/formatobjectbar.xml	2008-02-22 11:16:00.000000000 -0500
+@@ -33,7 +33,6 @@
+  <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:NumberFormatIncDecimals" toolbar:helpid="helpid:26057"  />
+  <toolbar:toolbaritem xlink:href=".uno:NumberFormatDecDecimals" toolbar:helpid="helpid:26058"  />
+  <toolbar:toolbarseparator/>



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