diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 46f3a40..0c34b62 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -97,6 +97,7 @@ const sal_Unicode CHAR_ZWNBSP = 0x2060; const SCSIZE MAXSUBTOTAL = 3; const SCSIZE MAXQUERY = 8; +const SCSIZE MAXCONDFRMT = 100; #define SC_START_INDEX_DB_COLL 50000 // Above this threshold are indices diff --git a/sc/source/ui/attrdlg/condfrmt.cxx b/sc/source/ui/attrdlg/condfrmt.cxx index 378655b..c31c92c 100644 --- a/sc/source/ui/attrdlg/condfrmt.cxx +++ b/sc/source/ui/attrdlg/condfrmt.cxx @@ -72,6 +72,8 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aFtCond1Template ( this, ScResId( FT_COND1_TEMPLATE ) ), aLbCond1Template ( this, ScResId( LB_COND1_TEMPLATE ) ), aBtnNew1 ( this, ScResId( BTN_COND1_NEW ) ), + aPreviewWin1 ( this, ScResId( WIN_CHAR_PREVIEW_COND1 ) ), + aFlSep1 ( this, ScResId( FL_SEP1 ) ), aCbxCond2 ( this, ScResId( CBX_COND2 ) ), aLbCond21 ( this, ScResId( LB_COND2_1 ) ), @@ -84,6 +86,8 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aFtCond2Template ( this, ScResId( FT_COND2_TEMPLATE ) ), aLbCond2Template ( this, ScResId( LB_COND2_TEMPLATE ) ), aBtnNew2 ( this, ScResId( BTN_COND2_NEW ) ), + aPreviewWin2 ( this, ScResId( WIN_CHAR_PREVIEW_COND2 ) ), + aFlSep2 ( this, ScResId( FL_SEP2 ) ), aCbxCond3 ( this, ScResId( CBX_COND3 ) ), aLbCond31 ( this, ScResId( LB_COND3_1 ) ), @@ -96,35 +100,58 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aFtCond3Template ( this, ScResId( FT_COND3_TEMPLATE ) ), aLbCond3Template ( this, ScResId( LB_COND3_TEMPLATE ) ), aBtnNew3 ( this, ScResId( BTN_COND3_NEW ) ), + aPreviewWin3 ( this, ScResId( WIN_CHAR_PREVIEW_COND3 ) ), + aScrollBar ( this, ScResId( LB_SCROLL ) ), aBtnOk ( this, ScResId( BTN_OK ) ), aBtnCancel ( this, ScResId( BTN_CANCEL ) ), + aBtnInsert ( this, ScResId( BTN_INSERT ) ), + aBtnHelp ( this, ScResId( BTN_HELP ) ), - aFlSep2 ( this, ScResId( FL_SEP2 ) ), - aFlSep1 ( this, ScResId( FL_SEP1 ) ), pEdActive ( NULL ), bDlgLostFocus ( false ), - pDoc ( pCurDoc ) + pDoc ( pCurDoc ), + nCurrentOffset ( 0 ) { Point aPos; String aName; SfxStyleSheetBase* pStyle; + const ScCondFormatEntry* pEntry; + for (SCSIZE i=0; iCount() ) ) + { + pEntry = pCurrentFormat->GetEntry( i ); + pEntryLists[i] = new ScCondFormatEntry( *pEntry ); + } + else + pEntryLists[i] = NULL; + } + FreeResource(); + aScrollBar.SetEndScrollHdl( LINK( this, ScConditionalFormatDlg, ScrollHdl ) ); + aScrollBar.SetScrollHdl( LINK( this, ScConditionalFormatDlg, ScrollHdl ) ); + aScrollBar.SetRange( Range( 0, MAXCONDFRMT - 3 ) ); + aScrollBar.SetLineSize( 1 ); + // Handler setzen aCbxCond1.SetClickHdl ( LINK( this, ScConditionalFormatDlg, ClickCond1Hdl ) ); aLbCond11.SetSelectHdl( LINK( this, ScConditionalFormatDlg, ChangeCond11Hdl ) ); aLbCond12.SetSelectHdl( LINK( this, ScConditionalFormatDlg, ChangeCond12Hdl ) ); + aLbCond1Template.SetSelectHdl( LINK( this, ScConditionalFormatDlg, ChangeCond1TemplateHdl ) ); aCbxCond2.SetClickHdl ( LINK( this, ScConditionalFormatDlg, ClickCond2Hdl ) ); aLbCond21.SetSelectHdl( LINK( this, ScConditionalFormatDlg, ChangeCond21Hdl ) ); aLbCond22.SetSelectHdl( LINK( this, ScConditionalFormatDlg, ChangeCond22Hdl ) ); + aLbCond2Template.SetSelectHdl( LINK( this, ScConditionalFormatDlg, ChangeCond2TemplateHdl ) ); aCbxCond3.SetClickHdl ( LINK( this, ScConditionalFormatDlg, ClickCond3Hdl ) ); aLbCond31.SetSelectHdl( LINK( this, ScConditionalFormatDlg, ChangeCond31Hdl ) ); aLbCond32.SetSelectHdl( LINK( this, ScConditionalFormatDlg, ChangeCond32Hdl ) ); + aLbCond3Template.SetSelectHdl( LINK( this, ScConditionalFormatDlg, ChangeCond3TemplateHdl ) ); aBtnOk.SetClickHdl ( LINK( this, ScConditionalFormatDlg, BtnHdl ) ); //? aBtnCancel.SetClickHdl( LINK( this, ScConditionalFormatDlg, BtnHdl ) ); @@ -172,10 +199,13 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aCond1Size3 = aEdtCond11.GetSizePixel(); aCond1Size2 = Size( aPos.X() - aCond1Pos2.X(), aCond1Size3.Height() ); aCond1Size1 = Size( aPos.X() - aCond1Pos1.X(), aCond1Size3.Height() ); + aCbxCond1InitialText = aCbxCond1.GetText(); aCbxCond1.Check(); aLbCond11.SelectEntryPos( 0 ); aLbCond12.SelectEntryPos( 0 ); + aPreviewWin1.SetDrawBaseLine( false ); + aPreviewWin1.UseResourceText( true ); // Condition 2 aCond2Pos1 = aLbCond22.GetPosPixel(); // Position Edit ohne Listbox @@ -187,10 +217,13 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aCond2Size3 = aEdtCond21.GetSizePixel(); aCond2Size2 = Size( aPos.X() - aCond2Pos2.X(), aCond2Size3.Height() ); aCond2Size1 = Size( aPos.X() - aCond2Pos1.X(), aCond2Size3.Height() ); + aCbxCond2InitialText = aCbxCond2.GetText(); aCbxCond2.Check( false ); aLbCond21.SelectEntryPos( 0 ); aLbCond22.SelectEntryPos( 0 ); + aPreviewWin2.SetDrawBaseLine( false ); + aPreviewWin2.UseResourceText( true ); // Condition 3 aCond3Pos1 = aLbCond32.GetPosPixel(); // Position Edit ohne Listbox @@ -202,10 +235,13 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aCond3Size3 = aEdtCond31.GetSizePixel(); aCond3Size2 = Size( aPos.X() - aCond3Pos2.X(), aCond3Size3.Height() ); aCond3Size1 = Size( aPos.X() - aCond3Pos1.X(), aCond3Size3.Height() ); + aCbxCond3InitialText = aCbxCond3.GetText(); aCbxCond3.Check( false ); aLbCond31.SelectEntryPos( 0 ); aLbCond32.SelectEntryPos( 0 ); + aPreviewWin3.SetDrawBaseLine( false ); + aPreviewWin3.UseResourceText( true ); // Vorlagen aus pDoc holen SfxStyleSheetIterator aStyleIter( pDoc->GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA ); @@ -228,6 +264,110 @@ ScConditionalFormatDlg::ScConditionalFormatDlg( aLbCond2Template.SelectEntry( aName ); aLbCond3Template.SelectEntry( aName ); + Refresh( nCurrentOffset ); + Cond1Cheked( true ); + + ClickCond1Hdl( NULL ); + ClickCond2Hdl( NULL ); + ClickCond3Hdl( NULL ); + + ChangeCond12Hdl( NULL ); + ChangeCond22Hdl( NULL ); + ChangeCond32Hdl( NULL ); + + aEdtCond11.GrabFocus(); + pEdActive = &aEdtCond11; + //@BugID 54702 Enablen/Disablen nur noch in Basisklasse + //SFX_APPWINDOW->Enable(); // Ref-Feld hat Focus +// SFX_APPWINDOW->Disable(); + + aLbCond11.SetAccessibleRelationLabeledBy( &aCbxCond1 ); + aLbCond12.SetAccessibleRelationLabeledBy( &aCbxCond1 ); + aEdtCond11.SetAccessibleRelationLabeledBy( &aCbxCond1 ); + aRbCond11.SetAccessibleRelationLabeledBy( &aCbxCond1 ); + + aLbCond21.SetAccessibleRelationLabeledBy( &aCbxCond2 ); + aLbCond22.SetAccessibleRelationLabeledBy( &aCbxCond2 ); + aEdtCond21.SetAccessibleRelationLabeledBy( &aCbxCond2 ); + aRbCond21.SetAccessibleRelationLabeledBy( &aCbxCond2 ); + + aLbCond31.SetAccessibleRelationLabeledBy( &aCbxCond3 ); + aLbCond32.SetAccessibleRelationLabeledBy( &aCbxCond3 ); + aEdtCond31.SetAccessibleRelationLabeledBy( &aCbxCond3 ); + aRbCond31.SetAccessibleRelationLabeledBy( &aCbxCond3 ); + aLbCond11.SetAccessibleName( ScResId(LABEL_FORMARTTING_CONDITIONS) ); + aLbCond12.SetAccessibleName( ScResId(LABEL_CONDITIONS) ); + aEdtCond11.SetAccessibleName( ScResId(LABEL_CONDITION_VALUE) ); + + aLbCond21.SetAccessibleName( ScResId(LABEL_FORMARTTING_CONDITIONS) ); + aLbCond22.SetAccessibleName( ScResId(LABEL_CONDITIONS) ); + aEdtCond21.SetAccessibleName( ScResId(LABEL_CONDITION_VALUE) ); + + aLbCond31.SetAccessibleName( ScResId(LABEL_FORMARTTING_CONDITIONS) ); + aLbCond32.SetAccessibleName( ScResId(LABEL_CONDITIONS) ); + aEdtCond31.SetAccessibleName( ScResId(LABEL_CONDITION_VALUE) ); +} + +//---------------------------------------------------------------------------- +// Destruktor + +ScConditionalFormatDlg::~ScConditionalFormatDlg() +{ + for (SCSIZE i=0; iGetCurX(), pData->GetCurY(), pData->GetTabNo() ); } - // Inhalt aus ConditionalFormat holen - if ( pCurrentFormat ) - { + String aEmptyString = ScGlobal::GetEmptyString(); + + // update checkBox text + String aValNum1 = aEmptyString; + if ( (nOffset + 1) >= 10) + aValNum1 = String::CreateFromInt32( (nOffset + 1) / 10 ); + aValNum1 += String::CreateFromAscii("~"); + aValNum1 += String::CreateFromInt32( (nOffset + 1) % 10 ); + String aVal1 = aCbxCond1InitialText; + aVal1.SearchAndReplace( String::CreateFromAscii( "~1" ), aValNum1 ); + aCbxCond1.SetText(aVal1); + + String aValNum2 = aEmptyString; + if ( (nOffset + 2) >= 10) + aValNum2 = String::CreateFromInt32( (nOffset + 2) / 10 ); + aValNum2 += String::CreateFromAscii("~"); + aValNum2 += String::CreateFromInt32( (nOffset + 2) % 10 ); + String aVal2 = aCbxCond2InitialText; + aVal2.SearchAndReplace( String::CreateFromAscii( "~2" ), aValNum2 ); + aCbxCond2.SetText(aVal2); + + String aValNum3 = aEmptyString; + if ( (nOffset + 3) >= 10) + aValNum3 = String::CreateFromInt32( (nOffset + 3) / 10 ); + aValNum3 += String::CreateFromAscii("~"); + aValNum3 += String::CreateFromInt32( (nOffset + 3) % 10 ); + String aVal3 = aCbxCond3InitialText; + aVal3.SearchAndReplace( String::CreateFromAscii( "~3" ), aValNum3 ); + aCbxCond3.SetText(aVal3); + const ScCondFormatEntry* pEntry; - if ( pCurrentFormat->Count() > 0 ) + if ( pEntryLists[ nOffset + 0 ] ) { - pEntry= pCurrentFormat->GetEntry( 0 ); + Cond1Cheked( true ); + pEntry= pEntryLists[ nOffset + 0 ]; aEdtCond11.SetText( pEntry->GetExpression( aCurPos, 0 ) ); aLbCond1Template.SelectEntry( pEntry->GetStyle() ); + ChangeCond1TemplateHdl( NULL ); ScConditionMode eMode = pEntry->GetOperation(); if ( eMode == SC_COND_DIRECT ) // via Formel - { aLbCond11.SelectEntryPos( 1 ); - ChangeCond11Hdl( NULL ); - } else if ( eMode == SC_COND_NONE ) // ??? ; else // via Werte { + aLbCond11.SelectEntryPos( 0 ); aLbCond12.SelectEntryPos( sal::static_int_cast( eMode ) ); if ( ( eMode == SC_COND_BETWEEN ) || ( eMode == SC_COND_NOTBETWEEN ) ) aEdtCond12.SetText( pEntry->GetExpression( aCurPos, 1 ) ); } } + else + { + Cond1Cheked( false ); + aLbCond11.SelectEntryPos( 0 ); + aLbCond12.SelectEntryPos( 0 ); + aLbCond1Template.SelectEntryPos( 0 ); + aEdtCond11.SetText( aEmptyString ); + aEdtCond12.SetText( aEmptyString ); + } + ChangeCond11Hdl( NULL ); - if ( pCurrentFormat->Count() > 1 ) + if ( pEntryLists[ nOffset + 1 ] ) { - aCbxCond2.Check( sal_True ); - pEntry= pCurrentFormat->GetEntry( 1 ); + Cond2Cheked( true ); + pEntry= pEntryLists[ nOffset + 1 ]; aEdtCond21.SetText( pEntry->GetExpression( aCurPos, 0 ) ); aLbCond2Template.SelectEntry( pEntry->GetStyle() ); + ChangeCond2TemplateHdl( NULL ); ScConditionMode eMode = pEntry->GetOperation(); if ( eMode == SC_COND_DIRECT ) // via Formel - { aLbCond21.SelectEntryPos( 1 ); - ChangeCond21Hdl( NULL ); - } - else if ( eMode == SC_COND_NONE ) // ??? + else if ( eMode == SC_COND_NONE ) // ??? ; else // via Werte { + aLbCond21.SelectEntryPos( 0 ); aLbCond22.SelectEntryPos( sal::static_int_cast( eMode ) ); if ( ( eMode == SC_COND_BETWEEN ) || ( eMode == SC_COND_NOTBETWEEN ) ) aEdtCond22.SetText( pEntry->GetExpression( aCurPos, 1 ) ); } } + else + { + Cond2Cheked( false ); + aLbCond21.SelectEntryPos( 0 ); + aLbCond22.SelectEntryPos( 0 ); + aLbCond2Template.SelectEntryPos( 0 ); + aEdtCond21.SetText( aEmptyString ); + aEdtCond22.SetText( aEmptyString ); + } + ChangeCond21Hdl( NULL ); - if ( pCurrentFormat->Count() > 2 ) + if ( pEntryLists[ nOffset + 2 ] ) { - aCbxCond3.Check( sal_True ); - pEntry= pCurrentFormat->GetEntry( 2 ); + Cond3Cheked( true ); + pEntry= pEntryLists[ nOffset + 2 ]; aEdtCond31.SetText( pEntry->GetExpression( aCurPos, 0 ) ); aLbCond3Template.SelectEntry( pEntry->GetStyle() ); + ChangeCond3TemplateHdl( NULL ); ScConditionMode eMode = pEntry->GetOperation(); if ( eMode == SC_COND_DIRECT ) // via Formel - { aLbCond31.SelectEntryPos( 1 ); - ChangeCond31Hdl( NULL ); - } - else if ( eMode == SC_COND_NONE ) // ??? + else if ( eMode == SC_COND_NONE ) // ??? ; else // via Werte { + aLbCond31.SelectEntryPos( 0 ); aLbCond32.SelectEntryPos( sal::static_int_cast( eMode ) ); if ( ( eMode == SC_COND_BETWEEN ) || ( eMode == SC_COND_NOTBETWEEN ) ) aEdtCond32.SetText( pEntry->GetExpression( aCurPos, 1 ) ); } } - } - - ClickCond1Hdl( NULL ); - ClickCond2Hdl( NULL ); - ClickCond3Hdl( NULL ); - - ChangeCond12Hdl( NULL ); - ChangeCond22Hdl( NULL ); - ChangeCond32Hdl( NULL ); - - aEdtCond11.GrabFocus(); - pEdActive = &aEdtCond11; - //@BugID 54702 Enablen/Disablen nur noch in Basisklasse - //SFX_APPWINDOW->Enable(); // Ref-Feld hat Focus -// SFX_APPWINDOW->Disable(); - - aLbCond11.SetAccessibleRelationLabeledBy( &aCbxCond1 ); - aLbCond12.SetAccessibleRelationLabeledBy( &aCbxCond1 ); - aEdtCond11.SetAccessibleRelationLabeledBy( &aCbxCond1 ); - aRbCond11.SetAccessibleRelationLabeledBy( &aCbxCond1 ); - - aLbCond21.SetAccessibleRelationLabeledBy( &aCbxCond2 ); - aLbCond22.SetAccessibleRelationLabeledBy( &aCbxCond2 ); - aEdtCond21.SetAccessibleRelationLabeledBy( &aCbxCond2 ); - aRbCond21.SetAccessibleRelationLabeledBy( &aCbxCond2 ); + else + { + Cond3Cheked( false ); + aLbCond31.SelectEntryPos( 0 ); + aLbCond32.SelectEntryPos( 0 ); + aLbCond3Template.SelectEntryPos( 0 ); + aEdtCond31.SetText( aEmptyString ); + aEdtCond32.SetText( aEmptyString ); + } + ChangeCond31Hdl( NULL ); +} - aLbCond31.SetAccessibleRelationLabeledBy( &aCbxCond3 ); - aLbCond32.SetAccessibleRelationLabeledBy( &aCbxCond3 ); - aEdtCond31.SetAccessibleRelationLabeledBy( &aCbxCond3 ); - aRbCond31.SetAccessibleRelationLabeledBy( &aCbxCond3 ); - aLbCond11.SetAccessibleName( ScResId(LABEL_FORMARTTING_CONDITIONS) ); - aLbCond12.SetAccessibleName( ScResId(LABEL_CONDITIONS) ); - aEdtCond11.SetAccessibleName( ScResId(LABEL_CONDITION_VALUE) ); +//---------------------------------------------------------------------------- +void ScConditionalFormatDlg::UpdateValueList( sal_uInt16 nOffset ) +{ + ScConditionMode eOper; + String sExpr1; + String sExpr2; + String sStyle; + ScAddress aCurPos; - aLbCond21.SetAccessibleName( ScResId(LABEL_FORMARTTING_CONDITIONS) ); - aLbCond22.SetAccessibleName( ScResId(LABEL_CONDITIONS) ); - aEdtCond21.SetAccessibleName( ScResId(LABEL_CONDITION_VALUE) ); + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); + if (pViewShell) + { + ScViewData* pData = pViewShell->GetViewData(); + aCurPos = ScAddress( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() ); + } - aLbCond31.SetAccessibleName( ScResId(LABEL_FORMARTTING_CONDITIONS) ); - aLbCond32.SetAccessibleName( ScResId(LABEL_CONDITIONS) ); - aEdtCond31.SetAccessibleName( ScResId(LABEL_CONDITION_VALUE) ); -} + delete pEntryLists[ nOffset + 0 ]; + if ( aCbxCond1.IsChecked() ) + { + if ( aLbCond11.GetSelectEntryPos() == 1 ) // via Formel + eOper = SC_COND_DIRECT; + else + eOper = (ScConditionMode)aLbCond12.GetSelectEntryPos(); + sExpr1 = aEdtCond11.GetText(); + sExpr2 = aEdtCond12.GetText(); + sStyle = aLbCond1Template.GetSelectEntry(); + pEntryLists[ nOffset + 0 ] = new ScCondFormatEntry( eOper, sExpr1, sExpr2, pDoc, aCurPos, sStyle ); + } + else + pEntryLists[ nOffset + 0 ] = NULL; -//---------------------------------------------------------------------------- -// Destruktor + delete pEntryLists[ nOffset + 1 ]; + if ( aCbxCond2.IsChecked() ) + { + if ( aLbCond21.GetSelectEntryPos() == 1 ) // via Formel??? + eOper = SC_COND_DIRECT; + else + eOper = (ScConditionMode)aLbCond22.GetSelectEntryPos(); + sExpr1 = aEdtCond21.GetText(); + sExpr2 = aEdtCond22.GetText(); + sStyle = aLbCond2Template.GetSelectEntry(); + pEntryLists[ nOffset + 1 ] = new ScCondFormatEntry( eOper, sExpr1, sExpr2, pDoc, aCurPos, sStyle ); + } + else + pEntryLists[ nOffset + 1 ] = NULL; -ScConditionalFormatDlg::~ScConditionalFormatDlg() -{ + delete pEntryLists[ nOffset + 2 ]; + if ( aCbxCond3.IsChecked() ) + { + if ( aLbCond31.GetSelectEntryPos() == 1 ) // via Formel??? + eOper = SC_COND_DIRECT; + else + eOper = (ScConditionMode)aLbCond32.GetSelectEntryPos(); + sExpr1 = aEdtCond31.GetText(); + sExpr2 = aEdtCond32.GetText(); + sStyle = aLbCond3Template.GetSelectEntry(); + pEntryLists[ nOffset + 2 ] = new ScCondFormatEntry( eOper, sExpr1, sExpr2, pDoc, aCurPos, sStyle ); + } + else + pEntryLists[ nOffset + 2 ] = NULL; } //---------------------------------------------------------------------------- - void ScConditionalFormatDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) { if ( pEdActive ) @@ -424,12 +632,6 @@ void ScConditionalFormatDlg::SetActive() void ScConditionalFormatDlg::GetConditionalFormat( ScConditionalFormat& rCndFmt ) { - ScConditionMode eOper; - String sExpr1; - String sExpr2; - String sStyle; - ScAddress aCurPos; - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) { @@ -437,47 +639,12 @@ void ScConditionalFormatDlg::GetConditionalFormat( ScConditionalFormat& rCndFmt ScRangeListRef rRanges; pData->GetMultiArea( rRanges ); rCndFmt.AddRangeInfo( rRanges ); - aCurPos = ScAddress( pData->GetCurX(), pData->GetCurY(), pData->GetTabNo() ); - } - - if ( aCbxCond1.IsChecked() ) - { - if ( aLbCond11.GetSelectEntryPos() == 1 ) // via Formel - eOper = SC_COND_DIRECT; - else - eOper = (ScConditionMode)aLbCond12.GetSelectEntryPos(); - sExpr1 = aEdtCond11.GetText(); - sExpr2 = aEdtCond12.GetText(); - sStyle = aLbCond1Template.GetSelectEntry(); - ScCondFormatEntry aNewEntry( eOper, sExpr1, sExpr2, pDoc, aCurPos, sStyle ); - rCndFmt.AddEntry( aNewEntry ); - } - - if ( aCbxCond2.IsChecked() ) - { - if ( aLbCond21.GetSelectEntryPos() == 1 ) // via Formel??? - eOper = SC_COND_DIRECT; - else - eOper = (ScConditionMode)aLbCond22.GetSelectEntryPos(); - sExpr1 = aEdtCond21.GetText(); - sExpr2 = aEdtCond22.GetText(); - sStyle = aLbCond2Template.GetSelectEntry(); - ScCondFormatEntry aNewEntry( eOper, sExpr1, sExpr2, pDoc, aCurPos, sStyle ); - rCndFmt.AddEntry( aNewEntry ); } - if ( aCbxCond3.IsChecked() ) - { - if ( aLbCond31.GetSelectEntryPos() == 1 ) // via Formel??? - eOper = SC_COND_DIRECT; - else - eOper = (ScConditionMode)aLbCond32.GetSelectEntryPos(); - sExpr1 = aEdtCond31.GetText(); - sExpr2 = aEdtCond32.GetText(); - sStyle = aLbCond3Template.GetSelectEntry(); - ScCondFormatEntry aNewEntry( eOper, sExpr1, sExpr2, pDoc, aCurPos, sStyle ); - rCndFmt.AddEntry( aNewEntry ); - } + UpdateValueList( nCurrentOffset ); + for (SCSIZE i=0; iGetStyleSheetPool()->Find( aStyleName, SFX_STYLE_FAMILY_PARA ); + if ( pStyleSheet ) + { + const SfxItemSet& rSet = pStyleSheet->GetItemSet(); + aPreviewWin1.Init( rSet ); + } + return( 0L ); +} + +//---------------------------------------------------------------------------- // Enabled/Disabled Condition2-Controls IMPL_LINK( ScConditionalFormatDlg, ClickCond2Hdl, void *, EMPTYARG ) { sal_Bool bChecked = aCbxCond2.IsChecked(); - aLbCond21.Enable( bChecked ); - aLbCond22.Enable( bChecked ); - aEdtCond21.Enable( bChecked ); - aRbCond21.Enable( bChecked ); - aFtCond2And.Enable( bChecked ); - aEdtCond22.Enable( bChecked ); - aRbCond22.Enable( bChecked ); - aFtCond2Template.Enable( bChecked ); - aLbCond2Template.Enable( bChecked ); - aBtnNew2.Enable( bChecked ); - + Cond2Cheked( bChecked ); return( 0L ); } @@ -668,23 +851,27 @@ IMPL_LINK( ScConditionalFormatDlg, ChangeCond22Hdl, void *, EMPTYARG ) } //---------------------------------------------------------------------------- + +IMPL_LINK( ScConditionalFormatDlg, ChangeCond2TemplateHdl, void *, EMPTYARG ) +{ + String aStyleName = aLbCond2Template.GetSelectEntry(); + SfxStyleSheetBase* pStyleSheet = pDoc->GetStyleSheetPool()->Find( aStyleName, SFX_STYLE_FAMILY_PARA ); + if ( pStyleSheet ) + { + const SfxItemSet& rSet = pStyleSheet->GetItemSet(); + aPreviewWin2.Init( rSet ); + } + return( 0L ); +} + +//---------------------------------------------------------------------------- // Enabled/Disabled Condition3-Controls IMPL_LINK( ScConditionalFormatDlg, ClickCond3Hdl, void *, EMPTYARG ) { sal_Bool bChecked = aCbxCond3.IsChecked(); - aLbCond31.Enable( bChecked ); - aLbCond32.Enable( bChecked ); - aEdtCond31.Enable( bChecked ); - aRbCond31.Enable( bChecked ); - aFtCond3And.Enable( bChecked ); - aEdtCond32.Enable( bChecked ); - aRbCond32.Enable( bChecked ); - aFtCond3Template.Enable( bChecked ); - aLbCond3Template.Enable( bChecked ); - aBtnNew3.Enable( bChecked ); - + Cond3Cheked( bChecked ); return( 0L ); } @@ -757,6 +944,20 @@ IMPL_LINK( ScConditionalFormatDlg, ChangeCond32Hdl, void *, EMPTYARG ) //---------------------------------------------------------------------------- +IMPL_LINK( ScConditionalFormatDlg, ChangeCond3TemplateHdl, void *, EMPTYARG ) +{ + String aStyleName = aLbCond3Template.GetSelectEntry(); + SfxStyleSheetBase* pStyleSheet = pDoc->GetStyleSheetPool()->Find( aStyleName, SFX_STYLE_FAMILY_PARA ); + if ( pStyleSheet ) + { + const SfxItemSet& rSet = pStyleSheet->GetItemSet(); + aPreviewWin3.Init( rSet ); + } + return( 0L ); +} + +//---------------------------------------------------------------------------- + IMPL_LINK( ScConditionalFormatDlg, GetFocusHdl, Control*, pCtrl ) { if( (pCtrl == (Control*)&aEdtCond11) || (pCtrl == (Control*)&aRbCond11) ) @@ -863,6 +1064,10 @@ IMPL_LINK( ScConditionalFormatDlg, NewBtnHdl, PushButton*, pBtn ) pListBox = &aLbCond3Template; pListBox->SelectEntry( aNewStyle ); + + ChangeCond1TemplateHdl( NULL ); + ChangeCond2TemplateHdl( NULL ); + ChangeCond3TemplateHdl( NULL ); } return 0; diff --git a/sc/source/ui/inc/condfrmt.hrc b/sc/source/ui/inc/condfrmt.hrc index 01db4be..0452018 100644 --- a/sc/source/ui/inc/condfrmt.hrc +++ b/sc/source/ui/inc/condfrmt.hrc @@ -63,6 +63,13 @@ #define FL_SEP1 41 #define FL_SEP2 42 +#define LB_SCROLL 43 + +#define WIN_CHAR_PREVIEW_COND1 44 +#define WIN_CHAR_PREVIEW_COND2 45 +#define WIN_CHAR_PREVIEW_COND3 46 +#define BTN_INSERT 47 + //IAccessibility2 Implementation 2009----- #define LABEL_FORMARTTING_CONDITIONS 5043 #define LABEL_CONDITIONS 5044 diff --git a/sc/source/ui/inc/condfrmt.hxx b/sc/source/ui/inc/condfrmt.hxx index b5e9ed9..6ba788d 100644 --- a/sc/source/ui/inc/condfrmt.hxx +++ b/sc/source/ui/inc/condfrmt.hxx @@ -33,6 +33,7 @@ #include "anyrefdg.hxx" #include #include +#include class ScDocument; @@ -56,6 +57,8 @@ public: virtual void AddRefEntry(); virtual sal_Bool IsRefInputMode() const; virtual void SetActive(); + void SliderMoved(); + sal_uInt16 GetSliderPos(); virtual sal_Bool Close(); private: @@ -70,6 +73,9 @@ private: FixedText aFtCond1Template; ListBox aLbCond1Template; PushButton aBtnNew1; + SvxFontPrevWindow aPreviewWin1; + FixedLine aFlSep1; + CheckBox aCbxCond2; ListBox aLbCond21; ListBox aLbCond22; @@ -81,6 +87,9 @@ private: FixedText aFtCond2Template; ListBox aLbCond2Template; PushButton aBtnNew2; + SvxFontPrevWindow aPreviewWin2; + FixedLine aFlSep2; + CheckBox aCbxCond3; ListBox aLbCond31; ListBox aLbCond32; @@ -92,9 +101,12 @@ private: FixedText aFtCond3Template; ListBox aLbCond3Template; PushButton aBtnNew3; + SvxFontPrevWindow aPreviewWin3; + ScrollBar aScrollBar; OKButton aBtnOk; CancelButton aBtnCancel; + PushButton aBtnInsert; HelpButton aBtnHelp; Point aCond1Pos1; @@ -120,31 +132,45 @@ private: Size aCond3Size1; Size aCond3Size2; Size aCond3Size3; - FixedLine aFlSep2; - FixedLine aFlSep1; + formula::RefEdit* pEdActive; sal_Bool bDlgLostFocus; ScDocument* pDoc; + ScCondFormatEntry* pEntryLists[MAXCONDFRMT]; + sal_uInt16 nCurrentOffset; + String aCbxCond1InitialText; + String aCbxCond2InitialText; + String aCbxCond3InitialText; #ifdef _CONDFRMT_CXX void GetConditionalFormat( ScConditionalFormat& rCndFmt ); + void Refresh( sal_uInt16 nOffset ); + void UpdateValueList ( sal_uInt16 nOffset ); + void Cond1Cheked( sal_Bool bChecked ); + void Cond2Cheked( sal_Bool bChecked ); + void Cond3Cheked( sal_Bool bChecked ); DECL_LINK( ClickCond1Hdl, void * ); DECL_LINK( ChangeCond11Hdl, void * ); DECL_LINK( ChangeCond12Hdl, void * ); + DECL_LINK( ChangeCond1TemplateHdl, void * ); DECL_LINK( ClickCond2Hdl, void * ); DECL_LINK( ChangeCond21Hdl, void * ); DECL_LINK( ChangeCond22Hdl, void * ); + DECL_LINK( ChangeCond2TemplateHdl, void * ); DECL_LINK( ClickCond3Hdl, void * ); DECL_LINK( ChangeCond31Hdl, void * ); DECL_LINK( ChangeCond32Hdl, void * ); + DECL_LINK( ChangeCond3TemplateHdl, void * ); DECL_LINK( GetFocusHdl, Control* ); DECL_LINK( LoseFocusHdl, Control* ); DECL_LINK( BtnHdl, PushButton* ); DECL_LINK( NewBtnHdl, PushButton* ); + DECL_LINK( ScrollHdl, ScrollBar* ); + #endif // _CONDFRMT_CXX }; diff --git a/sc/source/ui/src/condfrmt.src b/sc/source/ui/src/condfrmt.src index bc10d1f..32e6f74 100644 --- a/sc/source/ui/src/condfrmt.src +++ b/sc/source/ui/src/condfrmt.src @@ -31,7 +31,7 @@ ModelessDialog RID_SCDLG_CONDFORMAT { OutputSize = TRUE ; SVLook = TRUE ; - Size = MAP_APPFONT ( 316 , 161 ) ; + Size = MAP_APPFONT ( 326 , 161 ) ; Moveable = TRUE ; Closeable = TRUE ; HelpId = HID_SCDLG_CONDFORMAT ; @@ -136,10 +136,17 @@ ModelessDialog RID_SCDLG_CONDFORMAT DropDown = TRUE ; Sort = TRUE ; }; + Window WIN_CHAR_PREVIEW_COND1 + { + Border = FALSE ; + Pos = MAP_APPFONT ( 124 , 34 ) ; + Size = MAP_APPFONT ( 41 , 14 ) ; + Text [ en-US ] = "Example"; + }; PushButton BTN_COND1_NEW { HelpID = "sc:PushButton:RID_SCDLG_CONDFORMAT:BTN_COND1_NEW"; - Pos = MAP_APPFONT ( 124 , 34 ) ; + Pos = MAP_APPFONT ( 169 , 34 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; Text [ en-US ] = "~New Style..." ; @@ -249,10 +256,17 @@ ModelessDialog RID_SCDLG_CONDFORMAT DropDown = TRUE ; Sort = TRUE ; }; + Window WIN_CHAR_PREVIEW_COND2 + { + Border = FALSE ; + Pos = MAP_APPFONT ( 124 , 88 ) ; + Size = MAP_APPFONT ( 41 , 14 ) ; + Text [ en-US ] = "Example"; + }; PushButton BTN_COND2_NEW { HelpID = "sc:PushButton:RID_SCDLG_CONDFORMAT:BTN_COND2_NEW"; - Pos = MAP_APPFONT ( 124 , 88 ) ; + Pos = MAP_APPFONT ( 169 , 88 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; Text [ en-US ] = "Ne~w Style..." ; @@ -362,30 +376,51 @@ ModelessDialog RID_SCDLG_CONDFORMAT DropDown = TRUE ; Sort = TRUE ; }; + Window WIN_CHAR_PREVIEW_COND3 + { + Border = FALSE ; + Pos = MAP_APPFONT ( 124 , 142 ) ; + Size = MAP_APPFONT ( 41 , 14 ) ; + Text [ en-US ] = "Example"; + }; PushButton BTN_COND3_NEW { HelpID = "sc:PushButton:RID_SCDLG_CONDFORMAT:BTN_COND3_NEW"; - Pos = MAP_APPFONT ( 124 , 142 ) ; + Pos = MAP_APPFONT ( 169 , 142 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; Text [ en-US ] = "New ~Style..." ; }; + ScrollBar LB_SCROLL + { + Pos = MAP_APPFONT ( 260, 6 ) ; + Size = MAP_APPFONT ( 10 , 150 ) ; + TabStop = TRUE ; + VScroll = TRUE ; + }; OKButton BTN_OK { - Pos = MAP_APPFONT ( 260 , 6 ) ; + Pos = MAP_APPFONT ( 270 , 6 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; DefButton = TRUE ; }; CancelButton BTN_CANCEL { - Pos = MAP_APPFONT ( 260 , 23 ) ; + Pos = MAP_APPFONT ( 270 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + PushButton BTN_INSERT + { + Pos = MAP_APPFONT ( 270 , 57 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; + Text [ en-US ] = "~Insert" ; }; HelpButton BTN_HELP { - Pos = MAP_APPFONT ( 260 , 43 ) ; + Pos = MAP_APPFONT ( 270 , 74 ) ; Size = MAP_APPFONT ( 50 , 14 ) ; TabStop = TRUE ; };