diff options
author | Olivier Hallot <olivier.hallot@edx.srv.br> | 2013-12-18 00:45:32 -0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-12-19 13:30:41 +0000 |
commit | 9dccff429db197a92ed2af957fb6d3d75b3f2154 (patch) | |
tree | 7b2cd494d9ec1023c3568e221f60f74f51ac5580 /chart2 | |
parent | 6c5c79e2032ecc980e6774656a67ca67ce45b108 (diff) |
Convert chart data labels tabpage to .ui
Change-Id: I6ffd992fe8a2cb290c8f8992922f0e54276e6ae1
Reviewed-on: https://gerrit.libreoffice.org/7124
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/AllLangResTarget_chartcontroller.mk | 1 | ||||
-rw-r--r-- | chart2/UIConfig_chart2.mk | 1 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/res_DataLabel.cxx | 310 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/res_DataLabel.hxx | 65 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/tp_DataLabel.cxx | 11 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/tp_DataLabel.src | 32 | ||||
-rw-r--r-- | chart2/source/controller/inc/HelpIds.hrc | 2 | ||||
-rw-r--r-- | chart2/source/controller/inc/dlg_InsertDataLabel.hxx | 4 | ||||
-rw-r--r-- | chart2/uiconfig/ui/tp_DataLabel.ui | 482 |
10 files changed, 851 insertions, 59 deletions
diff --git a/chart2/AllLangResTarget_chartcontroller.mk b/chart2/AllLangResTarget_chartcontroller.mk index 9342cc7d8932..3c6d55b93d5b 100644 --- a/chart2/AllLangResTarget_chartcontroller.mk +++ b/chart2/AllLangResTarget_chartcontroller.mk @@ -46,7 +46,6 @@ $(eval $(call gb_SrsTarget_add_files,chart2/res,\ chart2/source/controller/dialogs/Strings_Statistic.src \ chart2/source/controller/dialogs/tp_AxisLabel.src \ chart2/source/controller/dialogs/tp_ChartType.src \ - chart2/source/controller/dialogs/tp_DataLabel.src \ chart2/source/controller/dialogs/tp_DataSource.src \ chart2/source/controller/dialogs/tp_ErrorBars.src \ chart2/source/controller/dialogs/tp_PointGeometry.src \ diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk index 41a5fa906149..9f5f044152aa 100644 --- a/chart2/UIConfig_chart2.mk +++ b/chart2/UIConfig_chart2.mk @@ -43,6 +43,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\ chart2/uiconfig/ui/tp_3D_SceneIllumination \ chart2/uiconfig/ui/tp_axisLabel \ chart2/uiconfig/ui/tp_AxisPositions \ + chart2/uiconfig/ui/tp_DataLabel \ chart2/uiconfig/ui/tp_LegendPosition \ chart2/uiconfig/ui/tp_SeriesToAxis \ chart2/uiconfig/ui/tp_Scale \ diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx index 9a1663821544..4047644b5b87 100644 --- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx @@ -31,7 +31,7 @@ DataLabelsDialog::DataLabelsDialog(Window* pWindow, const SfxItemSet& rInAttrs, m_aBtnOK(this, SchResId(BTN_OK)), m_aBtnCancel(this, SchResId(BTN_CANCEL)), m_aBtnHelp(this, SchResId(BTN_HELP)), - m_apDataLabelResources( new DataLabelResources(this,rInAttrs) ), + m_apDataLabelResources( new oldDataLabelResources(this,rInAttrs) ), m_rInAttrs(rInAttrs) { FreeResource(); diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index b69a9e36d5ae..c0caf79bd688 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -94,7 +94,289 @@ void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, sal_uInt16 nWhichId, }//end anonymous namespace -DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAttrs ) +DataLabelResources::DataLabelResources(SfxTabPage* pWindow, const SfxItemSet& rInAttrs ) + : + m_pNumberFormatter(0), + m_bNumberFormatMixedState(true), + m_bPercentFormatMixedState(true), + m_nNumberFormatForValue(0), + m_nNumberFormatForPercent(11), + m_bSourceFormatMixedState(true), + m_bPercentSourceMixedState(true), + m_bSourceFormatForValue(true), + m_bSourceFormatForPercent(true), + m_pWindow(pWindow), + m_pPool(rInAttrs.GetPool()) +{ + pWindow->get(m_pCBNumber, "CB_VALUE_AS_NUMBER"); + pWindow->get(m_pPB_NumberFormatForValue, "PB_NUMBERFORMAT"); + pWindow->get(m_pCBPercent, "CB_VALUE_AS_PERCENTAGE"); + pWindow->get(m_pPB_NumberFormatForPercent, "PB_PERCENT_NUMBERFORMAT"); + pWindow->get(m_pCBCategory, "CB_CATEGORY"); + pWindow->get(m_pCBSymbol, "CB_SYMBOL"); + + pWindow->get(m_pBxLabelPlacement, "boxPLACEMENT"); + pWindow->get(m_pLB_LabelPlacement, "LB_LABEL_PLACEMENT"); + + pWindow->get(m_pDC_Dial, "CT_DIAL"); + pWindow->get(m_pFT_Dial, "CT_LABEL_DIAL"); + + m_pDC_Dial->SetText(m_pFT_Dial->GetText()); + + pWindow->get(m_pNF_Degrees, "NF_LABEL_DEGREES"); + pWindow->get(m_pLB_TextDirection, "LB_LABEL_TEXTDIR"); + pWindow->get(m_pBxTextDirection, "boxTXT_DIRECTION"); + pWindow->get(m_pBxOrientation, "boxORIENTATION"); + + pWindow->get(m_pSeparatorResources, "boxSEPARATOR"); + pWindow->get(m_pLB_Separator, "LB_TEXT_SEPARATOR"); + + m_aEntryMap[0] = " "; + m_aEntryMap[1] = ", "; + m_aEntryMap[2] = "; "; + m_aEntryMap[3] = "\n" ; + + //fill label placement list + std::map< sal_Int32, OUString > aPlacementToStringMap; + for( sal_Int32 nEnum=0; nEnum<m_pLB_LabelPlacement->GetEntryCount(); ++nEnum ) + aPlacementToStringMap[nEnum] = m_pLB_LabelPlacement->GetEntry(static_cast<sal_uInt16>(nEnum)); + + ::com::sun::star::uno::Sequence < sal_Int32 > aAvailabelPlacementList; + const SfxPoolItem *pPoolItem = NULL; + if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, sal_True, &pPoolItem) == SFX_ITEM_SET ) + aAvailabelPlacementList =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence(); + + m_pLB_LabelPlacement->Clear(); + for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN ) + { + sal_uInt16 nListBoxPos = static_cast<sal_uInt16>( nN ); + sal_Int32 nPlacement = aAvailabelPlacementList[nN]; + m_aPlacementToListBoxMap[nPlacement]=nListBoxPos; + m_aListBoxToPlacementMap[nListBoxPos]=nPlacement; + m_pLB_LabelPlacement->InsertEntry( aPlacementToStringMap[nPlacement] ); + } + m_pLB_LabelPlacement->SetDropDownLineCount(m_pLB_LabelPlacement->GetEntryCount()); + + //some click handler + m_pPB_NumberFormatForValue->SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) ); + m_pPB_NumberFormatForPercent->SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) ); + m_pCBNumber->SetClickHdl( LINK( this, DataLabelResources, CheckHdl )); + m_pCBPercent->SetClickHdl( LINK( this, DataLabelResources, CheckHdl )); + m_pCBCategory->SetClickHdl( LINK( this, DataLabelResources, CheckHdl )); + m_pCBSymbol->SetClickHdl( LINK( this, DataLabelResources, CheckHdl )); + + m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState ); + m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState); + + if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, sal_True, &pPoolItem) == SFX_ITEM_SET ) + { + bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() ); + if( bForbidPercentValue ) + m_pCBPercent->Enable(false); + } + + m_pDC_Dial->SetLinkedField( m_pNF_Degrees ); +} + +DataLabelResources::~DataLabelResources() +{ +} + +void DataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter ) +{ + m_pNumberFormatter = pFormatter; +} + +IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton ) +{ + if( !m_pPool || !m_pNumberFormatter ) + { + OSL_FAIL("Missing item pool or number formatter"); + return 1; + } + + if( pButton == m_pPB_NumberFormatForValue && !m_pCBNumber->IsChecked()) + m_pCBNumber->Check(); + else if( pButton == m_pPB_NumberFormatForPercent && !m_pCBPercent->IsChecked()) + m_pCBPercent->Check(); + + SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool ); + aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO)); + + bool bPercent = ( pButton == m_pPB_NumberFormatForPercent ); + + sal_uLong& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue; + bool& rUseSourceFormat = bPercent ? m_bSourceFormatForPercent : m_bSourceFormatForValue; + bool& rbMixedState = bPercent ? m_bPercentFormatMixedState : m_bNumberFormatMixedState; + bool& rbSourceMixedState = bPercent ? m_bPercentSourceMixedState : m_bSourceFormatMixedState; + + if(!rbMixedState) + aNumberSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, rnFormatKey )); + aNumberSet.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, rUseSourceFormat )); + + NumberFormatDialog aDlg(m_pWindow, aNumberSet); + if( bPercent ) + aDlg.SetText( SCH_RESSTR( STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE ) ); + if( RET_OK == aDlg.Execute() ) + { + const SfxItemSet* pResult = aDlg.GetOutputItemSet(); + if( pResult ) + { + bool bOldSource = rUseSourceFormat; + sal_uLong nOldFormat = rnFormatKey; + bool bOldMixedState = rbMixedState || rbSourceMixedState; + + rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState ); + + //todo this maybe can be removed when the numberformatter dialog does handle mixed state for source format correctly + if( bOldMixedState && bOldSource == rUseSourceFormat && nOldFormat == rnFormatKey ) + rbMixedState = rbSourceMixedState = true; + } + } + return 0; +} + +IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox ) +{ + if( pBox ) + pBox->EnableTriState( sal_False ); + EnableControls(); + return 0; +} + +void DataLabelResources::EnableControls() +{ + m_pCBSymbol->Enable( m_pCBNumber->IsChecked() || (m_pCBPercent->IsChecked() && m_pCBPercent->IsEnabled()) + || m_pCBCategory->IsChecked() ); + + // Enable or disable separator, placement and direction based on the check + // box states. Note that the check boxes are tri-state. + { + long nNumberOfCheckedLabelParts = 0; + if (m_pCBNumber->GetState() != STATE_NOCHECK) + ++nNumberOfCheckedLabelParts; + if (m_pCBPercent->GetState() != STATE_NOCHECK && m_pCBPercent->IsEnabled()) + ++nNumberOfCheckedLabelParts; + if (m_pCBCategory->GetState() != STATE_NOCHECK) + ++nNumberOfCheckedLabelParts; + + m_pSeparatorResources->Enable( nNumberOfCheckedLabelParts > 1 ); + + bool bEnableTextDir = nNumberOfCheckedLabelParts > 0; + m_pBxTextDirection->Enable( bEnableTextDir ); + bool bEnablePlacement = nNumberOfCheckedLabelParts > 0 && m_pLB_LabelPlacement->GetEntryCount()>1; + m_pBxLabelPlacement->Enable( bEnablePlacement ); + } + + m_pPB_NumberFormatForValue->Enable( m_pNumberFormatter && m_pCBNumber->IsChecked() ); + m_pPB_NumberFormatForPercent->Enable( m_pNumberFormatter && m_pCBPercent->IsChecked() && m_pCBPercent->IsEnabled() ); + + bool bEnableRotation = ( m_pCBNumber->IsChecked() || m_pCBPercent->IsChecked() || m_pCBCategory->IsChecked() ); + m_pBxOrientation->Enable( bEnableRotation ); +} + +sal_Bool DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const +{ + if( m_pCBNumber->IsChecked() ) + { + if( !m_bNumberFormatMixedState ) + rOutAttrs.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, m_nNumberFormatForValue )); + if( !m_bSourceFormatMixedState ) + rOutAttrs.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, m_bSourceFormatForValue )); + } + if( m_pCBPercent->IsChecked() ) + { + if( !m_bPercentFormatMixedState ) + rOutAttrs.Put( SfxUInt32Item( SCHATTR_PERCENT_NUMBERFORMAT_VALUE, m_nNumberFormatForPercent )); + if( !m_bPercentSourceMixedState ) + rOutAttrs.Put( SfxBoolItem( SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_bSourceFormatForPercent )); + } + + if( m_pCBNumber->GetState()!= STATE_DONTKNOW ) + rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_NUMBER, m_pCBNumber->IsChecked() ) ); + if( m_pCBPercent->GetState()!= STATE_DONTKNOW ) + rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_pCBPercent->IsChecked() ) ); + if( m_pCBCategory->GetState()!= STATE_DONTKNOW ) + rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_CATEGORY, m_pCBCategory->IsChecked() ) ); + if( m_pCBSymbol->GetState()!= STATE_DONTKNOW ) + rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_pCBSymbol->IsChecked()) ); + + OUString aSep = m_aEntryMap[m_pLB_Separator->GetSelectEntryPos()]; + rOutAttrs.Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, aSep) ); + + ::std::map< sal_uInt16, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_pLB_LabelPlacement->GetSelectEntryPos()) ); + if(aIt!=m_aListBoxToPlacementMap.end()) + { + sal_Int32 nValue = aIt->second; + rOutAttrs.Put( SfxInt32Item( SCHATTR_DATADESCR_PLACEMENT, nValue ) ); + } + + if( m_pLB_TextDirection->GetSelectEntryCount() > 0 ) + rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_pLB_TextDirection->GetSelectEntryValue() ) ); + + if( m_pDC_Dial->IsVisible() ) + { + sal_Int32 nDegrees = m_pDC_Dial->GetRotation(); + rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) ); + } + + return sal_True; +} + +void DataLabelResources::Reset(const SfxItemSet& rInAttrs) +{ + // default state + m_pCBSymbol->Enable( sal_False ); + + lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, *m_pCBNumber ); + lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, *m_pCBPercent ); + lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, *m_pCBCategory ); + lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, *m_pCBSymbol ); + + m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState ); + m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState); + + const SfxPoolItem *pPoolItem = NULL; + if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, sal_True, &pPoolItem) == SFX_ITEM_SET ) + for(sal_Int32 i=0; i < NUMBER_SEPARATORS; ++i ) + { + if( m_aEntryMap[i] == ((const SfxStringItem*)pPoolItem)->GetValue()) + m_pLB_Separator->SelectEntryPos( i ); + } + else + m_pLB_Separator->SelectEntryPos( 0 ); + + + if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, sal_True, &pPoolItem) == SFX_ITEM_SET ) + { + sal_Int32 nPlacement = ((const SfxInt32Item*)pPoolItem)->GetValue(); + ::std::map< sal_Int32, sal_uInt16 >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) ); + if(aIt!=m_aPlacementToListBoxMap.end()) + { + sal_uInt16 nPos = aIt->second; + m_pLB_LabelPlacement->SelectEntryPos( nPos ); + } + else + m_pLB_LabelPlacement->SetNoSelection(); + } + else + m_pLB_LabelPlacement->SetNoSelection(); + + if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET ) + m_pLB_TextDirection->SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) ); + + if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, sal_True, &pPoolItem ) == SFX_ITEM_SET ) + { + sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); + m_pDC_Dial->SetRotation( nDegrees ); + } + else + m_pDC_Dial->SetRotation( 0 ); + + EnableControls(); +} + +oldDataLabelResources::oldDataLabelResources( Window* pWindow, const SfxItemSet& rInAttrs ) : m_aCBNumber(pWindow, SchResId(CB_VALUE_AS_NUMBER)), m_aPB_NumberFormatForValue(pWindow, SchResId(PB_NUMBERFORMAT)), m_aCBPercent(pWindow, SchResId(CB_VALUE_AS_PERCENTAGE)), @@ -187,12 +469,12 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt m_aLB_LabelPlacement.SetPosPixel( Point( m_aSeparatorResources.GetCurrentListBoxPosition().X(), m_aLB_LabelPlacement.GetPosPixel().Y() ) ); //some click handler - m_aPB_NumberFormatForValue.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) ); - m_aPB_NumberFormatForPercent.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) ); - m_aCBNumber.SetClickHdl( LINK( this, DataLabelResources, CheckHdl )); - m_aCBPercent.SetClickHdl( LINK( this, DataLabelResources, CheckHdl )); - m_aCBCategory.SetClickHdl( LINK( this, DataLabelResources, CheckHdl )); - m_aCBSymbol.SetClickHdl( LINK( this, DataLabelResources, CheckHdl )); + m_aPB_NumberFormatForValue.SetClickHdl( LINK( this, oldDataLabelResources, NumberFormatDialogHdl ) ); + m_aPB_NumberFormatForPercent.SetClickHdl( LINK( this, oldDataLabelResources, NumberFormatDialogHdl ) ); + m_aCBNumber.SetClickHdl( LINK( this, oldDataLabelResources, CheckHdl )); + m_aCBPercent.SetClickHdl( LINK( this, oldDataLabelResources, CheckHdl )); + m_aCBCategory.SetClickHdl( LINK( this, oldDataLabelResources, CheckHdl )); + m_aCBSymbol.SetClickHdl( LINK( this, oldDataLabelResources, CheckHdl )); m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState ); m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState); @@ -207,16 +489,16 @@ DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAt m_aDC_Dial.SetLinkedField( &m_aNF_Degrees ); } -DataLabelResources::~DataLabelResources() +oldDataLabelResources::~oldDataLabelResources() { } -void DataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter ) +void oldDataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter ) { m_pNumberFormatter = pFormatter; } -IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton ) +IMPL_LINK( oldDataLabelResources, NumberFormatDialogHdl, PushButton *, pButton ) { if( !m_pPool || !m_pNumberFormatter ) { @@ -265,7 +547,7 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton ) return 0; } -IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox ) +IMPL_LINK( oldDataLabelResources, CheckHdl, CheckBox*, pBox ) { if( pBox ) pBox->EnableTriState( sal_False ); @@ -273,7 +555,7 @@ IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox ) return 0; } -void DataLabelResources::EnableControls() +void oldDataLabelResources::EnableControls() { m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.IsChecked() ); @@ -306,7 +588,7 @@ void DataLabelResources::EnableControls() m_aNF_Degrees.Enable( bEnableRotation ); } -sal_Bool DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const +sal_Bool oldDataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const { if( m_aCBNumber.IsChecked() ) { @@ -352,7 +634,7 @@ sal_Bool DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const return sal_True; } -void DataLabelResources::Reset(const SfxItemSet& rInAttrs) +void oldDataLabelResources::Reset(const SfxItemSet& rInAttrs) { // default state m_aCBSymbol.Enable( sal_False ); diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx index 515dc3d542b8..4e0daf48a706 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.hxx +++ b/chart2/source/controller/dialogs/res_DataLabel.hxx @@ -19,15 +19,19 @@ #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_DATALABEL_HXX #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_DATALABEL_HXX +#define NUMBER_SEPARATORS 4 + #include "res_TextSeparator.hxx" // header for class CheckBox #include <vcl/button.hxx> +#include <vcl/layout.hxx> // header for class SfxItemSet #include <svl/itemset.hxx> #include "TextDirectionListBox.hxx" #include <svx/dialcontrol.hxx> #include <svx/wrapfield.hxx> +#include <sfx2/tabdlg.hxx> class SvNumberFormatter; @@ -37,7 +41,7 @@ namespace chart class DataLabelResources { public: - DataLabelResources( Window* pParent, const SfxItemSet& rInAttrs ); + DataLabelResources( SfxTabPage* pParent, const SfxItemSet& rInAttrs ); virtual ~DataLabelResources(); sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const; @@ -46,6 +50,64 @@ public: void SetNumberFormatter( SvNumberFormatter* pFormatter ); private: + CheckBox* m_pCBNumber; + PushButton* m_pPB_NumberFormatForValue; + CheckBox* m_pCBPercent; + PushButton* m_pPB_NumberFormatForPercent; + CheckBox* m_pCBCategory; + CheckBox* m_pCBSymbol; + +// TextSeparatorResources m_aSeparatorResources; + VclHBox* m_pSeparatorResources; + ListBox* m_pLB_Separator; + OUString m_aEntryMap[NUMBER_SEPARATORS]; + + VclHBox* m_pBxLabelPlacement; + ListBox* m_pLB_LabelPlacement; + + VclHBox* m_pBxOrientation; + svx::DialControl* m_pDC_Dial; + FixedText* m_pFT_Dial; + svx::WrapField* m_pNF_Degrees; + + VclHBox* m_pBxTextDirection; + TextDirectionListBox* m_pLB_TextDirection; + + ::std::map< sal_Int32, sal_uInt16 > m_aPlacementToListBoxMap; + ::std::map< sal_uInt16, sal_Int32 > m_aListBoxToPlacementMap; + + SvNumberFormatter* m_pNumberFormatter; + bool m_bNumberFormatMixedState; + bool m_bPercentFormatMixedState; + sal_uLong m_nNumberFormatForValue; + sal_uLong m_nNumberFormatForPercent; + + bool m_bSourceFormatMixedState; + bool m_bPercentSourceMixedState; + bool m_bSourceFormatForValue; + bool m_bSourceFormatForPercent; + + SfxTabPage* m_pWindow; + SfxItemPool* m_pPool; + + DECL_LINK(NumberFormatDialogHdl, PushButton * ); + DECL_LINK(CheckHdl, CheckBox* ); + void EnableControls(); +}; + +class oldDataLabelResources +{ +public: + oldDataLabelResources( Window* pParent, const SfxItemSet& rInAttrs ); + + virtual ~oldDataLabelResources(); + + sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const; + void Reset(const SfxItemSet& rInAttrs); + + void SetNumberFormatter( SvNumberFormatter* pFormatter ); + +private: CheckBox m_aCBNumber; PushButton m_aPB_NumberFormatForValue; CheckBox m_aCBPercent; @@ -87,7 +149,6 @@ private: DECL_LINK(CheckHdl, CheckBox* ); void EnableControls(); }; - } //namespace chart #endif diff --git a/chart2/source/controller/dialogs/tp_DataLabel.cxx b/chart2/source/controller/dialogs/tp_DataLabel.cxx index 53bcebfaca51..3a0d6e71f4ad 100644 --- a/chart2/source/controller/dialogs/tp_DataLabel.cxx +++ b/chart2/source/controller/dialogs/tp_DataLabel.cxx @@ -26,18 +26,19 @@ namespace chart { DataLabelsTabPage::DataLabelsTabPage(Window* pWindow, const SfxItemSet& rInAttrs) : - SfxTabPage(pWindow, SchResId(TP_DATA_DESCR), rInAttrs), - m_aDataLabelResources(this, rInAttrs) + SfxTabPage(pWindow + , "tp_DataLabel" + , "modules/schart/ui/tp_DataLabel.ui" + , rInAttrs) + , m_aDataLabelResources(this, rInAttrs) { - FreeResource(); } DataLabelsTabPage::~DataLabelsTabPage() { } -SfxTabPage* DataLabelsTabPage::Create(Window* pWindow, - const SfxItemSet& rOutAttrs) +SfxTabPage* DataLabelsTabPage::Create(Window* pWindow, const SfxItemSet& rOutAttrs) { return new DataLabelsTabPage(pWindow, rOutAttrs); } diff --git a/chart2/source/controller/dialogs/tp_DataLabel.src b/chart2/source/controller/dialogs/tp_DataLabel.src deleted file mode 100644 index d861eebc3dae..000000000000 --- a/chart2/source/controller/dialogs/tp_DataLabel.src +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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 "HelpIds.hrc" -#include "TabPages.hrc" -#include "res_DataLabel.hrc" - -TabPage TP_DATA_DESCR -{ - Hide = TRUE ; - HelpID = HID_SCH_DATA_DESCR ; - SVLook = TRUE ; - Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ; - RESOURCE_DATALABEL( 6, 8 ) -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/HelpIds.hrc b/chart2/source/controller/inc/HelpIds.hrc index 2c853445a7e7..10e27537336f 100644 --- a/chart2/source/controller/inc/HelpIds.hrc +++ b/chart2/source/controller/inc/HelpIds.hrc @@ -19,8 +19,6 @@ #ifndef CHART_HELPIDS_HRC #define CHART_HELPIDS_HRC -#define HID_SCH_DATA_DESCR "CHART2_HID_SCH_DATA_DESCR" - #define HID_SCH_WIN_DOCUMENT "CHART2_HID_SCH_WIN_DOCUMENT" #define HID_SCH_CTL_DATA "CHART2_HID_SCH_CTL_DATA" diff --git a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx index 4766285ec9d8..41518d1ac267 100644 --- a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx +++ b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx @@ -33,14 +33,14 @@ class SvNumberFormatter; namespace chart { -class DataLabelResources; +class oldDataLabelResources; class DataLabelsDialog : public ModalDialog { private: OKButton m_aBtnOK; CancelButton m_aBtnCancel; HelpButton m_aBtnHelp; - ::std::auto_ptr< DataLabelResources > m_apDataLabelResources; + ::std::auto_ptr< oldDataLabelResources > m_apDataLabelResources; const SfxItemSet& m_rInAttrs; diff --git a/chart2/uiconfig/ui/tp_DataLabel.ui b/chart2/uiconfig/ui/tp_DataLabel.ui new file mode 100644 index 000000000000..2ce94acb0086 --- /dev/null +++ b/chart2/uiconfig/ui/tp_DataLabel.ui @@ -0,0 +1,482 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkAdjustment" id="adjustmentDEGREE"> + <property name="upper">359</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkListStore" id="liststorePLACEMENT"> + <columns> + <!-- column-name gchararray1 --> + <column type="gchararray"/> + <!-- column-name guint1 --> + <column type="guint"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Best fit</col> + <col id="1">0</col> + </row> + <row> + <col id="0" translatable="yes">Center</col> + <col id="1">1</col> + </row> + <row> + <col id="0" translatable="yes">Above</col> + <col id="1">2</col> + </row> + <row> + <col id="0" translatable="yes">Top left</col> + <col id="1">3</col> + </row> + <row> + <col id="0" translatable="yes">Left</col> + <col id="1">4</col> + </row> + <row> + <col id="0" translatable="yes">Bottom left</col> + <col id="1">5</col> + </row> + <row> + <col id="0" translatable="yes">Below</col> + <col id="1">6</col> + </row> + <row> + <col id="0" translatable="yes">Bottom right</col> + <col id="1">7</col> + </row> + <row> + <col id="0" translatable="yes">Right</col> + <col id="1">8</col> + </row> + <row> + <col id="0" translatable="yes">Top right</col> + <col id="1">9</col> + </row> + <row> + <col id="0" translatable="yes">Inside</col> + <col id="1">10</col> + </row> + <row> + <col id="0" translatable="yes">Outside</col> + <col id="1">11</col> + </row> + <row> + <col id="0" translatable="yes">Near origin</col> + <col id="1">12</col> + </row> + </data> + </object> + <object class="GtkListStore" id="liststoreSEPARATOR"> + <columns> + <!-- column-name gchararray1 --> + <column type="gchararray"/> + <!-- column-name guint1 --> + <column type="guint"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Space</col> + <col id="1">0</col> + </row> + <row> + <col id="0" translatable="yes">Comma</col> + <col id="1">1</col> + </row> + <row> + <col id="0" translatable="yes">Semicolon</col> + <col id="1">2</col> + </row> + <row> + <col id="0" translatable="yes">New line</col> + <col id="1">3</col> + </row> + </data> + </object> + <object class="GtkBox" id="tp_DataLabel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <property name="row_homogeneous">True</property> + <child> + <object class="GtkCheckButton" id="CB_VALUE_AS_NUMBER"> + <property name="label" translatable="yes">Show value as _number</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="CB_VALUE_AS_PERCENTAGE"> + <property name="label" translatable="yes">Show value as _percentage</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="CB_CATEGORY"> + <property name="label" translatable="yes">Show _category</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="CB_SYMBOL"> + <property name="label" translatable="yes">Show _legend key</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="PB_NUMBERFORMAT"> + <property name="label" translatable="yes">Number _format...</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="PB_PERCENT_NUMBERFORMAT"> + <property name="label" translatable="yes">Percentage f_ormat...</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="CT_LABEL_DIAL"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="label" translatable="yes">ABCD</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="boxSEPARATOR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="FT_TEXT_SEPARATOR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">_Separator</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">LB_TEXT_SEPARATOR</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="LB_TEXT_SEPARATOR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="model">liststoreSEPARATOR</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">4</property> + <property name="width">2</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="boxPLACEMENT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="FT_LABEL_PLACEMENT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Place_ment</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">LB_LABEL_PLACEMENT</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="LB_LABEL_PLACEMENT"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="model">liststorePLACEMENT</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">5</property> + <property name="width">2</property> + <property name="height">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Text Attributes</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="boxORIENTATION"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="svxlo-DialControl" id="CT_DIAL"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="svxlo-WrapField" id="NF_LABEL_DEGREES"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">center</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustmentDEGREE</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="FT_LABEL_DEGREES"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Degrees</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="boxTXT_DIRECTION"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="FT_LABEL_TEXTDIR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Te_xt direction</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">LB_LABEL_TEXTDIR</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="chartcontrollerlo-TextDirectionListBox" id="LB_LABEL_TEXTDIR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Rotate Text</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <object class="GtkSizeGroup" id="sizegroup1"> + <widgets> + <widget name="FT_TEXT_SEPARATOR"/> + <widget name="FT_LABEL_PLACEMENT"/> + </widgets> + </object> + <object class="GtkSizeGroup" id="sizegroup2"> + <widgets> + <widget name="LB_TEXT_SEPARATOR"/> + <widget name="LB_LABEL_PLACEMENT"/> + </widgets> + </object> +</interface> |