diff options
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r-- | sc/source/ui/view/auditsh.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh.cxx | 3 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh3.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/drawview.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 48 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 529 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 26 | ||||
-rw-r--r-- | sc/source/ui/view/pivotsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh4.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 5 |
12 files changed, 651 insertions, 14 deletions
diff --git a/sc/source/ui/view/auditsh.cxx b/sc/source/ui/view/auditsh.cxx index ea6d75cda660..136f15523203 100644 --- a/sc/source/ui/view/auditsh.cxx +++ b/sc/source/ui/view/auditsh.cxx @@ -23,6 +23,7 @@ #include <sfx2/objface.hxx> #include <sfx2/objsh.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include "auditsh.hxx" #include "tabvwsh.hxx" @@ -61,6 +62,7 @@ ScAuditingShell::ScAuditingShell(ScViewData* pData) : } SetHelpId( HID_SCSHELL_AUDIT ); SetName(OUString("Auditing")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Auditing)); } //------------------------------------------------------------------------ @@ -137,5 +139,4 @@ void ScAuditingShell::GetState( SfxItemSet& rSet ) rSet.Put( SfxBoolItem( nFunction, sal_True ) ); // aktive Funktion markieren } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 47dc5ed61128..06856778bbf9 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -33,7 +33,9 @@ #include <sfx2/objface.hxx> #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/clipfmtitem.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <editeng/langitem.hxx> #include "cellsh.hxx" @@ -79,6 +81,7 @@ ScCellShell::ScCellShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_CELLSH); SetName(OUString("Cell")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Cell)); } ScCellShell::~ScCellShell() diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index cf82d0eb70f9..81c58f6a6401 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -357,6 +357,14 @@ void ScCellShell::Execute( SfxRequest& rReq ) pTabViewShell->ExecuteCellFormatDlg(rReq, "alignment"); break; + case SID_CELL_FORMAT_BORDER: + pTabViewShell->ExecuteCellFormatDlg( rReq, "borders" ); + break; + + case SID_CHAR_DLG_EFFECT: + pTabViewShell->ExecuteCellFormatDlg( rReq, "fonteffects" ); + break; + case SID_OPENDLG_SOLVE: { sal_uInt16 nId = ScSolverDlgWrapper::GetChildWindowId(); diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index e249e8c884dc..c664cbde1515 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -177,6 +177,10 @@ void ScDrawView::InvalidateDrawTextAttrs() rBindings.Invalidate( SID_ULINE_VAL_DOTTED ); rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE ); rBindings.Invalidate( SID_ATTR_CHAR_COLOR ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER); rBindings.Invalidate( SID_ALIGNLEFT ); rBindings.Invalidate( SID_ALIGNCENTERHOR ); rBindings.Invalidate( SID_ALIGNRIGHT ); @@ -186,6 +190,9 @@ void ScDrawView::InvalidateDrawTextAttrs() rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 ); rBindings.Invalidate( SID_SET_SUPER_SCRIPT ); rBindings.Invalidate( SID_SET_SUB_SCRIPT ); + rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); + rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT ); + rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT ); rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM ); rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT ); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index aade068f089c..fd3418811b5c 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -34,6 +34,7 @@ #include <editeng/flditem.hxx> #include <editeng/fontitem.hxx> #include <svx/hlnkitem.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <editeng/postitem.hxx> #include <editeng/scripttypeitem.hxx> #include <editeng/shdditem.hxx> @@ -96,6 +97,7 @@ ScEditShell::ScEditShell(EditView* pView, ScViewData* pData) : SetPool( pEditView->GetEditEngine()->GetEmptyItemSet().GetPool() ); SetUndoManager( &pEditView->GetEditEngine()->GetUndoManager() ); SetName(OUString("EditCell")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_EditCell)); } ScEditShell::~ScEditShell() @@ -311,6 +313,17 @@ void ScEditShell::Execute( SfxRequest& rReq ) pTableView->SetSelection(ESelection(0,0,nPar-1,nLen)); if (pTopView) pTopView->SetSelection(ESelection(0,0,nPar-1,nLen)); + rBindings.Invalidate( SID_ATTR_CHAR_FONT ); + rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT ); + rBindings.Invalidate( SID_ATTR_CHAR_POSTURE ); + rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE ); + rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT ); + rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); + rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); + rBindings.Invalidate( SID_ATTR_CHAR_COLOR ); + rBindings.Invalidate( SID_SET_SUPER_SCRIPT ); + rBindings.Invalidate( SID_SET_SUB_SCRIPT ); } bSetModified = sal_False; } @@ -434,6 +447,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: { SfxItemSet aAttrs( pTableView->GetAttribs() ); @@ -446,6 +460,10 @@ void ScEditShell::Execute( SfxRequest& rReq ) SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( pViewData->GetDialogParent(), &aAttrs, pObjSh, RID_SCDLG_CHAR ); OSL_ENSURE(pDlg, "Dialog create fail!"); + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS); + } short nRet = pDlg->Execute(); // pDlg is needed below @@ -987,6 +1005,15 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) rBindings.Invalidate( nSlot ); } break; + case SID_ATTR_CHAR_KERNING: + { + if(pArgs) + { + aSet.Put ( pArgs->Get(pArgs->GetPool()->GetWhich(nSlot))); + rBindings.Invalidate( nSlot ); + } + } + break; } // @@ -1073,6 +1100,27 @@ void ScEditShell::GetAttrState(SfxItemSet &rSet) ScInputHandler* pHdl = GetMyInputHdl(); if ( pHdl && pHdl->IsFormulaMode() ) rSet.ClearItem( EE_CHAR_WEIGHT ); // hervorgehobene Klammern hier nicht + + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aAttribs.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, sal_True ) ); + } + else if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + { + rSet.Put( SfxBoolItem( SID_SET_SUB_SCRIPT, sal_True ) ); + } + pViewData->GetBindings().Invalidate( SID_SET_SUPER_SCRIPT ); + pViewData->GetBindings().Invalidate( SID_SET_SUB_SCRIPT ); + + eState = aAttribs.GetItemState( EE_CHAR_KERNING, sal_True ); + pViewData->GetBindings().Invalidate( SID_ATTR_CHAR_KERNING ); + if ( eState == SFX_ITEM_DONTCARE ) + { + // rSet.InvalidateItem( SID_ATTR_CHAR_KERNING ); + rSet.InvalidateItem(EE_CHAR_KERNING); + } } String ScEditShell::GetSelectionText( sal_Bool bWholeWord ) diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 656f6080be47..398075107cd2 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include "scitems.hxx" +#include <editeng/borderline.hxx> #include <editeng/eeitem.hxx> #include <sfx2/app.hxx> @@ -1016,13 +1017,96 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) break; case SID_NUMBER_FORMAT: - if ( pReqArgs ) + //if ( pReqArgs ) + //{ + // const SfxPoolItem* pItem; + // if(pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET) + // { + // String aCode = ((const SfxStringItem*)pItem)->GetValue(); + // pTabViewShell->SetNumFmtByStr( aCode ); + // } + //} + + // symphony version with format interpretation + if(pReqArgs) { const SfxPoolItem* pItem; - if(pReqArgs->GetItemState(nSlot, sal_True, &pItem) == SFX_ITEM_SET) + ScDocument* pDoc = pViewData->GetDocument(); + SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + LanguageType eLanguage = ScGlobal::eLnge; + sal_Int16 eType = -1; + sal_uInt32 nCurrentNumberFormat; + + pDoc->GetNumberFormat(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo(), nCurrentNumberFormat); + const SvNumberformat* pEntry = pFormatter->GetEntry(nCurrentNumberFormat); + + if(pEntry) + { + eLanguage = pEntry->GetLanguage(); + eType = pEntry->GetType(); + } + + //Just use eType to judge whether the command is fired for NUMBER/PERCENT/CURRENCY + //In sidebar, users can fire SID_NUMBER_FORMAT command by operating the related UI controls before they are disable + switch(eType) + { + case NUMBERFORMAT_ALL: + case NUMBERFORMAT_NUMBER: + case NUMBERFORMAT_NUMBER| NUMBERFORMAT_DEFINED: + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_PERCENT| NUMBERFORMAT_DEFINED: + case NUMBERFORMAT_CURRENCY: + case NUMBERFORMAT_CURRENCY|NUMBERFORMAT_DEFINED: + eType = 0; + break; + default: + eType =-1; + } + + if(SFX_ITEM_SET == pReqArgs->GetItemState(nSlot, true, &pItem) && eType != -1) { String aCode = ((const SfxStringItem*)pItem)->GetValue(); - pTabViewShell->SetNumFmtByStr( aCode ); + sal_uInt16 aLen = aCode.Len(); + String* sFormat = new String[4]; + String sTmpStr = OUString(); + sal_uInt16 nCount(0); + sal_uInt16 nStrCount(0); + + while(nCount < aLen) + { + sal_Unicode cChar = aCode.GetChar(nCount); + + if(cChar == sal_Unicode(',')) + { + sFormat[nStrCount] = sTmpStr; + sTmpStr = OUString(); + nStrCount++; + } + else + { + sTmpStr += cChar; + } + + nCount++; + + if(nStrCount > 3) + break; + } + + const sal_Bool bThousand = (sal_Bool)sFormat[0].ToInt32(); + const sal_Bool bNegRed = (sal_Bool)sFormat[1].ToInt32(); + const sal_uInt16 nPrecision = (sal_uInt16)sFormat[2].ToInt32(); + const sal_uInt16 nLeadZeroes = (sal_uInt16)sFormat[3].ToInt32(); + + aCode = pFormatter->GenerateFormat( + nCurrentNumberFormat,//modify + eLanguage, + bThousand, + bNegRed, + nPrecision, + nLeadZeroes); + pTabViewShell->SetNumFmtByStr(aCode); + delete[] sFormat; } } break; @@ -1046,6 +1130,49 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) } break; + case SID_NUMBER_TYPE_FORMAT: + { + SfxInt16Item aFormatItem((const SfxInt16Item&)rReq.GetArgs()->Get(nSlot)); + sal_uInt16 nFormat = aFormatItem.GetValue(); + switch(nFormat) + { + case 0: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER); //Modify + break; + case 1: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_NUMBER, 2 ); //Modify + break; + case 2: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_PERCENT ); + break; + case 3: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_CURRENCY ); + break; + case 4: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_DATE ); + break; + case 5: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_TIME ); + break; + case 6: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_SCIENTIFIC ); + break; + case 7: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_FRACTION ); + break; + case 8: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_LOGICAL ); + break; + case 9: + pTabViewShell->SetNumberFormat( NUMBERFORMAT_TEXT ); + break; + default: + ; + } + rReq.Done(); + } + break; + default: OSL_FAIL("falscher Slot bei ExecuteEdit"); break; @@ -1119,7 +1246,10 @@ void ScFormatShell::ExecuteAlignment( SfxRequest& rReq ) } } } - + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER); rBindings.Invalidate( SID_ALIGNLEFT ); rBindings.Invalidate( SID_ALIGNRIGHT ); rBindings.Invalidate( SID_ALIGNCENTERHOR ); @@ -1647,6 +1777,43 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) } break; + case SID_ATTR_BORDER_DIAG_TLBR: + case SID_ATTR_BORDER_DIAG_BLTR: + { + const ScPatternAttr* pOldAttrs = pTabViewShell->GetSelectionPattern(); + SfxItemSet* pOldSet = new SfxItemSet(pOldAttrs->GetItemSet()); + SfxItemSet* pNewSet = new SfxItemSet(pOldAttrs->GetItemSet()); + const SfxPoolItem* pItem = 0; + + if(SID_ATTR_BORDER_DIAG_TLBR == nSlot) + { + if(SFX_ITEM_SET == pNewAttrs->GetItemState(ATTR_BORDER_TLBR, true, &pItem)) + { + SvxLineItem aItem(ATTR_BORDER_TLBR); + aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_TLBR)).GetLine()); + pNewSet->Put(aItem); + rReq.AppendItem(aItem); + pTabViewShell->ApplyAttributes(pNewSet, pOldSet); + } + } + else // if( nSlot == SID_ATTR_BORDER_DIAG_BLTR ) + { + if(SFX_ITEM_SET == pNewAttrs->GetItemState(ATTR_BORDER_BLTR, true, &pItem )) + { + SvxLineItem aItem(ATTR_BORDER_BLTR); + aItem.SetLine(((const SvxLineItem&)pNewAttrs->Get(ATTR_BORDER_BLTR)).GetLine()); + pNewSet->Put(aItem); + rReq.AppendItem(aItem); + pTabViewShell->ApplyAttributes(pNewSet, pOldSet); + } + } + + delete pOldSet; + delete pNewSet; + rBindings.Invalidate(nSlot); + } + break; + // ATTR_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs // gesetzt werden: case SID_BACKGROUND_COLOR: @@ -1698,7 +1865,7 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) { ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - const ::editeng::SvxBorderLine* pLine = pTabViewShell->GetDefaultFrameLine(); + //const ::editeng::SvxBorderLine* pLine = pTabViewShell->GetDefaultFrameLine(); const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rAttrSet.Get( ATTR_BACKGROUND ); SfxWhichIter aIter( rSet ); sal_uInt16 nWhich = aIter.FirstWhich(); @@ -1725,11 +1892,175 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) case SID_BACKGROUND_COLOR: { rSet.Put( SvxColorItem( rBrushItem.GetColor(), SID_BACKGROUND_COLOR ) ); + + if(SFX_ITEM_DONTCARE == rAttrSet.GetItemState(ATTR_BACKGROUND)) + { + rSet.InvalidateItem(SID_BACKGROUND_COLOR); + } } break; + case SID_FRAME_LINESTYLE: case SID_FRAME_LINECOLOR: { - rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) ); + // handled together because both need the cell border information for decisions + // rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) ); + Color aCol = 0; + editeng::SvxBorderLine aLine(0,0,0,0); + bool bCol = 0; + bool bColDisable = 0, bStyleDisable = 0; + SvxBoxItem aBoxItem(ATTR_BORDER); + SvxBoxInfoItem aInfoItem(ATTR_BORDER_INNER); + + pTabViewShell->GetSelectionFrame(aBoxItem, aInfoItem); + + if( aBoxItem.GetTop() ) + { + bCol = 1; + aCol = aBoxItem.GetTop()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aBoxItem.GetTop()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem.GetTop()->GetBorderLineStyle()); + } + + if( aBoxItem.GetBottom() ) + { + if(bCol == 0) + { + bCol = 1; + aCol = aBoxItem.GetBottom()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aBoxItem.GetBottom()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem.GetBottom()->GetBorderLineStyle()); + } + else + { + if(aCol != aBoxItem.GetBottom()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aBoxItem.GetBottom())) ) + bStyleDisable = 1; + } + } + + if( aBoxItem.GetLeft() ) + { + if(bCol == 0) + { + bCol = 1; + aCol = aBoxItem.GetLeft()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aBoxItem.GetLeft()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem.GetLeft()->GetBorderLineStyle()); + } + else + { + if(aCol != aBoxItem.GetLeft()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aBoxItem.GetLeft())) ) + bStyleDisable = 1; + } + } + + if( aBoxItem.GetRight() ) + { + if(bCol == 0) + { + bCol = 1; + aCol = aBoxItem.GetRight()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aBoxItem.GetRight()->GetWidth()); + aLine.SetBorderLineStyle( aBoxItem.GetRight()->GetBorderLineStyle()); + } + else + { + if(aCol != aBoxItem.GetRight()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aBoxItem.GetRight())) ) + bStyleDisable = 1; + } + } + + if( aInfoItem.GetVert()) + { + if(bCol == 0) + { + bCol = 1; + aCol = aInfoItem.GetVert()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aInfoItem.GetVert()->GetWidth()); + aLine.SetBorderLineStyle( aInfoItem.GetVert()->GetBorderLineStyle()); + } + else + { + if(aCol != aInfoItem.GetVert()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aInfoItem.GetVert())) ) + bStyleDisable = 1; + } + } + + if( aInfoItem.GetHori()) + { + if(bCol == 0) + { + bCol = 1; + aCol = aInfoItem.GetHori()->GetColor() ; + aLine.SetColor(aCol); + aLine.SetWidth( aInfoItem.GetHori()->GetWidth()); + aLine.SetBorderLineStyle( aInfoItem.GetHori()->GetBorderLineStyle()); + } + else + { + if(aCol != aInfoItem.GetHori()->GetColor() ) + bColDisable = 1; + if(!( aLine == *(aInfoItem.GetHori())) ) + bStyleDisable = 1; + } + } + + if( !aInfoItem.IsValid( VALID_VERT ) + || !aInfoItem.IsValid( VALID_HORI ) + || !aInfoItem.IsValid( VALID_LEFT ) + || !aInfoItem.IsValid( VALID_RIGHT ) + || !aInfoItem.IsValid( VALID_TOP ) + || !aInfoItem.IsValid( VALID_BOTTOM ) ) + { + bColDisable = 1; + bStyleDisable = 1; + } + + if(SID_FRAME_LINECOLOR == nWhich) + { + if(bColDisable) // if different lines have differernt colors + { + aCol = COL_TRANSPARENT; + rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) ); + rSet.InvalidateItem(SID_FRAME_LINECOLOR); + } + else if( bCol == 0 && bColDisable == 0) // if no line available + { + aCol = COL_AUTO; + rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) ); + } + else + rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) ); + } + else // if( nWhich == SID_FRAME_LINESTYLE) + { + if(bStyleDisable) // if have several lines but don't have same style + { + aLine.SetWidth( 1 ); + SvxLineItem aItem(SID_FRAME_LINESTYLE); + aItem.SetLine(&aLine); + rSet.Put( aItem ); + rSet.InvalidateItem(SID_FRAME_LINESTYLE); + } + else // all the lines have same style or no line availavle, use initial value (0,0,0,0) + { + SvxLineItem aItem(SID_FRAME_LINESTYLE); + aItem.SetLine(&aLine); + rSet.Put( aItem ); + } + } } break; case SID_ATTR_BRUSH: @@ -1740,6 +2071,13 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) } nWhich = aIter.NextWhich(); } + + if(nWhich) + { + // stuff for sidebar panels + Invalidate(SID_ATTR_ALIGN_DEGREES); + Invalidate(SID_ATTR_ALIGN_STACKED); + } } //------------------------------------------------------------------ @@ -2013,22 +2351,139 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) switch ( nWhich ) { case SID_NUMBER_FORMAT: + //{ + // String aFormatCode; // bleibt leer, wenn dont-care + // + // const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); + // if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) != SFX_ITEM_DONTCARE ) + // { + // sal_uLong nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get( + // ATTR_VALUE_FORMAT )).GetValue(); + // + // SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + // const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat ); + // if ( pFormatEntry ) + // aFormatCode = pFormatEntry->GetFormatstring(); + // } + // + // rSet.Put( SfxStringItem( nWhich, aFormatCode ) ); + //} + + // symphony version with format interpretation { - String aFormatCode; // bleibt leer, wenn dont-care + const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); - if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) != SFX_ITEM_DONTCARE ) + if(SFX_ITEM_DONTCARE != rAttrSet.GetItemState(ATTR_VALUE_FORMAT)) { - sal_uLong nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get( - ATTR_VALUE_FORMAT )).GetValue(); + SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + sal_uInt32 nNumberFormat = ((const SfxUInt32Item&)rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue(); + bool bThousand(false); + bool bNegRed(false); + sal_uInt16 nPrecision(0); + sal_uInt16 nLeadZeroes(0); + + pFormatter->GetFormatSpecialInfo(nNumberFormat,bThousand, bNegRed, nPrecision, nLeadZeroes); + String aFormat; + static String sBreak = OUString(","); + const String sThousand = OUString::number(static_cast<sal_Int32>(bThousand)); + const String sNegRed = OUString::number(static_cast<sal_Int32>(bNegRed)); + const String sPrecision = OUString::number(nPrecision); + const String sLeadZeroes = OUString::number(nLeadZeroes); + + aFormat += sThousand; + aFormat += sBreak; + aFormat += sNegRed; + aFormat += sBreak; + aFormat += sPrecision; + aFormat += sBreak; + aFormat += sLeadZeroes; + aFormat += sBreak; + + rSet.Put(SfxStringItem(nWhich, aFormat)); + } + else + { + rSet.InvalidateItem( nWhich ); + } + } + break; + case SID_NUMBER_TYPE_FORMAT: + { + sal_Int16 aFormatCode = -1; + const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet(); + if ( rAttrSet.GetItemState( ATTR_VALUE_FORMAT ) >= SFX_ITEM_AVAILABLE ) //Modify for more robust + { SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + sal_uInt32 nNumberFormat = pTabViewShell->GetSelectionPattern()->GetNumberFormat( pFormatter ); const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat ); + bool bStandard = false; + if ( pFormatEntry ) - aFormatCode = pFormatEntry->GetFormatstring(); + { + aFormatCode = pFormatEntry->GetType(); + bStandard = pFormatEntry->IsStandard(); + } + + switch(aFormatCode) + { + case NUMBERFORMAT_NUMBER: + case NUMBERFORMAT_NUMBER| NUMBERFORMAT_DEFINED: + //use format code and standard format code to judge whether it is General, + //if (nNumberFormat == nStandardNumberFormat) + if (bStandard) + aFormatCode = 0; + else + aFormatCode = 1; + break; + case NUMBERFORMAT_PERCENT: + case NUMBERFORMAT_PERCENT| NUMBERFORMAT_DEFINED: + aFormatCode = 2; + break; + case NUMBERFORMAT_CURRENCY: + case NUMBERFORMAT_CURRENCY| NUMBERFORMAT_DEFINED: + aFormatCode = 3; + break; + case NUMBERFORMAT_DATE: + case NUMBERFORMAT_DATE| NUMBERFORMAT_DEFINED: + //Add + case NUMBERFORMAT_DATETIME: + case NUMBERFORMAT_DATETIME | NUMBERFORMAT_DEFINED: + aFormatCode = 4; + break; + case NUMBERFORMAT_TIME: + case NUMBERFORMAT_TIME| NUMBERFORMAT_DEFINED: + aFormatCode = 5; + break; + case NUMBERFORMAT_SCIENTIFIC: + case NUMBERFORMAT_SCIENTIFIC| NUMBERFORMAT_DEFINED: + aFormatCode = 6; + break; + case NUMBERFORMAT_FRACTION: + case NUMBERFORMAT_FRACTION| NUMBERFORMAT_DEFINED: + aFormatCode = 7; + break; + case NUMBERFORMAT_LOGICAL: + case NUMBERFORMAT_LOGICAL| NUMBERFORMAT_DEFINED: + aFormatCode = 8; + break; + case NUMBERFORMAT_TEXT: + case NUMBERFORMAT_TEXT| NUMBERFORMAT_DEFINED: + aFormatCode = 9; + break; + default: + aFormatCode = -1; //for more roburst + } + if( aFormatCode == -1 ) + rSet.InvalidateItem( nWhich ); + else + rSet.Put( SfxInt16Item( nWhich, aFormatCode ) ); + } + else + { + rSet.InvalidateItem( nWhich ); } - rSet.Put( SfxStringItem( nWhich, aFormatCode ) ); } break; case SID_NUMBER_SCIENTIFIC: @@ -2323,4 +2778,52 @@ short ScFormatShell::GetCurrentNumberFormatType() return nType; } +void ScFormatShell::ExecViewOptions( SfxRequest& rReq ) +{ + ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + SfxBindings& rBindings = pViewData->GetBindings(); + const SfxItemSet* pNewAttrs = rReq.GetArgs(); + + if ( pNewAttrs ) + { + sal_uInt16 nSlot = rReq.GetSlot(); + + if( nSlot == SID_SCGRIDSHOW) + { + + ScViewData* pLclViewData = pTabViewShell->GetViewData(); + const ScViewOptions& rOldOpt = pLclViewData->GetOptions(); + ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current()); + bool bState = ((const SfxBoolItem &)pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich( nSlot ) )).GetValue(); + + if ( (bool)rOldOpt.GetOption( VOPT_GRID ) != bState) + { + ScViewOptions rNewOpt(rOldOpt); + rNewOpt.SetOption( VOPT_GRID, bState); + pLclViewData->SetOptions( rNewOpt ); + pLclViewData->GetDocument()->SetViewOptions( rNewOpt ); + pDocSh->SetDocumentModified(); + //add , write the change to sc view config + ScModule* pScMod = SC_MOD(); + pScMod->SetViewOptions( rNewOpt ); + //add end + rBindings.Invalidate( nSlot ); + } + } + } + +} + +void ScFormatShell::GetViewOptions( SfxItemSet& rSet ) +{ + ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); + if( pTabViewShell ) + { + ScViewOptions aViewOpt = pTabViewShell->GetViewData()->GetOptions(); + rSet.ClearItem(SID_SCGRIDSHOW); + SfxBoolItem aItem( SID_SCGRIDSHOW, aViewOpt.GetOption( VOPT_GRID ) ); + rSet.Put(aItem); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 86cddf2526c9..4a5c9b522947 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2038,7 +2038,20 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) } if (DrawMouseButtonUp(rMEvt)) // includes format paint brush handling for drawing objects + { + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + SfxBindings& rFrmBindings=pViewShell->GetViewFrame()->GetBindings(); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH); + rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT); return; + } rMark.SetMarking(false); @@ -3245,7 +3258,20 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) return; if (DrawKeyInput(rKEvt)) + { + const KeyCode& rLclKeyCode = rKEvt.GetKeyCode(); + if (rLclKeyCode.GetCode() == KEY_DOWN + || rLclKeyCode.GetCode() == KEY_UP + || rLclKeyCode.GetCode() == KEY_LEFT + || rLclKeyCode.GetCode() == KEY_RIGHT) + { + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings(); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y); + } return; + } if (!pViewData->GetView()->IsDrawSelMode() && !DrawHasMarkedObj()) // keine Eingaben im Zeichenmodus { //! DrawShell abfragen !!! diff --git a/sc/source/ui/view/pivotsh.cxx b/sc/source/ui/view/pivotsh.cxx index 57a7b56ad33d..40f278699022 100644 --- a/sc/source/ui/view/pivotsh.cxx +++ b/sc/source/ui/view/pivotsh.cxx @@ -25,6 +25,7 @@ #include <sfx2/request.hxx> #include <svl/whiter.hxx> #include <vcl/msgbox.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include "sc.hrc" #include "pivotsh.hxx" @@ -68,6 +69,7 @@ ScPivotShell::ScPivotShell( ScTabViewShell* pViewSh ) : } SetHelpId( HID_SCSHELL_PIVOTSH ); SetName(OUString("Pivot")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Pivot)); } //------------------------------------------------------------------------ diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 0124f6a0f795..30750750a697 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -212,6 +212,18 @@ void ScTabView::InvalidateAttribs() rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE ); + rBindings.Invalidate( SID_ATTR_CHAR_KERNING ); + rBindings.Invalidate( SID_SET_SUPER_SCRIPT ); + rBindings.Invalidate( SID_SET_SUB_SCRIPT ); + rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT ); + rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED ); + + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_LEFT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_RIGHT ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_BLOCK ); + rBindings.Invalidate( SID_ATTR_PARA_ADJUST_CENTER); + rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT); + rBindings.Invalidate( SID_ALIGNLEFT ); rBindings.Invalidate( SID_ALIGNRIGHT ); rBindings.Invalidate( SID_ALIGNBLOCK ); @@ -221,6 +233,21 @@ void ScTabView::InvalidateAttribs() rBindings.Invalidate( SID_ALIGNBOTTOM ); rBindings.Invalidate( SID_ALIGNCENTERVER ); + // stuff for sidebar panels + { + rBindings.Invalidate( SID_H_ALIGNCELL ); + rBindings.Invalidate( SID_V_ALIGNCELL ); + rBindings.Invalidate( SID_ATTR_ALIGN_INDENT ); + rBindings.Invalidate( SID_FRAME_LINECOLOR ); + rBindings.Invalidate( SID_FRAME_LINESTYLE ); + rBindings.Invalidate( SID_ATTR_BORDER_OUTER ); + rBindings.Invalidate( SID_ATTR_BORDER_INNER ); + rBindings.Invalidate( SID_SCGRIDSHOW ); + rBindings.Invalidate( SID_ATTR_BORDER_DIAG_TLBR ); + rBindings.Invalidate( SID_ATTR_BORDER_DIAG_BLTR ); + rBindings.Invalidate( SID_NUMBER_TYPE_FORMAT ); + } + rBindings.Invalidate( SID_BACKGROUND_COLOR ); rBindings.Invalidate( SID_ATTR_ALIGN_LINEBREAK ); diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx index f4d277fac4e2..537499b528ee 100644 --- a/sc/source/ui/view/tabvwsh.cxx +++ b/sc/source/ui/view/tabvwsh.cxx @@ -27,6 +27,7 @@ #include <sfx2/bindings.hxx> #include <sfx2/app.hxx> #include <sfx2/infobar.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include "tabvwsh.hxx" #include "docsh.hxx" @@ -54,6 +55,7 @@ SFX_IMPL_INTERFACE(ScTabViewShell,SfxViewShell,ScResId(SCSTR_TABVIEWSHELL)) SFX_CHILDWINDOW_REGISTRATION(SfxInfoBarContainerChild::GetChildWindowId()); SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR); SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE); + SFX_CHILDWINDOW_REGISTRATION(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScNameDlgWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScNameDefDlgWrapper::GetChildWindowId()); SFX_CHILDWINDOW_REGISTRATION(ScSolverDlgWrapper::GetChildWindowId()); diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index ecc73952b53a..377546fb9120 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -27,6 +27,7 @@ #include <svx/fmshell.hxx> #include <editeng/sizeitem.hxx> #include <svx/prtqry.hxx> +#include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <sfx2/request.hxx> #include <sfx2/printer.hxx> #include <sfx2/dispatch.hxx> @@ -212,6 +213,10 @@ void ScTabViewShell::Activate(sal_Bool bMDI) // Wenn Referenzeingabe-Tip-Hilfe hier wieder angezeigt werden soll (ShowRefTip), // muss sie beim Verschieben der View angepasst werden (gibt sonst Probleme unter OS/2 // beim Umschalten zwischen Dokumenten) + + ContextChangeEventMultiplexer::NotifyContextChange( + GetController(), + ::sfx2::sidebar::EnumContext::Context_Default); } void ScTabViewShell::Deactivate(sal_Bool bMDI) diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 49f8533a482f..e114c99bfbb2 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2758,6 +2758,11 @@ void ScViewFunc::ChangeIndent( sal_Bool bIncrement ) { pDocSh->UpdateOle(pViewData); StartFormatArea(); + + // stuff for sidebar panels + SfxBindings& rBindings = GetViewData()->GetBindings(); + rBindings.Invalidate( SID_H_ALIGNCELL ); + rBindings.Invalidate( SID_ATTR_ALIGN_INDENT ); } } |