diff options
Diffstat (limited to 'sc/source/ui')
63 files changed, 6058 insertions, 93 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 9baa6cc36eda..0f6ce7228342 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2367,6 +2367,12 @@ void ScInputHandler::InvalidateAttribs() rBindings.Invalidate( SID_ULINE_VAL_DOTTED ); rBindings.Invalidate( SID_HYPERLINK_GETLINK ); + + 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 ); } } diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index 9ed0e3ac069b..897a59f2e077 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -26,6 +26,7 @@ #include <comphelper/classids.hxx> #include <sfx2/taskpane.hxx> +#include <sfx2/sidebar/SidebarChildWindow.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/docfile.hxx> @@ -228,6 +229,7 @@ void ScDLL::Init() // common SFX controller ::sfx2::TaskPaneWrapper::RegisterChildWindow( false, pMod ); + ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod); // Svx-StatusBar-Controller SvxInsertStatusBarControl ::RegisterControl(SID_ATTR_INSERT, pMod); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index ac3daadc55fa..5a5747965646 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1108,7 +1108,10 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) } SetViewOptions( rNewOpt ); if (pBindings) + { pBindings->Invalidate(SID_HELPLINES_MOVE); + pBindings->Invalidate(SID_SCGRIDSHOW); + } } //============================================ diff --git a/sc/source/ui/app/typemap.cxx b/sc/source/ui/app/typemap.cxx index 01f0ba78bf8e..12e20053b23a 100644 --- a/sc/source/ui/app/typemap.cxx +++ b/sc/source/ui/app/typemap.cxx @@ -75,12 +75,20 @@ #include <editeng/crossedoutitem.hxx> #include <editeng/formatbreakitem.hxx> #include <editeng/charreliefitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/kernitem.hxx> #include <svx/rotmodit.hxx> #include <svx/drawitem.hxx> #include <svl/ilstitem.hxx> #include <svl/globalnameitem.hxx> #include <svx/chrtitem.hxx> #include <svx/zoomslideritem.hxx> +#include <svx/xflftrit.hxx> +#include <svx/xlncapit.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/AffineMatrixItem.hxx> // #i25616# #include <svx/sdshitm.hxx> diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 815dd1563fde..6e8cd1c81173 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -3898,6 +3898,11 @@ sal_Bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, sal_Bool bIncrement, pBindings->Invalidate( SID_ALIGNRIGHT ); pBindings->Invalidate( SID_ALIGNBLOCK ); pBindings->Invalidate( SID_ALIGNCENTERHOR ); + pBindings->Invalidate( SID_ATTR_LRSPACE ); + pBindings->Invalidate( SID_ATTR_PARA_ADJUST_LEFT ); + pBindings->Invalidate( SID_ATTR_PARA_ADJUST_RIGHT ); + pBindings->Invalidate( SID_ATTR_PARA_ADJUST_BLOCK ); + pBindings->Invalidate( SID_ATTR_PARA_ADJUST_CENTER); // pseudo slots for Format menu pBindings->Invalidate( SID_ALIGN_ANY_HDEFAULT ); pBindings->Invalidate( SID_ALIGN_ANY_LEFT ); diff --git a/sc/source/ui/drawfunc/chartsh.cxx b/sc/source/ui/drawfunc/chartsh.cxx index c20f0ad0acd7..e84b1be9fd40 100644 --- a/sc/source/ui/drawfunc/chartsh.cxx +++ b/sc/source/ui/drawfunc/chartsh.cxx @@ -25,6 +25,7 @@ #include <sfx2/app.hxx> #include <sfx2/objface.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/whiter.hxx> #include <vcl/msgbox.hxx> @@ -58,6 +59,7 @@ ScChartShell::ScChartShell(ScViewData* pData) : { SetHelpId( HID_SCSHELL_CHARTSH ); SetName( OUString("ChartObject") ); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Chart)); } ScChartShell::~ScChartShell() @@ -100,5 +102,10 @@ void ScChartShell::ExecuteExportAsGraphic( SfxRequest& ) Invalidate(); } +void ScChartShell::HandleSelectionChange (void) +{ + // Do not call the implementation in the base class. Let + // Activate()/Deactivate() handle context switches. +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index 3e8605c70827..5a675be518f6 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -46,6 +46,8 @@ #include <svx/svdobj.hxx> #include <svx/drawitem.hxx> #include <svx/xtable.hxx> +#include "tabvwsh.hxx" +#include <sfx2/bindings.hxx> #define ScDrawShell #include "scslots.hxx" @@ -125,14 +127,21 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) case SID_ATTR_LINE_STYLE: case SID_ATTR_LINEEND_STYLE: + case SID_ATTR_LINE_START: + case SID_ATTR_LINE_END: case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: case SID_ATTR_FILL_STYLE: case SID_ATTR_FILL_COLOR: case SID_ATTR_FILL_GRADIENT: case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: // #i25616# case SID_ATTR_FILL_SHADOW: @@ -146,6 +155,9 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) case SID_ATTR_LINE_DASH: case SID_ATTR_LINE_WIDTH: case SID_ATTR_LINE_COLOR: + case SID_ATTR_LINE_TRANSPARENCE: + case SID_ATTR_LINE_JOINT: + case SID_ATTR_LINE_CAP: ExecuteLineDlg( rReq ); break; @@ -154,6 +166,8 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) case SID_ATTR_FILL_GRADIENT: case SID_ATTR_FILL_HATCH: case SID_ATTR_FILL_BITMAP: + case SID_ATTR_FILL_TRANSPARENCE: + case SID_ATTR_FILL_FLOATTRANSPARENCE: // #i25616# case SID_ATTR_FILL_SHADOW: @@ -219,6 +233,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) break; case SID_ATTR_TRANSFORM: + { { if ( pView->AreObjectsMarked() ) { @@ -282,7 +297,20 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) pView->SetGeoAttrToMarked( *pArgs ); } } + + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings(); + rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH); + rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); + rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y); + rBindings.Invalidate(SID_ATTR_TRANSFORM_ANGLE); + rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_X); + rBindings.Invalidate(SID_ATTR_TRANSFORM_ROT_Y); + rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOWIDTH); + rBindings.Invalidate(SID_ATTR_TRANSFORM_AUTOHEIGHT); break; + } default: break; diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index b161aeafa9d4..b63732ad792e 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -33,6 +33,8 @@ #include <svx/svdouno.hxx> #include <svx/extrusionbar.hxx> #include <svx/fontworkbar.hxx> +#include <svx/sidebar/SelectionChangeHandler.hxx> +#include <svx/sidebar/SelectionAnalyzer.hxx> #include "drawsh.hxx" #include "drawview.hxx" @@ -45,15 +47,23 @@ #include <svx/svdoole2.hxx> #include <svx/svdocapt.hxx> +#include <boost/bind.hpp> + + sal_uInt16 ScGetFontWorkId(); // in drtxtob using namespace com::sun::star; + //------------------------------------------------------------------ ScDrawShell::ScDrawShell( ScViewData* pData ) : SfxShell(pData->GetViewShell()), - pViewData( pData ) + pViewData( pData ), + mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler( + ::boost::bind(&ScDrawShell::GetContextForSelection, this), + GetFrame()->GetFrame().GetController(), + sfx2::sidebar::EnumContext::Context_Cell)) { SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() ); ::svl::IUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); @@ -64,10 +74,13 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) : } SetHelpId( HID_SCSHELL_DRAWSH ); SetName(OUString("Drawing")); + + mpSelectionChangeHandler->Connect(); } ScDrawShell::~ScDrawShell() { + mpSelectionChangeHandler->Disconnect(); } void ScDrawShell::GetState( SfxItemSet& rSet ) // Zustaende / Toggles @@ -130,6 +143,8 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // Funktionen disabl { rSet.DisableItem( SID_MIRROR_HORIZONTAL ); rSet.DisableItem( SID_MIRROR_VERTICAL ); + rSet.DisableItem( SID_FLIP_HORIZONTAL ); + rSet.DisableItem( SID_FLIP_VERTICAL ); } const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); @@ -380,5 +395,22 @@ sal_Bool ScDrawShell::AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList return bResult; } +void ScDrawShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet ) +{ + ScDrawView* pView = pViewData->GetScDrawView(); + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + + if( rMarkList.GetMark(0) != 0 ) + { + SfxItemSet aNewAttr(pView->GetGeoAttrFromMarked()); + rSet.Put(aNewAttr, sal_False); + } +} + +sfx2::sidebar::EnumContext::Context ScDrawShell::GetContextForSelection (void) +{ + return ::svx::sidebar::SelectionAnalyzer::GetContextForSelection_SC( + GetDrawView()->GetMarkedObjectList()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index 8a82fda696fc..61cc2358ad26 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -305,10 +305,14 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) break; case SID_MIRROR_HORIZONTAL: + case SID_FLIP_HORIZONTAL: pView->MirrorAllMarkedHorizontal(); + rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE ); break; case SID_MIRROR_VERTICAL: + case SID_FLIP_VERTICAL: pView->MirrorAllMarkedVertical(); + rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE ); break; case SID_OBJECT_ALIGN_LEFT: diff --git a/sc/source/ui/drawfunc/drformsh.cxx b/sc/source/ui/drawfunc/drformsh.cxx index 6355ef5e8d9d..02cf369c3498 100644 --- a/sc/source/ui/drawfunc/drformsh.cxx +++ b/sc/source/ui/drawfunc/drformsh.cxx @@ -35,6 +35,7 @@ #include "drawview.hxx" #include "scresid.hxx" #include <svx/svdobj.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #define ScDrawFormShell #include "scslots.hxx" @@ -54,12 +55,11 @@ ScDrawFormShell::ScDrawFormShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_DRAWFORMSH); SetName(OUString("DrawForm")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form)); } ScDrawFormShell::~ScDrawFormShell() { } - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 9e0891e540a4..8e97dd2bc6e6 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -31,6 +31,9 @@ #include <editeng/flditem.hxx> #include <editeng/fontitem.hxx> #include <editeng/frmdiritem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/ulspitem.hxx> #include <svx/hlnkitem.hxx> #include <editeng/lspcitem.hxx> #include <svx/svdoutl.hxx> @@ -57,6 +60,7 @@ #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> +#include <sfx2/sidebar/EnumContext.hxx> #include "sc.hrc" #include "globstr.hrc" @@ -121,6 +125,7 @@ ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) : SetHelpId( HID_SCSHELL_DRTXTOB ); SetName(OUString("DrawText")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText)); } ScDrawTextObjectBar::~ScDrawTextObjectBar() @@ -698,10 +703,11 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) } break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: // Dialog-Button case SID_ATTR_CHAR_FONT: // Controller nicht angezeigt case SID_ATTR_CHAR_FONTHEIGHT: - bDone = ExecuteCharDlg( aEditAttr, aNewAttr ); + bDone = ExecuteCharDlg( aEditAttr, aNewAttr , nSlot); break; case SID_PARA_DLG: @@ -818,6 +824,11 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) aNewAttr.Put( *pDlg->GetOutputItemSet() ); delete pDlg; + + SfxBindings& rBindings = pViewData->GetBindings(); + rBindings.Invalidate( SID_TABLE_VERT_NONE ); + rBindings.Invalidate( SID_TABLE_VERT_CENTER ); + rBindings.Invalidate( SID_TABLE_VERT_BOTTOM ); } break; } @@ -849,6 +860,120 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) pView->SetAttributes( aSetItem.GetItemSet() ); } + else if( nSlot == SID_ATTR_PARA_LRSPACE ) + { + sal_uInt16 nId = SID_ATTR_PARA_LRSPACE; + const SvxLRSpaceItem& rItem = (const SvxLRSpaceItem&) + pArgs->Get( nId ); + SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE ); + nId = EE_PARA_LRSPACE; + SvxLRSpaceItem aLRSpaceItem( rItem.GetLeft(), + rItem.GetRight(), rItem.GetTxtLeft(), + rItem.GetTxtFirstLineOfst(), nId ); + aEditAttr.Put( aLRSpaceItem ); +// rReq.Done( aEditAttr ); +// pArgs = rReq.GetArgs(); +// pView->SetAttributes( *pArgs ); + pView->SetAttributes( aEditAttr ); +// Invalidate(SID_ATTR_PARA_LRSPACE); + } + else if( nSlot == SID_ATTR_PARA_LINESPACE ) + { + SvxLineSpacingItem aLineSpaceItem = (const SvxLineSpacingItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL ); + aEditAttr.Put( aLineSpaceItem ); +// rReq.Done( aEditAttr ); +// pArgs = rReq.GetArgs(); +// pView->SetAttributes( *pArgs ); + pView->SetAttributes( aEditAttr ); +// Invalidate(SID_ATTR_PARA_LINESPACE); + } + else if( nSlot == SID_ATTR_PARA_ULSPACE ) + { + SvxULSpaceItem aULSpaceItem = (const SvxULSpaceItem&)pArgs->Get( + GetPool().GetWhich(nSlot)); + SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE ); + aULSpaceItem.SetWhich(EE_PARA_ULSPACE); + aEditAttr.Put( aULSpaceItem ); +// rReq.Done( aEditAttr ); +// pArgs = rReq.GetArgs(); +// pView->SetAttributes( *pArgs ); + pView->SetAttributes( aEditAttr ); +// Invalidate(SID_ATTR_PARA_ULSPACE); + } + else if(nSlot == SID_SET_SUPER_SCRIPT ) + { + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + pView->GetAttributes(aEditAttr); + SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT ); + aNewAttr.Put( aItem ); + pView->SetAttributes( aNewAttr ); + } + else if( nSlot == SID_SET_SUB_SCRIPT ) + { + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + pView->GetAttributes(aEditAttr); + SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + + SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); + SvxEscapement eEsc = (SvxEscapement) ( (const SvxEscapementItem&) + aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); + + if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) + aItem.SetEscapement( SVX_ESCAPEMENT_OFF ); + else + aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT ); + aNewAttr.Put( aItem ); + pView->SetAttributes( aNewAttr ); + } + + else if (bArgsInReq && + ( nSlot == SID_TABLE_VERT_NONE || nSlot == SID_TABLE_VERT_CENTER || + nSlot == SID_TABLE_VERT_BOTTOM ) ) + { + SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP; + if (nSlot == SID_TABLE_VERT_CENTER) + eTVA = SDRTEXTVERTADJUST_CENTER; + else if (nSlot == SID_TABLE_VERT_BOTTOM) + eTVA = SDRTEXTVERTADJUST_BOTTOM; + + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + aNewAttr.Put(SdrTextVertAdjustItem(eTVA)); + pView->SetAttributes(aNewAttr); + } + else if (bArgsInReq && + (nSlot == SID_ATTR_PARA_ADJUST_LEFT || nSlot == SID_ATTR_PARA_ADJUST_CENTER || nSlot == SID_ATTR_PARA_ADJUST_RIGHT || nSlot == SID_ATTR_PARA_ADJUST_BLOCK )) + { + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + SfxItemSet aNewAttr( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + switch ( nSlot ) + { + case SID_ATTR_PARA_ADJUST_LEFT: + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) ); + break; + case SID_ATTR_PARA_ADJUST_CENTER: + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_CENTER, EE_PARA_JUST ) ); + break; + case SID_ATTR_PARA_ADJUST_RIGHT: + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) ); + break; + case SID_ATTR_PARA_ADJUST_BLOCK: + aNewAttr.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, EE_PARA_JUST ) ); + break; + } + pView->SetAttributes(aNewAttr); + } else { // use args directly @@ -901,24 +1026,35 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_WEIGHT, nScript ); if ( rDestSet.GetItemState( EE_CHAR_ITALIC ) != SFX_ITEM_UNKNOWN ) ScViewUtil::PutItemScript( rDestSet, aAttrSet, EE_CHAR_ITALIC, nScript ); - // Ausrichtung SvxAdjust eAdj = ((const SvxAdjustItem&)aAttrSet.Get(EE_PARA_JUST)).GetAdjust(); switch( eAdj ) { - case SVX_ADJUST_LEFT: + case SVX_ADJUST_LEFT: + { rDestSet.Put( SfxBoolItem( SID_ALIGNLEFT, sal_True ) ); - break; - case SVX_ADJUST_CENTER: + rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_LEFT, sal_True ) ); + } + break; + case SVX_ADJUST_CENTER: + { rDestSet.Put( SfxBoolItem( SID_ALIGNCENTERHOR, sal_True ) ); - break; - case SVX_ADJUST_RIGHT: + rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_CENTER, sal_True ) ); + } + break; + case SVX_ADJUST_RIGHT: + { rDestSet.Put( SfxBoolItem( SID_ALIGNRIGHT, sal_True ) ); - break; - case SVX_ADJUST_BLOCK: + rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_RIGHT, sal_True ) ); + } + break; + case SVX_ADJUST_BLOCK: + { rDestSet.Put( SfxBoolItem( SID_ALIGNBLOCK, sal_True ) ); - break; + rDestSet.Put( SfxBoolItem( SID_ATTR_PARA_ADJUST_BLOCK, sal_True ) ); + } + break; default: { // added to avoid warnings @@ -930,6 +1066,32 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_RIGHT, eAdj == SVX_ADJUST_RIGHT ) ); rDestSet.Put( SfxBoolItem( SID_ALIGN_ANY_JUSTIFIED, eAdj == SVX_ADJUST_BLOCK ) ); + SvxLRSpaceItem aLR = ((const SvxLRSpaceItem&)aAttrSet.Get( EE_PARA_LRSPACE )); + aLR.SetWhich(SID_ATTR_PARA_LRSPACE); + rDestSet.Put(aLR); + Invalidate( SID_ATTR_PARA_LRSPACE ); + SfxItemState eState = aAttrSet.GetItemState( EE_PARA_LRSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + rDestSet.InvalidateItem(SID_ATTR_PARA_LRSPACE); + //xuxu for Line Space + SvxLineSpacingItem aLineSP = ((const SvxLineSpacingItem&)aAttrSet. + Get( EE_PARA_SBL )); + aLineSP.SetWhich(SID_ATTR_PARA_LINESPACE); + rDestSet.Put(aLineSP); + Invalidate(SID_ATTR_PARA_LINESPACE); + eState = aAttrSet.GetItemState( EE_PARA_SBL ); + if ( eState == SFX_ITEM_DONTCARE ) + rDestSet.InvalidateItem(SID_ATTR_PARA_LINESPACE); + //xuxu for UL Space + SvxULSpaceItem aULSP = ((const SvxULSpaceItem&)aAttrSet. + Get( EE_PARA_ULSPACE )); + aULSP.SetWhich(SID_ATTR_PARA_ULSPACE); + rDestSet.Put(aULSP); + Invalidate(SID_ATTR_PARA_ULSPACE); + eState = aAttrSet.GetItemState( EE_PARA_ULSPACE ); + if ( eState == SFX_ITEM_DONTCARE ) + rDestSet.InvalidateItem(SID_ATTR_PARA_ULSPACE); + // Zeilenabstand sal_uInt16 nLineSpace = (sal_uInt16) @@ -959,7 +1121,7 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) // Unterstreichung - SfxItemState eState = aAttrSet.GetItemState( EE_CHAR_UNDERLINE, sal_True ); + eState = aAttrSet.GetItemState( EE_CHAR_UNDERLINE, sal_True ); if ( eState == SFX_ITEM_DONTCARE ) { rDestSet.InvalidateItem( SID_ULINE_VAL_NONE ); @@ -1056,4 +1218,55 @@ void ScDrawTextObjectBar::ExecuteTrans( SfxRequest& rReq ) } } +void ScDrawTextObjectBar::GetStatePropPanelAttr(SfxItemSet &rSet) +{ + SfxWhichIter aIter( rSet ); + sal_uInt16 nWhich = aIter.FirstWhich(); + + SdrView* pView = pViewData->GetScDrawView(); + + SfxItemSet aEditAttr(pView->GetModel()->GetItemPool()); + pView->GetAttributes(aEditAttr); + //SfxItemSet aAttrs( *aEditAttr.GetPool(), aEditAttr.GetRanges() ); + + while ( nWhich ) + { + sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich) + ? GetPool().GetSlotId(nWhich) + : nWhich; + switch ( nSlotId ) + { + case SID_TABLE_VERT_NONE: + case SID_TABLE_VERT_CENTER: + case SID_TABLE_VERT_BOTTOM: + sal_Bool bContour = sal_False; + SfxItemState eConState = aEditAttr.GetItemState( SDRATTR_TEXT_CONTOURFRAME ); + if( eConState != SFX_ITEM_DONTCARE ) + { + bContour = ( ( const SdrTextContourFrameItem& )aEditAttr.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); + } + if (bContour) break; + + SfxItemState eVState = aEditAttr.GetItemState( SDRATTR_TEXT_VERTADJUST ); + //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ); + + //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState) + if(SFX_ITEM_DONTCARE != eVState) + { + SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aEditAttr.Get(SDRATTR_TEXT_VERTADJUST)).GetValue(); + sal_Bool bSet = nSlotId == (SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) || + (nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) || + (nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM); + rSet.Put(SfxBoolItem(nSlotId, bSet)); + } + else + { + rSet.Put(SfxBoolItem(nSlotId, sal_False)); + } + break; + } + nWhich = aIter.NextWhich(); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx index 37c9a2512329..a3f5445d5f49 100644 --- a/sc/source/ui/drawfunc/drtxtob1.cxx +++ b/sc/source/ui/drawfunc/drtxtob1.cxx @@ -41,7 +41,7 @@ //------------------------------------------------------------------------ sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, - SfxItemSet& rOutSet ) + SfxItemSet& rOutSet , sal_uInt16 nSlot) { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); @@ -49,6 +49,10 @@ sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs, SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( pViewData->GetDialogParent(), &rArgs, pViewData->GetSfxDocShell(),RID_SCDLG_CHAR ); OSL_ENSURE(pDlg, "Dialog create fail!"); + if (nSlot == SID_CHAR_DLG_EFFECT) + { + pDlg->SetCurPageId(RID_SVXPAGE_CHAR_EFFECTS); + } sal_Bool bRet = ( pDlg->Execute() == RET_OK ); if ( bRet ) diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index 5b6e0b124b7c..8ea5fc2d90b3 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -61,6 +61,10 @@ static void lcl_InvalidateAttribs( SfxBindings& rBindings ) rBindings.Invalidate( SID_ATTR_CHAR_COLOR ); rBindings.Invalidate( SID_ATTR_CHAR_FONT ); rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + 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 ); @@ -80,6 +84,11 @@ static void lcl_InvalidateAttribs( SfxBindings& rBindings ) rBindings.Invalidate( SID_ALIGN_ANY_HCENTER ); rBindings.Invalidate( SID_ALIGN_ANY_RIGHT ); rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED ); + 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 ); } static void lcl_UpdateHyphenator( Outliner& rOutliner, SdrObject* pObj ) diff --git a/sc/source/ui/drawfunc/graphsh.cxx b/sc/source/ui/drawfunc/graphsh.cxx index 45666e6f6999..6276575cd712 100644 --- a/sc/source/ui/drawfunc/graphsh.cxx +++ b/sc/source/ui/drawfunc/graphsh.cxx @@ -20,6 +20,7 @@ #include <sfx2/app.hxx> #include <sfx2/objface.hxx> #include <sfx2/request.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svl/whiter.hxx> #include <svx/svdograf.hxx> #include <svx/grfflt.hxx> @@ -79,6 +80,7 @@ ScGraphicShell::ScGraphicShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_GRAPHIC); SetName(OUString("GraphicObject")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic)); } ScGraphicShell::~ScGraphicShell() @@ -241,4 +243,5 @@ void ScGraphicShell::ExecuteCompressGraphic( SfxRequest& ) Invalidate(); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/drawfunc/mediash.cxx b/sc/source/ui/drawfunc/mediash.cxx index 79185a965e31..9537f376876d 100644 --- a/sc/source/ui/drawfunc/mediash.cxx +++ b/sc/source/ui/drawfunc/mediash.cxx @@ -25,6 +25,7 @@ #include <svl/whiter.hxx> #include <svx/svdomedia.hxx> #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include "mediash.hxx" #include "sc.hrc" @@ -48,6 +49,7 @@ ScMediaShell::ScMediaShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_MEDIA); SetName( String( ScResId( SCSTR_MEDIASHELL ) ) ); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media)); } ScMediaShell::~ScMediaShell() diff --git a/sc/source/ui/drawfunc/oleobjsh.cxx b/sc/source/ui/drawfunc/oleobjsh.cxx index 6cb1db567ce5..9add3117d3df 100644 --- a/sc/source/ui/drawfunc/oleobjsh.cxx +++ b/sc/source/ui/drawfunc/oleobjsh.cxx @@ -35,6 +35,7 @@ #include "drawview.hxx" #include "scresid.hxx" #include <svx/svdobj.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #define ScOleObjectShell #include "scslots.hxx" @@ -54,12 +55,17 @@ ScOleObjectShell::ScOleObjectShell(ScViewData* pData) : { SetHelpId(HID_SCSHELL_OLEOBEJCTSH); SetName(OUString("OleObject")); + SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OLE)); } ScOleObjectShell::~ScOleObjectShell() { } - +void ScOleObjectShell::HandleSelectionChange (void) +{ + // Do not call the implementation in the base class. Let + // Activate()/Deactivate() handle context switches. +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index 58ac2464246d..bb5cb9a77ef0 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -108,7 +108,10 @@ ScFunctionDockWin::ScFunctionDockWin( SfxBindings* pBindingsP, aTimer.SetTimeout(200); aTimer.SetTimeoutHdl(LINK( this, ScFunctionDockWin, TimerHdl)); - eSfxNewAlignment=GetAlignment(); + if (pCW != NULL) + eSfxNewAlignment=GetAlignment(); + else + eSfxNewAlignment=SFX_ALIGN_RIGHT; eSfxOldAlignment=eSfxNewAlignment; aFiFuncDesc.SetUpdateMode(sal_True); pAllFuncList=&aFuncList; diff --git a/sc/source/ui/inc/chartsh.hxx b/sc/source/ui/inc/chartsh.hxx index 3e2eddfb787b..9a3719af1a96 100644 --- a/sc/source/ui/inc/chartsh.hxx +++ b/sc/source/ui/inc/chartsh.hxx @@ -40,6 +40,8 @@ public: void ExecuteExportAsGraphic(SfxRequest& rReq); void GetExportAsGraphicState(SfxItemSet &rSet); + + virtual void HandleSelectionChange (void); }; #endif diff --git a/sc/source/ui/inc/drawsh.hxx b/sc/source/ui/inc/drawsh.hxx index 307bcac4abbb..d251eee63d77 100644 --- a/sc/source/ui/inc/drawsh.hxx +++ b/sc/source/ui/inc/drawsh.hxx @@ -23,16 +23,22 @@ #include <sfx2/shell.hxx> #include "shellids.hxx" #include <sfx2/module.hxx> +#include <sfx2/sidebar/EnumContext.hxx> #include <svx/svdmark.hxx> #include <tools/link.hxx> +#include <rtl/ref.hxx> class AbstractSvxNameDialog; class ScViewData; class ScDrawView; +namespace svx { namespace sidebar { +class SelectionChangeHandler; +} } class ScDrawShell : public SfxShell { ScViewData* pViewData; + ::rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; DECL_LINK( NameObjectHdl, AbstractSvxNameDialog* ); @@ -75,6 +81,9 @@ public: ScDrawView* GetDrawView(); sal_Bool AreAllObjectsOnLayer(sal_uInt16 nLayerNo,const SdrMarkList& rMark); + + void GetDrawAttrStateForIFBX( SfxItemSet& rSet ); + ::sfx2::sidebar::EnumContext::Context GetContextForSelection (void); }; diff --git a/sc/source/ui/inc/drformsh.hxx b/sc/source/ui/inc/drformsh.hxx index 4947d3ebb6b9..ba72981621b3 100644 --- a/sc/source/ui/inc/drformsh.hxx +++ b/sc/source/ui/inc/drformsh.hxx @@ -39,9 +39,6 @@ public: ScDrawFormShell(ScViewData* pData); virtual ~ScDrawFormShell(); - -// void Execute(SfxRequest &); -// void GetState(SfxItemSet &); }; #endif diff --git a/sc/source/ui/inc/drtxtob.hxx b/sc/source/ui/inc/drtxtob.hxx index ee61c02ba328..4838c64e3072 100644 --- a/sc/source/ui/inc/drtxtob.hxx +++ b/sc/source/ui/inc/drtxtob.hxx @@ -57,8 +57,9 @@ public: void ExecuteAttr( SfxRequest &rReq ); void GetAttrState( SfxItemSet& rSet ); void ExecuteToggle( SfxRequest &rReq ); + void GetStatePropPanelAttr(SfxItemSet &); - sal_Bool ExecuteCharDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet ); + sal_Bool ExecuteCharDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet , sal_uInt16 nSlot); sal_Bool ExecuteParaDlg( const SfxItemSet& rArgs, SfxItemSet& rOutSet ); void ExecuteExtra( SfxRequest &rReq ); diff --git a/sc/source/ui/inc/formatsh.hxx b/sc/source/ui/inc/formatsh.hxx index 975e2ad63597..ccf69ca153b9 100644 --- a/sc/source/ui/inc/formatsh.hxx +++ b/sc/source/ui/inc/formatsh.hxx @@ -67,6 +67,9 @@ public: void ExecFormatPaintbrush( SfxRequest& rReq ); void StateFormatPaintbrush( SfxItemSet& rSet ); + void ExecViewOptions( SfxRequest& rReq ); + void GetViewOptions( SfxItemSet& rSet ); + private: short GetCurrentNumberFormatType(); }; diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index 9eb57004c38c..c62f534c62a9 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -267,6 +267,7 @@ private: SCROW nCurRow; SCTAB nCurTab; sal_Bool bFirstBig; + bool mbUseStyleSettingsBackground; ScNavigatorControllerItem** ppBoundItems; @@ -319,7 +320,8 @@ protected: virtual void Resizing( Size& rSize ); public: - ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent ); + ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent, + const bool bUseStyleSettingsBackground); ~ScNavigatorDlg(); using Window::Notify; diff --git a/sc/source/ui/inc/oleobjsh.hxx b/sc/source/ui/inc/oleobjsh.hxx index 73b1fcc32110..2de3f6882549 100644 --- a/sc/source/ui/inc/oleobjsh.hxx +++ b/sc/source/ui/inc/oleobjsh.hxx @@ -39,6 +39,7 @@ public: ScOleObjectShell(ScViewData* pData); virtual ~ScOleObjectShell(); + virtual void HandleSelectionChange (void); }; #endif diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 5d32ee48dbf7..5c5d7583476e 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -547,7 +547,7 @@ ScNavigatorDialogWrapper::ScNavigatorDialogWrapper( SfxChildWinInfo* /* pInfo */ ) : SfxChildWindowContext( nId ) { - pNavigator = new ScNavigatorDlg( pBind, this, pParent ); + pNavigator = new ScNavigatorDlg( pBind, this, pParent, true ); SetWindow( pNavigator ); // Einstellungen muessen anderswo gemerkt werden, @@ -615,7 +615,8 @@ void ScNavigatorDialogWrapper::Resizing( Size& rSize ) #define REGISTER_SLOT(i,id) \ ppBoundItems[i]=new ScNavigatorControllerItem(id,*this,rBindings); -ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent ) : +ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Window* pParent, + const bool bUseStyleSettingsBackground) : Window( pParent, ScResId(RID_SCDLG_NAVIGATOR) ), rBindings ( *pB ), // is used in CommandToolBox ctor aCmdImageList( ScResId( IL_CMD ) ), @@ -640,7 +641,8 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Win nCurCol ( 0 ), nCurRow ( 0 ), nCurTab ( 0 ), - bFirstBig ( false ) + bFirstBig ( false ), + mbUseStyleSettingsBackground(bUseStyleSettingsBackground) { ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); nDropMode = rCfg.GetDragMode(); @@ -725,6 +727,16 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Win aLbEntries.SetAccessibleRelationLabeledBy(&aLbEntries); aTbxCmd.SetAccessibleRelationLabeledBy(&aTbxCmd); aLbDocuments.SetAccessibleName(aStrActiveWin); + + if (pContextWin == NULL) + { + // When the context window is missing then the navigator is + // displayed in the sidebar and has the whole deck to fill. + // Therefore hide the button that hides all controls below the + // top two rows of buttons. + aTbxCmd.Select(IID_ZOOMOUT); + aTbxCmd.RemoveItem(aTbxCmd.GetItemPos(IID_ZOOMOUT)); + } } //------------------------------------------------------------------------ @@ -748,7 +760,7 @@ ScNavigatorDlg::~ScNavigatorDlg() void ScNavigatorDlg::Resizing( Size& rNewSize ) // Size = Outputsize? { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL; if ( pFloat ) { Size aMinOut = pFloat->GetMinOutputSizePixel(); @@ -770,13 +782,21 @@ void ScNavigatorDlg::Resizing( Size& rNewSize ) // Size = Outputsize? void ScNavigatorDlg::Paint( const Rectangle& rRect ) { - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - Color aBgColor = rStyleSettings.GetFaceColor(); - Wallpaper aBack( aBgColor ); + if (mbUseStyleSettingsBackground) + { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + Color aBgColor = rStyleSettings.GetFaceColor(); + Wallpaper aBack( aBgColor ); - SetBackground( aBack ); - aFtCol.SetBackground( aBack ); - aFtRow.SetBackground( aBack ); + SetBackground( aBack ); + aFtCol.SetBackground( aBack ); + aFtRow.SetBackground( aBack ); + } + else + { + aFtCol.SetBackground(Wallpaper()); + aFtRow.SetBackground(Wallpaper()); + } Window::Paint( rRect ); } @@ -850,9 +870,12 @@ void ScNavigatorDlg::DoResize() aLbDocuments.SetSizePixel( aDocSize ); sal_Bool bListMode = (eListMode != NAV_LMODE_NONE); - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); - if ( pFloat && bListMode ) - nListModeHeight = nTotalHeight; + if (pContextWin != NULL) + { + FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + if ( pFloat && bListMode ) + nListModeHeight = nTotalHeight; + } } //------------------------------------------------------------------------ @@ -1183,7 +1206,7 @@ void ScNavigatorDlg::SetListMode( NavListMode eMode, sal_Bool bSetSize ) void ScNavigatorDlg::ShowList( sal_Bool bShow, sal_Bool bSetSize ) { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL; Size aSize = GetParent()->GetOutputSizePixel(); if ( bShow ) @@ -1217,10 +1240,13 @@ void ScNavigatorDlg::ShowList( sal_Bool bShow, sal_Bool bSetSize ) } else { - SfxNavigator* pNav = (SfxNavigator*)GetParent(); - Size aFloating = pNav->GetFloatingSize(); - aFloating.Height() = aSize.Height(); - pNav->SetFloatingSize( aFloating ); + SfxNavigator* pNav = dynamic_cast<SfxNavigator*>(GetParent()); + if (pNav != NULL) + { + Size aFloating = pNav->GetFloatingSize(); + aFloating.Height() = aSize.Height(); + pNav->SetFloatingSize( aFloating ); + } } } @@ -1228,7 +1254,7 @@ void ScNavigatorDlg::ShowList( sal_Bool bShow, sal_Bool bSetSize ) void ScNavigatorDlg::ShowScenarios( sal_Bool bShow, sal_Bool bSetSize ) { - FloatingWindow* pFloat = pContextWin->GetFloatingWindow(); + FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL; Size aSize = GetParent()->GetOutputSizePixel(); if ( bShow ) diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx new file mode 100644 index 000000000000..3fb7bb278bb8 --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -0,0 +1,632 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <AlignmentPropertyPanel.hxx> +#include <AlignmentPropertyPanel.hrc> +#include <editeng/justifyitem.hxx> +#include <svx/dialmgr.hxx> +#include "sc.hrc" +#include "scresid.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <svx/algitem.hxx> +#include <svx/dlgutil.hxx> +#include <vcl/toolbox.hxx> +#include <svx/sidebar/SidebarDialControl.hxx> + +using namespace css; +using namespace cssu; +using ::sfx2::sidebar::ControlFactory; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace sc { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +AlignmentPropertyPanel::AlignmentPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) + : Control( + pParent, + ScResId(RID_PROPERTYPANEL_SC_ALIGNMENT)), + mpTBHorizontalBackground(ControlFactory::CreateToolBoxBackground(this)), + mpTBHorizontal(ControlFactory::CreateToolBox( + mpTBHorizontalBackground.get(), + ScResId(TBX_HORIZONTAL_ALIGNMENT))), + mpTBVerticalBackground(ControlFactory::CreateToolBoxBackground(this)), + mpTBVertical(ControlFactory::CreateToolBox( + mpTBVerticalBackground.get(), + ScResId(TBX_VERTICAL_ALIGN))), + mpFTLeftIndent(new FixedText(this, ScResId(FT_LEFT_INDENT))), + mpMFLeftIndent(new MetricField(this, ScResId(MF_LEFT_INDENT))), + mpCBXWrapText(new CheckBox(this, ScResId(CBX_WRAP))), + mpCBXMergeCell(new CheckBox(this, ScResId(CBX_MERGE))), + mpFtRotate(new FixedText(this, ScResId(FT_ORIENT))), + mpCtrlDial(new svx::sidebar::SidebarDialControl(this, ScResId(DIAL_CONTROL))), // , true)), + mpMtrAngle(new MetricBox(this, ScResId(CBOX_ANGLE))), + mpCbStacked(new CheckBox(this, ScResId(CBX_VERT))), + maAlignHorControl(SID_H_ALIGNCELL, *pBindings, *this), + maAlignVerControl(SID_V_ALIGNCELL, *pBindings, *this), + maLeftIndentControl(SID_ATTR_ALIGN_INDENT, *pBindings, *this), + maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this), + maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this), + maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this), + maStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this), + maIMGAlignLeft(ScResId(IMG_ALIGN_LEFT)), + maIMGAlignCenter(ScResId(IMG_ALIGN_CENTER)), + maIMGAlignRight(ScResId(IMG_ALIGN_RIGHT)), + maIMGAlignJust(ScResId(IMG_ALIGN_JUST)), + maIMGAlignTop(ScResId(IMG_ALIGN_TOP)), + maIMGAlignCenterV(ScResId(IMG_ALIGN_CENTER_V)), + maIMGAlignBottom(ScResId(IMG_ALIGN_BOTTOM)), + meHorAlignState(SVX_HOR_JUSTIFY_STANDARD), + meVerAlignState(SVX_VER_JUSTIFY_STANDARD), + mbMultiDisable(false), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); + + mpFTLeftIndent->SetBackground(Wallpaper()); + mpFtRotate->SetBackground(Wallpaper()); +} + +////////////////////////////////////////////////////////////////////////////// + +AlignmentPropertyPanel::~AlignmentPropertyPanel() +{ +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::Initialize() +{ + mpTBHorizontal->SetItemImage(ID_SUBSTLEFT, maIMGAlignLeft); + mpTBHorizontal->SetItemImage(ID_SUBSTCENTER, maIMGAlignCenter); + mpTBHorizontal->SetItemImage(ID_SUBSTRIGHT, maIMGAlignRight); + mpTBHorizontal->SetItemImage(ID_SUBSTJUSTIFY, maIMGAlignJust); + Size aTbxSize( mpTBHorizontal->CalcWindowSizePixel() ); + mpTBHorizontal->SetOutputSizePixel( aTbxSize ); + mpTBHorizontal->SetBackground(Wallpaper()); + mpTBHorizontal->SetPaintTransparent(true); + Link aLink = LINK(this, AlignmentPropertyPanel, TbxHorAlignSelectHdl); + mpTBHorizontal->SetSelectHdl ( aLink ); + + mpTBVertical->SetItemImage(IID_VERT_TOP, maIMGAlignTop); + mpTBVertical->SetItemImage(IID_VERT_CENTER, maIMGAlignCenterV); + mpTBVertical->SetItemImage(IID_VERT_BOTTOM, maIMGAlignBottom); + Size aTbxSize2( mpTBVertical->CalcWindowSizePixel() ); + mpTBVertical->SetOutputSizePixel( aTbxSize2 ); + mpTBVertical->SetBackground(Wallpaper()); + mpTBVertical->SetPaintTransparent(true); + aLink = LINK(this, AlignmentPropertyPanel, TbxVerAlignSelectHdl); + mpTBVertical->SetSelectHdl ( aLink ); + + mpFTLeftIndent->Disable(); + mpMFLeftIndent->Disable(); + mpMFLeftIndent->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left Indent"))); //wj acc + aLink = LINK(this, AlignmentPropertyPanel, MFLeftIndentMdyHdl); + mpMFLeftIndent->SetModifyHdl ( aLink ); + + aLink = LINK(this, AlignmentPropertyPanel, CBOXMergnCellClkHdl); + mpCBXMergeCell->SetClickHdl ( aLink ); + + aLink = LINK(this, AlignmentPropertyPanel, CBOXWrapTextClkHdl); + mpCBXWrapText->SetClickHdl ( aLink ); + + //rotation control + mpCtrlDial->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc + mpCtrlDial->SetModifyHdl(LINK( this, AlignmentPropertyPanel, RotationHdl)); + + //rotation + mpMtrAngle->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text Orientation"))); //wj acc + mpMtrAngle->SetModifyHdl(LINK( this, AlignmentPropertyPanel, AngleModifiedHdl)); + mpMtrAngle->EnableAutocomplete( false ); + + //Vertical stacked + mpCbStacked->SetClickHdl( LINK( this, AlignmentPropertyPanel, ClickStackHdl ) ); + + mpMtrAngle->InsertValue(0, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(45, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(90, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(135, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(180, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(225, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(270, FUNIT_CUSTOM); + mpMtrAngle->InsertValue(315, FUNIT_CUSTOM); + mpMtrAngle->SetDropDownLineCount(mpMtrAngle->GetEntryCount()); + + mpTBHorizontal->SetAccessibleRelationLabeledBy(mpTBHorizontal.get()); + mpTBVertical->SetAccessibleRelationLabeledBy(mpTBVertical.get()); + mpMFLeftIndent->SetAccessibleRelationLabeledBy(mpFTLeftIndent.get()); + mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate.get()); +#ifdef HAS_IA2 + mpMtrAngle->SetMpSubEditAccLableBy(mpFtRotate.get()); +#endif +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( AlignmentPropertyPanel, AngleModifiedHdl, void *, EMPTYARG ) +{ + OUString sTmp = mpMtrAngle->GetText(); + + sal_Unicode nChar = sTmp.isEmpty() ? 0 : sTmp[0]; + if((sTmp.getLength()== 1 && nChar == '-') || + (nChar != '-' && ((nChar < '0') || (nChar > '9') ) )) ////modify + return 0; + + double dTmp = sTmp.toDouble(); + FormatDegrees(dTmp); + + sal_Int64 nTmp = (sal_Int64)dTmp*100; + SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L ); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( AlignmentPropertyPanel, RotationHdl, void *, EMPTYARG ) +{ + sal_Int32 nTmp = mpCtrlDial->GetRotation(); + SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp); + + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_ALIGN_DEGREES, SFX_CALLMODE_RECORD, &aAngleItem, 0L ); + + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( AlignmentPropertyPanel, ClickStackHdl, void *, EMPTYARG ) +{ + bool bVertical = mpCbStacked->IsChecked() ? true : false; + SfxBoolItem aStackItem( SID_ATTR_ALIGN_STACKED, bVertical ); + GetBindings()->GetDispatcher()->Execute( + SID_ATTR_ALIGN_STACKED, SFX_CALLMODE_RECORD, &aStackItem, 0L ); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, TbxHorAlignSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if(nId == ID_SUBSTLEFT) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_LEFT) + meHorAlignState = SVX_HOR_JUSTIFY_LEFT; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + else if( nId == ID_SUBSTCENTER ) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_CENTER) + meHorAlignState = SVX_HOR_JUSTIFY_CENTER; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + else if( nId == ID_SUBSTRIGHT ) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_RIGHT) + meHorAlignState = SVX_HOR_JUSTIFY_RIGHT; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + else if( nId == ID_SUBSTJUSTIFY ) + { + if(meHorAlignState != SVX_HOR_JUSTIFY_BLOCK) + meHorAlignState = SVX_HOR_JUSTIFY_BLOCK; + else + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + SvxHorJustifyItem aHorItem(meHorAlignState, SID_H_ALIGNCELL); + GetBindings()->GetDispatcher()->Execute(SID_H_ALIGNCELL, SFX_CALLMODE_RECORD, &aHorItem, 0L); + UpdateHorAlign(); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, TbxVerAlignSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + //Bold + if(nId == IID_VERT_TOP) + { + if(meVerAlignState != SVX_VER_JUSTIFY_TOP) + meVerAlignState = SVX_VER_JUSTIFY_TOP; + else + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + else if( nId == IID_VERT_CENTER ) + { + if(meVerAlignState != SVX_VER_JUSTIFY_CENTER) + meVerAlignState = SVX_VER_JUSTIFY_CENTER; + else + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + else if( nId == IID_VERT_BOTTOM ) + { + if(meVerAlignState != SVX_VER_JUSTIFY_BOTTOM) + meVerAlignState = SVX_VER_JUSTIFY_BOTTOM; + else + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + SvxVerJustifyItem aVerItem(meVerAlignState, SID_V_ALIGNCELL); + GetBindings()->GetDispatcher()->Execute(SID_V_ALIGNCELL, SFX_CALLMODE_RECORD, &aVerItem, 0L); + UpdateVerAlign(); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, MFLeftIndentMdyHdl, void*, EMPTYARG) +{ + mpCBXWrapText->EnableTriState(false); + sal_uInt16 nVal = (sal_uInt16)mpMFLeftIndent->GetValue(); + SfxUInt16Item aItem( SID_ATTR_ALIGN_INDENT, (sal_uInt16)CalcToUnit( nVal, SFX_MAPUNIT_TWIP ) ); + + GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_INDENT, SFX_CALLMODE_RECORD, &aItem, 0L); + return( 0L ); +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, CBOXMergnCellClkHdl, void*, EMPTYARG) +{ + bool bState = mpCBXMergeCell->IsChecked(); + + //Modified + //SfxBoolItem aItem( FID_MERGE_TOGGLE , bState); + //GetBindings()->GetDispatcher()->Execute(FID_MERGE_TOGGLE, SFX_CALLMODE_RECORD, &aItem, false, 0L); + if(bState) + GetBindings()->GetDispatcher()->Execute(FID_MERGE_ON, SFX_CALLMODE_RECORD); + else + GetBindings()->GetDispatcher()->Execute(FID_MERGE_OFF, SFX_CALLMODE_RECORD); + GetBindings()->Invalidate(FID_MERGE_TOGGLE,true,false); + //modified end + + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(AlignmentPropertyPanel, CBOXWrapTextClkHdl, void*, EMPTYARG) +{ + bool bState = mpCBXWrapText->IsChecked(); + SfxBoolItem aItem( SID_ATTR_ALIGN_LINEBREAK , bState); + GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_LINEBREAK, SFX_CALLMODE_RECORD, &aItem, 0L); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +AlignmentPropertyPanel* AlignmentPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to AlignmentPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to AlignmentPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to AlignmentPropertyPanel::Create"), NULL, 2); + + return new AlignmentPropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + + + // todo +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_H_ALIGNCELL: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxHorJustifyItem) ) + { + const SvxHorJustifyItem* pItem = (const SvxHorJustifyItem*)pState; + meHorAlignState = (SvxCellHorJustify)pItem->GetValue(); + } + else + { + meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + } + UpdateHorAlign(); + break; + case SID_V_ALIGNCELL: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxVerJustifyItem) ) + { + const SvxVerJustifyItem* pItem = (const SvxVerJustifyItem*)pState; + meVerAlignState = (SvxCellVerJustify)pItem->GetValue(); + } + else + { + meVerAlignState = SVX_VER_JUSTIFY_STANDARD; + } + UpdateVerAlign(); + break; + case SID_ATTR_ALIGN_INDENT: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxUInt16Item) ) + { + const SfxUInt16Item* pItem = (const SfxUInt16Item*)pState; + sal_uInt16 nVal = pItem->GetValue(); + mpMFLeftIndent->SetValue( CalcToPoint(nVal, SFX_MAPUNIT_TWIP, 1) ); + } + else + { + mpMFLeftIndent->SetValue(0); + mpMFLeftIndent->SetText(String()); + } + break; + case FID_MERGE_TOGGLE: + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) + { + mpCBXMergeCell->Enable(); + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + bool bVal = pItem->GetValue(); + if(bVal) + mpCBXMergeCell->Check(true); + else + mpCBXMergeCell->Check(false); + } + else + { + mpCBXMergeCell->Check(false); + mpCBXMergeCell->Disable(); + } + break; + + case SID_ATTR_ALIGN_LINEBREAK: + if(eState == SFX_ITEM_DISABLED) + { + mpCBXWrapText->EnableTriState(false); + mpCBXWrapText->Check(false); + mpCBXWrapText->Disable(); + } + else + { + mpCBXWrapText->Enable(); + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SfxBoolItem) ) + { + mpCBXWrapText->EnableTriState(false); + const SfxBoolItem* pItem = (const SfxBoolItem*)pState; + bool bVal = pItem->GetValue(); + if(bVal) + mpCBXWrapText->Check(true); + else + mpCBXWrapText->Check(false); + } + else if(eState == SFX_ITEM_DONTCARE) + { + mpCBXWrapText->EnableTriState(true); + mpCBXWrapText->SetState(STATE_DONTKNOW); + } + } + break; + case SID_ATTR_ALIGN_DEGREES: + if (eState >= SFX_ITEM_AVAILABLE) + { + long nTmp = ((const SfxInt32Item*)pState)->GetValue(); + mpMtrAngle->SetValue( nTmp / 100); //wj + mpCtrlDial->SetRotation( nTmp ); + switch(nTmp) + { + case 0: + mpMtrAngle->SelectEntryPos(0); + break; + case 4500: + mpMtrAngle->SelectEntryPos(1); + break; + case 9000: + mpMtrAngle->SelectEntryPos(2); + break; + case 13500: + mpMtrAngle->SelectEntryPos(3); + break; + case 18000: + mpMtrAngle->SelectEntryPos(4); + break; + case 22500: + mpMtrAngle->SelectEntryPos(5); + break; + case 27000: + mpMtrAngle->SelectEntryPos(6); + break; + case 31500: + mpMtrAngle->SelectEntryPos(7); + } + } + else + { + mpMtrAngle->SetText( String() ); + mpCtrlDial->SetRotation( 0 ); + } + break; + case SID_ATTR_ALIGN_STACKED: + if (eState >= SFX_ITEM_AVAILABLE) + { + mpCbStacked->EnableTriState(false); + const SfxBoolItem* aStackItem = (const SfxBoolItem*)pState; + bool IsChecked = (bool)aStackItem->GetValue(); + if(IsChecked) + { + mpCbStacked->Check(IsChecked); + mpFtRotate->Disable(); + mpMtrAngle->Disable(); + mpCtrlDial->Disable(); + mbMultiDisable = true; + } + else + { + mpCbStacked->Check(IsChecked); + mpFtRotate->Enable(); + mpMtrAngle->Enable(); + mpCtrlDial->Enable(); + mbMultiDisable = false; + } + } + else + { + mbMultiDisable = true; + mpFtRotate->Disable(); + mpMtrAngle->Disable(); + mpCtrlDial->Disable(); + mpCbStacked->EnableTriState(true); + mpCbStacked->SetState(STATE_DONTKNOW); + } + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* AlignmentPropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::FormatDegrees(double& dTmp) +{ + while(dTmp<0) + dTmp += 360; + while (dTmp > 359) //modify + dTmp = 359; +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::UpdateHorAlign() +{ + mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_NOCHECK); + mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_NOCHECK); + mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_NOCHECK); + mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_NOCHECK); + mpFTLeftIndent->Disable(); + mpMFLeftIndent->Disable(); + if(meHorAlignState==SVX_HOR_JUSTIFY_REPEAT) + { + mpFtRotate->Disable(); + mpCtrlDial->Disable(); + mpMtrAngle->Disable(); + mpCbStacked->Disable(); + } + else + { + if(!mbMultiDisable) + { + mpFtRotate->Enable(); + mpCtrlDial->Enable(); + mpMtrAngle->Enable(); + } + else + { + mpFtRotate->Disable(); + mpCtrlDial->Disable(); + mpMtrAngle->Disable(); + } + mpCbStacked->Enable(); + } + switch(meHorAlignState) + { + case SVX_HOR_JUSTIFY_LEFT: + mpTBHorizontal->SetItemState(ID_SUBSTLEFT, STATE_CHECK); + mpFTLeftIndent->Enable(); + mpMFLeftIndent->Enable(); + break; + case SVX_HOR_JUSTIFY_CENTER:mpTBHorizontal->SetItemState(ID_SUBSTCENTER, STATE_CHECK);break; + case SVX_HOR_JUSTIFY_RIGHT: mpTBHorizontal->SetItemState(ID_SUBSTRIGHT, STATE_CHECK);break; + case SVX_HOR_JUSTIFY_BLOCK: mpTBHorizontal->SetItemState(ID_SUBSTJUSTIFY,STATE_CHECK);break; + default:; + } +} + +////////////////////////////////////////////////////////////////////////////// + +void AlignmentPropertyPanel::UpdateVerAlign() +{ + mpTBVertical->SetItemState(IID_VERT_TOP, STATE_NOCHECK); + mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_NOCHECK); + mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_NOCHECK); + + switch(meVerAlignState) + { + case SVX_VER_JUSTIFY_TOP: mpTBVertical->SetItemState(IID_VERT_TOP, STATE_CHECK);break; + case SVX_VER_JUSTIFY_CENTER:mpTBVertical->SetItemState(IID_VERT_CENTER, STATE_CHECK);break; + case SVX_VER_JUSTIFY_BOTTOM: mpTBVertical->SetItemState(IID_VERT_BOTTOM, STATE_CHECK);break; + default:; + } +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc b/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc new file mode 100644 index 000000000000..96b795f06fac --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hrc @@ -0,0 +1,84 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +// RID_PROPERTYPANEL_SC_ALIGNMENT-------------------------------------------------------------- +#define FT_ORIENT 1 +#define CBX_WRAP 5 +#define FT_LEFT_INDENT 7 +#define MF_LEFT_INDENT 8 +#define CBX_MERGE 9 +#define CBX_VERT 10 +#define CTL_SBSHAPE_POSREFERENCE 12 +#define CBOX_ANGLE 14 +#define TBX_HORIZONTAL_ALIGNMENT 15 +#define TBX_VERTICAL_ALIGN 16 +#define DIAL_CONTROL 17 +#define ID_SUBSTLEFT 20 +#define ID_SUBSTCENTER 21 +#define ID_SUBSTRIGHT 22 +#define ID_SUBSTJUSTIFY 23 +#define IID_VERT_TOP 24 +#define IID_VERT_CENTER 25 +#define IID_VERT_BOTTOM 26 + +#define MBOX_WIDTH 45 +#define TEXT_WIDTH 40 +#define FLIP_BUTTON_SIZE 13 +#define ALIGNMENT_TBX_HEIGHT 17 +#define ALIGNMENT_TBX_WIDTH 13 + +#define IMG_ALIGN_LEFT 50 +#define IMG_ALIGN_CENTER 51 +#define IMG_ALIGN_RIGHT 52 +#define IMG_ALIGN_JUST 53 +#define IMG_ALIGN_TOP 54 +#define IMG_ALIGN_CENTER_V 55 +#define IMG_ALIGN_BOTTOM 56 + +//---------------position----------------- + +#define ALIGNMENT_X SECTIONPAGE_MARGIN_HORIZONTAL +#define ALIGNMENT_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define ALIGNMENT_VERT_X (ALIGNMENT_X + TBX_OUT_BORDER_OFFSET_X*2 + TOOLBOX_ITEM_WIDTH * 4 + CONTROL_SPACING_HORIZONTAL) +#define ALIGNMENT_VERT_Y ALIGNMENT_Y + +#define FT_LEFTINDENT_X ALIGNMENT_X +#define FT_LEFTINDENT_Y (ALIGNMENT_Y + TOOLBOX_ITEM_HEIGHT + TBX_OUT_BORDER_OFFSET_Y + CONTROL_SPACING_VERTICAL) +#define MTR_LEFTINDENT_X ALIGNMENT_X +#define MTR_LEFTINDENT_Y (FT_LEFTINDENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) + +#define CBX_WRAP_X (ALIGNMENT_X + TEXT_WIDTH + 10 + CONTROL_SPACING_HORIZONTAL) +#define CBX_WRAP_Y (FT_LEFTINDENT_Y + 2) + +#define CBX_MERGE_X CBX_WRAP_X +#define CBX_MERGE_Y CBX_WRAP_Y + CBOX_HEIGHT + 2 + +#define FT_ORIENT_X ALIGNMENT_X +#define FT_ORIENT_Y MTR_LEFTINDENT_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define COMOBX_ROTATION_X FT_ORIENT_X + 30 + CONTROL_SPACING_HORIZONTAL +#define COMOBX_ROTATION_Y FT_ORIENT_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + 5 + +#define ROTATE_CONTROL_X FT_ORIENT_X +#define ROTATE_CONTROL_Y COMOBX_ROTATION_Y - 3 + +#define CBX_VERT_X COMOBX_ROTATION_X +#define CBX_VERT_Y COMOBX_ROTATION_Y + CBOX_HEIGHT + CONTROL_SPACING_VERTICAL + 2 + +#define PANEL_HEIGHT CBX_VERT_Y + 6 + SECTIONPAGE_MARGIN_VERTICAL_BOT + +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx new file mode 100644 index 000000000000..07d3e06540b0 --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx @@ -0,0 +1,126 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_PROPERTYPANEL_ALIGNMENT_HXX +#define SC_PROPERTYPANEL_ALIGNMENT_HXX + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <vcl/fixed.hxx> +#include <boost/scoped_ptr.hpp> +#include <editeng/svxenum.hxx> + +class ToolBox; +class MetricField; +class MetricBox; +class CheckBox; +namespace svx { namespace sidebar { class SidebarDialControl; }} + +namespace sc { namespace sidebar { + +class AlignmentPropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + static AlignmentPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr<Window> mpTBHorizontalBackground; + ::boost::scoped_ptr< ToolBox > mpTBHorizontal; + ::boost::scoped_ptr<Window> mpTBVerticalBackground; + ::boost::scoped_ptr< ToolBox > mpTBVertical; + ::boost::scoped_ptr< FixedText > mpFTLeftIndent; + ::boost::scoped_ptr< MetricField > mpMFLeftIndent; + ::boost::scoped_ptr< CheckBox > mpCBXWrapText; + ::boost::scoped_ptr< CheckBox > mpCBXMergeCell; + ::boost::scoped_ptr< FixedText > mpFtRotate; + ::boost::scoped_ptr< svx::sidebar::SidebarDialControl > mpCtrlDial; + ::boost::scoped_ptr< MetricBox > mpMtrAngle; + ::boost::scoped_ptr< CheckBox > mpCbStacked; + + ::sfx2::sidebar::ControllerItem maAlignHorControl; + ::sfx2::sidebar::ControllerItem maAlignVerControl; + ::sfx2::sidebar::ControllerItem maLeftIndentControl; + ::sfx2::sidebar::ControllerItem maMergeCellControl; + ::sfx2::sidebar::ControllerItem maWrapTextControl; + ::sfx2::sidebar::ControllerItem maAngleControl; + ::sfx2::sidebar::ControllerItem maStackControl; + + Image maIMGAlignLeft; + Image maIMGAlignCenter; + Image maIMGAlignRight; + Image maIMGAlignJust; + Image maIMGAlignTop; + Image maIMGAlignCenterV; + Image maIMGAlignBottom; + + SvxCellHorJustify meHorAlignState; + SvxCellVerJustify meVerAlignState; + + /// bitfield + bool mbMultiDisable : 1; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + DECL_LINK( TbxHorAlignSelectHdl, ToolBox* ); + DECL_LINK( TbxVerAlignSelectHdl, ToolBox* ); + DECL_LINK( MFLeftIndentMdyHdl, void * ); + DECL_LINK( CBOXMergnCellClkHdl, void * ); + DECL_LINK( CBOXWrapTextClkHdl, void * ); + DECL_LINK( AngleModifiedHdl, void * ); + DECL_LINK( RotationHdl, void * ); + DECL_LINK( ClickStackHdl, void * ); + + // constructor/destuctor + AlignmentPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~AlignmentPropertyPanel(); + + void Initialize(); + void UpdateHorAlign(); + void UpdateVerAlign(); + void FormatDegrees(double& dTmp); +}; + +} } // end of namespace ::sc::sidebar + +#endif +// eof diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.src b/sc/source/ui/sidebar/AlignmentPropertyPanel.src new file mode 100644 index 000000000000..5a5501295524 --- /dev/null +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.src @@ -0,0 +1,213 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "AlignmentPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "sc.hrc" +#include "helpids.h" + +Control RID_PROPERTYPANEL_SC_ALIGNMENT +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PANEL_HEIGHT ); + HelpID = HID_PROPERTYPANEL_SC_ALIGN_SECTION; + Text [ en-US ] = "Alignment"; + + //------------ Alignment ------------- + ToolBox TBX_HORIZONTAL_ALIGNMENT + { + Pos = MAP_APPFONT ( ALIGNMENT_X , ALIGNMENT_Y ); + Size = MAP_APPFONT ( ALIGNMENT_TBX_WIDTH*4 ,ALIGNMENT_TBX_HEIGHT); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_HOR; + Text [ en-US ] = "Horizontal Alignment" ; + ItemList = + { + ToolBoxItem + { + Identifier = ID_SUBSTLEFT ; + Text [ en-US ] = "Align Left" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_L; + }; + ToolBoxItem + { + Identifier = ID_SUBSTCENTER ; + Text [ en-US ] = "Align Center" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_C; + }; + ToolBoxItem + { + Identifier = ID_SUBSTRIGHT ; + Text [ en-US ] = "Align Right" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_R; + }; + ToolBoxItem + { + Identifier = ID_SUBSTJUSTIFY ; + Text [ en-US ] = "Align Justified" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_HOR_J; + }; + }; + }; + ToolBox TBX_VERTICAL_ALIGN + { + SVLook = TRUE ; + Border = FALSE ; + Pos = MAP_APPFONT ( ALIGNMENT_VERT_X, ALIGNMENT_VERT_Y ) ; + Size = MAP_APPFONT ( TOOLBOX_ITEM_WIDTH * 3 , TOOLBOX_ITEM_HEIGHT) ; + TabStop = TRUE ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBX_VER; + Text [ en-US ] = "Vertical Alignment" ; + ItemList = + { + ToolBoxItem + { + Identifier = IID_VERT_TOP ; + Text [ en-US ] = "Align Top" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_T; + }; + + ToolBoxItem + { + Identifier = IID_VERT_CENTER ; + Text [ en-US ] = "Align Center Vertically" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_C; + }; + + ToolBoxItem + { + Identifier = IID_VERT_BOTTOM ; + Text [ en-US ] = "Align Bottom" ; + HelpID = HID_PROPERTY_PANEL_ALIGN_TBI_VER_B; + }; + }; + }; + //------------ Left indent ------------ + FixedText FT_LEFT_INDENT + { + Pos = MAP_APPFONT ( FT_LEFTINDENT_X, FT_LEFTINDENT_Y ); + Size = MAP_APPFONT (CBX_WRAP_X - FT_LEFTINDENT_X - 1 , TEXT_HEIGHT) ; //MBOX_WIDTH + Text [ en-US ] = "Left ~indent:"; + }; + MetricField MF_LEFT_INDENT + { + Border = TRUE; + Pos = MAP_APPFONT ( MTR_LEFTINDENT_X , MTR_LEFTINDENT_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH, MBOX_HEIGHT ) ; + TabStop = TRUE; + Repeat = TRUE; + Spin = TRUE; + Minimum = 0; + Maximum = 990; + Unit = FUNIT_POINT; + SpinSize = 10; + QuickHelpText [ en-US ] = "Indents from the left edge."; + HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_INDENT; + }; + CheckBox CBX_WRAP + { + Pos = MAP_APPFONT ( CBX_WRAP_X , CBX_WRAP_Y ) ; + Size = MAP_APPFONT (PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;// + TabStop = TRUE ; + Text [ en-US ] = "~Wrap text" ; + QuickHelpText [ en-US ] = "Wrap texts automatically."; + HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_WRAP; + }; + CheckBox CBX_MERGE + { + Pos = MAP_APPFONT ( CBX_MERGE_X , CBX_MERGE_Y ) ; + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - CBX_WRAP_X - 1 , CBOX_HEIGHT ) ;// + TabStop = TRUE ; + Text [ en-US ] = "~Merge cells" ; + QuickHelpText [ en-US ] = "Joins the selected cells into one."; + HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_MERGE; + }; + //------------ Text orientation ------------ + FixedText FT_ORIENT + { + Pos = MAP_APPFONT ( FT_ORIENT_X, FT_ORIENT_Y ); + Size = MAP_APPFONT ( TEXT_WIDTH + 50, TEXT_HEIGHT) ; + Text [ en-US ] = "Text ~orientation:"; + }; + MetricBox CBOX_ANGLE + { + Border = TRUE ; + Pos = MAP_APPFONT ( COMOBX_ROTATION_X , COMOBX_ROTATION_Y ); + Size = MAP_APPFONT ( MBOX_WIDTH + 20, MBOX_HEIGHT ) ; + Unit = FUNIT_CUSTOM ; + CustomUnitText [ en-US ] = " degrees"; + DecimalDigits = 0; + Minimum = 0; + Maximum = 359; + TabStop = TRUE ; + DropDown = TRUE ; + QuickHelpText [ en-US ] = "Select the angle for rotation."; + HelpID = HID_PROPERTY_PANEL_ALIGN_MBX_ANGLE; + }; + + Control DIAL_CONTROL + { + Pos = MAP_APPFONT ( ROTATE_CONTROL_X , ROTATE_CONTROL_Y ); + Size = MAP_PIXEL( 50, 50 ); + HelpID = HID_PROPERTY_PANEL_ALIGN_DIAL_CONTROL; + QuickHelpText [ en-US ] = "Drag to change the rotation value."; + }; + CheckBox CBX_VERT + { + Pos = MAP_APPFONT ( CBX_VERT_X , CBX_VERT_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH + 20 , CBOX_HEIGHT + 5 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Vertically stacked" ; + QuickHelpText [ en-US ] = "Aligns text vertically."; + HelpID = HID_PROPERTY_PANEL_ALIGN_CBX_VERT; + }; + + Image IMG_ALIGN_LEFT + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignleft.png";}; + }; + Image IMG_ALIGN_CENTER + { + ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter.png";}; + }; + Image IMG_ALIGN_RIGHT + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignright.png";}; + }; + Image IMG_ALIGN_JUST + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignjust.png";}; + }; + Image IMG_ALIGN_TOP + { + ImageBitmap = Bitmap{File = "sidebar/sc_aligntop.png";}; + }; + Image IMG_ALIGN_CENTER_V + { + ImageBitmap = Bitmap{File = "sidebar/sc_aligncenter_v.png";}; + }; + Image IMG_ALIGN_BOTTOM + { + ImageBitmap = Bitmap{File = "sidebar/sc_alignbottom.png";}; + }; +}; + +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx new file mode 100644 index 000000000000..fe48df6ccf03 --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx @@ -0,0 +1,865 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <CellAppearancePropertyPanel.hrc> +#include "sc.hrc" +#include "scresid.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/fixed.hxx> +#include <svx/tbxcolorupdate.hxx> +#include <svl/eitem.hxx> +#include <editeng/borderline.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/lineitem.hxx> +#include <vcl/svapp.hxx> +#include <svx/sidebar/ColorControl.hxx> +#include <boost/bind.hpp> +#include <svx/sidebar/PopupContainer.hxx> +#include <CellLineStyleControl.hxx> +#include <CellLineStylePopup.hxx> +#include <CellBorderUpdater.hxx> +#include <CellBorderStyleControl.hxx> +#include <CellBorderStylePopup.hxx> + +using namespace css; +using namespace cssu; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// helpers + +namespace +{ + Color GetTransparentColor(void) + { + return COL_TRANSPARENT; + } +} // end of anonymous namespace + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace sc { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent) +{ + const ScResId aResId(VS_NOFILLCOLOR); + + return new svx::sidebar::ColorControl( + pParent, + mpBindings, + ScResId(RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR), + ScResId(VS_FILLCOLOR), + ::boost::bind(GetTransparentColor), + ::boost::bind(&CellAppearancePropertyPanel::SetFillColor, this, _1, _2), + pParent, + &aResId); +} + +void CellAppearancePropertyPanel::SetFillColor( + const String& /*rsColorName*/, + const Color aColor) +{ + const SvxColorItem aColorItem(aColor, SID_BACKGROUND_COLOR); + mpBindings->GetDispatcher()->Execute(SID_BACKGROUND_COLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maBackColor = aColor; +} + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent) +{ + return new svx::sidebar::ColorControl( + pParent, + mpBindings, + ScResId(RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR), + ScResId(VS_LINECOLOR), + ::boost::bind(GetTransparentColor), + ::boost::bind(&CellAppearancePropertyPanel::SetLineColor, this, _1, _2), + pParent, + 0); +} + +void CellAppearancePropertyPanel::SetLineColor( + const String& /*rsColorName*/, + const Color aColor) +{ + const SvxColorItem aColorItem(aColor, SID_FRAME_LINECOLOR); + mpBindings->GetDispatcher()->Execute(SID_FRAME_LINECOLOR, SFX_CALLMODE_RECORD, &aColorItem, 0L); + maLineColor = aColor; +} + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent) +{ + return new CellLineStyleControl(pParent, *this); +} + +void CellAppearancePropertyPanel::EndCellLineStylePopupMode(void) +{ + if(mpCellLineStylePopup.get()) + { + mpCellLineStylePopup->Hide(); + } +} + +////////////////////////////////////////////////////////////////////////////// + +svx::sidebar::PopupControl* CellAppearancePropertyPanel::CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent) +{ + return new CellBorderStyleControl(pParent, *this); +} + +void CellAppearancePropertyPanel::EndCellBorderStylePopupMode(void) +{ + if(mpCellBorderStylePopup.get()) + { + mpCellBorderStylePopup->Hide(); + } +} + +////////////////////////////////////////////////////////////////////////////// + +CellAppearancePropertyPanel::CellAppearancePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + ScResId(RID_PROPERTYPANEL_SC_APPEAR)), + + mpFTFillColor(new FixedText(this, ScResId(FT_BK_COLOR))), + mpTBFillColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBFillColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBFillColorBackground.get(), ScResId(TB_BK_COLOR))), + mpFillColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_ATTR_BRUSH, TBI_BK_COLOR, mpTBFillColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + + mpFTCellBorder(new FixedText(this, ScResId(FT_BORDER))), + mpTBCellBorderBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBCellBorder(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCellBorderBackground.get(), ScResId(TB_APP_BORDER))), + mpCellBorderUpdater(new CellBorderUpdater(TBI_BORDER, *mpTBCellBorder)), + + mpTBLineStyleBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBLineStyle(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineStyleBackground.get(), ScResId(TB_BORDER_LINE_STYLE))), + + mpTBLineColorBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBLineColor(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBLineColorBackground.get(), ScResId(TB_BORDER_LINE_COLOR))), + mpLineColorUpdater(new ::svx::ToolboxButtonColorUpdater(SID_FRAME_LINECOLOR, TBI_LINE_COLOR, mpTBLineColor.get(), TBX_UPDATER_MODE_CHAR_COLOR_NEW)), + + mpCBXShowGrid(new CheckBox(this, ScResId(CBX_SHOW_GRID))), + + maBackColorControl(SID_BACKGROUND_COLOR, *pBindings, *this), + maLineColorControl(SID_FRAME_LINECOLOR, *pBindings, *this), + maLineStyleControl(SID_FRAME_LINESTYLE, *pBindings, *this), + maBorderOuterControl(SID_ATTR_BORDER_OUTER, *pBindings, *this), + maBorderInnerControl(SID_ATTR_BORDER_INNER, *pBindings, *this), + maGridShowControl(SID_SCGRIDSHOW, *pBindings, *this), + maBorderTLBRControl(SID_ATTR_BORDER_DIAG_TLBR, *pBindings, *this), + maBorderBLTRControl(SID_ATTR_BORDER_DIAG_BLTR, *pBindings, *this), + + maIMGBKColor(ScResId(IMG_BK_COLOR)), + maIMGCellBorder(ScResId(IMG_CELL_BORDER)), + maIMGLineColor(ScResId(IMG_LINE_COLOR)), + maIMGLineStyle1(ScResId(IMG_LINE_STYLE1)), + maIMGLineStyle2(ScResId(IMG_LINE_STYLE2)), + maIMGLineStyle3(ScResId(IMG_LINE_STYLE3)), + maIMGLineStyle4(ScResId(IMG_LINE_STYLE4)), + maIMGLineStyle5(ScResId(IMG_LINE_STYLE5)), + maIMGLineStyle6(ScResId(IMG_LINE_STYLE6)), + maIMGLineStyle7(ScResId(IMG_LINE_STYLE7)), + maIMGLineStyle8(ScResId(IMG_LINE_STYLE8)), + maIMGLineStyle9(ScResId(IMG_LINE_STYLE9)), + + maBackColor(COL_TRANSPARENT), + maLineColor(COL_BLACK), + maTLBRColor(COL_BLACK), + maBLTRColor(COL_BLACK), + mnIn(0), + mnOut(0), + mnDis(0), + mnTLBRIn(0), + mnTLBROut(0), + mnTLBRDis(0), + mnBLTRIn(0), + mnBLTROut(0), + mnBLTRDis(0), + mbBackColorAvailable(true), + mbLineColorAvailable(true), + mbBorderStyleAvailable(true), + mbLeft(false), + mbRight(false), + mbTop(false), + mbBottom(false), + mbVer(false), + mbHor(false), + mbOuterBorder(false), + mbInnerBorder(false), + mbTLBR(false), + mbBLTR(false), + + maFillColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateFillColorPopupControl, this, _1)), + maLineColorPopup(this, ::boost::bind(&CellAppearancePropertyPanel::CreateLineColorPopupControl, this, _1)), + mpCellLineStylePopup(), + mpCellBorderStylePopup(), + + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); +} + +////////////////////////////////////////////////////////////////////////////// + +CellAppearancePropertyPanel::~CellAppearancePropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpTBFillColor.reset(); + mpTBCellBorder.reset(); + mpTBLineStyle.reset(); + mpTBLineColor.reset(); + + mpTBFillColorBackground.reset(); + mpTBCellBorderBackground.reset(); + mpTBLineStyleBackground.reset(); + mpTBLineColorBackground.reset(); +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::Initialize() +{ + mpTBFillColor->SetItemImage(TBI_BK_COLOR, maIMGBKColor); + mpTBFillColor->SetItemBits( TBI_BK_COLOR, mpTBFillColor->GetItemBits( TBI_BK_COLOR ) | TIB_DROPDOWNONLY ); + mpTBFillColor->SetQuickHelpText(TBI_BK_COLOR,String(ScResId(STR_QH_BK_COLOR))); //Add + Size aTbxSize1( mpTBFillColor->CalcWindowSizePixel() ); + mpTBFillColor->SetOutputSizePixel( aTbxSize1 ); + mpTBFillColor->SetBackground(Wallpaper()); + mpTBFillColor->SetPaintTransparent(true); + Link aLink = LINK(this, CellAppearancePropertyPanel, TbxBKColorSelectHdl); + mpTBFillColor->SetDropdownClickHdl ( aLink ); + mpTBFillColor->SetSelectHdl ( aLink ); + + mpTBCellBorder->SetItemImage(TBI_BORDER, maIMGCellBorder); + mpTBCellBorder->SetItemBits( TBI_BORDER, mpTBCellBorder->GetItemBits( TBI_BORDER ) | TIB_DROPDOWNONLY ); + mpTBCellBorder->SetQuickHelpText(TBI_BORDER,String(ScResId(STR_QH_BORDER))); //Add + Size aTbxSize2( mpTBCellBorder->CalcWindowSizePixel() ); + mpTBCellBorder->SetOutputSizePixel( aTbxSize2 ); + mpTBCellBorder->SetBackground(Wallpaper()); + mpTBCellBorder->SetPaintTransparent(true); + aLink = LINK(this, CellAppearancePropertyPanel, TbxCellBorderSelectHdl); + mpTBCellBorder->SetDropdownClickHdl ( aLink ); + mpTBCellBorder->SetSelectHdl ( aLink ); + + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); + mpTBLineStyle->SetItemBits( TBI_LINE_STYLE, mpTBLineStyle->GetItemBits( TBI_LINE_STYLE ) | TIB_DROPDOWNONLY ); + mpTBLineStyle->SetQuickHelpText(TBI_LINE_STYLE,String(ScResId(STR_QH_BORDER_LINE_STYLE))); //Add + Size aTbxSize3( mpTBLineStyle->CalcWindowSizePixel() ); + mpTBLineStyle->SetOutputSizePixel( aTbxSize3 ); + mpTBLineStyle->SetBackground(Wallpaper()); + mpTBLineStyle->SetPaintTransparent(true); + aLink = LINK(this, CellAppearancePropertyPanel, TbxLineStyleSelectHdl); + mpTBLineStyle->SetDropdownClickHdl ( aLink ); + mpTBLineStyle->SetSelectHdl ( aLink ); + mpTBLineStyle->Disable(); + + mpTBLineColor->SetItemImage(TBI_LINE_COLOR, maIMGLineColor); + mpTBLineColor->SetItemBits( TBI_LINE_COLOR, mpTBLineColor->GetItemBits( TBI_LINE_COLOR ) | TIB_DROPDOWNONLY ); + mpTBLineColor->SetQuickHelpText(TBI_LINE_COLOR,String(ScResId(STR_QH_BORDER_LINE_COLOR))); //Add + Size aTbxSize4( mpTBLineColor->CalcWindowSizePixel() ); + mpTBLineColor->SetOutputSizePixel( aTbxSize4 ); + mpTBLineColor->SetBackground(Wallpaper()); + mpTBLineColor->SetPaintTransparent(true); + aLink = LINK(this, CellAppearancePropertyPanel, TbxLineColorSelectHdl); + mpTBLineColor->SetDropdownClickHdl ( aLink ); + mpTBLineColor->SetSelectHdl ( aLink ); + mpTBLineColor->Disable(); + + aLink = LINK(this, CellAppearancePropertyPanel, CBOXGridShowClkHdl); + mpCBXShowGrid->SetClickHdl ( aLink ); + + mpTBFillColor->SetAccessibleRelationLabeledBy(mpFTFillColor.get()); + mpTBLineColor->SetAccessibleRelationLabeledBy(mpTBLineColor.get()); + mpTBCellBorder->SetAccessibleRelationLabeledBy(mpFTCellBorder.get()); + mpTBLineStyle->SetAccessibleRelationLabeledBy(mpTBLineStyle.get()); +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxBKColorSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_BK_COLOR) + { + maFillColorPopup.Show(*pToolBox); + maFillColorPopup.SetCurrentColor(maBackColor, mbBackColorAvailable); + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxLineColorSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_LINE_COLOR) + { + maLineColorPopup.Show(*pToolBox); + maLineColorPopup.SetCurrentColor(maLineColor, mbLineColorAvailable); + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxCellBorderSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if(nId == TBI_BORDER) + { + // create popup on demand + if(!mpCellBorderStylePopup.get()) + { + mpCellBorderStylePopup.reset( + new CellBorderStylePopup( + this, + ::boost::bind(&CellAppearancePropertyPanel::CreateCellBorderStylePopupControl, this, _1))); + } + + if(mpCellBorderStylePopup.get()) + { + mpCellBorderStylePopup->Show(*pToolBox); + } + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, TbxLineStyleSelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + if(nId == TBI_LINE_STYLE) + { + // create popup on demand + if(!mpCellLineStylePopup.get()) + { + mpCellLineStylePopup.reset( + new CellLineStylePopup( + this, + ::boost::bind(&CellAppearancePropertyPanel::CreateCellLineStylePopupControl, this, _1))); + } + + if(mpCellLineStylePopup.get()) + { + mpCellLineStylePopup->SetLineStyleSelect(mnOut, mnIn, mnDis); + mpCellLineStylePopup->Show(*pToolBox); + } + } + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK(CellAppearancePropertyPanel, CBOXGridShowClkHdl, void*, EMPTYARG) +{ + bool bState = mpCBXShowGrid->IsChecked(); + SfxBoolItem aItem( SID_SCGRIDSHOW , bState); + GetBindings()->GetDispatcher()->Execute(SID_SCGRIDSHOW, SFX_CALLMODE_RECORD, &aItem, false, 0L); + return 0; +} + +////////////////////////////////////////////////////////////////////////////// + +CellAppearancePropertyPanel* CellAppearancePropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to CellAppearancePropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to CellAppearancePropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to CellAppearancePropertyPanel::Create"), NULL, 2); + + return new CellAppearancePropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + + + // todo +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_BACKGROUND_COLOR: + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState); + + if(pSvxColorItem) + { + maBackColor = ((const SvxColorItem*)pState)->GetValue(); + mbBackColorAvailable = true; + mpFillColorUpdater->Update(maBackColor); + break; + } + } + + mbBackColorAvailable = false; + maBackColor.SetColor(COL_TRANSPARENT); + mpFillColorUpdater->Update(COL_TRANSPARENT); + break; + case SID_FRAME_LINECOLOR: + if( eState == SFX_ITEM_DONTCARE) + { + mbLineColorAvailable = true; + maLineColor.SetColor( COL_TRANSPARENT ); + UpdateControlState(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT && pState && pState->ISA(SvxColorItem) ) + { + const SvxColorItem* pSvxColorItem = dynamic_cast< const SvxColorItem* >(pState); + + if(pSvxColorItem) + { + maLineColor = ((const SvxColorItem*)pState)->GetValue(); + if(maLineColor == COL_AUTO) + mbLineColorAvailable = false; + else + { + mbLineColorAvailable = true; + // mpLineColorUpdater->Update(maLineColor); + } + + UpdateControlState(); + break; + } + } + + mbLineColorAvailable = false; + maLineColor.SetColor(COL_AUTO); + // mpLineColorUpdater->Update(maLineColor); + UpdateControlState(); + break; + case SID_FRAME_LINESTYLE: + if( eState == SFX_ITEM_DONTCARE ) + { + mbBorderStyleAvailable = true; + mnIn = 0; + mnOut = 0; + mnDis = 0; + SetStyleIcon(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxLineItem* pSvxLineItem = dynamic_cast< const SvxLineItem* >(pState); + + if(pSvxLineItem) + { + const editeng::SvxBorderLine* mbLineItem = pSvxLineItem->GetLine(); + mnIn = mbLineItem->GetInWidth(); + mnOut = mbLineItem->GetOutWidth(); + mnDis = mbLineItem->GetDistance(); + + if(mnIn == 0 && mnOut == 0 && mnDis == 0) + mbBorderStyleAvailable = false; + else + mbBorderStyleAvailable = true; + + SetStyleIcon(); + break; + } + } + + mbBorderStyleAvailable = false; + SetStyleIcon(); + break; + case SID_ATTR_BORDER_OUTER: + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxBoxItem* pBoxItem = dynamic_cast< const SvxBoxItem* >(pState); + + if(pBoxItem) + { + mbLeft=false, mbRight=false, mbTop=false, mbBottom=false; + + if(pBoxItem->GetLeft()) + mbLeft = true; + + if(pBoxItem->GetRight()) + mbRight = true; + + if(pBoxItem->GetTop()) + mbTop = true; + + if(pBoxItem->GetBottom()) + mbBottom = true; + + if(!Application::GetSettings().GetLayoutRTL()) + mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbLeft, mbRight, maIMGCellBorder, mbVer, mbHor); + else + mpCellBorderUpdater->UpdateCellBorder(mbTop, mbBottom, mbRight, mbLeft, maIMGCellBorder, mbVer, mbHor); + + if(mbLeft || mbRight || mbTop || mbBottom) + mbOuterBorder = true; + else + mbOuterBorder = false; + + UpdateControlState(); + } + } + break; + case SID_ATTR_BORDER_INNER: + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxBoxInfoItem* pBoxInfoItem = dynamic_cast< const SvxBoxInfoItem* >(pState); + + if(pBoxInfoItem) + { + bool bLeft(false), bRight(false), bTop(false), bBottom(false); + + mbVer = false, mbHor = false; + + if(!pBoxInfoItem->IsValid( VALID_VERT ) || pBoxInfoItem->GetVert()) + mbVer = true; + + if(!pBoxInfoItem->IsValid( VALID_HORI ) || pBoxInfoItem->GetHori()) + mbHor = true; + + if(!pBoxInfoItem->IsValid( VALID_LEFT ) || mbLeft) + bLeft = true; + + if(!pBoxInfoItem->IsValid( VALID_RIGHT ) || mbRight) + bRight = true; + + if(!pBoxInfoItem->IsValid( VALID_TOP ) || mbTop) + bTop = true; + + if(!pBoxInfoItem->IsValid( VALID_BOTTOM ) || mbBottom) + bBottom = true; + + if(!Application::GetSettings().GetLayoutRTL()) + mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bLeft, bRight, maIMGCellBorder, mbVer, mbHor); + else + mpCellBorderUpdater->UpdateCellBorder(bTop, bBottom, bRight, bLeft, maIMGCellBorder, mbVer, mbHor); + + if(mbVer || mbHor || bLeft || bRight || bTop || bBottom) + mbInnerBorder = true; + else + mbInnerBorder = false; + + UpdateControlState(); + } + } + break; + case SID_ATTR_BORDER_DIAG_TLBR: + if( eState == SFX_ITEM_DONTCARE ) + { + mbTLBR = true; + maTLBRColor.SetColor(COL_TRANSPARENT); + mnTLBRIn = mnTLBROut = mnTLBRDis = 0; + UpdateControlState(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState); + + if(pItem) + { + const editeng::SvxBorderLine* aLine = pItem->GetLine(); + + if(!aLine) + { + mbTLBR = false; + } + else + { + mbTLBR = true; + maTLBRColor = aLine->GetColor(); + mnTLBRIn = aLine->GetInWidth(); + mnTLBROut = aLine->GetOutWidth(); + mnTLBRDis = aLine->GetDistance(); + + if(mnTLBRIn == 0 && mnTLBROut == 0 && mnTLBRDis == 0) + mbTLBR = false; + } + + UpdateControlState(); + break; + } + } + + mbTLBR = false; + UpdateControlState(); + break; + case SID_ATTR_BORDER_DIAG_BLTR: + if( eState == SFX_ITEM_DONTCARE ) + { + mbBLTR = true; + maBLTRColor.SetColor( COL_TRANSPARENT ); + mnBLTRIn = mnBLTROut = mnBLTRDis = 0; + UpdateControlState(); + break; + } + + if(eState >= SFX_ITEM_DEFAULT) + { + const SvxLineItem* pItem = dynamic_cast< const SvxLineItem* >(pState); + + if(pItem) + { + const editeng::SvxBorderLine* aLine = pItem->GetLine(); + + if(!aLine) + { + mbBLTR = false; + } + else + { + mbBLTR = true; + maBLTRColor = aLine->GetColor(); + mnBLTRIn = aLine->GetInWidth(); + mnBLTROut = aLine->GetOutWidth(); + mnBLTRDis = aLine->GetDistance(); + + if(mnBLTRIn == 0 && mnBLTROut == 0 && mnBLTRDis == 0) + mbBLTR = false; + } + + UpdateControlState(); + } + break; + } + + mbBLTR = false; + UpdateControlState(); + break; + case SID_SCGRIDSHOW: + if(eState >= SFX_ITEM_DEFAULT) + { + const SfxBoolItem* pItem = dynamic_cast< const SfxBoolItem* >(pState); + + if(pItem) + { + const bool bVal = pItem->GetValue(); + + if(bVal) + mpCBXShowGrid->Check(true); + else + mpCBXShowGrid->Check(false); + } + } + break; + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* CellAppearancePropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::SetStyleIcon() +{ + //FIXME: update for new line border possibilities + if(mnOut == DEF_LINE_WIDTH_0 && mnIn == 0 && mnDis == 0) //1 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); + else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == 0 && mnDis == 0) //2 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle2); + else if(mnOut == DEF_LINE_WIDTH_3 && mnIn == 0 && mnDis == 0) //3 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle3); + else if(mnOut == DEF_LINE_WIDTH_4 && mnIn == 0 && mnDis == 0) //4 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle4); + else if(mnOut == DEF_LINE_WIDTH_0 && mnIn == DEF_LINE_WIDTH_0 && mnDis == DEF_LINE_WIDTH_1) //5 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle5); + else if(mnOut == DEF_LINE_WIDTH_0 && mnIn == DEF_LINE_WIDTH_0 && mnDis == DEF_LINE_WIDTH_2) //6 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle6); + else if(mnOut == DEF_LINE_WIDTH_1 && mnIn == DEF_LINE_WIDTH_2 && mnDis == DEF_LINE_WIDTH_1) //7 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle7); + else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == DEF_LINE_WIDTH_0 && mnDis == DEF_LINE_WIDTH_2) //8 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle8); + else if(mnOut == DEF_LINE_WIDTH_2 && mnIn == DEF_LINE_WIDTH_2 && mnDis == DEF_LINE_WIDTH_2) //9 + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle9); + else + mpTBLineStyle->SetItemImage(TBI_LINE_STYLE, maIMGLineStyle1); +} + +////////////////////////////////////////////////////////////////////////////// + +void CellAppearancePropertyPanel::UpdateControlState() +{ + if(mbOuterBorder || mbInnerBorder || mbTLBR || mbBLTR) + { + mpTBLineColor->Enable(); + mpTBLineStyle->Enable(); + + //set line color state + if( mbLineColorAvailable && !mbTLBR && !mbBLTR ) + mpLineColorUpdater->Update(maLineColor); + else if( !mbLineColorAvailable && mbTLBR && !mbBLTR ) + mpLineColorUpdater->Update(maTLBRColor); + else if ( !mbLineColorAvailable && !mbTLBR && mbBLTR ) + mpLineColorUpdater->Update(maBLTRColor); + else if( !mbLineColorAvailable && mbTLBR && mbBLTR) + { + if( maTLBRColor == maBLTRColor) + mpLineColorUpdater->Update(maBLTRColor); + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + } + else if( mbLineColorAvailable && mbTLBR && !mbBLTR ) + { + if( maTLBRColor == maLineColor) + mpLineColorUpdater->Update(maLineColor); + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + } + else if( mbLineColorAvailable && !mbTLBR && mbBLTR ) + { + if( maBLTRColor == maLineColor) + mpLineColorUpdater->Update(maLineColor); + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + } + else + mpLineColorUpdater->Update(COL_TRANSPARENT); + + //set line style state + if( mbBorderStyleAvailable && !mbTLBR && !mbBLTR ) + { + } + else if( !mbBorderStyleAvailable && mbTLBR && !mbBLTR ) + { + mnIn = mnTLBRIn; + mnOut = mnTLBROut; + mnDis = mnTLBRDis; + } + else if ( !mbBorderStyleAvailable && !mbTLBR && mbBLTR ) + { + mnIn = mnBLTRIn; + mnOut = mnBLTROut; + mnDis = mnBLTRDis; + } + else if( !mbBorderStyleAvailable && mbTLBR && mbBLTR) + { + if( mnTLBRIn == mnBLTRIn && mnTLBROut == mnBLTROut && mnTLBRDis == mnBLTRDis) + { + mnIn = mnTLBRIn; + mnOut = mnTLBROut; + mnDis = mnTLBRDis; + } + else + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + } + else if( mbBorderStyleAvailable && mbTLBR && !mbBLTR ) + { + if( mnTLBRIn != mnIn || mnTLBROut != mnOut || mnTLBRDis != mnDis) + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + } + else if( mbBorderStyleAvailable && !mbTLBR && mbBLTR ) + { + if( mnBLTRIn != mnIn || mnBLTROut != mnOut || mnBLTRDis != mnDis ) + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + } + else + { + mnIn = 0; + mnOut = 0; + mnDis = 0; + } + SetStyleIcon(); + } + else + { + mpTBLineColor->Disable(); + mpTBLineStyle->Disable(); + } +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc new file mode 100644 index 000000000000..a0a3b9e2c16f --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hrc @@ -0,0 +1,114 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#define FT_BK_COLOR 1 +#define TB_BK_COLOR 2 +#define TBI_BK_COLOR 3 +#define FT_BORDER 4 +#define TB_APP_BORDER 5 +#define TBI_BORDER 6 +#define TB_BORDER_LINE_STYLE 7 +#define TBI_LINE_STYLE 8 +#define TB_BORDER_LINE_COLOR 9 +#define TBI_LINE_COLOR 10 +#define CBX_SHOW_GRID 11 + +#define STR_QH_BK_COLOR 12 +#define STR_QH_BORDER 13 +#define STR_QH_BORDER_LINE_STYLE 14 +#define STR_QH_BORDER_LINE_COLOR 15 + +#define IMG_BK_COLOR 21 +#define IMG_CELL_BORDER 22 +#define IMG_LINE_COLOR 23 +#define IMG_LINE_STYLE1 25 +#define IMG_LINE_STYLE2 26 +#define IMG_LINE_STYLE3 27 +#define IMG_LINE_STYLE4 28 +#define IMG_LINE_STYLE5 29 +#define IMG_LINE_STYLE6 30 +#define IMG_LINE_STYLE7 31 +#define IMG_LINE_STYLE8 32 +#define IMG_LINE_STYLE9 33 + +//BACK_COLOR PAGE +#define VS_BACK_COLOR 1 +#define STR_AUTOMATICE 2 + +//LINE COLOR PAGE +#define VS_LINE_COLOR 1 + +//line style page +#define VS_STYLE 1 +#define PB_OPTIONS 2 +#define BMP_UNDERLINE_MORE 3 + +//line border page +#define TB_BORDER1 1 +#define TB_BORDER2 2 +#define TB_BORDER3 3 + +#define TBI_BORDER1_NONE 7 +#define TBI_BORDER1_ALL 8 +#define TBI_BORDER1_OUTER 9 +#define TBI_BORDER1_OUTERBOLD 10 +#define TBI_BORDER2_LEFT 11 +#define TBI_BORDER2_RIGHT 12 +#define TBI_BORDER2_TOP 13 +#define TBI_BORDER2_BOT 14 +#define TBI_BORDER2_BLTR 15 +#define TBI_BORDER2_TLBR 16 +#define TBI_BORDER2_TOPBOT 17 +#define TBI_BORDER2_LEFTRIGHT 18 +#define TBI_BORDER3_S1 19 +#define TBI_BORDER3_S2 20 +#define TBI_BORDER3_S3 21 +#define TBI_BORDER3_S4 22 +#define FL_1 23 +#define FL_2 24 + +#define IMG_BORDER1 25 +#define IMG_BORDER2 26 +#define IMG_BORDER3 27 +#define IMG_BORDER4 28 +#define IMG_BORDER5 29 +#define IMG_BORDER6 30 +#define IMG_BORDER7 31 +#define IMG_BORDER8 32 +#define IMG_BORDER9 33 +#define IMG_BORDER10 34 +#define IMG_BORDER11 35 +#define IMG_BORDER12 36 +#define IMG_BORDER13 37 +#define IMG_BORDER14 38 +#define IMG_BORDER15 39 +#define IMG_BORDER16 40 + +#define STR_BORDER_1 41 +#define STR_BORDER_2 42 +#define STR_BORDER_3 43 +#define STR_BORDER_4 44 +#define STR_BORDER_5 45 +#define STR_BORDER_6 46 +#define STR_BORDER_7 47 +#define STR_BORDER_8 48 + +#define VS_FILLCOLOR 1 +#define VS_NOFILLCOLOR 2 +#define VS_LINECOLOR 1 + +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx new file mode 100644 index 000000000000..184cd9580588 --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.hxx @@ -0,0 +1,197 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_PROPERTYPANEL_APPEARANCE_HXX +#define SC_PROPERTYPANEL_APPEARANCE_HXX + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <boost/scoped_ptr.hpp> +#include <svx/sidebar/ColorPopup.hxx> + +class FixedText; +namespace svx { class ToolboxButtonColorUpdater; } +namespace sc { namespace sidebar { + class CellLineStylePopup; + class CellBorderStylePopup; + class CellLineStyleControl; + class CellBorderUpdater; +}} +class ToolBox; +class CheckBox; + +namespace sc { namespace sidebar { + +class CellAppearancePropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +private: + friend class CellLineStyleControl; + friend class CellBorderStyleControl; + +public: + static CellAppearancePropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFTFillColor; + ::boost::scoped_ptr< Window > mpTBFillColorBackground; + ::boost::scoped_ptr< ToolBox > mpTBFillColor; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpFillColorUpdater; + + ::boost::scoped_ptr< FixedText > mpFTCellBorder; + ::boost::scoped_ptr< Window > mpTBCellBorderBackground; + ::boost::scoped_ptr< ToolBox > mpTBCellBorder; + ::boost::scoped_ptr< CellBorderUpdater > mpCellBorderUpdater; + + ::boost::scoped_ptr< Window > mpTBLineStyleBackground; + ::boost::scoped_ptr< ToolBox > mpTBLineStyle; + + ::boost::scoped_ptr< Window > mpTBLineColorBackground; + ::boost::scoped_ptr< ToolBox > mpTBLineColor; + ::boost::scoped_ptr< ::svx::ToolboxButtonColorUpdater > mpLineColorUpdater; + + ::boost::scoped_ptr< CheckBox > mpCBXShowGrid; + + ::sfx2::sidebar::ControllerItem maBackColorControl; + ::sfx2::sidebar::ControllerItem maLineColorControl; + ::sfx2::sidebar::ControllerItem maLineStyleControl; + ::sfx2::sidebar::ControllerItem maBorderOuterControl; + ::sfx2::sidebar::ControllerItem maBorderInnerControl; + ::sfx2::sidebar::ControllerItem maGridShowControl; + ::sfx2::sidebar::ControllerItem maBorderTLBRControl; + ::sfx2::sidebar::ControllerItem maBorderBLTRControl; + + // images + Image maIMGBKColor; + Image maIMGCellBorder; + Image maIMGLineColor; + Image maIMGLineStyle1; + Image maIMGLineStyle2; + Image maIMGLineStyle3; + Image maIMGLineStyle4; + Image maIMGLineStyle5; + Image maIMGLineStyle6; + Image maIMGLineStyle7; + Image maIMGLineStyle8; + Image maIMGLineStyle9; + + // cell background color + Color maBackColor; + + // cell line color(s) + Color maLineColor; + Color maTLBRColor; + Color maBLTRColor; + + // BorderStyle defines + sal_uInt16 mnIn; + sal_uInt16 mnOut; + sal_uInt16 mnDis; + sal_uInt16 mnTLBRIn; + sal_uInt16 mnTLBROut; + sal_uInt16 mnTLBRDis; + sal_uInt16 mnBLTRIn; + sal_uInt16 mnBLTROut; + sal_uInt16 mnBLTRDis; + + /// bitfield + bool mbBackColorAvailable : 1; + bool mbLineColorAvailable : 1; + bool mbBorderStyleAvailable : 1; + + // CellBorder defines + bool mbLeft : 1; + bool mbRight : 1; + bool mbTop : 1; + bool mbBottom : 1; + bool mbVer : 1; + bool mbHor : 1; + + bool mbOuterBorder : 1; // mbLeft || mbRight || mbTop || mbBottom + bool mbInnerBorder : 1; // mbVer || mbHor || bLeft || bRight || bTop || bBottom + + bool mbTLBR : 1; + bool mbBLTR : 1; + + // popups + svx::sidebar::ColorPopup maFillColorPopup; + svx::sidebar::ColorPopup maLineColorPopup; + ::boost::scoped_ptr< CellLineStylePopup > mpCellLineStylePopup; + ::boost::scoped_ptr< CellBorderStylePopup > mpCellBorderStylePopup; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + DECL_LINK(TbxBKColorSelectHdl, ToolBox*); + DECL_LINK(TbxLineColorSelectHdl, ToolBox*); + DECL_LINK(TbxCellBorderSelectHdl, ToolBox*); + DECL_LINK(TbxLineStyleSelectHdl, ToolBox*); + DECL_LINK(CBOXGridShowClkHdl, void*); + + // for fill color picker + svx::sidebar::PopupControl* CreateFillColorPopupControl(svx::sidebar::PopupContainer* pParent); + void SetFillColor(const String& rsColorName, const Color aColor); + + // for line color picker + svx::sidebar::PopupControl* CreateLineColorPopupControl(svx::sidebar::PopupContainer* pParent); + void SetLineColor(const String& rsColorName, const Color aColor); + + // for CellLineStyle popup + svx::sidebar::PopupControl* CreateCellLineStylePopupControl(svx::sidebar::PopupContainer* pParent); + void EndCellLineStylePopupMode(void); + + // for CellBorderStyle popup + svx::sidebar::PopupControl* CreateCellBorderStylePopupControl(svx::sidebar::PopupContainer* pParent); + void EndCellBorderStylePopupMode(void); + + // constructor/destuctor + CellAppearancePropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~CellAppearancePropertyPanel(); + + void Initialize(); + void SetStyleIcon(); + void UpdateControlState(); +}; + +} } // end of namespace ::sc::sidebar + +#endif +// eof diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.src b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src new file mode 100644 index 000000000000..cb870818bfd3 --- /dev/null +++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src @@ -0,0 +1,495 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "CellAppearancePropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "sc.hrc" +#include "helpids.h" + +#define TOOLBOX_WIDTH 50 +#define TOOLBOX_HEIGHT 15 + +#define TOOLBOX_WIDTH_2 34 +#define TOOLBOX_HEIGHT_2 30 + +#define TOOLBOX_BORDER_WIDTH 107 +#define PB_BORDER_MOREBTN 57 +#define POPUPPANEL_MARGIN_SMALL_PIXEL 8 + +////////////////////////////////////////////////////////////////////////////// +// the basic propertypanel + +Control RID_PROPERTYPANEL_SC_APPEAR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT_2 + CBOX_HEIGHT + SECTIONPAGE_MARGIN_VERTICAL_BOT - 2); + HelpID = HID_PROPERTYPANEL_SC_CELL_SECTION ; + Text [ en-US ] = "Cell Appearance"; + + FixedText FT_BK_COLOR + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP ); + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL * 2 , TEXT_HEIGHT) ; + Text [ en-US ] = "~Cell background:"; + }; + ToolBox TB_BK_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_BKCOLOR ; + Text [ en-US ] = "Cell Background"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BK_COLOR ; + DropDown = TRUE ; + Text [ en-US ] = "Cell background" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_BKCOLOR; + }; + }; + }; + String STR_QH_BK_COLOR + { + Text [ en-US ] = "Select the background color of the selected cells." ; + }; + FixedText FT_BORDER + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL); + Size = MAP_APPFONT ( PROPERTYPAGE_WIDTH - SECTIONPAGE_MARGIN_HORIZONTAL * 2 , TEXT_HEIGHT) ; + Text [ en-US ] = "Cell ~border:"; + }; + ToolBox TB_APP_BORDER + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH_2 ,TOOLBOX_HEIGHT_2 ) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_BORDER ; + Text [ en-US ] = "Cell Border"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BORDER ; + DropDown = TRUE ; + Text [ en-US ] = "Cell border" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_BORDER; + }; + }; + }; + String STR_QH_BORDER + { + Text [ en-US ] = "Specify the borders of the selected cells." ; + }; + ToolBox TB_BORDER_LINE_STYLE + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH_2 + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL ) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_STYLE ; + Text [ en-US ] = "Line Style"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_LINE_STYLE ; + DropDown = TRUE ; + Text [ en-US ] = "Line style" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_STYLE; + }; + }; + }; + String STR_QH_BORDER_LINE_STYLE + { + Text [ en-US ] = "Select the line style of the borders." ; + }; + ToolBox TB_BORDER_LINE_COLOR + { + SVLook = TRUE ; + Pos = MAP_APPFONT (SECTIONPAGE_MARGIN_HORIZONTAL + TOOLBOX_WIDTH_2 + 3, SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT * 2 + CONTROL_SPACING_VERTICAL + 3) ; + Size = MAP_APPFONT (TOOLBOX_WIDTH ,TOOLBOX_HEIGHT ) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_TBX_LINECOLOR ; + Text [ en-US ] = "Line Color"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_LINE_COLOR ; + DropDown = TRUE ; + Text [ en-US ] = "Line color" ; + HelpID = HID_PROPERTYPANEL_SC_TBI_LINECOLOR; + }; + }; + }; + String STR_QH_BORDER_LINE_COLOR + { + Text [ en-US ] = "Select the line color of the borders." ; + }; + CheckBox CBX_SHOW_GRID + { + Pos = MAP_APPFONT ( SECTIONPAGE_MARGIN_HORIZONTAL , SECTIONPAGE_MARGIN_VERTICAL_TOP + TEXT_HEIGHT * 2 + TEXT_CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT + CONTROL_SPACING_VERTICAL * 2 + TOOLBOX_HEIGHT_2 + 2) ; + Size = MAP_APPFONT ( 90 , CBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "Show cell ~grid lines" ; + QuickHelpText [ en-US ] = "Show the grid lines of the cells in the entire spreadsheet."; + HelpID = HID_PROPERTYPANEL_SC_CBOX_SHOWGRID; + }; + + Image IMG_BK_COLOR + { + ImageBitmap = Bitmap{File = "sidebar/fill_color.png";}; + }; + Image IMG_CELL_BORDER + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder.png";}; + //MaskColor = STD_MASKCOLOR ; + }; + Image IMG_LINE_COLOR + { + ImageBitmap = Bitmap{File = "sidebar/Line_color.png";}; + }; + Image IMG_LINE_STYLE1 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_005.png";}; + }; + Image IMG_LINE_STYLE2 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_250.png";}; + }; + Image IMG_LINE_STYLE3 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_400.png";}; + }; + Image IMG_LINE_STYLE4 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_500.png";}; + }; + Image IMG_LINE_STYLE5 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_110.png";}; + }; + Image IMG_LINE_STYLE6 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_260.png";}; + }; + Image IMG_LINE_STYLE7 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_450.png";}; + }; + Image IMG_LINE_STYLE8 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_505.png";}; + }; + Image IMG_LINE_STYLE9 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorderLineStyle_750.png";}; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// fill color popup + +Control RID_POPUPPANEL_CELLAPPEARANCE_FILLCOLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_FILLCOLOR + { + HelpID = HID_PROPERTYPANEL_FILL_COLOR_VS; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text [ en-US ] = "Color"; + }; + + String VS_NOFILLCOLOR + { + Text [ en-US ] = "No Color" ; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// line color popup + +Control RID_POPUPPANEL_CELLAPPEARANCE_LINECOLOR +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + Size = MAP_APPFONT( POPUP_COLOR_PICKER_WIDTH , POPUP_COLOR_PICKER_HEIGHT ); + + Control VS_LINECOLOR + { + HelpID = HID_PROPERTYPANEL_LINE_COLOR_VS; + Hide = TRUE ; + Pos = MAP_APPFONT ( OFFSET_X , OFFSET_Y ); + Size = MAP_APPFONT ( POPUP_COLOR_PICKER_WIDTH - OFFSET_X * 2, POPUP_COLOR_PICKER_HEIGHT - OFFSET_Y * 2); + TabStop = TRUE ; + Text [ en-US ] = "Color"; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// cell line style popup + +Control RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( + POPUPPANEL_MARGIN_SMALL * 2 + POPUP_BORDER_WIDTH + 80, + 13 + POPUP_BORDER_HEIGHT + POPUPPANEL_MARGIN_SMALL * 2 + POPUPPANEL_MARGIN_LARGE + 12*9); + + Control VS_STYLE + { + HelpID = HID_PROPERTYPANEL_SC_STYLE_VS ; + Hide = TRUE ; + Pos = MAP_APPFONT( POPUPPANEL_MARGIN_SMALL + OFFSET_X , POPUPPANEL_MARGIN_SMALL + OFFSET_Y ); + Size = MAP_APPFONT ( 80 , 12 * 9); + TabStop = TRUE ; + Text [ en-US ] = "Line Style"; + }; + PushButton PB_OPTIONS + { + HelpID = HID_PROPERTYPANEL_SC_STYLE_PB; + Pos = MAP_APPFONT ( POPUPPANEL_MARGIN_LARGE + OFFSET_X , POPUPPANEL_MARGIN_SMALL * 2 + OFFSET_Y + 12 * 9); + Size = MAP_APPFONT ( 75 , 12 ); + TabStop = TRUE; + Text [ en-US ] = "~More Options..."; + }; + Bitmap BMP_UNDERLINE_MORE + { + File = "sidebar/morebutton.png"; + }; +}; + +////////////////////////////////////////////////////////////////////////////// +// cell border style popup + +Control RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_PIXEL( POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 108, POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 138); + + ToolBox TB_BORDER1 + { + SVLook = TRUE ; + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL); //MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 1) ; + Size = MAP_PIXEL(TOOLBOX_BORDER_WIDTH, 31); //MAP_APPFONT (TOOLBOX_BORDER_WIDTH ,20) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER1_TBX; + Text [ en-US ] = "Cell Border 1"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BORDER1_NONE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_NONE; + Text [ en-US ] = "No Border" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER1_ALL ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_ALL; + Text [ en-US ] = "All Borders" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER1_OUTER ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_OUTER; + Text [ en-US ] = "Outside Borders" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER1_OUTERBOLD ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_OUTERBOLD; + Text [ en-US ] = "Thick Box Border" ; + }; + }; + }; + FixedLine FL_1 + { + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31); //MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1 , POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 1) ; + Size = MAP_PIXEL(TOOLBOX_BORDER_WIDTH, 8); // MAP_APPFONT ( TOOLBOX_BORDER_WIDTH , 5 ) ; + }; + ToolBox TB_BORDER2 + { + SVLook = TRUE ; + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 + 8); // MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 5 + 1) ; + Size = MAP_PIXEL (TOOLBOX_BORDER_WIDTH ,61) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER2_TBX; + Text [ en-US ] = "Cell Border 2"; + }; + FixedLine FL_2 + { + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 + 8 + 61); // MAP_APPFONT ( POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1 , POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 38 + 5 + 1) ; + Size = MAP_PIXEL ( TOOLBOX_BORDER_WIDTH , 8 ) ; + }; + ToolBox TB_BORDER3 + { + SVLook = TRUE ; + Pos = MAP_PIXEL(POPUPPANEL_MARGIN_SMALL_PIXEL, POPUPPANEL_MARGIN_SMALL_PIXEL + 31 +8 + 61 + 8); // MAP_APPFONT (POPUPPANEL_MARGIN_SMALL + OFFSET_X + 1, POPUPPANEL_MARGIN_SMALL + OFFSET_Y + 20 + 38 + 10 + 1) ; + Size = MAP_PIXEL (TOOLBOX_BORDER_WIDTH ,31) ; + TabStop = TRUE ; + HelpID = HID_PROPERTYPANEL_SC_BORDER3_TBX; + Text [ en-US ] = "Cell Border 3"; + ItemList = + { + ToolBoxItem + { + Identifier = TBI_BORDER3_S1; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S1; + Text [ en-US ] = "Thick Bottom Border" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER3_S2 ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S2; + Text [ en-US ] = "Double Bottom Border" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER3_S3 ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S3; + Text [ en-US ] = "Top and Thick Bottom Borders" ; + }; + ToolBoxItem + { + Identifier = TBI_BORDER3_S4 ; + HelpID = HID_PROPERTYPANEL_SC_BORDER_TBI_S4; + Text [ en-US ] = "Top and Double Bottom Borders" ; + }; + }; + }; + + Image IMG_BORDER1 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Empty_18x18.png";}; + }; + Image IMG_BORDER2 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_All_18x18.png";}; + }; + Image IMG_BORDER3 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_18x18.png";}; + }; + Image IMG_BORDER4 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_FourBorders_Thick_18x18.png";}; + }; + Image IMG_BORDER5 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Left_18x18.png";}; + }; + Image IMG_BORDER6 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Right_18x18.png";}; + }; + Image IMG_BORDER7 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Top_18x18.png";}; + }; + Image IMG_BORDER8 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_18x18.png";}; + }; + Image IMG_BORDER9 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_RightDiagonal_18x18.png";}; + }; + Image IMG_BORDER10 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftDiagonal_18x18.png";}; + }; + Image IMG_BORDER11 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopAndBottom_18x18.png";}; + }; + Image IMG_BORDER12 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_LeftAndRight_18x18.png";}; + }; + Image IMG_BORDER13 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Thick_18x18.png";}; + }; + Image IMG_BORDER14 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_Bottom_Double_18x18.png";}; + }; + Image IMG_BORDER15 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopThin_BottomThick_18x18.png";}; + }; + Image IMG_BORDER16 + { + ImageBitmap = Bitmap{File = "sidebar/CellBorder_TopSingle_BottomDouble_18x18.png";}; + }; + String STR_BORDER_1 + { + Text [ en-US ] = "Left Border"; + }; + String STR_BORDER_2 + { + Text [ en-US ] = "Right Border"; + }; + String STR_BORDER_3 + { + Text [ en-US ] = "Top Border"; + }; + String STR_BORDER_4 + { + Text [ en-US ] = "Bottom Border"; + }; + String STR_BORDER_5 + { + Text [ en-US ] = "Diagonal Up Border"; + }; + String STR_BORDER_6 + { + Text [ en-US ] = "Diagonal Down Border"; + }; + String STR_BORDER_7 + { + Text [ en-US ] = "Top and Bottom Borders"; + }; + String STR_BORDER_8 + { + Text [ en-US ] = "Left and Right Borders"; + }; +}; + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.cxx b/sc/source/ui/sidebar/CellBorderStyleControl.cxx new file mode 100644 index 000000000000..867d1c0308cf --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStyleControl.cxx @@ -0,0 +1,344 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <CellBorderStyleControl.hxx> +#include "sc.hrc" +#include "scresid.hxx" +#include <CellAppearancePropertyPanel.hrc> +#include <editeng/boxitem.hxx> +#include <editeng/borderline.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/svapp.hxx> +#include <editeng/lineitem.hxx> + +namespace sc { namespace sidebar { + +#define FRM_VALID_LEFT 0x01 +#define FRM_VALID_RIGHT 0x02 +#define FRM_VALID_TOP 0x04 +#define FRM_VALID_BOTTOM 0x08 +#define FRM_VALID_HINNER 0x10 +#define FRM_VALID_VINNER 0x20 +#define FRM_VALID_OUTER 0x0f +#define FRM_VALID_ALL 0xff + +CellBorderStyleControl::CellBorderStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel) +: svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE)), + mrCellAppearancePropertyPanel(rPanel), + maTBBorder1(this, ScResId(TB_BORDER1)), + maTBBorder2(this, ScResId(TB_BORDER2)), + maTBBorder3(this, ScResId(TB_BORDER3)), + maFL1(this, ScResId(FL_1)), + maFL2(this, ScResId(FL_2)), + mpImageList(0) +{ + Initialize(); + FreeResource(); +} + +CellBorderStyleControl::~CellBorderStyleControl(void) +{ + delete[] mpImageList; +} + +void CellBorderStyleControl::Initialize() +{ + mpImageList = new Image[16]; + mpImageList[0] = Image(ScResId(IMG_BORDER1)); + mpImageList[1] = Image(ScResId(IMG_BORDER2)); + mpImageList[2] = Image(ScResId(IMG_BORDER3)); + mpImageList[3] = Image(ScResId(IMG_BORDER4)); + mpImageList[4] = Image(ScResId(IMG_BORDER5)); + mpImageList[5] = Image(ScResId(IMG_BORDER6)); + mpImageList[6] = Image(ScResId(IMG_BORDER7)); + mpImageList[7] = Image(ScResId(IMG_BORDER8)); + mpImageList[8] = Image(ScResId(IMG_BORDER9)); + mpImageList[9] = Image(ScResId(IMG_BORDER10)); + mpImageList[10] = Image(ScResId(IMG_BORDER11)); + mpImageList[11] = Image(ScResId(IMG_BORDER12)); + mpImageList[12] = Image(ScResId(IMG_BORDER13)); + mpImageList[13] = Image(ScResId(IMG_BORDER14)); + mpImageList[14] = Image(ScResId(IMG_BORDER15)); + mpImageList[15] = Image(ScResId(IMG_BORDER16)); + + maTBBorder1.SetItemImage(TBI_BORDER1_NONE, mpImageList[0]); + maTBBorder1.SetItemImage(TBI_BORDER1_ALL, mpImageList[1]); + maTBBorder1.SetItemImage(TBI_BORDER1_OUTER, mpImageList[2]); + maTBBorder1.SetItemImage(TBI_BORDER1_OUTERBOLD, mpImageList[3]); + maTBBorder1.SetBackground(Wallpaper()); + maTBBorder1.SetPaintTransparent(true); + Size aTbxSize( maTBBorder1.CalcWindowSizePixel() ); + maTBBorder1.SetOutputSizePixel( aTbxSize ); + Link aLink = LINK(this, CellBorderStyleControl, TB1SelectHdl); + maTBBorder1.SetSelectHdl ( aLink ); + + maTBBorder2.SetLineCount(2); + maTBBorder2.InsertItem(TBI_BORDER2_LEFT, mpImageList[4]); + maTBBorder2.InsertItem(TBI_BORDER2_RIGHT, mpImageList[5]); + maTBBorder2.InsertItem(TBI_BORDER2_TOP, mpImageList[6]); + maTBBorder2.InsertItem(TBI_BORDER2_BOT, mpImageList[7]); + maTBBorder2.InsertBreak(); + maTBBorder2.InsertItem(TBI_BORDER2_BLTR, mpImageList[8]); + maTBBorder2.InsertItem(TBI_BORDER2_TLBR, mpImageList[9]); + maTBBorder2.InsertItem(TBI_BORDER2_TOPBOT, mpImageList[10]); + maTBBorder2.InsertItem(TBI_BORDER2_LEFTRIGHT, mpImageList[11]); + maTBBorder2.SetBackground(Wallpaper()); + maTBBorder2.SetPaintTransparent(true); + aTbxSize = maTBBorder2.CalcWindowSizePixel() ; + maTBBorder2.SetOutputSizePixel( aTbxSize ); + maTBBorder2.SetHelpId(TBI_BORDER2_LEFT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFT); + maTBBorder2.SetHelpId(TBI_BORDER2_RIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_RIGHT); + maTBBorder2.SetHelpId(TBI_BORDER2_TOP, HID_PROPERTYPANEL_SC_BORDER_TBI_TOP); + maTBBorder2.SetHelpId(TBI_BORDER2_BOT, HID_PROPERTYPANEL_SC_BORDER_TBI_BOT); + maTBBorder2.SetHelpId(TBI_BORDER2_BLTR, HID_PROPERTYPANEL_SC_BORDER_TBI_BLTR); + maTBBorder2.SetHelpId(TBI_BORDER2_TLBR, HID_PROPERTYPANEL_SC_BORDER_TBI_TLBR); + maTBBorder2.SetHelpId(TBI_BORDER2_TOPBOT, HID_PROPERTYPANEL_SC_BORDER_TBI_TOPBOT); + maTBBorder2.SetHelpId(TBI_BORDER2_LEFTRIGHT, HID_PROPERTYPANEL_SC_BORDER_TBI_LEFTRIGHT); + maTBBorder2.SetItemText(TBI_BORDER2_LEFT, ScResId(STR_BORDER_1)); + maTBBorder2.SetItemText(TBI_BORDER2_RIGHT, ScResId(STR_BORDER_2)); + maTBBorder2.SetItemText(TBI_BORDER2_TOP, ScResId(STR_BORDER_3)); + maTBBorder2.SetItemText(TBI_BORDER2_BOT, ScResId(STR_BORDER_4)); + maTBBorder2.SetItemText(TBI_BORDER2_BLTR, ScResId(STR_BORDER_5)); + maTBBorder2.SetItemText(TBI_BORDER2_TLBR, ScResId(STR_BORDER_6)); + maTBBorder2.SetItemText(TBI_BORDER2_TOPBOT, ScResId(STR_BORDER_7)); + maTBBorder2.SetItemText(TBI_BORDER2_LEFTRIGHT, ScResId(STR_BORDER_8)); + aLink = LINK(this, CellBorderStyleControl, TB2SelectHdl); + maTBBorder2.SetSelectHdl ( aLink ); + + maTBBorder3.SetItemImage(TBI_BORDER3_S1, mpImageList[12]); + maTBBorder3.SetItemImage(TBI_BORDER3_S2, mpImageList[13]); + maTBBorder3.SetItemImage(TBI_BORDER3_S3, mpImageList[14]); + maTBBorder3.SetItemImage(TBI_BORDER3_S4, mpImageList[15]); + maTBBorder3.SetBackground(Wallpaper()); + maTBBorder3.SetPaintTransparent(true); + aTbxSize = maTBBorder3.CalcWindowSizePixel() ; + maTBBorder3.SetOutputSizePixel( aTbxSize ); + aLink = LINK(this, CellBorderStyleControl, TB3SelectHdl); + maTBBorder3.SetSelectHdl ( aLink ); +} + +IMPL_LINK(CellBorderStyleControl, TB1SelectHdl, ToolBox*, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + ::Color aColBlack( COL_BLACK ); + SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); + SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); + editeng::SvxBorderLine theDefLine(NULL, 1); + editeng::SvxBorderLine *pLeft = 0, *pRight = 0, *pTop = 0, *pBottom = 0; + sal_uInt8 nValidFlags = 0; + switch ( nId ) + { + case TBI_BORDER1_NONE: + { + nValidFlags |= FRM_VALID_ALL; + SvxLineItem aLineItem1( SID_ATTR_BORDER_DIAG_BLTR ); + SvxLineItem aLineItem2( SID_ATTR_BORDER_DIAG_TLBR ); + aLineItem1.SetLine( NULL ); //modify + aLineItem2.SetLine( NULL ); //modify + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem1, 0L); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem2, 0L); + } + break; + case TBI_BORDER1_ALL: + pLeft = pRight = pTop = pBottom = &theDefLine; + aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI ); + aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT ); + nValidFlags |= FRM_VALID_ALL; + break; + case TBI_BORDER1_OUTER: + pLeft = pRight = pTop = pBottom = &theDefLine; + nValidFlags |= FRM_VALID_OUTER; + break; + case TBI_BORDER1_OUTERBOLD: + theDefLine.SetWidth(DEF_LINE_WIDTH_2); + pLeft = pRight = pTop = pBottom = &theDefLine; + nValidFlags |= FRM_VALID_OUTER; + break; + } + + aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); + aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); + aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); + aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + + aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); + aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( VALID_DISTANCE, true ); + aBorderInner.SetValid( VALID_DISABLE, false ); + + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); + mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); + return 0; +} + +IMPL_LINK(CellBorderStyleControl, TB2SelectHdl, ToolBox *, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + if( nId != TBI_BORDER2_BLTR && nId != TBI_BORDER2_TLBR ) + { + ::Color aColBlack( COL_BLACK ); + SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); + SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); + editeng::SvxBorderLine theDefLine(NULL, 1); + editeng::SvxBorderLine *pLeft = 0, + *pRight = 0, + *pTop = 0, + *pBottom = 0; + sal_uInt8 nValidFlags = 0; + switch ( nId ) + { + case TBI_BORDER2_LEFT: + pLeft = &theDefLine; + nValidFlags |= FRM_VALID_LEFT; + break; + case TBI_BORDER2_RIGHT: + // + if(!Application::GetSettings().GetLayoutRTL()) + { + pRight = &theDefLine; + nValidFlags |= FRM_VALID_RIGHT; + } + else + { + pLeft = &theDefLine; + nValidFlags |= FRM_VALID_LEFT; + } + break; + case TBI_BORDER2_TOP: + pTop = &theDefLine; + nValidFlags |= FRM_VALID_TOP; + break; + case TBI_BORDER2_BOT: + pBottom = &theDefLine; + nValidFlags |= FRM_VALID_BOTTOM; + break; + case TBI_BORDER2_TOPBOT: + pTop = pBottom = &theDefLine; + nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; + break; + case TBI_BORDER2_LEFTRIGHT: + pLeft = pRight = &theDefLine; + nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT; + break; + } + aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT ); + aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT ); + aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); + aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + + aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); + aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( VALID_DISTANCE, true ); + aBorderInner.SetValid( VALID_DISABLE, false ); + + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); + } + else if(nId == TBI_BORDER2_BLTR) + { + editeng::SvxBorderLine aTmp( NULL, 1 ); + SvxLineItem aLineItem( SID_ATTR_BORDER_DIAG_BLTR ); + aLineItem.SetLine( &aTmp ); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_BLTR, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + else if(nId == TBI_BORDER2_TLBR) + { + editeng::SvxBorderLine aTmp( NULL, 1 ); + SvxLineItem aLineItem( SID_ATTR_BORDER_DIAG_TLBR ); + aLineItem.SetLine( &aTmp ); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER_DIAG_TLBR, SFX_CALLMODE_RECORD, &aLineItem, 0L); + } + + mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); + return 0; +} + +IMPL_LINK(CellBorderStyleControl, TB3SelectHdl, ToolBox *, pToolBox) +{ + sal_uInt16 nId = pToolBox->GetCurItemId(); + + ::Color aColBlack( COL_BLACK ); + SvxBoxItem aBorderOuter( SID_ATTR_BORDER_OUTER ); + SvxBoxInfoItem aBorderInner( SID_ATTR_BORDER_INNER ); + editeng::SvxBorderLine *pTop = 0 , + *pBottom = 0 ; + sal_uInt8 nValidFlags = 0; + using namespace ::com::sun::star::table::BorderLineStyle; + + //FIXME: properly adapt to new line border model + + switch ( nId ) + { + case TBI_BORDER3_S1: + pBottom = new editeng::SvxBorderLine(NULL, DEF_LINE_WIDTH_2 ); + nValidFlags |= FRM_VALID_BOTTOM; + break; + case TBI_BORDER3_S2: + pBottom = new editeng::SvxBorderLine(NULL); + pBottom->GuessLinesWidths(DOUBLE, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_1); + nValidFlags |= FRM_VALID_BOTTOM; + break; + case TBI_BORDER3_S3: + pBottom = new editeng::SvxBorderLine(NULL, DEF_LINE_WIDTH_2 ); + pTop = new editeng::SvxBorderLine(NULL, 1); + nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; + break; + case TBI_BORDER3_S4: + pBottom = new editeng::SvxBorderLine(NULL); + pBottom->GuessLinesWidths(DOUBLE, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_0, DEF_LINE_WIDTH_1); + pTop = new editeng::SvxBorderLine(NULL, 1); + nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP; + break; + } + + aBorderOuter.SetLine( pTop, BOX_LINE_TOP ); + aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM ); + aBorderOuter.SetLine( NULL, BOX_LINE_LEFT ); + aBorderOuter.SetLine( NULL, BOX_LINE_RIGHT ); + + aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT )); + aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( VALID_DISTANCE, true ); + aBorderInner.SetValid( VALID_DISABLE, false ); + + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_ATTR_BORDER, SFX_CALLMODE_RECORD, &aBorderOuter, &aBorderInner, 0L); + + delete pTop; + delete pBottom; + + mrCellAppearancePropertyPanel.EndCellBorderStylePopupMode(); + return 0; +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStyleControl.hxx b/sc/source/ui/sidebar/CellBorderStyleControl.hxx new file mode 100644 index 000000000000..8dd594094717 --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStyleControl.hxx @@ -0,0 +1,56 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX +#define SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX + +#include <svx/sidebar/PopupControl.hxx> +#include <vcl/button.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/fixed.hxx> + +namespace sc { namespace sidebar { + +class CellAppearancePropertyPanel; + +class CellBorderStyleControl : public svx::sidebar::PopupControl +{ +private: + CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; + ToolBox maTBBorder1; + ToolBox maTBBorder2; + ToolBox maTBBorder3; + FixedLine maFL1; + FixedLine maFL2; + Image* mpImageList; + + void Initialize(); + + DECL_LINK(TB1SelectHdl, ToolBox *); + DECL_LINK(TB2SelectHdl, ToolBox *); + DECL_LINK(TB3SelectHdl, ToolBox *); + +public: + CellBorderStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel); + virtual ~CellBorderStyleControl(void); +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_BORDER_STYLE_CONTROL_HXX + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStylePopup.cxx b/sc/source/ui/sidebar/CellBorderStylePopup.cxx new file mode 100644 index 000000000000..f3dd43aa9196 --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStylePopup.cxx @@ -0,0 +1,37 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "CellBorderStylePopup.hxx" +#include "CellLineStyleControl.hxx" + +namespace sc { namespace sidebar { + +CellBorderStylePopup::CellBorderStylePopup ( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator) +: Popup(pParent, rControlCreator, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellBorderStyle"))) +{ +} + +CellBorderStylePopup::~CellBorderStylePopup (void) +{ +} + +} } // end of namespace sc::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellBorderStylePopup.hxx b/sc/source/ui/sidebar/CellBorderStylePopup.hxx new file mode 100644 index 000000000000..1443a9682137 --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderStylePopup.hxx @@ -0,0 +1,39 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_ +#define _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_ + +#include <svx/sidebar/Popup.hxx> +#include <boost/function.hpp> + +namespace sc { namespace sidebar { + +class CellBorderStylePopup : public svx::sidebar::Popup +{ +public : + CellBorderStylePopup( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator); + virtual ~CellBorderStylePopup(void); +}; + +} } // end of namespace sc::sidebar + +#endif // _SC_SIDEBAR_CELL_BORDER_STYLE_POPUP_HXX_ + +// eof diff --git a/sc/source/ui/sidebar/CellBorderUpdater.cxx b/sc/source/ui/sidebar/CellBorderUpdater.cxx new file mode 100644 index 000000000000..e3182611e7ae --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderUpdater.cxx @@ -0,0 +1,122 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <CellBorderUpdater.hxx> +#include <vcl/bmpacc.hxx> +#include <vcl/svapp.hxx> + +namespace sc { namespace sidebar { + +CellBorderUpdater::CellBorderUpdater( + sal_uInt16 nTbxBtnId, + ToolBox& rTbx) +: mnBtnId(nTbxBtnId), + mrTbx(rTbx) +{ +} + +CellBorderUpdater::~CellBorderUpdater() +{ +} + +void CellBorderUpdater::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image aImg, bool bVer, bool bHor) +{ + BitmapEx aBmpEx( aImg.GetBitmapEx() ); + Bitmap aBmp( aBmpEx.GetBitmap() ); + BitmapWriteAccess* pBmpAcc = aBmp.AcquireWriteAccess(); + const Size maBmpSize = aBmp.GetSizePixel(); + + if( pBmpAcc ) + { + Bitmap aMsk; + BitmapWriteAccess* pMskAcc; + + if( aBmpEx.IsAlpha() ) + pMskAcc = ( aMsk = aBmpEx.GetAlpha().GetBitmap() ).AcquireWriteAccess(); + else if( aBmpEx.IsTransparent() ) + pMskAcc = ( aMsk = aBmpEx.GetMask() ).AcquireWriteAccess(); + else + pMskAcc = NULL; + + pBmpAcc->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ; + pBmpAcc->SetFillColor( COL_BLACK); + + if(maBmpSize.Width() == 43 && maBmpSize.Height() == 43) + { + Point aTL(2, 1), aTR(42,1), aBL(2, 41), aBR(42, 41), aHL(2,21), aHR(42, 21), aVT(22,1), aVB(22, 41); + if( pMskAcc ) + { + pMskAcc->SetLineColor( COL_BLACK ); + pMskAcc->SetFillColor( COL_BLACK ); + } + if(bLeft) + { + pBmpAcc->DrawLine( aTL,aBL ); + if( pMskAcc ) + pMskAcc->DrawLine( aTL,aBL ); + } + if(bRight) + { + pBmpAcc->DrawLine( aTR,aBR ); + if( pMskAcc ) + pMskAcc->DrawLine( aTR,aBR ); + } + if(bTop) + { + pBmpAcc->DrawLine( aTL,aTR ); + if( pMskAcc ) + pMskAcc->DrawLine( aTL,aTR ); + } + if(bBot) + { + pBmpAcc->DrawLine( aBL,aBR ); + if( pMskAcc ) + pMskAcc->DrawLine( aBL,aBR ); + } + if(bVer) + { + pBmpAcc->DrawLine( aVT,aVB ); + if( pMskAcc ) + pMskAcc->DrawLine( aVT,aVB ); + } + if(bHor) + { + pBmpAcc->DrawLine( aHL,aHR ); + if( pMskAcc ) + pMskAcc->DrawLine( aHL,aHR ); + } + } + + aBmp.ReleaseAccess( pBmpAcc ); + if( pMskAcc ) + aMsk.ReleaseAccess( pMskAcc ); + + if( aBmpEx.IsAlpha() ) + aBmpEx = BitmapEx( aBmp, AlphaMask( aMsk ) ); + else if( aBmpEx.IsTransparent() ) + aBmpEx = BitmapEx( aBmp, aMsk ); + else + aBmpEx = aBmp; + + mrTbx.SetItemImage( mnBtnId, Image( aBmpEx ) ); + } +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellBorderUpdater.hxx b/sc/source/ui/sidebar/CellBorderUpdater.hxx new file mode 100644 index 000000000000..fcb02447c4fe --- /dev/null +++ b/sc/source/ui/sidebar/CellBorderUpdater.hxx @@ -0,0 +1,42 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_SIDEBAR_CELL_BORDER_UPDATER_HXX +#define SC_SIDEBAR_CELL_BORDER_UPDATER_HXX + +#include <vcl/toolbox.hxx> + +namespace sc { namespace sidebar { + +class CellBorderUpdater +{ +private: + sal_uInt16 mnBtnId; + ToolBox& mrTbx; + +public: + CellBorderUpdater(sal_uInt16 nTbxBtnId, ToolBox& rTbx); + ~CellBorderUpdater(); + + void UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image aImg, bool bVer, bool bHor); +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_BORDER_UPDATER_HXX + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleControl.cxx b/sc/source/ui/sidebar/CellLineStyleControl.cxx new file mode 100644 index 000000000000..339eff356dfb --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleControl.cxx @@ -0,0 +1,254 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <CellLineStyleControl.hxx> +#include "sc.hrc" +#include "scresid.hxx" +#include <CellAppearancePropertyPanel.hrc> +#include <CellLineStyleValueSet.hxx> +#include <vcl/i18nhelp.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/borderline.hxx> +#include <editeng/lineitem.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> + +namespace sc { namespace sidebar { + +CellLineStyleControl::CellLineStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel) +: svx::sidebar::PopupControl(pParent, ScResId(RID_POPUPPANEL_APPEARANCE_CELL_LINESTYLE)), + mrCellAppearancePropertyPanel(rPanel), + maPushButtonMoreOptions(this, ScResId(PB_OPTIONS)), + maCellLineStyleValueSet(this, ScResId(VS_STYLE)), + mpStr(0), + mbVSfocus(true) +{ + Initialize(); + FreeResource(); +} + +CellLineStyleControl::~CellLineStyleControl(void) +{ + delete[] mpStr; +} + +void CellLineStyleControl::Initialize() +{ + //maPushButtonMoreOptions.SetIcoPosX(2); + Link aLink = LINK(this, CellLineStyleControl, PBClickHdl); + maPushButtonMoreOptions.SetClickHdl(aLink); + + maCellLineStyleValueSet.SetStyle(maCellLineStyleValueSet.GetStyle()| WB_3DLOOK | WB_NO_DIRECTSELECT); + maCellLineStyleValueSet.SetControlBackground(GetSettings().GetStyleSettings().GetMenuColor()); + maCellLineStyleValueSet.SetColor(GetSettings().GetStyleSettings().GetMenuColor()); + + for(sal_uInt16 i = 1 ; i <= 9 ; i++) + { + maCellLineStyleValueSet.InsertItem(i); + } + + mpStr = new XubString[9]; + mpStr[0] = GetSettings().GetLocaleI18nHelper().GetNum( 5, 2 ).AppendAscii("pt"); + mpStr[1] = GetSettings().GetLocaleI18nHelper().GetNum( 250, 2 ).AppendAscii("pt"); + mpStr[2] = GetSettings().GetLocaleI18nHelper().GetNum( 400, 2 ).AppendAscii("pt"); + mpStr[3] = GetSettings().GetLocaleI18nHelper().GetNum( 500, 2 ).AppendAscii("pt"); + mpStr[4] = GetSettings().GetLocaleI18nHelper().GetNum( 110, 2 ).AppendAscii("pt"); + mpStr[5] = GetSettings().GetLocaleI18nHelper().GetNum( 260, 2 ).AppendAscii("pt"); + mpStr[6] = GetSettings().GetLocaleI18nHelper().GetNum( 450, 2 ).AppendAscii("pt"); + mpStr[7] = GetSettings().GetLocaleI18nHelper().GetNum( 505, 2 ).AppendAscii("pt"); + mpStr[8] = GetSettings().GetLocaleI18nHelper().GetNum( 750, 2 ).AppendAscii("pt"); + maCellLineStyleValueSet.SetUnit(mpStr); + + for(sal_uInt16 i = 1 ; i <= 9 ; i++) + { + maCellLineStyleValueSet.SetItemText(i, mpStr[i-1]); + } + + SetAllNoSel(); + aLink = LINK(this, CellLineStyleControl, VSSelectHdl); + maCellLineStyleValueSet.SetSelectHdl(aLink); + maCellLineStyleValueSet.StartSelection(); + maCellLineStyleValueSet.Show(); +} + +void CellLineStyleControl::GetFocus() +{ + if(!mbVSfocus) + { + maPushButtonMoreOptions.GrabFocus(); + } + else + { + maCellLineStyleValueSet.GrabFocus(); + } +} + +void CellLineStyleControl::SetAllNoSel() +{ + maCellLineStyleValueSet.SelectItem(0); + maCellLineStyleValueSet.SetNoSelection(); + maCellLineStyleValueSet.Format(); + Invalidate(); + maCellLineStyleValueSet.StartSelection(); +} + +IMPL_LINK(CellLineStyleControl, VSSelectHdl, void *, pControl) +{ + if(pControl == &maCellLineStyleValueSet) + { + const sal_uInt16 iPos(maCellLineStyleValueSet.GetSelectItemId()); + SvxLineItem aLineItem(SID_FRAME_LINESTYLE); + using namespace ::com::sun::star::table::BorderLineStyle; + editeng::SvxBorderStyle nStyle = SOLID; + sal_uInt16 n1 = 0; + sal_uInt16 n2 = 0; + sal_uInt16 n3 = 0; + + //FIXME: fully for new border line possibilities + + switch(iPos) + { + case 1: + n1 = DEF_LINE_WIDTH_0; + break; + case 2: + n1 = DEF_LINE_WIDTH_2; + break; + case 3: + n1 = DEF_LINE_WIDTH_3; + break; + case 4: + n1 = DEF_LINE_WIDTH_4; + break; + case 5: + n1 = DEF_LINE_WIDTH_0; + n2 = DEF_LINE_WIDTH_0; + n3 = DEF_LINE_WIDTH_1; + nStyle = DOUBLE; + break; + case 6: + n1 = DEF_LINE_WIDTH_0; + n2 = DEF_LINE_WIDTH_0; + n3 = DEF_LINE_WIDTH_2; + nStyle = DOUBLE; + break; + case 7: + n1 = DEF_LINE_WIDTH_1; + n2 = DEF_LINE_WIDTH_2; + n3 = DEF_LINE_WIDTH_1; + nStyle = DOUBLE; + break; + case 8: + n1 = DEF_LINE_WIDTH_2; + n2 = DEF_LINE_WIDTH_0; + n3 = DEF_LINE_WIDTH_2; + nStyle = DOUBLE; + break; + case 9: + n1 = DEF_LINE_WIDTH_2; + n2 = DEF_LINE_WIDTH_2; + n3 = DEF_LINE_WIDTH_2; + nStyle = DOUBLE; + break; + default: + break; + } + + editeng::SvxBorderLine aTmp; + aTmp.GuessLinesWidths(nStyle, n1, n2, n3); + aLineItem.SetLine( &aTmp ); + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_FRAME_LINESTYLE, SFX_CALLMODE_RECORD, &aLineItem, 0L); + SetAllNoSel(); + mrCellAppearancePropertyPanel.EndCellLineStylePopupMode(); + } + + return(0L); +} + +IMPL_LINK(CellLineStyleControl, PBClickHdl, PushButton *, pPBtn) +{ + if(pPBtn == &maPushButtonMoreOptions) + { + if(mrCellAppearancePropertyPanel.GetBindings()) + { + mrCellAppearancePropertyPanel.GetBindings()->GetDispatcher()->Execute(SID_CELL_FORMAT_BORDER, SFX_CALLMODE_ASYNCHRON); + } + + mrCellAppearancePropertyPanel.EndCellLineStylePopupMode(); + } + + return 0; +} + +void CellLineStyleControl::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis) +{ + SetAllNoSel(); + mbVSfocus = true; + + //FIXME: fully for new border line possibilities + + if(out == DEF_LINE_WIDTH_0 && in == 0 && dis == 0) //1 + { + maCellLineStyleValueSet.SetSelItem(1); + } + else if(out == DEF_LINE_WIDTH_2 && in == 0 && dis == 0) //2 + { + maCellLineStyleValueSet.SetSelItem(2); + } + else if(out == DEF_LINE_WIDTH_3 && in == 0 && dis == 0) //3 + { + maCellLineStyleValueSet.SetSelItem(3); + } + else if(out == DEF_LINE_WIDTH_4 && in == 0 && dis == 0) //4 + { + maCellLineStyleValueSet.SetSelItem(4); + } + else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_1) //5 + { + maCellLineStyleValueSet.SetSelItem(5); + } + else if(out == DEF_LINE_WIDTH_0 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //6 + { + maCellLineStyleValueSet.SetSelItem(6); + } + else if(out == DEF_LINE_WIDTH_1 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_1) //7 + { + maCellLineStyleValueSet.SetSelItem(7); + } + else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_0 && dis == DEF_LINE_WIDTH_2) //8 + { + maCellLineStyleValueSet.SetSelItem(8); + } + else if(out == DEF_LINE_WIDTH_2 && in == DEF_LINE_WIDTH_2 && dis == DEF_LINE_WIDTH_2) //9 + { + maCellLineStyleValueSet.SetSelItem(9); + } + else + { + maCellLineStyleValueSet.SetSelItem(0); + mbVSfocus = false; + } + + maCellLineStyleValueSet.Format(); + maCellLineStyleValueSet.StartSelection(); +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleControl.hxx b/sc/source/ui/sidebar/CellLineStyleControl.hxx new file mode 100644 index 000000000000..d7d47dad1f18 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleControl.hxx @@ -0,0 +1,68 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX +#define SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX + +#include <svx/sidebar/PopupControl.hxx> +#include <vcl/button.hxx> +#include <CellLineStyleValueSet.hxx> + +namespace sc { namespace sidebar { + +class CellAppearancePropertyPanel; + +class CellLineStyleControl : public svx::sidebar::PopupControl +{ +private: + CellAppearancePropertyPanel& mrCellAppearancePropertyPanel; + PushButton maPushButtonMoreOptions; + CellLineStyleValueSet maCellLineStyleValueSet; + XubString* mpStr; + + /// bitfield + bool mbVSfocus : 1; + + void Initialize(); + void SetAllNoSel(); + + DECL_LINK(VSSelectHdl, void*); + DECL_LINK(PBClickHdl, PushButton*); + +public: + CellLineStyleControl(Window* pParent, CellAppearancePropertyPanel& rPanel); + virtual ~CellLineStyleControl(void); + + void GetFocus(); + void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis); + + ValueSet& GetValueSet() + { + return maCellLineStyleValueSet; + } + + Control& GetPushButton() + { + return maPushButtonMoreOptions; + } +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_LINE_STYLE_CONTROL_HXX + +// eof diff --git a/sc/source/ui/sidebar/CellLineStylePopup.cxx b/sc/source/ui/sidebar/CellLineStylePopup.cxx new file mode 100644 index 000000000000..23f80d9a44e3 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStylePopup.cxx @@ -0,0 +1,49 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "CellLineStylePopup.hxx" +#include "CellLineStyleControl.hxx" + +namespace sc { namespace sidebar { + +CellLineStylePopup::CellLineStylePopup ( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator) +: Popup(pParent, rControlCreator, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CellLineStyle"))) +{ +} + +CellLineStylePopup::~CellLineStylePopup (void) +{ +} + +void CellLineStylePopup::SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis) +{ + ProvideContainerAndControl(); + + CellLineStyleControl* pControl = dynamic_cast< CellLineStyleControl* >(mpControl.get()); + + if(pControl) + { + pControl->SetLineStyleSelect(out, in, dis); + } +} + +} } // end of namespace sc::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellLineStylePopup.hxx b/sc/source/ui/sidebar/CellLineStylePopup.hxx new file mode 100644 index 000000000000..8401dee217dc --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStylePopup.hxx @@ -0,0 +1,41 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_ +#define _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_ + +#include <svx/sidebar/Popup.hxx> +#include <boost/function.hpp> + +namespace sc { namespace sidebar { + +class CellLineStylePopup : public svx::sidebar::Popup +{ +public : + CellLineStylePopup( + Window* pParent, + const ::boost::function<svx::sidebar::PopupControl*(svx::sidebar::PopupContainer*)>& rControlCreator); + virtual ~CellLineStylePopup(void); + + void SetLineStyleSelect(sal_uInt16 out, sal_uInt16 in, sal_uInt16 dis); +}; + +} } // end of namespace sc::sidebar + +#endif // _SC_SIDEBAR_CELL_LINE_STYLE_POPUP_HXX_ + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.cxx b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx new file mode 100644 index 000000000000..4f823f029841 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.cxx @@ -0,0 +1,179 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <CellLineStyleValueSet.hxx> +#include <i18nlangtag/mslangid.hxx> + +namespace sc { namespace sidebar { + +CellLineStyleValueSet::CellLineStyleValueSet( Window* pParent, const ResId& rResId) +: ValueSet( pParent, rResId ), + pVDev(NULL), + nSelItem(0), + bCusEnable(false) +{ + strUnit = new XubString[9]; + SetColCount( 1 ); + SetLineCount( 9); +} + +CellLineStyleValueSet::~CellLineStyleValueSet() +{ + delete pVDev; + delete[] strUnit; +} + +void CellLineStyleValueSet::SetUnit(XubString* str) +{ + for(int i = 0; i < 9; i++) + { + strUnit[i] = str[i]; + } +} + +void CellLineStyleValueSet::SetSelItem(sal_uInt16 nSel) +{ + nSelItem = nSel; + if(nSel == 0) + { + SelectItem(1); + SetNoSelection(); + } + else + { + SelectItem(nSelItem); + GrabFocus(); + } +} + +sal_uInt16 CellLineStyleValueSet::GetSelItem() +{ + return nSelItem; +} + +void CellLineStyleValueSet::SetImage(Image img) +{ + imgCus = img; +} + +void CellLineStyleValueSet::SetCusEnable(bool bEnable) +{ + bCusEnable = bEnable; +} + +void CellLineStyleValueSet::UserDraw( const UserDrawEvent& rUDEvt ) +{ + Rectangle aRect = rUDEvt.GetRect(); + OutputDevice* pDev = rUDEvt.GetDevice(); + sal_uInt16 nItemId = rUDEvt.GetItemId(); + + long nRectHeight = aRect.GetHeight(); + long nRectWidth = aRect.GetWidth(); + Point aBLPos = aRect.TopLeft(); + + Font aOldFont = pDev->GetFont(); + Color aOldColor = pDev->GetLineColor(); + Color aOldFillColor = pDev->GetFillColor(); + + Font aFont(OutputDevice::GetDefaultFont(DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE)); + Size aSize = aFont.GetSize(); + aSize.Height() = nRectHeight*3/5; + aFont.SetSize( aSize ); + + Point aLineStart(aBLPos.X() + 5, aBLPos.Y() + ( nRectHeight - nItemId )/2); + Point aLineEnd(aBLPos.X() + nRectWidth * 7 / 9 - 15, aBLPos.Y() + ( nRectHeight - nItemId )/2); + long nTLX = aBLPos.X() + 5, nTLY = aBLPos.Y() + ( nRectHeight - nItemId )/2; + long nTRX = aBLPos.X() + nRectWidth * 7 / 9 - 15, nTRY = aBLPos.Y() + ( nRectHeight - nItemId )/2; + + if( nSelItem == nItemId ) + { + Color aBackColor(50,107,197); + Rectangle aBackRect = aRect; + aBackRect.Top() += 3; + aBackRect.Bottom() -= 2; + pDev->SetFillColor(aBackColor); + pDev->DrawRect(aBackRect); + } + else + { + pDev->SetFillColor( COL_TRANSPARENT ); + pDev->DrawRect(aRect); + } + + //draw text + if(nSelItem == nItemId ) + aFont.SetColor(COL_WHITE); + else + aFont.SetColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + + pDev->SetFont(aFont); + Point aStart(aBLPos.X() + nRectWidth * 7 / 9 - 5 , aBLPos.Y() + nRectHeight/6); + pDev->DrawText(aStart, strUnit[ nItemId - 1 ]); //can't set TEXT_DRAW_ENDELLIPSIS here, or the text will disapear + + //draw line + if( nSelItem == nItemId ) + { + pDev->SetFillColor(COL_WHITE); + pDev->SetLineColor(COL_WHITE); + } + else + { + pDev->SetFillColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + pDev->SetLineColor(GetSettings().GetStyleSettings().GetFieldTextColor()); //high contrast + } + + switch( nItemId ) + { + case 1: + case 2: + case 3: + case 4: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + nItemId * 2 - 1 )); + break; + case 5: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 4 )); + break; + case 6: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 )); + break; + case 7: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 1 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 3 , nTRX, nTRY + 6 )); + break; + case 8: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 3 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 6 )); + break; + case 9: + pDev->DrawRect(Rectangle(nTLX, nTLY , nTRX, nTRY + 3 )); + pDev->DrawRect(Rectangle(nTLX, nTLY + 5 , nTRX, nTRY + 8 )); + break; + } + + Invalidate( aRect ); + pDev->SetLineColor(aOldColor); + pDev->SetFillColor(aOldFillColor); + pDev->SetFont(aOldFont); + +} + +} } // end of namespace svx::sidebar + +// eof diff --git a/sc/source/ui/sidebar/CellLineStyleValueSet.hxx b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx new file mode 100644 index 000000000000..ebdfa53f2956 --- /dev/null +++ b/sc/source/ui/sidebar/CellLineStyleValueSet.hxx @@ -0,0 +1,50 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX +#define SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX + +#include <svtools/valueset.hxx> +#include <vcl/image.hxx> + +namespace sc { namespace sidebar { + +class CellLineStyleValueSet : public ValueSet +{ +private: + VirtualDevice* pVDev; + sal_uInt16 nSelItem; + XubString* strUnit; + Image imgCus; + bool bCusEnable; +public: + CellLineStyleValueSet( Window* pParent, const ResId& rResId); + virtual ~CellLineStyleValueSet(); + + void SetUnit(XubString* str); + void SetSelItem(sal_uInt16 nSel); + sal_uInt16 GetSelItem(); + void SetImage(Image img); + void SetCusEnable(bool bEnable); + virtual void UserDraw( const UserDrawEvent& rUDEvt ); +}; + +} } // end of namespace svx::sidebar + +#endif // SC_SIDEBAR_CELL_LINE_STYLE_VALUE_SET_HXX + +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx new file mode 100644 index 000000000000..2f5a805b3043 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -0,0 +1,384 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include <sfx2/sidebar/Theme.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <NumberFormatPropertyPanel.hxx> +#include <NumberFormatPropertyPanel.hrc> +#include "sc.hrc" +#include "scresid.hxx" +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/fixed.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#include <vcl/toolbox.hxx> +#include <svl/intitem.hxx> +#include <svl/stritem.hxx> + +using namespace css; +using namespace cssu; + +#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) + +////////////////////////////////////////////////////////////////////////////// +// namespace open + +namespace sc { namespace sidebar { + +////////////////////////////////////////////////////////////////////////////// + +NumberFormatPropertyPanel::NumberFormatPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +: Control( + pParent, + ScResId(RID_PROPERTYPANEL_SC_NUMBERFORMAT)), + mpFtCategory(new FixedText(this, ScResId(FT_CATEGORY))), + mpLbCategory(new ListBox(this, ScResId(LB_CATEGORY))), + mpTBCategoryBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)), + mpTBCategory(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCategoryBackground.get(), ScResId(TBX_CATEGORY))), + mpFtDecimals(new FixedText(this, ScResId(FT_DECIMALS))), + mpEdDecimals(new NumericField(this, ScResId(ED_DECIMALS))), + mpFtLeadZeroes(new FixedText(this, ScResId(FT_LEADZEROES))), + mpEdLeadZeroes(new NumericField(this, ScResId(ED_LEADZEROES))), + mpBtnNegRed(new CheckBox(this, ScResId(BTN_NEGRED))), + mpBtnThousand(new CheckBox(this, ScResId(BTN_THOUSAND))), + maNumFormatControl(SID_NUMBER_TYPE_FORMAT, *pBindings, *this), + + // Caution! SID_NUMBER_FORMAT is reworked in symphony code, may be needed (!) If + // yes, grep for it in SC and symphony (!) + maFormatControl(SID_NUMBER_FORMAT, *pBindings, *this), + + maImgNumber(ScResId(IMG_NUMBER)), + maImgPercent(ScResId(IMG_PERCENT)), + maImgCurrency(ScResId(IMG_CURRENCY)), + maImgDate(ScResId(IMG_DATE)), + maImgText(ScResId(IMG_TEXT)), + mnCategorySelected(0), + mxFrame(rxFrame), + maContext(), + mpBindings(pBindings) +{ + Initialize(); + FreeResource(); +} + +////////////////////////////////////////////////////////////////////////////// + +NumberFormatPropertyPanel::~NumberFormatPropertyPanel() +{ + // Destroy the toolboxes, then their background windows. + mpTBCategory.reset(); + mpTBCategoryBackground.reset(); +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::Initialize() +{ + Link aLink = LINK(this, NumberFormatPropertyPanel, NumFormatSelectHdl); + mpLbCategory->SetSelectHdl ( aLink ); + mpLbCategory->SelectEntryPos(0); + mpLbCategory->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Category"))); //wj acc + mpLbCategory->SetDropDownLineCount(mpLbCategory->GetEntryCount()); + + mpTBCategory->SetItemImage(ID_NUMBER, maImgNumber); + mpTBCategory->SetItemImage(ID_PERCENT, maImgPercent); + mpTBCategory->SetItemImage(ID_CURRENCY, maImgCurrency); + mpTBCategory->SetItemImage(ID_DATE, maImgDate); + mpTBCategory->SetItemImage(ID_TEXT, maImgText); + Size aTbxSize( mpTBCategory->CalcWindowSizePixel() ); + mpTBCategory->SetOutputSizePixel( aTbxSize ); + mpTBCategory->SetBackground(Wallpaper()); + mpTBCategory->SetPaintTransparent(true); + aLink = LINK(this, NumberFormatPropertyPanel, NumFormatHdl); + mpTBCategory->SetSelectHdl ( aLink ); + + aLink = LINK(this, NumberFormatPropertyPanel, NumFormatValueHdl); + + mpEdDecimals->SetModifyHdl( aLink ); + mpEdLeadZeroes->SetModifyHdl( aLink ); + mpEdDecimals->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Decimal Places"))); //wj acc + mpEdLeadZeroes->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Leading Zeroes"))); //wj acc + mpBtnNegRed->SetClickHdl( aLink ); + mpBtnThousand->SetClickHdl( aLink ); + + mpLbCategory->SetAccessibleRelationLabeledBy(mpFtCategory.get()); + mpTBCategory->SetAccessibleRelationLabeledBy(mpTBCategory.get()); + mpEdDecimals->SetAccessibleRelationLabeledBy(mpFtDecimals.get()); + mpEdLeadZeroes->SetAccessibleRelationLabeledBy(mpFtLeadZeroes.get()); +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( NumberFormatPropertyPanel, NumFormatHdl, ToolBox*, pBox ) +{ + sal_uInt16 nVal = pBox->GetCurItemId(); + sal_uInt16 nId = 0; + switch(nVal) + { + case ID_NUMBER: + nId = 1; + break; + case ID_PERCENT: + nId = 2; + break; + case ID_CURRENCY: + nId = 3; + break; + case ID_DATE: + nId = 4; + break; + case ID_TEXT: + nId = 9; + break; + default: + ; + } + if( nId != mnCategorySelected ) + { + SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT, nId ); + GetBindings()->GetDispatcher()->Execute(SID_NUMBER_TYPE_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L); + } + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( NumberFormatPropertyPanel, NumFormatSelectHdl, ListBox*, pBox ) +{ + sal_uInt16 nVal = pBox->GetSelectEntryPos(); + if( nVal != mnCategorySelected ) + { + SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT, nVal ); + GetBindings()->GetDispatcher()->Execute(SID_NUMBER_TYPE_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L); + mnCategorySelected = nVal; + } + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +IMPL_LINK( NumberFormatPropertyPanel, NumFormatValueHdl, void*, EMPTYARG ) +{ + String aFormat; + String sBreak = OUString(","); + bool bThousand = mpBtnThousand->IsEnabled() + && mpBtnThousand->IsChecked(); + bool bNegRed = mpBtnNegRed->IsEnabled() + && mpBtnNegRed->IsChecked(); + sal_uInt16 nPrecision = (mpEdDecimals->IsEnabled()) + ? (sal_uInt16)mpEdDecimals->GetValue() + : (sal_uInt16)0; + sal_uInt16 nLeadZeroes = (mpEdLeadZeroes->IsEnabled()) + ? (sal_uInt16)mpEdLeadZeroes->GetValue() + : (sal_uInt16)0; + + String sThousand = OUString::number(static_cast<sal_Int32>(bThousand)); + String sNegRed = OUString::number(static_cast<sal_Int32>(bNegRed)); + String sPrecision = OUString::number(nPrecision); + String sLeadZeroes = OUString::number(nLeadZeroes); + + aFormat += sThousand; + aFormat += sBreak; + aFormat += sNegRed; + aFormat += sBreak; + aFormat += sPrecision; + aFormat += sBreak; + aFormat += sLeadZeroes; + aFormat += sBreak; + + SfxStringItem aItem( SID_NUMBER_FORMAT, aFormat ); + GetBindings()->GetDispatcher()->Execute(SID_NUMBER_FORMAT, SFX_CALLMODE_RECORD, &aItem, 0L); + return 0L; +} + +////////////////////////////////////////////////////////////////////////////// + +NumberFormatPropertyPanel* NumberFormatPropertyPanel::Create ( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == NULL) + throw lang::IllegalArgumentException(A2S("no parent Window given to NumberFormatPropertyPanel::Create"), NULL, 0); + if ( ! rxFrame.is()) + throw lang::IllegalArgumentException(A2S("no XFrame given to NumberFormatPropertyPanel::Create"), NULL, 1); + if (pBindings == NULL) + throw lang::IllegalArgumentException(A2S("no SfxBindings given to NumberFormatPropertyPanel::Create"), NULL, 2); + + return new NumberFormatPropertyPanel( + pParent, + rxFrame, + pBindings); +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::DataChanged( + const DataChangedEvent& rEvent) +{ + (void)rEvent; +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext) +{ + if(maContext == aContext) + { + // Nothing to do. + return; + } + + maContext = aContext; + + + + // todo +} + +////////////////////////////////////////////////////////////////////////////// + +void NumberFormatPropertyPanel::NotifyItemUpdate( + sal_uInt16 nSID, + SfxItemState eState, + const SfxPoolItem* pState) +{ + switch(nSID) + { + case SID_NUMBER_TYPE_FORMAT: + { + if( eState >= SFX_ITEM_AVAILABLE) + { + const SfxInt16Item* pItem = (const SfxInt16Item*)pState; + sal_uInt16 nVal = pItem->GetValue(); + mnCategorySelected = nVal; + mpLbCategory->SelectEntryPos(nVal); + if( nVal < 4 ) + { + mpBtnThousand->Enable(); + mpBtnNegRed->Enable(); + mpEdDecimals->Enable(); + mpEdLeadZeroes->Enable(); + } + else + { + mpBtnThousand->Disable(); + mpBtnNegRed->Disable(); + mpEdDecimals->Disable(); + mpEdLeadZeroes->Disable(); + } + } + else + { + mpLbCategory->SetNoSelection(); + mnCategorySelected = 0; + mpBtnThousand->Disable(); + mpBtnNegRed->Disable(); + mpEdDecimals->Disable(); + mpEdLeadZeroes->Disable(); + } + } + break; + case SID_NUMBER_FORMAT: + { + bool bThousand = 0; + bool bNegRed = 0; + sal_uInt16 nPrecision = 0; + sal_uInt16 nLeadZeroes = 0; + if( eState >= SFX_ITEM_AVAILABLE) + { + const SfxStringItem* pItem = (const SfxStringItem*)pState; + String aCode = pItem->GetValue(); + /* if(aCode.Equals(String::CreateFromAscii("General"))) + { + mnCategorySelected = 0; + mpLbCategory->SelectEntryPos(0); + mpBtnThousand->Check(0); + mpBtnNegRed->Check(0); + mpEdDecimals->SetValue(0); + mpEdLeadZeroes->SetValue(1); + break; + } + else if( mpLbCategory->GetSelectEntryPos() == 0 ) + { + mnCategorySelected = 1; + mpLbCategory->SelectEntryPos(1); + }*/ + 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++; + } + bThousand = sFormat[0].ToInt32(); + bNegRed = sFormat[1].ToInt32(); + nPrecision = (sal_uInt16)sFormat[2].ToInt32(); + nLeadZeroes = (sal_uInt16)sFormat[3].ToInt32(); + delete[] sFormat; + } + else + { + bThousand = 0; + bNegRed = 0; + nPrecision = 0; + nLeadZeroes = 1; + } + mpBtnThousand->Check(bThousand); + mpBtnNegRed->Check(bNegRed); + mpEdDecimals->SetValue(nPrecision); + mpEdLeadZeroes->SetValue(nLeadZeroes); + } + default: + ; + } +} + +////////////////////////////////////////////////////////////////////////////// + +SfxBindings* NumberFormatPropertyPanel::GetBindings() +{ + return mpBindings; +} + +////////////////////////////////////////////////////////////////////////////// +// namespace close + +}} // end of namespace ::sc::sidebar + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc new file mode 100644 index 000000000000..13b17c32ef71 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc @@ -0,0 +1,70 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#define FT_CATEGORY 1 +#define LB_CATEGORY 2 +#define FT_DECIMALS 3 +#define ED_DECIMALS 4 +#define FT_LEADZEROES 5 +#define ED_LEADZEROES 6 +#define BTN_NEGRED 7 +#define BTN_THOUSAND 8 +#define TBX_CATEGORY 9 +#define ID_NUMBER 10 +#define ID_PERCENT 11 +#define ID_CURRENCY 12 +#define ID_DATE 13 +#define ID_TEXT 14 +#define IMG_NUMBER 15 +#define IMG_PERCENT 16 +#define IMG_CURRENCY 17 +#define IMG_DATE 18 +#define IMG_TEXT 19 + +//===============================================================position============================================= + +#define MBOX_WIDTH 28 +#define NF_TOOLBOX_ITEM_HEIGHT 12 +#define CHECKBOX_HEIGHT 10 + +#define FT_CATEGORY_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_CATEGORY_Y SECTIONPAGE_MARGIN_VERTICAL_TOP +#define LB_CATEGORY_X FT_CATEGORY_X +#define LB_CATEGORY_Y FT_CATEGORY_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define TBX_CATEGORY_X SECTIONPAGE_MARGIN_HORIZONTAL + 1 +#define TBX_CATEGORY_Y LB_CATEGORY_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define FT_DECIMALS_X SECTIONPAGE_MARGIN_HORIZONTAL +#define FT_DECIMALS_Y TBX_CATEGORY_Y + NF_TOOLBOX_ITEM_HEIGHT + 4 + CONTROL_SPACING_VERTICAL +#define LB_DECIMALS_X FT_CATEGORY_X +#define LB_DECIMALS_Y FT_DECIMALS_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define FT_LEADZEROES_X SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH*2 + CONTROL_SPACING_HORIZONTAL +#define FT_LEADZEROES_Y FT_DECIMALS_Y +#define LB_LEADZEROES_X FT_LEADZEROES_X +#define LB_LEADZEROES_Y FT_LEADZEROES_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL + +#define BTN_NEGRED_X SECTIONPAGE_MARGIN_HORIZONTAL +#define BTN_NEGRED_Y LB_LEADZEROES_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL + +#define BTN_THOUSAND_X SECTIONPAGE_MARGIN_HORIZONTAL +#define BTN_THOUSAND_Y BTN_NEGRED_Y + CHECKBOX_HEIGHT + CONTROL_SPACING_VERTICAL - 3 + +#define PROPERTYPAGE_HEIGHT BTN_THOUSAND_Y + CHECKBOX_HEIGHT + 2 + +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx new file mode 100644 index 000000000000..98102f476297 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx @@ -0,0 +1,104 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SC_PROPERTYPANEL_NUMFORMAT_HXX +#define SC_PROPERTYPANEL_NUMFORMAT_HXX + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <sfx2/sidebar/IContextChangeReceiver.hxx> +#include <boost/scoped_ptr.hpp> + +class FixedText; +class ListBox; +class NumericField; + +namespace sc { namespace sidebar { + +class NumberFormatPropertyPanel +: public Control, + public ::sfx2::sidebar::IContextChangeReceiver, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: +public: + static NumberFormatPropertyPanel* Create( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void DataChanged( + const DataChangedEvent& rEvent); + + virtual void HandleContextChange( + const ::sfx2::sidebar::EnumContext aContext); + + virtual void NotifyItemUpdate( + const sal_uInt16 nSId, + const SfxItemState eState, + const SfxPoolItem* pState); + + SfxBindings* GetBindings(); + +private: + //ui controls + ::boost::scoped_ptr< FixedText > mpFtCategory; + ::boost::scoped_ptr< ListBox > mpLbCategory; + ::boost::scoped_ptr< Window > mpTBCategoryBackground; + ::boost::scoped_ptr< ToolBox > mpTBCategory; + ::boost::scoped_ptr< FixedText > mpFtDecimals; + ::boost::scoped_ptr< NumericField > mpEdDecimals; + ::boost::scoped_ptr< FixedText > mpFtLeadZeroes; + ::boost::scoped_ptr< NumericField > mpEdLeadZeroes; + ::boost::scoped_ptr< CheckBox > mpBtnNegRed; + ::boost::scoped_ptr< CheckBox > mpBtnThousand; + + ::sfx2::sidebar::ControllerItem maNumFormatControl; + ::sfx2::sidebar::ControllerItem maFormatControl; + + // images + Image maImgNumber; + Image maImgPercent; + Image maImgCurrency; + Image maImgDate; + Image maImgText; + + sal_uInt16 mnCategorySelected; + + cssu::Reference<css::frame::XFrame> mxFrame; + ::sfx2::sidebar::EnumContext maContext; + SfxBindings* mpBindings; + + DECL_LINK(NumFormatHdl, ToolBox*); + DECL_LINK(NumFormatSelectHdl, ListBox*); + DECL_LINK(NumFormatValueHdl, void*); + + // constructor/destuctor + NumberFormatPropertyPanel( + Window* pParent, + const cssu::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~NumberFormatPropertyPanel(); + + void Initialize(); +}; + +} } // end of namespace ::sc::sidebar + +#endif + +// eof diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.src b/sc/source/ui/sidebar/NumberFormatPropertyPanel.src new file mode 100644 index 000000000000..2111a5ca233f --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.src @@ -0,0 +1,183 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include "NumberFormatPropertyPanel.hrc" +#include <sfx2/sidebar/ResourceDefinitions.hrc> +#include "sc.hrc" +#include "helpids.h" + +Control RID_PROPERTYPANEL_SC_NUMBERFORMAT +{ + OutputSize = TRUE; + DialogControl = TRUE; + Border = FALSE; + + Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PROPERTYPAGE_HEIGHT ); + HelpID = HID_PROPERTYPANEL_SC_NUM_SECTION ; + Text = "Number Format"; + + FixedText FT_CATEGORY + { + Pos = MAP_APPFONT ( FT_CATEGORY_X , FT_CATEGORY_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH*4 , TEXT_HEIGHT ) ; + Text [ en-US ] = "~Category:" ; + }; + ListBox LB_CATEGORY + { + Border = TRUE ; + Pos = MAP_APPFONT ( LB_CATEGORY_X , LB_CATEGORY_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH *2 , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_LB_CATEGORY; + QuickHelpText [ en-US ] = "Select a category of contents."; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "General" ; Default ; > ; + < "Number" ;> ; + < "Percent" ;> ; + < "Currency" ;> ; + < "Date" ;> ; + < "Time" ;> ; + < "Scientific" ;> ; + < "Fraction" ;> ; + < "Boolean Value" ;> ; + < "Text" ;> ; + }; + }; + ToolBox TBX_CATEGORY + { + Pos = MAP_APPFONT ( TBX_CATEGORY_X , TBX_CATEGORY_Y ); + SVLook = TRUE ; + Border = FALSE ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_TBX_CATEGORY; + Text = "Format"; + ItemList = + { + ToolBoxItem + { + Identifier = ID_NUMBER ; + Text [ en-US ] = "Number" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_NUMBER; + }; + ToolBoxItem + { + Identifier = ID_PERCENT ; + Text [ en-US ] = "Percent" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_PERCENT; + }; + ToolBoxItem + { + Identifier = ID_CURRENCY ; + Text [ en-US ] = "Currency" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_CURRENCY; + }; + ToolBoxItem + { + Identifier = ID_DATE ; + Text [ en-US ] = "Date" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_DATE; + }; + ToolBoxItem + { + Identifier = ID_TEXT ; + Text [ en-US ] = "Text" ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_TEXT; + }; + }; + }; + FixedText FT_DECIMALS + { + Pos = MAP_APPFONT ( FT_DECIMALS_X , FT_DECIMALS_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH *2, TEXT_HEIGHT ) ; + Text [ en-US ] = "~Decimal places:" ; + }; + NumericField ED_DECIMALS + { + Border = TRUE ; + Pos = MAP_APPFONT ( LB_DECIMALS_X , LB_DECIMALS_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_DECIMALS; + QuickHelpText [ en-US ] = "Enter the number of decimal places that you want to display."; + Spin = TRUE ; + Maximum = 20 ; + Last = 15 ; + First = 0 ; + StrictFormat = TRUE ; + SpinSize = 1 ; + Repeat = TRUE ; + }; + FixedText FT_LEADZEROES + { + Pos = MAP_APPFONT ( FT_LEADZEROES_X , FT_LEADZEROES_Y ) ; + Size = MAP_APPFONT (PROPERTYPAGE_WIDTH - MBOX_WIDTH *2 - SECTIONPAGE_MARGIN_HORIZONTAL * 2, TEXT_HEIGHT ) ; // + Text [ en-US ] = "Leading ~zeroes:" ; + }; + NumericField ED_LEADZEROES + { + Border = TRUE ; + Pos = MAP_APPFONT ( LB_LEADZEROES_X , LB_LEADZEROES_Y ) ; + Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_LEADZEROES; + QuickHelpText [ en-US ] = "Enter the maximum number of zeroes to display before the decimal point."; + Spin = TRUE ; + Maximum = 20 ; + Last = 15 ; + First = 0 ; + StrictFormat = TRUE ; + SpinSize = 1 ; + Repeat = TRUE ; + }; + CheckBox BTN_NEGRED + { + Pos = MAP_APPFONT ( BTN_NEGRED_X , BTN_NEGRED_Y ) ; + Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_NEGRED; + QuickHelpText [ en-US ] = "Changes the font color of negative numbers to red."; + Text [ en-US ] = "~Negative numbers red" ; + }; + CheckBox BTN_THOUSAND + { + Pos = MAP_APPFONT ( BTN_THOUSAND_X , BTN_THOUSAND_Y ) ; + Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ; + HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_THOUSAND; + QuickHelpText [ en-US ] = "Inserts a separator between thousands."; + Text [ en-US ] = "~Thousands separator" ; + }; + Image IMG_NUMBER + { + ImageBitmap = Bitmap{File = "sidebar/123.png";}; + }; + Image IMG_PERCENT + { + ImageBitmap = Bitmap{File = "sidebar/percent.png";}; + }; + Image IMG_CURRENCY + { + ImageBitmap = Bitmap{File = "sidebar/money.png";}; + }; + Image IMG_DATE + { + ImageBitmap = Bitmap{File = "sidebar/canlendar.png";}; + }; + Image IMG_TEXT + { + ImageBitmap = Bitmap{File = "sidebar/ABC.png";}; + }; +}; + +// eof diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx new file mode 100644 index 000000000000..ce97a8994cf5 --- /dev/null +++ b/sc/source/ui/sidebar/ScPanelFactory.cxx @@ -0,0 +1,168 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "ScPanelFactory.hxx" + +#include <AlignmentPropertyPanel.hxx> +#include <CellAppearancePropertyPanel.hxx> +#include <NumberFormatPropertyPanel.hxx> +#include <navipi.hxx> +#include <dwfunctr.hxx> +#include "sc.hrc" + +#include <sfx2/sidebar/SidebarPanelBase.hxx> +#include <sfx2/sfxbasecontroller.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/window.hxx> +#include <rtl/ref.hxx> +#include <comphelper/namedvaluecollection.hxx> + +#include <boost/bind.hpp> + + +using namespace css; +using namespace cssu; +using ::rtl::OUString; + + +namespace sc { namespace sidebar { + +#define A2S(s) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) +#define IMPLEMENTATION_NAME "org.apache.openoffice.comp.sc.sidebar.ScPanelFactory" +#define SERVICE_NAME "com.sun.star.ui.UIElementFactory" + + +::rtl::OUString SAL_CALL ScPanelFactory::getImplementationName (void) +{ + return A2S(IMPLEMENTATION_NAME); +} + + +cssu::Reference<cssu::XInterface> SAL_CALL ScPanelFactory::createInstance( + const uno::Reference<lang::XMultiServiceFactory>& ) +{ + ::rtl::Reference<ScPanelFactory> pPanelFactory (new ScPanelFactory()); + cssu::Reference<cssu::XInterface> xService (static_cast<XWeak*>(pPanelFactory.get()), cssu::UNO_QUERY); + return xService; +} + + +cssu::Sequence<OUString> SAL_CALL ScPanelFactory::getSupportedServiceNames (void) +{ + cssu::Sequence<OUString> aServiceNames (1); + aServiceNames[0] = A2S(SERVICE_NAME); + return aServiceNames; + +} + + +ScPanelFactory::ScPanelFactory (void) + : PanelFactoryInterfaceBase(m_aMutex) +{ +} + + +ScPanelFactory::~ScPanelFactory (void) +{ +} + + +Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement ( + const ::rtl::OUString& rsResourceURL, + const ::cssu::Sequence<css::beans::PropertyValue>& rArguments) + throw( + container::NoSuchElementException, + lang::IllegalArgumentException, + RuntimeException) +{ + Reference<ui::XUIElement> xElement; + + const ::comphelper::NamedValueCollection aArguments (rArguments); + Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>())); + Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>())); + const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0))); + SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue); + + ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow); + if ( ! xParentWindow.is() || pParentWindow==NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without ParentWindow"), + NULL); + if ( ! xFrame.is()) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without Frame"), + NULL); + if (pBindings == NULL) + throw RuntimeException( + A2S("PanelFactory::createUIElement called without SfxBindings"), + NULL); + +#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s)) + if (DoesResourceEndWith("/AlignmentPropertyPanel")) + { + AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/CellAppearancePropertyPanel")) + { + CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/NumberFormatPropertyPanel")) + { + NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings ); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(-1,-1,-1)); + } + else if (DoesResourceEndWith("/NavigatorPanel")) + { + Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(0,-1,-1)); + } + else if (DoesResourceEndWith("/FunctionsPanel")) + { + Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX)); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(0,-1,-1)); + } +#undef DoesResourceEndWith + + return xElement; +} + +} } // end of namespace sc::sidebar + +// eof diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx index 3783fb17f98e..2f4263892431 100644 --- a/sc/source/ui/unoobj/appluno.cxx +++ b/sc/source/ui/unoobj/appluno.cxx @@ -38,6 +38,7 @@ #include "unonames.hxx" #include "funcdesc.hxx" #include <com/sun/star/sheet/FunctionArgument.hpp> +#include "ScPanelFactory.hxx" using namespace com::sun::star; @@ -185,154 +186,189 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL sc_component_getFactory( OUString aImpl(OUString::createFromAscii(pImplName)); if ( aImpl == ScSpreadsheetSettings::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScSpreadsheetSettings::getImplementationName_Static(), ScSpreadsheetSettings_CreateInstance, ScSpreadsheetSettings::getSupportedServiceNames_Static() )); - - if ( aImpl == ScRecentFunctionsObj::getImplementationName_Static() ) + } + else if ( aImpl == ScRecentFunctionsObj::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScRecentFunctionsObj::getImplementationName_Static(), ScRecentFunctionsObj_CreateInstance, ScRecentFunctionsObj::getSupportedServiceNames_Static() )); - - if ( aImpl == ScFunctionListObj::getImplementationName_Static() ) + } + else if ( aImpl == ScFunctionListObj::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScFunctionListObj::getImplementationName_Static(), ScFunctionListObj_CreateInstance, ScFunctionListObj::getSupportedServiceNames_Static() )); - - if ( aImpl == ScAutoFormatsObj::getImplementationName_Static() ) + } + else if ( aImpl == ScAutoFormatsObj::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScAutoFormatsObj::getImplementationName_Static(), ScAutoFormatsObj_CreateInstance, ScAutoFormatsObj::getSupportedServiceNames_Static() )); - - if ( aImpl == ScFunctionAccess::getImplementationName_Static() ) + } + else if ( aImpl == ScFunctionAccess::getImplementationName_Static() ) + { xFactory.set(cppu::createOneInstanceFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScFunctionAccess::getImplementationName_Static(), ScFunctionAccess_CreateInstance, ScFunctionAccess::getSupportedServiceNames_Static() )); - - if ( aImpl == ScFilterOptionsObj::getImplementationName_Static() ) + } + else if ( aImpl == ScFilterOptionsObj::getImplementationName_Static() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScFilterOptionsObj::getImplementationName_Static(), ScFilterOptionsObj_CreateInstance, ScFilterOptionsObj::getSupportedServiceNames_Static() )); - - if ( aImpl == ScXMLImport_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_getImplementationName(), ScXMLImport_createInstance, ScXMLImport_getSupportedServiceNames() )); - - if ( aImpl == ScXMLImport_Meta_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_Meta_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_Meta_getImplementationName(), ScXMLImport_Meta_createInstance, ScXMLImport_Meta_getSupportedServiceNames() )); - - if ( aImpl == ScXMLImport_Styles_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_Styles_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_Styles_getImplementationName(), ScXMLImport_Styles_createInstance, ScXMLImport_Styles_getSupportedServiceNames() )); - - if ( aImpl == ScXMLImport_Content_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_Content_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_Content_getImplementationName(), ScXMLImport_Content_createInstance, ScXMLImport_Content_getSupportedServiceNames() )); - - if ( aImpl == ScXMLImport_Settings_getImplementationName() ) + } + else if ( aImpl == ScXMLImport_Settings_getImplementationName() ) + { xFactory.set(cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLImport_Settings_getImplementationName(), ScXMLImport_Settings_createInstance, ScXMLImport_Settings_getSupportedServiceNames() )); - - if ( aImpl == ScXMLOOoExport_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_getImplementationName(), ScXMLOOoExport_createInstance, ScXMLOOoExport_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOOoExport_Meta_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_Meta_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_Meta_getImplementationName(), ScXMLOOoExport_Meta_createInstance, ScXMLOOoExport_Meta_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOOoExport_Styles_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_Styles_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_Styles_getImplementationName(), ScXMLOOoExport_Styles_createInstance, ScXMLOOoExport_Styles_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOOoExport_Content_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_Content_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_Content_getImplementationName(), ScXMLOOoExport_Content_createInstance, ScXMLOOoExport_Content_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOOoExport_Settings_getImplementationName() ) + } + else if ( aImpl == ScXMLOOoExport_Settings_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOOoExport_Settings_getImplementationName(), ScXMLOOoExport_Settings_createInstance, ScXMLOOoExport_Settings_getSupportedServiceNames() ); - - if ( aImpl == ScXMLOasisExport_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_getImplementationName(), ScXMLOasisExport_createInstance, ScXMLOasisExport_getSupportedServiceNames() ); - if ( aImpl == ScXMLOasisExport_Meta_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_Meta_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_Meta_getImplementationName(), ScXMLOasisExport_Meta_createInstance, ScXMLOasisExport_Meta_getSupportedServiceNames() ); - if ( aImpl == ScXMLOasisExport_Styles_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_Styles_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_Styles_getImplementationName(), ScXMLOasisExport_Styles_createInstance, ScXMLOasisExport_Styles_getSupportedServiceNames() ); - if ( aImpl == ScXMLOasisExport_Content_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_Content_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_Content_getImplementationName(), ScXMLOasisExport_Content_createInstance, ScXMLOasisExport_Content_getSupportedServiceNames() ); - if ( aImpl == ScXMLOasisExport_Settings_getImplementationName() ) + } + else if ( aImpl == ScXMLOasisExport_Settings_getImplementationName() ) + { xFactory = cppu::createSingleFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScXMLOasisExport_Settings_getImplementationName(), ScXMLOasisExport_Settings_createInstance, ScXMLOasisExport_Settings_getSupportedServiceNames() ); - - if ( aImpl == ScDocument_getImplementationName() ) + } + else if ( aImpl == ScDocument_getImplementationName() ) + { xFactory.set(sfx2::createSfxModelFactory( reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), ScDocument_getImplementationName(), ScDocument_createInstance, ScDocument_getSupportedServiceNames() )); + } + else if ( aImpl == ::sc::sidebar::ScPanelFactory::getImplementationName() ) + { + xFactory = ::cppu::createSingleFactory( + reinterpret_cast<lang::XMultiServiceFactory*>(pServiceManager), + ::sc::sidebar::ScPanelFactory::getImplementationName(), + ::sc::sidebar::ScPanelFactory::createInstance, + ::sc::sidebar::ScPanelFactory::getSupportedServiceNames() ); + } void* pRet = NULL; if (xFactory.is()) 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 ); } } |