From 3596e88b65c52e53357be356025bc23baad71a0a Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Thu, 26 Dec 2013 16:43:13 -0200 Subject: Convert chart data label dialog to widget UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Conflicts: chart2/AllLangResTarget_chartcontroller.mk Change-Id: Id9054b3b0c6e7a10a72bc90b05cd7c6bbc5e82a2 Reviewed-on: https://gerrit.libreoffice.org/7205 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- chart2/AllLangResTarget_chartcontroller.mk | 2 - chart2/Library_chartcontroller.mk | 1 - chart2/UIConfig_chart2.mk | 1 + chart2/source/controller/dialogs/Strings.src | 5 - .../controller/dialogs/dlg_InsertDataLabel.cxx | 15 +- .../controller/dialogs/dlg_InsertDataLabel.hrc | 26 - .../controller/dialogs/dlg_InsertDataLabel.src | 35 -- chart2/source/controller/dialogs/res_DataLabel.cxx | 316 +---------- chart2/source/controller/dialogs/res_DataLabel.hxx | 61 +-- .../controller/dialogs/res_DataLabel_IDs.hrc | 39 -- .../controller/dialogs/res_DataLabel_tmpl.hrc | 163 ------ .../controller/dialogs/res_TextSeparator.cxx | 142 ----- .../controller/dialogs/res_TextSeparator.hxx | 65 --- .../controller/dialogs/res_TextSeparator.src | 43 -- chart2/source/controller/dialogs/tp_DataLabel.cxx | 6 +- chart2/source/controller/dialogs/tp_DataLabel.hxx | 4 +- chart2/source/controller/inc/HelpIds.hrc | 13 - .../source/controller/inc/dlg_InsertDataLabel.hxx | 14 +- chart2/source/inc/Strings.hrc | 1 - chart2/uiconfig/ui/dlg_DataLabel.ui | 577 +++++++++++++++++++++ chart2/uiconfig/ui/tp_DataLabel.ui | 11 +- 21 files changed, 611 insertions(+), 929 deletions(-) delete mode 100644 chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc delete mode 100644 chart2/source/controller/dialogs/dlg_InsertDataLabel.src delete mode 100644 chart2/source/controller/dialogs/res_DataLabel_IDs.hrc delete mode 100644 chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc delete mode 100644 chart2/source/controller/dialogs/res_TextSeparator.cxx delete mode 100644 chart2/source/controller/dialogs/res_TextSeparator.hxx delete mode 100644 chart2/source/controller/dialogs/res_TextSeparator.src create mode 100644 chart2/uiconfig/ui/dlg_DataLabel.ui diff --git a/chart2/AllLangResTarget_chartcontroller.mk b/chart2/AllLangResTarget_chartcontroller.mk index d74298196297..2bac70802169 100644 --- a/chart2/AllLangResTarget_chartcontroller.mk +++ b/chart2/AllLangResTarget_chartcontroller.mk @@ -32,7 +32,6 @@ $(eval $(call gb_SrsTarget_add_files,chart2/res,\ chart2/source/controller/dialogs/dlg_ShapeFont.src \ chart2/source/controller/dialogs/dlg_ShapeParagraph.src \ chart2/source/controller/dialogs/res_BarGeometry.src \ - chart2/source/controller/dialogs/res_TextSeparator.src \ chart2/source/controller/dialogs/Strings_AdditionalControls.src \ chart2/source/controller/dialogs/Strings_ChartTypes.src \ chart2/source/controller/dialogs/Strings_Scale.src \ @@ -47,7 +46,6 @@ $(eval $(call gb_SrsTarget_add_nonlocalizable_files,chart2/res,\ chart2/source/controller/dialogs/Bitmaps.src \ chart2/source/controller/dialogs/dlg_ChartType.src \ chart2/source/controller/dialogs/dlg_CreationWizard.src \ - chart2/source/controller/dialogs/dlg_InsertDataLabel.src \ chart2/source/controller/dialogs/dlg_InsertErrorBars.src \ chart2/source/controller/dialogs/tp_PointGeometry.src \ chart2/source/controller/menus/ShapeContextMenu.src \ diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk index a4e606730ee3..ea7cb8a9ae9b 100644 --- a/chart2/Library_chartcontroller.mk +++ b/chart2/Library_chartcontroller.mk @@ -115,7 +115,6 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\ chart2/source/controller/dialogs/res_DataLabel \ chart2/source/controller/dialogs/res_ErrorBar \ chart2/source/controller/dialogs/res_LegendPosition \ - chart2/source/controller/dialogs/res_TextSeparator \ chart2/source/controller/dialogs/res_Titles \ chart2/source/controller/dialogs/res_Trendline \ chart2/source/controller/dialogs/TextDirectionListBox \ diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk index 1385a0204b79..ed55b984fec9 100644 --- a/chart2/UIConfig_chart2.mk +++ b/chart2/UIConfig_chart2.mk @@ -32,6 +32,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/schart,\ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\ chart2/uiconfig/ui/3dviewdialog \ chart2/uiconfig/ui/attributedialog \ + chart2/uiconfig/ui/dlg_DataLabel \ chart2/uiconfig/ui/insertaxisdlg \ chart2/uiconfig/ui/insertgriddlg \ chart2/uiconfig/ui/inserttitledlg \ diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src index c79b847c4b50..5705867ff78a 100644 --- a/chart2/source/controller/dialogs/Strings.src +++ b/chart2/source/controller/dialogs/Strings.src @@ -33,11 +33,6 @@ String STR_DLG_STEPPED_LINE_PROPERTIES Text [ en-US ] = "Stepped Lines" ; }; -String STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE -{ - Text [ en-US ] = "Number Format for Percentage Value" ; -}; - String STR_PAGE_CHARTTYPE { Text [ en-US ] = "Chart Type" ; diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx index 4047644b5b87..3625ef5fc5f1 100644 --- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertDataLabel.cxx @@ -18,25 +18,18 @@ */ #include "dlg_InsertDataLabel.hxx" -#include "dlg_InsertDataLabel.hrc" -#include "ResId.hxx" -#include "ObjectNameProvider.hxx" #include "res_DataLabel.hxx" namespace chart { DataLabelsDialog::DataLabelsDialog(Window* pWindow, const SfxItemSet& rInAttrs, SvNumberFormatter* pFormatter) : - ModalDialog(pWindow, SchResId(DLG_DATA_DESCR)), - m_aBtnOK(this, SchResId(BTN_OK)), - m_aBtnCancel(this, SchResId(BTN_CANCEL)), - m_aBtnHelp(this, SchResId(BTN_HELP)), - m_apDataLabelResources( new oldDataLabelResources(this,rInAttrs) ), + ModalDialog(pWindow + ,"dlg_DataLabels" + ,"modules/schart/ui/dlg_DataLabel.ui"), + m_apDataLabelResources( new DataLabelResources(this, this, rInAttrs) ), m_rInAttrs(rInAttrs) { - FreeResource(); - this->SetText( ObjectNameProvider::getName_ObjectForAllSeries( OBJECTTYPE_DATA_LABELS ) ); - m_apDataLabelResources->SetNumberFormatter( pFormatter ); Reset(); } diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc b/chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc deleted file mode 100644 index 1e56b5e98672..000000000000 --- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.hrc +++ /dev/null @@ -1,26 +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 "ResourceIds.hrc" - -#define BTN_OK 1 -#define BTN_CANCEL 1 -#define BTN_HELP 1 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/dlg_InsertDataLabel.src b/chart2/source/controller/dialogs/dlg_InsertDataLabel.src deleted file mode 100644 index 520ed9f935dd..000000000000 --- a/chart2/source/controller/dialogs/dlg_InsertDataLabel.src +++ /dev/null @@ -1,35 +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 "dlg_InsertDataLabel.hrc" -#include "CommonResources.hrc" -#include "res_DataLabel.hrc" - -ModalDialog DLG_DATA_DESCR -{ - HelpID = HID_INSERT_DESCRIPTION ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 316 , 185 ) ; - Moveable = TRUE ; - BUTTONS_OK_CANCEL_HELP_STACKED(260) - RESOURCE_DATALABEL( 6, 7 ) -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index c0caf79bd688..33d7a800f082 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -18,10 +18,7 @@ */ #include "res_DataLabel.hxx" -#include "res_DataLabel_IDs.hrc" -#include "Strings.hrc" -#include "ResId.hxx" #include "chartview/ChartSfxItemIds.hxx" #include "dlg_NumberFormat.hxx" @@ -94,7 +91,7 @@ void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, sal_uInt16 nWhichId, }//end anonymous namespace -DataLabelResources::DataLabelResources(SfxTabPage* pWindow, const SfxItemSet& rInAttrs ) +DataLabelResources::DataLabelResources(VclBuilderContainer* pWindow, Window* pParent, const SfxItemSet& rInAttrs ) : m_pNumberFormatter(0), m_bNumberFormatMixedState(true), @@ -105,13 +102,14 @@ DataLabelResources::DataLabelResources(SfxTabPage* pWindow, const SfxItemSet& rI m_bPercentSourceMixedState(true), m_bSourceFormatForValue(true), m_bSourceFormatForPercent(true), - m_pWindow(pWindow), + m_pWindow(pParent), 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_pFT_NumberFormatForPercent,"STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE"); pWindow->get(m_pCBCategory, "CB_CATEGORY"); pWindow->get(m_pCBSymbol, "CB_SYMBOL"); @@ -216,7 +214,7 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton ) NumberFormatDialog aDlg(m_pWindow, aNumberSet); if( bPercent ) - aDlg.SetText( SCH_RESSTR( STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE ) ); + aDlg.SetText( m_pFT_NumberFormatForPercent->GetText()); if( RET_OK == aDlg.Execute() ) { const SfxItemSet* pResult = aDlg.GetOutputItemSet(); @@ -376,312 +374,6 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs) 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)), - m_aPB_NumberFormatForPercent(pWindow, SchResId(PB_PERCENT_NUMBERFORMAT)), - m_aCBCategory(pWindow, SchResId(CB_CATEGORY)), - m_aCBSymbol(pWindow, SchResId(CB_SYMBOL)), - m_aSeparatorResources(pWindow), - m_aFT_LabelPlacement(pWindow, SchResId(FT_LABEL_PLACEMENT)), - m_aLB_LabelPlacement(pWindow, SchResId(LB_LABEL_PLACEMENT)), - m_aFL_Rotate(pWindow, SchResId(FL_LABEL_ROTATE)), - m_aDC_Dial(pWindow, SchResId(CT_LABEL_DIAL)), - m_aFT_Degrees(pWindow, SchResId(FT_LABEL_DEGREES)), - m_aNF_Degrees(pWindow, SchResId(NF_LABEL_DEGREES)), - m_aFT_TextDirection(pWindow, SchResId(FT_LABEL_TEXTDIR)), - m_aLB_TextDirection(pWindow, SchResId(LB_LABEL_TEXTDIR), &m_aFT_TextDirection), - 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()) -{ - //fill label placement list - std::map< sal_Int32, OUString > aPlacementToStringMap; - for( sal_Int32 nEnum=0; nEnum(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_aLB_LabelPlacement.Clear(); - for( sal_Int32 nN=0; nN( nN ); - sal_Int32 nPlacement = aAvailabelPlacementList[nN]; - m_aPlacementToListBoxMap[nPlacement]=nListBoxPos; - m_aListBoxToPlacementMap[nListBoxPos]=nPlacement; - m_aLB_LabelPlacement.InsertEntry( aPlacementToStringMap[nPlacement] ); - } - m_aLB_LabelPlacement.SetDropDownLineCount(m_aLB_LabelPlacement.GetEntryCount()); - - //replace&resize push buttons and resize checkboxes - Size aControlDistance( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) ); - long nPBWidth = ::std::max( m_aPB_NumberFormatForPercent.CalcMinimumSize().getWidth(), m_aPB_NumberFormatForValue.CalcMinimumSize().getWidth() ) - + 20; //the min with is to small to fit, hm... so add alittle - long nCBXWidth = ::std::max( m_aCBNumber.CalcMinimumSize().getWidth(), m_aCBPercent.CalcMinimumSize().getWidth() ); - long nNewPBXPos = m_aCBNumber.GetPosPixel().X() + nCBXWidth + aControlDistance.Width(); - long nPageWidth = pWindow->LogicToPixel( Size(260,185), MapMode(MAP_APPFONT) ).getWidth(); - if( nNewPBXPos + nPBWidth > nPageWidth ) - { - if( nPBWidth > nPageWidth/2 ) - nPBWidth = nPageWidth/2; - nNewPBXPos = nPageWidth-nPBWidth; - nCBXWidth = nPageWidth-m_aCBNumber.GetPosPixel().X()-nPBWidth-aControlDistance.Width(); - } - m_aPB_NumberFormatForValue.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForValue.GetPosPixel().Y() ) ); - m_aPB_NumberFormatForPercent.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForPercent.GetPosPixel().Y() ) ); - - Size aPBSize( m_aPB_NumberFormatForPercent.GetSizePixel() ); - aPBSize.setWidth( nPBWidth ); - m_aPB_NumberFormatForValue.SetSizePixel( aPBSize ); - m_aPB_NumberFormatForPercent.SetSizePixel( aPBSize ); - - Size aCBSize( m_aCBNumber.GetSizePixel() ); - aCBSize.setWidth(nCBXWidth); - m_aCBNumber.SetSizePixel( aCBSize ); - m_aCBPercent.SetSizePixel( aCBSize ); - - //place and align separator and label placement listboxes - Size aSize( m_aFT_LabelPlacement.GetSizePixel() ); - aSize.setWidth( m_aFT_LabelPlacement.CalcMinimumSize().getWidth() ); - m_aFT_LabelPlacement.SetSizePixel(aSize); - - long nWantedMinLeftBorder = m_aFT_LabelPlacement.GetPosPixel().X() + aSize.getWidth () + aControlDistance.Width(); - - m_aSeparatorResources.PositionBelowControl(m_aCBSymbol); - m_aSeparatorResources.AlignListBoxWidthAndXPos( nWantedMinLeftBorder, -1, m_aLB_LabelPlacement.CalcMinimumSize().getWidth() ); - m_aSeparatorResources.Show(true); - - aSize = m_aLB_LabelPlacement.GetSizePixel(); - aSize.setWidth( m_aSeparatorResources.GetCurrentListBoxSize().getWidth() ); - m_aLB_LabelPlacement.SetSizePixel(aSize); - m_aLB_LabelPlacement.SetPosPixel( Point( m_aSeparatorResources.GetCurrentListBoxPosition().X(), m_aLB_LabelPlacement.GetPosPixel().Y() ) ); - - //some click handler - 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); - - 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_aCBPercent.Enable(false); - } - - m_aDC_Dial.SetLinkedField( &m_aNF_Degrees ); -} - -oldDataLabelResources::~oldDataLabelResources() -{ -} - -void oldDataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter ) -{ - m_pNumberFormatter = pFormatter; -} - -IMPL_LINK( oldDataLabelResources, NumberFormatDialogHdl, PushButton *, pButton ) -{ - if( !m_pPool || !m_pNumberFormatter ) - { - OSL_FAIL("Missing item pool or number formatter"); - return 1; - } - - if( pButton == &m_aPB_NumberFormatForValue && !m_aCBNumber.IsChecked()) - m_aCBNumber.Check(); - else if( pButton == &m_aPB_NumberFormatForPercent && !m_aCBPercent.IsChecked()) - m_aCBPercent.Check(); - - SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool ); - aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO)); - - bool bPercent = ( pButton == &m_aPB_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( oldDataLabelResources, CheckHdl, CheckBox*, pBox ) -{ - if( pBox ) - pBox->EnableTriState( sal_False ); - EnableControls(); - return 0; -} - -void oldDataLabelResources::EnableControls() -{ - m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.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_aCBNumber.GetState() != STATE_NOCHECK) - ++nNumberOfCheckedLabelParts; - if (m_aCBPercent.GetState() != STATE_NOCHECK && m_aCBPercent.IsEnabled()) - ++nNumberOfCheckedLabelParts; - if (m_aCBCategory.GetState() != STATE_NOCHECK) - ++nNumberOfCheckedLabelParts; - m_aSeparatorResources.Enable( nNumberOfCheckedLabelParts > 1 ); - bool bEnableTextDir = nNumberOfCheckedLabelParts > 0; - m_aFT_TextDirection.Enable( bEnableTextDir ); - m_aLB_TextDirection.Enable( bEnableTextDir ); - bool bEnablePlacement = nNumberOfCheckedLabelParts > 0 && m_aLB_LabelPlacement.GetEntryCount()>1; - m_aFT_LabelPlacement.Enable( bEnablePlacement ); - m_aLB_LabelPlacement.Enable( bEnablePlacement ); - } - - m_aPB_NumberFormatForValue.Enable( m_pNumberFormatter && m_aCBNumber.IsChecked() ); - m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() ); - - bool bEnableRotation = ( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() ); - m_aFL_Rotate.Enable( bEnableRotation ); - m_aDC_Dial.Enable( bEnableRotation ); - m_aFT_Degrees.Enable( bEnableRotation ); - m_aNF_Degrees.Enable( bEnableRotation ); -} - -sal_Bool oldDataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const -{ - if( m_aCBNumber.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_aCBPercent.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_aCBNumber.GetState()!= STATE_DONTKNOW ) - rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber.IsChecked() ) ); - if( m_aCBPercent.GetState()!= STATE_DONTKNOW ) - rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent.IsChecked() ) ); - if( m_aCBCategory.GetState()!= STATE_DONTKNOW ) - rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory.IsChecked() ) ); - if( m_aCBSymbol.GetState()!= STATE_DONTKNOW ) - rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol.IsChecked()) ); - - rOutAttrs.Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, m_aSeparatorResources.GetValue() ) ); - ::std::map< sal_uInt16, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_aLB_LabelPlacement.GetSelectEntryPos()) ); - if(aIt!=m_aListBoxToPlacementMap.end()) - { - sal_Int32 nValue = aIt->second; - rOutAttrs.Put( SfxInt32Item( SCHATTR_DATADESCR_PLACEMENT, nValue ) ); - } - - if( m_aLB_TextDirection.GetSelectEntryCount() > 0 ) - rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLB_TextDirection.GetSelectEntryValue() ) ); - - if( m_aDC_Dial.IsVisible() ) - { - sal_Int32 nDegrees = m_aDC_Dial.GetRotation(); - rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) ); - } - - return sal_True; -} - -void oldDataLabelResources::Reset(const SfxItemSet& rInAttrs) -{ - // default state - m_aCBSymbol.Enable( sal_False ); - - lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber ); - lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent ); - lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory ); - lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol ); - - 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 ) - m_aSeparatorResources.SetValue( ((const SfxStringItem*)pPoolItem)->GetValue() ); - else - m_aSeparatorResources.SetDefault(); - - 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_aLB_LabelPlacement.SelectEntryPos( nPos ); - } - else - m_aLB_LabelPlacement.SetNoSelection(); - } - else - m_aLB_LabelPlacement.SetNoSelection(); - - if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET ) - m_aLB_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_aDC_Dial.SetRotation( nDegrees ); - } - else - m_aDC_Dial.SetRotation( 0 ); - - EnableControls(); -} - } //namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx index 4e0daf48a706..fa32bd565aa0 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.hxx +++ b/chart2/source/controller/dialogs/res_DataLabel.hxx @@ -21,7 +21,6 @@ #define NUMBER_SEPARATORS 4 -#include "res_TextSeparator.hxx" // header for class CheckBox #include #include @@ -41,7 +40,7 @@ namespace chart class DataLabelResources { public: - DataLabelResources( SfxTabPage* pParent, const SfxItemSet& rInAttrs ); + DataLabelResources( VclBuilderContainer* pWindow, Window* pParent, const SfxItemSet& rInAttrs ); virtual ~DataLabelResources(); sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const; @@ -54,10 +53,10 @@ private: PushButton* m_pPB_NumberFormatForValue; CheckBox* m_pCBPercent; PushButton* m_pPB_NumberFormatForPercent; + FixedText* m_pFT_NumberFormatForPercent; CheckBox* m_pCBCategory; CheckBox* m_pCBSymbol; -// TextSeparatorResources m_aSeparatorResources; VclHBox* m_pSeparatorResources; ListBox* m_pLB_Separator; OUString m_aEntryMap[NUMBER_SEPARATORS]; @@ -87,61 +86,6 @@ private: 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; - PushButton m_aPB_NumberFormatForPercent; - CheckBox m_aCBCategory; - CheckBox m_aCBSymbol; - - TextSeparatorResources m_aSeparatorResources; - - FixedText m_aFT_LabelPlacement; - ListBox m_aLB_LabelPlacement; - - FixedLine m_aFL_Rotate; - svx::DialControl m_aDC_Dial; - FixedText m_aFT_Degrees; - svx::WrapField m_aNF_Degrees; - - FixedText m_aFT_TextDirection; - TextDirectionListBox m_aLB_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; - Window* m_pWindow; SfxItemPool* m_pPool; @@ -149,6 +93,7 @@ private: DECL_LINK(CheckHdl, CheckBox* ); void EnableControls(); }; + } //namespace chart #endif diff --git a/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc b/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc deleted file mode 100644 index 9c1f0e35df9f..000000000000 --- a/chart2/source/controller/dialogs/res_DataLabel_IDs.hrc +++ /dev/null @@ -1,39 +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 . - */ - -#define CB_VALUE_AS_NUMBER 1 -#define CB_VALUE_AS_PERCENTAGE 2 -#define CB_CATEGORY 3 -#define CB_SYMBOL 4 - -#define PB_NUMBERFORMAT 20 -#define PB_PERCENT_NUMBERFORMAT 21 - -#define FT_LABEL_PLACEMENT 2 -#define LB_LABEL_PLACEMENT 2 - -#define FT_LABEL_TEXTDIR 31 -#define LB_LABEL_TEXTDIR 32 - -#define FL_LABEL_ROTATE 40 -#define CT_LABEL_DIAL 40 -#define FT_LABEL_DEGREES 40 -#define NF_LABEL_DEGREES 40 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc b/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc deleted file mode 100644 index 717ceb41e3d3..000000000000 --- a/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc +++ /dev/null @@ -1,163 +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 . - */ -#ifndef _CHART2_RESOURCE_DATALABEL_HXX -#define _CHART2_RESOURCE_DATALABEL_HXX - -#include "HelpIds.hrc" -#include "res_DataLabel_IDs.hrc" - -#define WORKAROUND \ - StringList [ en-US ] = \ - { \ - "Best fit" ; \ - "Center" ; \ - "Above" ; \ - "Top left" ; \ - "Left" ; \ - "Bottom left" ; \ - "Below" ; \ - "Bottom right" ; \ - "Right" ; \ - "Top right" ; \ - "Inside" ; \ - "Outside" ; \ - "Near origin" ; \ - }; - - -#define RESOURCE_DATALABEL( xpos, ypos ) \ -CheckBox CB_VALUE_AS_NUMBER \ -{ \ - HelpID = HID_SCH_DATALABEL_VALUE; \ - Pos = MAP_APPFONT ( xpos , ypos ) ; \ - Size = MAP_APPFONT ( 136 , 10 ) ; \ - TabStop = TRUE ; \ - Text [ en-US ] = "Show value as ~number" ; \ -}; \ -PushButton PB_NUMBERFORMAT \ -{ \ - HelpID = HID_SCH_PB_NUMBERFORMAT; \ - TabStop = TRUE ; \ - Pos = MAP_APPFONT ( xpos+100 , ypos-3 ) ; \ - Size = MAP_APPFONT ( 100 , 14 ) ; \ - Text [ en-US ] = "Number ~format..." ; \ -}; \ -CheckBox CB_VALUE_AS_PERCENTAGE \ -{ \ - HelpID = HID_SCH_DATALABEL_PERCENT; \ - Pos = MAP_APPFONT ( xpos , ypos+17 ) ; \ - Size = MAP_APPFONT ( 136 , 10 ) ; \ - TabStop = TRUE ; \ - Text [ en-US ] = "Show value as ~percentage" ; \ -}; \ -PushButton PB_PERCENT_NUMBERFORMAT \ -{ \ - HelpID = HID_SCH_PB_PERCENT_NUMBERFORMAT; \ - TabStop = TRUE ; \ - Pos = MAP_APPFONT ( xpos+100 , ypos+17-3 ) ; \ - Size = MAP_APPFONT ( 100 , 14 ) ; \ - Text [ en-US ] = "Percentage f~ormat..." ; \ -}; \ -CheckBox CB_CATEGORY \ -{ \ - HelpID = HID_SCH_DATALABEL_TEXT; \ - Pos = MAP_APPFONT ( xpos , ypos+33 ); \ - Size = MAP_APPFONT ( 254 , 10 ); \ - TabStop = TRUE; \ - Text [ en-US ] = "Show ~category"; \ -}; \ -CheckBox CB_SYMBOL \ -{ \ - HelpID = HID_SCH_DATALABEL_SYMBOL; \ - Pos = MAP_APPFONT ( xpos , ypos+49 ) ; \ - Size = MAP_APPFONT ( 254 , 10 ) ; \ - TabStop = TRUE ; \ - Text [ en-US ] = "Show ~legend key" ; \ -}; \ -FixedText FT_LABEL_PLACEMENT \ -{ \ - Pos = MAP_APPFONT ( xpos , ypos+84 ) ; \ - Size = MAP_APPFONT ( 182 , 10 ) ; \ - TabStop = FALSE ; \ - Text [ en-US ] = "Place~ment"; \ -}; \ -ListBox LB_LABEL_PLACEMENT \ -{ \ - HelpID = HID_SCH_DATALABEL_PLACEMENT; \ - Border = TRUE ; \ - AutoHScroll = TRUE ; \ - Pos = MAP_APPFONT ( xpos+100 , ypos+82 ) ; \ - Size = MAP_APPFONT ( 89 , 12 ) ; \ - TabStop = TRUE ; \ - Group = TRUE ; \ - DropDown=TRUE; \ - DDExtraWidth = TRUE ; \ - WORKAROUND \ -}; \ -FixedLine FL_LABEL_ROTATE \ -{ \ - Pos = MAP_APPFONT ( xpos, ypos+103 ) ; \ - Size = MAP_APPFONT ( 248, 8 ) ; \ - Text [ en-US ] = "Rotate Text" ; \ -}; \ -Control CT_LABEL_DIAL \ -{ \ - HelpId = HID_SCH_DATALABEL_ROTATION_KNOB ; \ - Pos = MAP_APPFONT ( xpos+6 , ypos+116 ) ; \ - Size = MAP_APPFONT ( 43 , 43 ) ; \ - Text = "ABCD" ; \ -}; \ -FixedText FT_LABEL_DEGREES \ -{ \ - Pos = MAP_APPFONT ( xpos+87 , ypos+133 ) ; \ - Size = MAP_APPFONT ( 46, 8 ) ; \ - Text [ en-US ] = "~Degrees" ; \ -}; \ -NumericField NF_LABEL_DEGREES \ -{ \ - HelpId = HID_SCH_DATALABEL_ROTATION_EDIT ; \ - Pos = MAP_APPFONT ( xpos+55 , ypos+131 ) ; \ - Size = MAP_APPFONT ( 28 , 12 ) ; \ - Border = TRUE ; \ - TabStop = TRUE ; \ - Repeat = TRUE ; \ - Spin = TRUE ; \ - Minimum = 0 ; \ - Maximum = 359 ; \ - SpinSize = 5 ; \ -}; \ -FixedText FT_LABEL_TEXTDIR \ -{ \ - Pos = MAP_APPFONT ( xpos , ypos+162 ) ; \ - Size = MAP_APPFONT ( 64 , 8 ) ; \ - Text [ en-US ] = "Te~xt direction" ; \ -}; \ -ListBox LB_LABEL_TEXTDIR \ -{ \ - HelpID = HID_SCH_TEXTDIRECTION; \ - Pos = MAP_APPFONT ( xpos+66 , ypos+160 ) ; \ - Size = MAP_APPFONT ( 170 , 100 ) ; \ - Border = TRUE; \ - TabStop = TRUE; \ - DropDown = TRUE; \ -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/res_TextSeparator.cxx b/chart2/source/controller/dialogs/res_TextSeparator.cxx deleted file mode 100644 index 700476106dab..000000000000 --- a/chart2/source/controller/dialogs/res_TextSeparator.cxx +++ /dev/null @@ -1,142 +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 "res_TextSeparator.hxx" -#include "ResourceIds.hrc" -#include "Strings.hrc" -#include "ResId.hxx" -#include "macros.hxx" - -#include - -namespace chart -{ - -TextSeparatorResources::TextSeparatorResources( Window* pWindow ) - : m_aFT_Separator( pWindow, pWindow->GetStyle() ) - , m_aLB_Separator( pWindow , SchResId( LB_TEXT_SEPARATOR ) ) - , m_aEntryMap() - , m_nDefaultPos(0) -{ - m_aFT_Separator.SetText( SCH_RESSTR( STR_TEXT_SEPARATOR ) ); - m_aFT_Separator.SetSizePixel( m_aFT_Separator.CalcMinimumSize() ); - - m_aLB_Separator.SetDropDownLineCount(m_aLB_Separator.GetEntryCount()); - m_aLB_Separator.SetSizePixel( m_aLB_Separator.CalcMinimumSize() ); - - m_aEntryMap[ " " ] = 0; - m_aEntryMap[ ", " ] = 1; - m_aEntryMap[ "; " ] = 2; - m_aEntryMap[ "\n" ] = 3; - - m_aLB_Separator.SetAccessibleName(m_aFT_Separator.GetText()); - m_aLB_Separator.SetAccessibleRelationLabeledBy(&m_aFT_Separator); -} -TextSeparatorResources::~TextSeparatorResources() -{ -} -void TextSeparatorResources::Show( bool bShow ) -{ - m_aFT_Separator.Show( bShow ); - m_aLB_Separator.Show( bShow ); -} -void TextSeparatorResources::Enable( bool bEnable ) -{ - m_aFT_Separator.Enable( bEnable ); - m_aLB_Separator.Enable( bEnable ); -} -void TextSeparatorResources::PositionBelowControl( const Window& rWindow ) -{ - Point aPoint( rWindow.GetPosPixel() ); - Size aSize( rWindow.GetSizePixel() ); - aPoint.Y() += aSize.Height(); - Size aBigDistanceSize( rWindow.LogicToPixel( Size(0,RSC_SP_CTRL_Y), MapMode(MAP_APPFONT) ) ); - aPoint.Y() += aBigDistanceSize.Height(); - - Size aDistanceSize( rWindow.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, (RSC_CD_DROPDOWN_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2), MapMode(MAP_APPFONT) ) ); - aPoint.Y() += aDistanceSize.Height(); - - m_aFT_Separator.SetPosPixel( aPoint ); - m_aLB_Separator.SetPosPixel( Point( aPoint.X()+m_aFT_Separator.GetSizePixel().Width()+aDistanceSize.Width(), aPoint.Y()-aDistanceSize.Height()-1) ); -} - -void TextSeparatorResources::AlignListBoxWidthAndXPos( long nWantedLeftBorder /*use -1 to indicate that this can be automatic*/ - , long nWantedRightBorder /*use -1 to indicate that this can be automatic*/ - , long nMinimumListBoxWidth /*use -1 to indicate that this can be automatic*/ ) -{ - long nMinPossibleLeftBorder = m_aFT_Separator.GetPosPixel().X() + m_aFT_Separator.GetSizePixel().Width() + 1 ; - if( nWantedLeftBorder >= 0 && nWantedLeftBorder>nMinPossibleLeftBorder ) - { - Point aPos( m_aLB_Separator.GetPosPixel() ); - aPos.X() = nWantedLeftBorder; - m_aLB_Separator.SetPosPixel( aPos ); - } - - long nMinPossibleRightBorder = m_aLB_Separator.GetPosPixel().X() + m_aLB_Separator.CalcMinimumSize().Width() - 1 ; - if( nWantedRightBorder < m_aLB_Separator.GetPosPixel().X() + nMinimumListBoxWidth ) - nWantedRightBorder = m_aLB_Separator.GetPosPixel().X() + nMinimumListBoxWidth; - - if( nWantedRightBorder >= 0 && nWantedRightBorder > nMinPossibleRightBorder ) - { - Size aSize( m_aLB_Separator.GetSizePixel() ); - aSize.Width() = nWantedRightBorder-m_aLB_Separator.GetPosPixel().X(); - m_aLB_Separator.SetSizePixel(aSize); - } -} - -Point TextSeparatorResources::GetCurrentListBoxPosition() const -{ - return m_aLB_Separator.GetPosPixel(); -} - -Size TextSeparatorResources::GetCurrentListBoxSize() const -{ - return m_aLB_Separator.GetSizePixel(); -} - -void TextSeparatorResources::SetValue( const OUString& rSeparator ) -{ - ::std::map< OUString , sal_uInt16 >::iterator aIter( m_aEntryMap.find(rSeparator) ); - if( aIter == m_aEntryMap.end() ) - m_aLB_Separator.SelectEntryPos( m_nDefaultPos ); - else - m_aLB_Separator.SelectEntryPos( aIter->second ); -} - -void TextSeparatorResources::SetDefault() -{ - m_aLB_Separator.SelectEntryPos( m_nDefaultPos ); -} - - OUString TextSeparatorResources::GetValue() const -{ - sal_uInt16 nPos = m_aLB_Separator.GetSelectEntryPos(); - ::std::map< OUString , sal_uInt16 >::const_iterator aIter( m_aEntryMap.begin() ); - while( aIter != m_aEntryMap.end() ) - { - if(aIter->second==nPos ) - return aIter->first; - ++aIter; - } - return OUString( " " ); -} - -} //namespace chart - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/res_TextSeparator.hxx b/chart2/source/controller/dialogs/res_TextSeparator.hxx deleted file mode 100644 index e063b3799794..000000000000 --- a/chart2/source/controller/dialogs/res_TextSeparator.hxx +++ /dev/null @@ -1,65 +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 . - */ -#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_TEXTSEPARATOR_HXX -#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_TEXTSEPARATOR_HXX - -// header for class FixedText -#include -// header for class ListBox -#include - -#include - -namespace chart -{ - -class TextSeparatorResources -{ -public: - TextSeparatorResources( Window* pParent ); - virtual ~TextSeparatorResources(); - - void Show( bool bShow ); - void Enable( bool bEnable ); - - void PositionBelowControl( const Window& rWindow ); - void AlignListBoxWidthAndXPos( long nWantedLeftBorder /*use -1 to indicate that this can be automatic*/ - , long nWantedRightBorder /*use -1 to indicate that this can be automatic*/ - , long nMinimumListBoxWidth /*use -1 to indicate that this can be automatic*/ ); - Point GetCurrentListBoxPosition() const; - Size GetCurrentListBoxSize() const; - - OUString GetValue() const; - void SetValue( const OUString& rSeparator ); - void SetDefault(); - -private: - FixedText m_aFT_Separator; - ListBox m_aLB_Separator; - - ::std::map< OUString, sal_uInt16 > m_aEntryMap; - - const sal_uInt16 m_nDefaultPos; -}; - -} //namespace chart - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/res_TextSeparator.src b/chart2/source/controller/dialogs/res_TextSeparator.src deleted file mode 100644 index 8afe3de45873..000000000000 --- a/chart2/source/controller/dialogs/res_TextSeparator.src +++ /dev/null @@ -1,43 +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 "ResourceIds.hrc" -#include "HelpIds.hrc" - -ListBox LB_TEXT_SEPARATOR -{ - HelpID = HID_SCH_DATALABEL_SEPARATOR; \ - Border = TRUE ; - AutoHScroll = TRUE ; - Pos = MAP_APPFONT ( 6 , 17 ) ; - Size = MAP_APPFONT ( 89 , 12 ) ; - TabStop = TRUE ; - Group = TRUE ; - DropDown=TRUE; - DDExtraWidth = TRUE ; - - StringList [ en-US ] = - { - "Space" ; - "Comma" ; - "Semicolon" ; - "New line" ; - }; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/dialogs/tp_DataLabel.cxx b/chart2/source/controller/dialogs/tp_DataLabel.cxx index 3a0d6e71f4ad..c8bb89d65446 100644 --- a/chart2/source/controller/dialogs/tp_DataLabel.cxx +++ b/chart2/source/controller/dialogs/tp_DataLabel.cxx @@ -25,12 +25,12 @@ namespace chart { -DataLabelsTabPage::DataLabelsTabPage(Window* pWindow, const SfxItemSet& rInAttrs) : - SfxTabPage(pWindow +DataLabelsTabPage::DataLabelsTabPage(Window* pWindow, const SfxItemSet& rInAttrs) + : SfxTabPage(pWindow , "tp_DataLabel" , "modules/schart/ui/tp_DataLabel.ui" , rInAttrs) - , m_aDataLabelResources(this, rInAttrs) + , m_aDataLabelResources(this, this, rInAttrs) { } diff --git a/chart2/source/controller/dialogs/tp_DataLabel.hxx b/chart2/source/controller/dialogs/tp_DataLabel.hxx index 36dbea0782a9..9d44d9e2b2c9 100644 --- a/chart2/source/controller/dialogs/tp_DataLabel.hxx +++ b/chart2/source/controller/dialogs/tp_DataLabel.hxx @@ -33,10 +33,10 @@ namespace chart class DataLabelsTabPage : public SfxTabPage { public: - DataLabelsTabPage(Window* pParent, const SfxItemSet& rInAttrs); + DataLabelsTabPage(Window* pWindow, const SfxItemSet& rInAttrs); virtual ~DataLabelsTabPage(); - static SfxTabPage* Create(Window* pParent, const SfxItemSet& rInAttrs); + static SfxTabPage* Create(Window* pWindow, const SfxItemSet& rInAttrs); void SetNumberFormatter( SvNumberFormatter* pFormatter ); diff --git a/chart2/source/controller/inc/HelpIds.hrc b/chart2/source/controller/inc/HelpIds.hrc index a8d90cb6f1ce..7f75c2edbef1 100644 --- a/chart2/source/controller/inc/HelpIds.hrc +++ b/chart2/source/controller/inc/HelpIds.hrc @@ -57,18 +57,6 @@ #define HID_SCH_STATISTIK_PERCENT "CHART2_HID_SCH_STATISTIK_PERCENT" #define HID_SCH_STATISTIK_CONSTERROR "CHART2_HID_SCH_STATISTIK_CONSTERROR" -#define HID_SCH_DATALABEL_VALUE "CHART2_HID_SCH_DATALABEL_VALUE" -#define HID_SCH_DATALABEL_PERCENT "CHART2_HID_SCH_DATALABEL_PERCENT" -#define HID_SCH_DATALABEL_TEXT "CHART2_HID_SCH_DATALABEL_TEXT" -#define HID_SCH_DATALABEL_SYMBOL "CHART2_HID_SCH_DATALABEL_SYMBOL" -#define HID_SCH_PB_NUMBERFORMAT "CHART2_HID_SCH_PB_NUMBERFORMAT" -#define HID_SCH_PB_PERCENT_NUMBERFORMAT "CHART2_HID_SCH_PB_PERCENT_NUMBERFORMAT" -#define HID_SCH_DATALABEL_SEPARATOR "CHART2_HID_SCH_DATALABEL_SEPARATOR" -#define HID_SCH_DATALABEL_PLACEMENT "CHART2_HID_SCH_DATALABEL_PLACEMENT" -#define HID_SCH_TEXTDIRECTION "CHART2_HID_SCH_TEXTDIRECTION" -#define HID_SCH_DATALABEL_ROTATION_KNOB "CHART2_HID_SCH_DATALABEL_ROTATION_KNOB" -#define HID_SCH_DATALABEL_ROTATION_EDIT "CHART2_HID_SCH_DATALABEL_ROTATION_EDIT" - #define HID_SCH_WIZARD_ROADMAP "CHART2_HID_SCH_WIZARD_ROADMAP" #define HID_SCH_LEGEND_SHOW "CHART2_HID_SCH_LEGEND_SHOW" #define HID_SCH_DATA_SERIES_LABEL "CHART2_HID_SCH_DATA_SERIES_LABEL" @@ -90,7 +78,6 @@ #define HID_DIAGRAM_TYPE "CHART2_HID_DIAGRAM_TYPE" #define HID_DIAGRAM_DATA "CHART2_HID_DIAGRAM_DATA" #define HID_INSERT_STATISTICS "CHART2_HID_INSERT_STATISTICS" -#define HID_INSERT_DESCRIPTION "CHART2_HID_INSERT_DESCRIPTION" #endif diff --git a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx index 41518d1ac267..311707509c75 100644 --- a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx +++ b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx @@ -25,22 +25,22 @@ #include // header for class SfxItemSet #include -//for auto_ptr -#include +#include + class SvNumberFormatter; namespace chart { -class oldDataLabelResources; +class DataLabelResources; class DataLabelsDialog : public ModalDialog { private: - OKButton m_aBtnOK; - CancelButton m_aBtnCancel; - HelpButton m_aBtnHelp; - ::std::auto_ptr< oldDataLabelResources > m_apDataLabelResources; +// OKButton m_aBtnOK; +// CancelButton m_aBtnCancel; +// HelpButton m_aBtnHelp; + boost::scoped_ptr < DataLabelResources > m_apDataLabelResources; const SfxItemSet& m_rInAttrs; diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc index ce3223494411..fd6e687acf25 100644 --- a/chart2/source/inc/Strings.hrc +++ b/chart2/source/inc/Strings.hrc @@ -243,7 +243,6 @@ #define STR_DLG_SMOOTH_LINE_PROPERTIES (RID_APP_START + 239) #define STR_DLG_STEPPED_LINE_PROPERTIES (RID_APP_START + 270) -#define STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE (RID_APP_START + 266) #define STR_PAGE_POSITIONING (RID_APP_START + 277) #define STR_PAGE_ASIAN (RID_APP_START + 281) diff --git a/chart2/uiconfig/ui/dlg_DataLabel.ui b/chart2/uiconfig/ui/dlg_DataLabel.ui new file mode 100644 index 000000000000..2910aba77ba1 --- /dev/null +++ b/chart2/uiconfig/ui/dlg_DataLabel.ui @@ -0,0 +1,577 @@ + + + + + + 359 + 1 + 10 + + + False + 6 + Data Labels for all Data Series + dialog + + + False + vertical + 12 + + + False + end + + + gtk-ok + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + + + False + True + 1 + + + + + gtk-help + True + True + True + True + + + False + True + 2 + + + + + False + True + end + 0 + + + + + True + False + 6 + vertical + 12 + + + True + False + 0 + none + + + True + False + 6 + 12 + + + True + False + 6 + 12 + True + + + Show value as _number + True + False + False + True + 0 + True + + + 0 + 0 + 1 + 1 + + + + + Show value as _percentage + True + False + False + True + 0 + True + + + 0 + 1 + 1 + 1 + + + + + Show _category + True + False + False + True + 0 + True + + + 0 + 2 + 1 + 1 + + + + + Show _legend key + True + False + False + True + 0 + True + + + 0 + 3 + 1 + 1 + + + + + Number _format... + True + False + True + center + True + + + 1 + 0 + 1 + 1 + + + + + Percentage f_ormat... + True + False + True + center + True + + + 1 + 1 + 1 + 1 + + + + + False + True + ABCD + + + + + + 1 + 3 + 1 + 1 + + + + + True + False + 12 + + + True + False + 0 + _Separator + True + LB_TEXT_SEPARATOR + + + False + True + 0 + + + + + True + False + center + liststoreSEPARATOR + + + False + True + 1 + + + + + 0 + 4 + 2 + 1 + + + + + True + False + 12 + + + True + False + 0 + Place_ment + True + LB_LABEL_PLACEMENT + + + False + True + 0 + + + + + True + False + center + liststorePLACEMENT + + + False + True + 1 + + + + + 0 + 5 + 2 + 1 + + + + + False + Number Format for Percentage Value + + + 1 + 2 + 1 + 1 + + + + + + + + + True + False + 0 + Text Attributes + + + + + + + + False + True + 0 + + + + + True + False + 0 + none + + + True + False + 6 + 12 + + + True + False + vertical + 6 + + + True + False + 12 + + + True + False + + + False + True + 0 + + + + + True + False + center + + True + adjustmentDEGREE + + + False + True + 1 + + + + + True + False + _Degrees + True + + + False + True + 2 + + + + + False + True + 0 + + + + + True + False + 12 + + + True + False + Te_xt direction + True + LB_LABEL_TEXTDIR + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + False + True + 1 + + + + + + + + + True + False + 0 + Rotate Text + + + + + + + + False + True + 1 + + + + + False + True + 1 + + + + + + ok + cancel + help + + + + + + + + + + + + Best fit + 0 + + + Center + 1 + + + Above + 2 + + + Top left + 3 + + + Left + 4 + + + Bottom left + 5 + + + Below + 6 + + + Bottom right + 7 + + + Right + 8 + + + Top right + 9 + + + Inside + 10 + + + Outside + 11 + + + Near origin + 12 + + + + + + + + + + + + + Space + 0 + + + Comma + 1 + + + Semicolon + 2 + + + New line + 3 + + + + + + + + + + + + + + + + diff --git a/chart2/uiconfig/ui/tp_DataLabel.ui b/chart2/uiconfig/ui/tp_DataLabel.ui index e8395f0ff0b6..798c9350edbc 100644 --- a/chart2/uiconfig/ui/tp_DataLabel.ui +++ b/chart2/uiconfig/ui/tp_DataLabel.ui @@ -319,7 +319,16 @@ - + + False + Number Format for Percentage Value + + + 1 + 2 + 1 + 1 + -- cgit