diff options
19 files changed, 322 insertions, 369 deletions
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 6b6d682186c5..f89171d4d55e 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -40,6 +40,7 @@ #include "ControllerLockGuard.hxx" #include "macros.hxx" #include "StatisticsHelper.hxx" +#include "ContainerHelper.hxx" #include <com/sun/star/container/XIndexReplace.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> @@ -420,28 +421,30 @@ void DataBrowserModel::removeDataSeries( sal_Int32 nAtColumnIndex ) m_apDialogModel->deleteSeries( xSeries, getHeaderForSeries( xSeries ).m_xChartType ); - Reference< chart2::XInternalDataProvider > xDataProvider( - m_apDialogModel->getDataProvider(), uno::UNO_QUERY ); - Reference< chart2::data::XDataSource > xSource( xSeries,uno::UNO_QUERY ); - if( xDataProvider.is() && xSource.is()) + //delete sequences from internal data provider that are not used anymore + //but do not delete sequences that are still in use by the remaining series + Reference< chart2::XInternalDataProvider > xDataProvider( m_apDialogModel->getDataProvider(), uno::UNO_QUERY ); + Reference< chart2::data::XDataSource > xSourceOfDeletedSeries( xSeries, uno::UNO_QUERY ); + if( xDataProvider.is() && xSourceOfDeletedSeries.is()) { ::std::vector< sal_Int32 > aSequenceIndexesToDelete; - Sequence< Reference< chart2::data::XLabeledDataSequence > > aUsedSequences( xSource->getDataSequences()); - Reference< chart2::XDataSeriesContainer > xSeriesCnt( - getHeaderForSeries( xSeries ).m_xChartType, uno::UNO_QUERY ); + Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequencesOfDeletedSeries( xSourceOfDeletedSeries->getDataSequences() ); + Reference< chart2::XDataSeriesContainer > xSeriesCnt( getHeaderForSeries( xSeries ).m_xChartType, uno::UNO_QUERY ); if( xSeriesCnt.is()) { - lcl_tSharedSeqVec aSharedSequences = lcl_getSharedSequences( xSeriesCnt->getDataSeries()); - for( sal_Int32 i=0; i<aUsedSequences.getLength(); ++i ) + Reference< chart2::data::XDataSource > xRemainingDataSource( DataSeriesHelper::getDataSource( xSeriesCnt->getDataSeries() ) ); + if( xRemainingDataSource.is() ) { - lcl_tSharedSeqVec::const_iterator aHitIt( - ::std::find_if( - aSharedSequences.begin(), aSharedSequences.end(), - lcl_RepresentationsOfLSeqMatch( aUsedSequences[i] ))); - // if not shared -> delete - if( aHitIt == aSharedSequences.end()) - aSequenceIndexesToDelete.push_back( - lcl_getValuesRepresentationIndex( aUsedSequences[i] )); + ::std::vector< Reference< chart2::data::XLabeledDataSequence > > aRemainingSeq( ContainerHelper::SequenceToVector( xRemainingDataSource->getDataSequences() ) ); + for( sal_Int32 i=0; i<aSequencesOfDeletedSeries.getLength(); ++i ) + { + ::std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aHitIt( + ::std::find_if( aRemainingSeq.begin(), aRemainingSeq.end(), + lcl_RepresentationsOfLSeqMatch( aSequencesOfDeletedSeries[i] ))); + // if not used by the remaining series this sequence can be deleted + if( aHitIt == aRemainingSeq.end() ) + aSequenceIndexesToDelete.push_back( lcl_getValuesRepresentationIndex( aSequencesOfDeletedSeries[i] ) ); + } } } diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index eb5aef2a8375..f60637af4c44 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -452,14 +452,17 @@ public: SplinePropertiesDialog( Window* pParent ); virtual ~SplinePropertiesDialog(); - void adjustSize(); - void fillControls( const ChartTypeParameter& rParameter ); void fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines ); + virtual void StateChanged( StateChangedType nType ); + private: DECL_LINK( SplineModeRadioHdl, RadioButton* ); + void adjustControlPositions(); + void adjustSize(); + private: RadioButton m_aRB_Splines_Cubic; RadioButton m_aRB_Splines_B; @@ -497,7 +500,25 @@ SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent ) m_aRB_Splines_Cubic.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) ); m_aRB_Splines_B.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) ); +} + +SplinePropertiesDialog::~SplinePropertiesDialog() +{ +} + +void SplinePropertiesDialog::StateChanged( StateChangedType nType ) +{ + Dialog::StateChanged( nType ); + + if( nType == STATE_CHANGE_INITSHOW ) + { + adjustControlPositions(); + adjustSize(); + } +} +void SplinePropertiesDialog::adjustControlPositions() +{ //position of controls: //---------------- //fixed line and Fixed texts as near as possible to radio controls @@ -525,9 +546,6 @@ SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent ) m_aMF_SplineResolution.SetPosPixel( Point( nMFXPos, m_aMF_SplineResolution.GetPosPixel().Y() ) ); } -SplinePropertiesDialog::~SplinePropertiesDialog() -{ -} void SplinePropertiesDialog::adjustSize() { Size aDlgSize( this->GetSizePixel() ); @@ -636,10 +654,7 @@ SplineResourceGroup::~SplineResourceGroup() SplinePropertiesDialog& SplineResourceGroup::getSplinePropertiesDialog() { if( !m_pSplinePropertiesDialog.get() ) - { m_pSplinePropertiesDialog = ::std::auto_ptr< SplinePropertiesDialog >( new SplinePropertiesDialog( m_aPB_DetailsDialog.GetParent() ) ); - m_pSplinePropertiesDialog->adjustSize(); - } return *m_pSplinePropertiesDialog; } void SplineResourceGroup::showControls( bool bShow ) diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx index 581d06d84838..4c626d1dfb37 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx +++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx @@ -76,7 +76,7 @@ BOOL PolarOptionsTabPage::FillItemSet( SfxItemSet& rOutAttrs ) } if( m_aCB_Clockwise.IsVisible() ) - rOutAttrs.Put(SfxInt32Item(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked())); + rOutAttrs.Put(SfxBoolItem(SCHATTR_CLOCKWISE,m_aCB_Clockwise.IsChecked())); return TRUE; } diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx index d799fd31b89d..a2c3694a8469 100644 --- a/chart2/source/controller/dialogs/tp_Scale.cxx +++ b/chart2/source/controller/dialogs/tp_Scale.cxx @@ -137,47 +137,6 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : FreeResource(); SetExchangeSupport(); - //optimize position of the controls - { - long nLabelWidth = ::std::max( aTxtMin.CalcMinimumSize().Width(), aTxtMax.CalcMinimumSize().Width() ); - nLabelWidth = ::std::max( aTxtMain.CalcMinimumSize().Width(), nLabelWidth ); - nLabelWidth = ::std::max( aTxtHelp.CalcMinimumSize().Width(), nLabelWidth ); - nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth ); - nLabelWidth+=1; - - long nLabelDistance = aTxtMin.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width(); - long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance; - - //ensure that the auto checkboxes are wide enough and have correct size for calculation - aCbxAutoMin.SetSizePixel( aCbxAutoMin.CalcMinimumSize() ); - aCbxAutoMax.SetSizePixel( aCbxAutoMax.CalcMinimumSize() ); - aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() ); - aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() ); - aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() ); - - //ensure new pos is ok - long nWidthOfOtherControls = aCbxAutoMin.GetPosPixel().X() + aCbxAutoMin.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X(); - long nDialogWidth = GetSizePixel().Width(); - - long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls; - if(nLeftSpace>=0) - { - Size aSize( aTxtMin.GetSizePixel() ); - aSize.Width() = nLabelWidth; - aTxtMin.SetSizePixel(aSize); - aTxtMax.SetSizePixel(aSize); - aTxtMain.SetSizePixel(aSize); - aTxtHelp.SetSizePixel(aSize); - aTxtOrigin.SetSizePixel(aSize); - - lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos ); - lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos ); - lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos ); - lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos ); - lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos ); - } - } - aCbxAutoMin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); aCbxAutoMax.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); aCbxAutoStepMain.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); @@ -185,6 +144,56 @@ ScaleTabPage::ScaleTabPage(Window* pWindow,const SfxItemSet& rInAttrs) : aCbxAutoOrigin.SetClickHdl(LINK(this, ScaleTabPage, EnableValueHdl)); } +void ScaleTabPage::StateChanged( StateChangedType nType ) +{ + TabPage::StateChanged( nType ); + + if( nType == STATE_CHANGE_INITSHOW ) + AdjustControlPositions(); +} + +void ScaleTabPage::AdjustControlPositions() +{ + //optimize position of the controls + long nLabelWidth = ::std::max( aTxtMin.CalcMinimumSize().Width(), aTxtMax.CalcMinimumSize().Width() ); + nLabelWidth = ::std::max( aTxtMain.CalcMinimumSize().Width(), nLabelWidth ); + nLabelWidth = ::std::max( aTxtHelp.CalcMinimumSize().Width(), nLabelWidth ); + nLabelWidth = ::std::max( aTxtOrigin.CalcMinimumSize().Width(), nLabelWidth ); + nLabelWidth+=1; + + long nLabelDistance = aTxtMin.LogicToPixel( Size(RSC_SP_CTRL_DESC_X, 0), MapMode(MAP_APPFONT) ).Width(); + long nNewXPos = aTxtMin.GetPosPixel().X() + nLabelWidth + nLabelDistance; + + //ensure that the auto checkboxes are wide enough and have correct size for calculation + aCbxAutoMin.SetSizePixel( aCbxAutoMin.CalcMinimumSize() ); + aCbxAutoMax.SetSizePixel( aCbxAutoMax.CalcMinimumSize() ); + aCbxAutoStepMain.SetSizePixel( aCbxAutoStepMain.CalcMinimumSize() ); + aCbxAutoStepHelp.SetSizePixel( aCbxAutoStepHelp.CalcMinimumSize() ); + aCbxAutoOrigin.SetSizePixel( aCbxAutoOrigin.CalcMinimumSize() ); + + //ensure new pos is ok + long nWidthOfOtherControls = aCbxAutoMin.GetPosPixel().X() + aCbxAutoMin.GetSizePixel().Width() - aFmtFldMin.GetPosPixel().X(); + long nDialogWidth = GetSizePixel().Width(); + + long nLeftSpace = nDialogWidth - nNewXPos - nWidthOfOtherControls; + if(nLeftSpace>=0) + { + Size aSize( aTxtMin.GetSizePixel() ); + aSize.Width() = nLabelWidth; + aTxtMin.SetSizePixel(aSize); + aTxtMax.SetSizePixel(aSize); + aTxtMain.SetSizePixel(aSize); + aTxtHelp.SetSizePixel(aSize); + aTxtOrigin.SetSizePixel(aSize); + + lcl_shiftControls( aFmtFldMin, aCbxAutoMin, nNewXPos ); + lcl_shiftControls( aFmtFldMax, aCbxAutoMax, nNewXPos ); + lcl_shiftControls( aFmtFldStepMain, aCbxAutoStepMain, nNewXPos ); + lcl_shiftControls( aMtStepHelp, aCbxAutoStepHelp, nNewXPos ); + lcl_shiftControls( aFmtFldOrigin, aCbxAutoOrigin, nNewXPos ); + } +} + void ScaleTabPage::EnableControls() { bool bEnableForValueOrPercentAxis = chart2::AxisType::REALNUMBER == nAxisType || chart2::AxisType::PERCENT == nAxisType; diff --git a/chart2/source/controller/dialogs/tp_Scale.hxx b/chart2/source/controller/dialogs/tp_Scale.hxx index 7453b3e649b6..2b0684854c48 100644 --- a/chart2/source/controller/dialogs/tp_Scale.hxx +++ b/chart2/source/controller/dialogs/tp_Scale.hxx @@ -62,6 +62,8 @@ public: void ShowAxisOrigin( bool bShowOrigin ); + virtual void StateChanged( StateChangedType nType ); + private: FixedLine aFlScale; @@ -98,6 +100,7 @@ private: bool m_bShowAxisOrigin; + void AdjustControlPositions(); void EnableControls(); DECL_LINK( EnableValueHdl, CheckBox* ); diff --git a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx index 132e5c948a7a..4ee0ca2f1f51 100644 --- a/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/StatisticsItemConverter.cxx @@ -633,29 +633,21 @@ void StatisticsItemConverter::FillSpecialItem( case SCHATTR_REGRESSION_SHOW_EQUATION: { + bool bShowEq = false; uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 )); if( xEqProp.is()) - { - bool bShowEq = false; - if( xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq ) - rOutItemSet.Put( SfxBoolItem( nWhichId, bShowEq )); - } - else - rOutItemSet.InvalidateItem( nWhichId ); + xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq; + rOutItemSet.Put( SfxBoolItem( nWhichId, bShowEq )); } break; case SCHATTR_REGRESSION_SHOW_COEFF: { + bool bShowCoeff = false; uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 )); if( xEqProp.is()) - { - bool bShowCoeff = false; - if( xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff ) - rOutItemSet.Put( SfxBoolItem( nWhichId, bShowCoeff )); - } - else - rOutItemSet.InvalidateItem( nWhichId ); + xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff; + rOutItemSet.Put( SfxBoolItem( nWhichId, bShowCoeff )); } break; diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 5db316196e1d..fdbda4589abd 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -80,6 +80,8 @@ // for SolarMutex #include <vcl/svapp.hxx> #include <vos/mutex.hxx> +// for OutlinerView +#include <svx/outliner.hxx> using namespace ::com::sun::star; @@ -376,14 +378,23 @@ void ChartController::executeDispatch_Paste() OUString aString; if( aDataHelper.GetString( FORMAT_STRING, aString ) && m_pDrawModelWrapper ) { - awt::Point aTextPos; - awt::Size aPageSize( ChartModelHelper::getPageSize( m_aModel->getModel())); - aTextPos.X = (aPageSize.Width / 2); - aTextPos.Y = (aPageSize.Height / 2); - lcl_InsertStringAsTextShapeIntoDrawPage( - m_pDrawModelWrapper->getShapeFactory(), - m_pDrawModelWrapper->getMainDrawPage(), - aString, aTextPos ); + if( m_pDrawViewWrapper ) + { + OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); + if( pOutlinerView )//in case of edit mode insert into edited string + pOutlinerView->InsertText( aString ); + else + { + awt::Point aTextPos; + awt::Size aPageSize( ChartModelHelper::getPageSize( m_aModel->getModel())); + aTextPos.X = (aPageSize.Width / 2); + aTextPos.Y = (aPageSize.Height / 2); + lcl_InsertStringAsTextShapeIntoDrawPage( + m_pDrawModelWrapper->getShapeFactory(), + m_pDrawModelWrapper->getMainDrawPage(), + aString, aTextPos ); + } + } } } } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 55aafb1e5538..2288bb602296 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -872,6 +872,15 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) aContextMenuHelper.completeAndExecute( aPos, xPopupMenu ); } } + else if( ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT ) || + ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT ) || + ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT ) || + ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE ) ) + { + //#i84417# enable editing with IME + if( m_pDrawViewWrapper ) + m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow ); + } } bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx index 66a35ff04790..5ffe02b5212b 100644 --- a/chart2/source/model/template/LineChartTypeTemplate.cxx +++ b/chart2/source/model/template/LineChartTypeTemplate.cxx @@ -232,6 +232,9 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate( // with symbols (or with lines) if( bResult ) { + bool bSymbolFound = false; + bool bLineFound = false; + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); @@ -244,16 +247,25 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate( drawing::LineStyle eLineStyle; Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW ); - if( (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && - (aSymbProp.Style != chart2::SymbolStyle_NONE) && - (!m_bHasSymbols) ) + bool bCurrentHasSymbol = (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && + (aSymbProp.Style != chart2::SymbolStyle_NONE); + + if( bCurrentHasSymbol ) + bSymbolFound = true; + + if( bCurrentHasSymbol && (!m_bHasSymbols) ) { bResult = false; break; } - if( (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && - (m_bHasLines != ( eLineStyle != drawing::LineStyle_NONE )) ) + bool bCurrentHasLine = (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && + ( eLineStyle != drawing::LineStyle_NONE ); + + if( bCurrentHasLine ) + bLineFound = true; + + if( bCurrentHasLine && (!m_bHasLines) ) { bResult = false; break; @@ -264,6 +276,16 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate( ASSERT_EXCEPTION( ex ); } } + + if(bResult) + { + if( !bLineFound && m_bHasLines && bSymbolFound ) + bResult = false; + else if( !bSymbolFound && m_bHasSymbols && bLineFound ) + bResult = false; + else if( !bLineFound && !bSymbolFound ) + return m_bHasLines && m_bHasSymbols; + } } // adapt curve style, spline order and resolution diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx index 44da318a8013..ab90f0f7ff42 100644 --- a/chart2/source/model/template/NetChartTypeTemplate.cxx +++ b/chart2/source/model/template/NetChartTypeTemplate.cxx @@ -114,9 +114,11 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( // check symbol-style // for a template with symbols it is ok, if there is at least one series // with symbols, otherwise an unknown template is too easy to achieve - bool bSymbolsFound = false; if( bResult ) { + bool bSymbolFound = false; + bool bLineFound = false; + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); @@ -128,18 +130,26 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( chart2::Symbol aSymbProp; drawing::LineStyle eLineStyle; Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW ); - if( (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && - (aSymbProp.Style != chart2::SymbolStyle_NONE ) && - (! m_bHasSymbols) ) + + bool bCurrentHasSymbol = (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && + (aSymbProp.Style != chart2::SymbolStyle_NONE); + + if( bCurrentHasSymbol ) + bSymbolFound = true; + + if( bCurrentHasSymbol && (!m_bHasSymbols) ) { bResult = false; break; } - if( m_bHasSymbols ) - bSymbolsFound = bSymbolsFound || (aSymbProp.Style != chart2::SymbolStyle_NONE); - if( (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && - (m_bHasLines != ( eLineStyle != drawing::LineStyle_NONE )) ) + bool bCurrentHasLine = (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && + ( eLineStyle != drawing::LineStyle_NONE ); + + if( bCurrentHasLine ) + bLineFound = true; + + if( bCurrentHasLine && (!m_bHasLines) ) { bResult = false; break; @@ -151,8 +161,15 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate( } } - if( m_bHasSymbols ) - bResult = bResult && bSymbolsFound; + if(bResult) + { + if( !bLineFound && m_bHasLines && bSymbolFound ) + bResult = false; + else if( !bSymbolFound && m_bHasSymbols && bLineFound ) + bResult = false; + else if( !bLineFound && !bSymbolFound ) + return m_bHasLines && m_bHasSymbols; + } } return bResult; diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx index 50c8cdc4b78f..6e5449d49f49 100644 --- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx +++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx @@ -271,6 +271,9 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate( // with symbols (or with lines) if( bResult ) { + bool bSymbolFound = false; + bool bLineFound = false; + ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec( DiagramHelper::getDataSeriesFromDiagram( xDiagram )); @@ -283,16 +286,25 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate( drawing::LineStyle eLineStyle; Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW ); - if( (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && - (aSymbProp.Style != chart2::SymbolStyle_NONE) && - (!m_bHasSymbols) ) + bool bCurrentHasSymbol = (xProp->getPropertyValue( C2U( "Symbol" )) >>= aSymbProp) && + (aSymbProp.Style != chart2::SymbolStyle_NONE); + + if( bCurrentHasSymbol ) + bSymbolFound = true; + + if( bCurrentHasSymbol && (!m_bHasSymbols) ) { bResult = false; break; } - if( (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && - (m_bHasLines != ( eLineStyle != drawing::LineStyle_NONE )) ) + bool bCurrentHasLine = (xProp->getPropertyValue( C2U( "LineStyle" )) >>= eLineStyle) && + ( eLineStyle != drawing::LineStyle_NONE ); + + if( bCurrentHasLine ) + bLineFound = true; + + if( bCurrentHasLine && (!m_bHasLines) ) { bResult = false; break; @@ -303,6 +315,16 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate( ASSERT_EXCEPTION( ex ); } } + + if(bResult) + { + if( !bLineFound && m_bHasLines && bSymbolFound ) + bResult = false; + else if( !bSymbolFound && m_bHasSymbols && bLineFound ) + bResult = false; + else if( !bLineFound && !bSymbolFound ) + return m_bHasLines && m_bHasSymbols; + } } // adapt curve style, spline order and resolution diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 11c408e7bc6a..baeac4a29cf1 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -203,6 +203,7 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( double fZ = fScaledZ; bool bReverse = !pPosHelper->isMathematicalOrientationY(); bool bNormalOutside = (!bReverse == !!(fBaseValue < fScaledUpperYValue)); + double fDepth = fScaledUpperBarDepth; switch(nLabelPlacement) { @@ -212,6 +213,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( { fY = bReverse ? fScaledLowerYValue : fScaledUpperYValue; rAlignment = LABEL_ALIGN_TOP; + if(3==m_nDimension) + fDepth = bReverse ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth); } else { @@ -227,6 +230,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( { fY = bReverse ? fScaledUpperYValue : fScaledLowerYValue; rAlignment = LABEL_ALIGN_BOTTOM; + if(3==m_nDimension) + fDepth = bReverse ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth); } else { @@ -242,6 +247,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( { fY = bReverse ? fScaledUpperYValue : fScaledLowerYValue; rAlignment = LABEL_ALIGN_LEFT; + if(3==m_nDimension) + fDepth = bReverse ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth); } else { @@ -257,6 +264,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( { fY = bReverse ? fScaledLowerYValue : fScaledUpperYValue; rAlignment = LABEL_ALIGN_RIGHT; + if(3==m_nDimension) + fDepth = bReverse ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth); } else { @@ -273,6 +282,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT; else rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM; + if(3==m_nDimension) + fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth); } break; case ::com::sun::star::chart::DataLabelPlacement::INSIDE: @@ -282,6 +293,8 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( rAlignment = bNormalOutside ? LABEL_ALIGN_LEFT : LABEL_ALIGN_RIGHT; else rAlignment = bNormalOutside ? LABEL_ALIGN_BOTTOM : LABEL_ALIGN_TOP; + if(3==m_nDimension) + fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledUpperBarDepth) : fabs(fScaledLowerBarDepth); } break; case ::com::sun::star::chart::DataLabelPlacement::NEAR_ORIGIN: @@ -291,26 +304,24 @@ awt::Point BarChart::getLabelScreenPositionAndAlignment( rAlignment = bNormalOutside ? LABEL_ALIGN_RIGHT : LABEL_ALIGN_LEFT; else rAlignment = bNormalOutside ? LABEL_ALIGN_TOP : LABEL_ALIGN_BOTTOM; + if(3==m_nDimension) + fDepth = (fBaseValue < fScaledUpperYValue) ? fabs(fScaledLowerBarDepth) : fabs(fScaledUpperBarDepth); } break; case ::com::sun::star::chart::DataLabelPlacement::CENTER: fY -= (fScaledUpperYValue-fScaledLowerYValue)/2.0; rAlignment = LABEL_ALIGN_CENTER; + if(3==m_nDimension) + fDepth = fabs(fScaledUpperBarDepth-fScaledLowerBarDepth)/2.0; break; default: DBG_ERROR("this label alignment is not implemented yet"); break; } - if(3==m_nDimension) - { - rAlignment = LABEL_ALIGN_CENTER; - double fDepth = fScaledUpperBarDepth; - if(nLabelPlacement==::com::sun::star::chart::DataLabelPlacement::CENTER) - fDepth = fabs(fScaledUpperBarDepth-fScaledLowerBarDepth)/2.0; fZ -= fDepth/2.0; - } + drawing::Position3D aScenePosition3D( pPosHelper-> transformScaledLogicToScene( fX, fY, fZ, true ) ); return LabelPositionHelper(pPosHelper,m_nDimension,m_xLogicTarget,m_pShapeFactory) @@ -884,13 +895,29 @@ void BarChart::createShapes() LabelAlignment eAlignment(LABEL_ALIGN_CENTER); sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nCatIndex, m_xChartTypeModel, m_nDimension, pPosHelper->isSwapXAndY() ); + double fLowerBarDepth = fLogicBarDepth; + double fUpperBarDepth = fLogicBarDepth; + { + double fOuterBarDepth = fLogicBarDepth; + if( lcl_hasGeometry3DVariableWidth(nGeometry3D) && fCompleteHeight!=0.0 ) + { + fOuterBarDepth = fLogicBarDepth * (fTopHeight)/(fabs(fCompleteHeight)); + fLowerBarDepth = (fBaseValue < fUpperYValue) ? fabs(fLogicBarDepth) : fabs(fOuterBarDepth); + fUpperBarDepth = (fBaseValue < fUpperYValue) ? fabs(fOuterBarDepth) : fabs(fLogicBarDepth); + } + } + awt::Point aScreenPosition2D( this->getLabelScreenPositionAndAlignment( eAlignment, nLabelPlacement , fLogicX, fLowerYValue, fUpperYValue, fLogicZ - , fLogicBarDepth, fLogicBarDepth, fBaseValue, pPosHelper )); + , fLowerBarDepth, fUpperBarDepth, fBaseValue, pPosHelper )); sal_Int32 nOffset = 0; if(LABEL_ALIGN_CENTER!=eAlignment) + { nOffset = 100;//add some spacing //@todo maybe get more intelligent values + if( m_nDimension == 3 ) + nOffset = 260; + } this->createDataLabel( xTextTarget, **aSeriesIter, nCatIndex , fLogicValueForLabeDisplay, fLogicSum, aScreenPosition2D, eAlignment, nOffset ); } diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 774ea4dd5815..7759f3110cbd 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -570,7 +570,9 @@ namespace ::basegfx::B2IRectangle lcl_getRect( const uno::Reference< drawing::XShape >& xShape ) { - ::basegfx::B2IRectangle aRect( BaseGFXHelper::makeRectangle(xShape->getPosition(),xShape->getSize() )); + ::basegfx::B2IRectangle aRect; + if( xShape.is() ) + aRect = BaseGFXHelper::makeRectangle(xShape->getPosition(),xShape->getSize() ); return aRect; } diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index f15ed34d5209..f648b7510cec 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -199,6 +199,23 @@ struct lcl_LessXOfPoint return false; } }; + +void lcl_clearIfTextIsContained( VDataSequence& rData, const uno::Reference<data::XDataSequence>& xDataSequence ) +{ + uno::Sequence< rtl::OUString > aStrings( DataSequenceToStringSequence( xDataSequence ) ); + for( sal_Int32 i = 0; i < rData.Doubles.getLength(); ++i ) + { + if( ::rtl::math::isNan( rData.Doubles[i] ) ) + { + if( i < aStrings.getLength() && aStrings[i].getLength() ) + { + rData.clear(); + break; + } + } + } +} + } VDataSeries::VDataSeries() @@ -280,7 +297,10 @@ VDataSeries::VDataSeries( const uno::Reference< XDataSeries >& xDataSeries ) aARole >>= aRole; if( aRole.equals(C2U("values-x")) ) + { m_aValues_X.init( xDataSequence ); + lcl_clearIfTextIsContained( m_aValues_X, xDataSequence ); + } else if( aRole.equals(C2U("values-y")) ) m_aValues_Y.init( xDataSequence ); else if( aRole.equals(C2U("values-min")) ) diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 53e05e1b0ec4..6ffd928f55dc 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -59,6 +59,10 @@ #include "attrib.hxx" #include "jumpmatrix.hxx" +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include <comphelper/processfactory.hxx> +#endif + #include <stdlib.h> #include <string.h> #include <math.h> @@ -2643,251 +2647,31 @@ void ScInterpreter::ScChar() static ::rtl::OUString lcl_convertIntoHalfWidth( const ::rtl::OUString & rStr ) { - const sal_Unicode *pSrc = rStr.getStr(); - sal_Int32 nLen = rStr.getLength(); - ::rtl::OUStringBuffer aRes( nLen ); + static bool bFirstASCCall = true; + static utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), 0 ); - for (sal_Int32 i=0; i<nLen; i++) + if( bFirstASCCall ) { - if( pSrc[i] >= 0x30a1 && pSrc[i] <= 0x30aa && (pSrc[i] % 2) == 0 ) - // katakana a-o - aRes.append((sal_Unicode)((pSrc[i] - 0x30a2) / 2 + 0xff71)); - else if( pSrc[i] >= 0x30a1 && pSrc[i] <= 0x30aa && (pSrc[i] % 2) == 1 ) - // katakana small a-o - aRes.append((sal_Unicode)((pSrc[i] - 0x30a1) / 2 + 0xff67)); - else if( pSrc[i] >= 0x30ab && pSrc[i] <= 0x30c2 && (pSrc[i] % 2) == 1 ) - // katakana ka-chi - aRes.append((sal_Unicode)((pSrc[i] - 0x30ab) / 2 + 0xff76)); - else if( pSrc[i] >= 0x30ab && pSrc[i] <= 0x30c2 && (pSrc[i] % 2) == 0 ) - { - // katakana ga-dhi - aRes.append((sal_Unicode)((pSrc[i] - 0x30ac) / 2 + 0xff76)); - aRes.append((sal_Unicode)0xff9e ); - } - else if( pSrc[i] == 0x30c3 ) - // katakana small tsu - aRes.append((sal_Unicode)0xff6f ); - else if( pSrc[i] >= 0x30c4 && pSrc[i] <= 0x30c9 && (pSrc[i] % 2) == 0 ) - // katakana tsu-to - aRes.append((sal_Unicode)((pSrc[i] - 0x30c4) / 2 + 0xff82)); - else if( pSrc[i] >= 0x30c4 && pSrc[i] <= 0x30c9 && (pSrc[i] % 2) == 1 ) - { - // katakana du-do - aRes.append((sal_Unicode)((pSrc[i] - 0x30c5) / 2 + 0xff82)); - aRes.append((sal_Unicode)0xff9e ); - } - else if( pSrc[i] >= 0x30ca && pSrc[i] <= 0x30ce ) - // katakana na-no - aRes.append((sal_Unicode)(pSrc[i] - 0x30ca + 0xff85)); - else if( pSrc[i] >= 0x30cf && pSrc[i] <= 0x30dd && (pSrc[i] % 3) == 0 ) - // katakana ha-ho - aRes.append((sal_Unicode)((pSrc[i] - 0x30cf) / 3 + 0xff8a)); - else if( pSrc[i] >= 0x30cf && pSrc[i] <= 0x30dd && (pSrc[i] % 3) == 1 ) - { - // katakana ba-bo - aRes.append((sal_Unicode)((pSrc[i] - 0x30d0) / 3 + 0xff8a)); - aRes.append((sal_Unicode)0xff9e ); - } - else if( pSrc[i] >= 0x30cf && pSrc[i] <= 0x30dd && (pSrc[i] % 3) == 2 ) - { - // katakana pa-po - aRes.append((sal_Unicode)((pSrc[i] - 0x30d1) / 3 + 0xff8a)); - aRes.append((sal_Unicode)0xff9f ); - } - else if( pSrc[i] >= 0x30de && pSrc[i] <= 0x30e2 ) - // katakana ma-mo - aRes.append((sal_Unicode)(pSrc[i] - 0x30de + 0xff8f)); - else if( pSrc[i] >= 0x30e3 && pSrc[i] <= 0x30e8 && (pSrc[i] % 2) == 0) - // katakana ya-yo - aRes.append((sal_Unicode)((pSrc[i] - 0x30e4) / 2 + 0xff94)); - else if( pSrc[i] >= 0x30e3 && pSrc[i] <= 0x30e8 && (pSrc[i] % 2) == 1) - // katakana small ya-yo - aRes.append((sal_Unicode)((pSrc[i] - 0x30e3) / 2 + 0xff6c)); - else if( pSrc[i] >= 0x30e9 && pSrc[i] <= 0x30ed ) - // katakana ra-ro - aRes.append((sal_Unicode)(pSrc[i] - 0x30e9 + 0xff97)); - else if( pSrc[i] == 0x30ef ) - // katakana wa - aRes.append((sal_Unicode)0xff9c); - else if( pSrc[i] == 0x30f2 ) - // katakana wo - aRes.append((sal_Unicode)0xff66); - else if( pSrc[i] == 0x30f3 ) - // katakana nn - aRes.append((sal_Unicode)0xff9d); - else if( pSrc[i] >= 0xff01 && pSrc[i] <= 0xff5e ) - // ASCII characters - aRes.append((sal_Unicode)(pSrc[i] - 0xff01 + 0x0021)); - else - { - switch (pSrc[i]) - { - case 0x2015: // HORIZONTAL BAR => HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK - aRes.append((sal_Unicode)0xff70); break; - case 0x2018: // LEFT SINGLE QUOTATION MARK => GRAVE ACCENT - aRes.append((sal_Unicode)0x0060); break; - case 0x2019: // RIGHT SINGLE QUOTATION MARK => APOSTROPHE - aRes.append((sal_Unicode)0x0027); break; - case 0x201d: // RIGHT DOUBLE QUOTATION MARK => QUOTATION MARK - aRes.append((sal_Unicode)0x0022); break; - case 0x3001: // IDEOGRAPHIC COMMA - aRes.append((sal_Unicode)0xff64); break; - case 0x3002: // IDEOGRAPHIC FULL STOP - aRes.append((sal_Unicode)0xff61); break; - case 0x300c: // LEFT CORNER BRACKET - aRes.append((sal_Unicode)0xff62); break; - case 0x300d: // RIGHT CORNER BRACKET - aRes.append((sal_Unicode)0xff63); break; - case 0x309b: // KATAKANA-HIRAGANA VOICED SOUND MARK - aRes.append((sal_Unicode)0xff9e); break; - case 0x309c: // KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK - aRes.append((sal_Unicode)0xff9f); break; - case 0x30fb: // KATAKANA MIDDLE DOT - aRes.append((sal_Unicode)0xff65); break; - case 0x30fc: // KATAKANA-HIRAGANA PROLONGED SOUND MARK - aRes.append((sal_Unicode)0xff70); break; - case 0xffe5: // FULLWIDTH YEN SIGN => REVERSE SOLIDUS "\" - aRes.append((sal_Unicode)0x005c); break; - default: - aRes.append( pSrc[i] ); - } - } + aTrans.loadModuleByImplName( ::rtl::OUString::createFromAscii( "FULLWIDTH_HALFWIDTH_LIKE_ASC" ), LANGUAGE_SYSTEM ); + bFirstASCCall = false; } - return aRes.makeStringAndClear(); + return aTrans.transliterate( rStr, 0, rStr.getLength(), NULL ); } static ::rtl::OUString lcl_convertIntoFullWidth( const ::rtl::OUString & rStr ) { - const sal_Unicode *pSrc = rStr.getStr(); - sal_Int32 nLen = rStr.getLength(); - ::rtl::OUStringBuffer aRes( nLen ); + static bool bFirstJISCall = true; + static utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), 0 ); - for (sal_Int32 i=0; i<nLen; i++) + if( bFirstJISCall ) { - if( pSrc[i] == 0x0022 ) - // QUOTATION MARK => RIGHT DOUBLE QUOTATION MARK - // This is an exception to the ASCII range that follows below. - aRes.append((sal_Unicode)0x201d); - else if( pSrc[i] == 0x005c ) - // REVERSE SOLIDUS "\", a specialty that gets displayed as a - // Yen sign, which is a legacy of code-page 932, see - // http://www.microsoft.com/globaldev/DrIntl/columns/019/default.mspx#EED - // http://www.microsoft.com/globaldev/reference/dbcs/932.htm - // This is an exception to the ASCII range that follows below. - aRes.append((sal_Unicode)0xffe5); - else if( pSrc[i] == 0x0060 ) - // GRAVE ACCENT => LEFT SINGLE QUOTATION MARK - // This is an exception to the ASCII range that follows below. - aRes.append((sal_Unicode)0x2018); - else if( pSrc[i] == 0x0027 ) - // APOSTROPHE => RIGHT SINGLE QUOTATION MARK - // This is an exception to the ASCII range that follows below. - aRes.append((sal_Unicode)0x2019); - else if( pSrc[i] >= 0x0021 && pSrc[i] <= 0x007e ) - // ASCII characters - aRes.append((sal_Unicode)(pSrc[i] - 0x0021 + 0xff01)); - else if( pSrc[i] == 0xff66 ) - // katakana wo - aRes.append((sal_Unicode)0x30f2); - else if( pSrc[i] >= 0xff67 && pSrc[i] <= 0xff6b ) - // katakana small a-o - aRes.append((sal_Unicode)((pSrc[i] - 0xff67) * 2 + 0x30a1 )); - else if( pSrc[i] >= 0xff6c && pSrc[i] <= 0xff6e ) - // katakana small ya-yo - aRes.append((sal_Unicode)((pSrc[i] - 0xff6c) * 2 + 0x30e3 )); - else if( pSrc[i] == 0xff6f ) - // katakana small tsu - aRes.append((sal_Unicode)0x30c3); - else if( pSrc[i] >= 0xff71 && pSrc[i] <= 0xff75 ) - // katakana a-o - aRes.append((sal_Unicode)((pSrc[i] - 0xff71) * 2 + 0x30a2)); - else if( pSrc[i] >= 0xff76 && pSrc[i] <= 0xff81 ) - { - if( (i+1)<nLen && pSrc[i+1] == 0xff9e ) - { - // katakana ga-dsu - aRes.append((sal_Unicode)((pSrc[i] - 0xff76) * 2 + 0x30ac)); - i+=1; - } - else - // katakana ka-chi - aRes.append((sal_Unicode)((pSrc[i] - 0xff76) * 2 + 0x30ab)); - } - else if( pSrc[i] >= 0xff82 && pSrc[i] <= 0xff84 ) - { - if( (i+1)<nLen && pSrc[i+1] == 0xff9e ) - { - // katakana du-do - aRes.append((sal_Unicode)((pSrc[i] - 0xff82) * 2 + 0x30c5)); - i+=1; - } - else - // katakana tsu-to - aRes.append((sal_Unicode)((pSrc[i] - 0xff82) * 2 + 0x30c4)); - } - else if( pSrc[i] >= 0xff85 && pSrc[i] <= 0xff89 ) - // katakana na-no - aRes.append((sal_Unicode)(pSrc[i] - 0xff85 + 0x30ca)); - else if( pSrc[i] >= 0xff8a && pSrc[i] <= 0xff8e ) - { - if( (i+1)<nLen && pSrc[i+1] == 0xff9e ) - { - // katakana ba-bo - aRes.append((sal_Unicode)((pSrc[i] - 0xff8a) * 3 + 0x30d0)); - i+=1; - } - else if( (i+1)<nLen && pSrc[i+1] == 0xff9f ) - { - // katakana pa-po - aRes.append((sal_Unicode)((pSrc[i] - 0xff8a) * 3 + 0x30d1)); - i+=1; - } - else - // katakana ha-ho - aRes.append((sal_Unicode)((pSrc[i] - 0xff8a) * 3 + 0x30cf)); - } - else if( pSrc[i] >= 0xff8f && pSrc[i] <= 0xff93 ) - // katakana ma-mo - aRes.append((sal_Unicode)(pSrc[i] - 0xff8f + 0x30de)); - else if( pSrc[i] >= 0xff94 && pSrc[i] <= 0xff96 ) - // katakana ya-yo - aRes.append((sal_Unicode)((pSrc[i] - 0xff94) * 2 + 0x30e4)); - else if( pSrc[i] >= 0xff97 && pSrc[i] <= 0xff9b ) - // katakana ra-ro - aRes.append((sal_Unicode)(pSrc[i] - 0xff97 + 0x30e9)); - else - { - switch (pSrc[i]) - { - case 0xff9c: // katakana wa - aRes.append((sal_Unicode)0x30ef); break; - case 0xff9d: // katakana nn - aRes.append((sal_Unicode)0x30f3); break; - case 0xff9e: // HALFWIDTH KATAKANA VOICED SOUND MARK - aRes.append((sal_Unicode)0x309b); break; - case 0xff9f: // HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK - aRes.append((sal_Unicode)0x309c); break; - case 0xff70: // HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK - aRes.append((sal_Unicode)0x30fc); break; - case 0xff61: // HALFWIDTH IDEOGRAPHIC FULL STOP - aRes.append((sal_Unicode)0x3002); break; - case 0xff62: // HALFWIDTH LEFT CORNER BRACKET - aRes.append((sal_Unicode)0x300c); break; - case 0xff63: // HALFWIDTH RIGHT CORNER BRACKET - aRes.append((sal_Unicode)0x300d); break; - case 0xff64: // HALFWIDTH IDEOGRAPHIC COMMA - aRes.append((sal_Unicode)0x3001); break; - case 0xff65: // HALFWIDTH KATAKANA MIDDLE DOT - aRes.append((sal_Unicode)0x30fb); break; - default: - aRes.append( pSrc[i] ); - } - } + aTrans.loadModuleByImplName( ::rtl::OUString::createFromAscii( "HALFWIDTH_FULLWIDTH_LIKE_JIS" ), LANGUAGE_SYSTEM ); + bFirstJISCall = false; } - return aRes.makeStringAndClear(); + return aTrans.transliterate( rStr, 0, rStr.getLength(), NULL ); } diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx index e748cbebc4ad..7f11a6ec173d 100644 --- a/sc/source/filter/excel/xlstyle.cxx +++ b/sc/source/filter/excel/xlstyle.cxx @@ -546,8 +546,7 @@ namespace { /** Property names for common font settings. */ const sal_Char *const sppcPropNamesChCommon[] = { - "CharUnderline", "CharStrikeout", "CharEscapement", "CharColor", - "CharContoured", "CharShadowed", 0 + "CharUnderline", "CharStrikeout", "CharColor", "CharContoured", "CharShadowed", 0 }; /** Property names for Western font settings. */ const sal_Char *const sppcPropNamesChWstrn[] = @@ -564,6 +563,12 @@ const sal_Char *const sppcPropNamesChCmplx[] = { "CharFontNameComplex", "CharHeightComplex", "CharPostureComplex", "CharWeightComplex", 0 }; +/** Property names for escapement. */ +const sal_Char *const sppcPropNamesChEscapement[] = +{ + "CharEscapement", "CharEscapementHeight", 0 +}; +const sal_Int8 EXC_API_ESC_HEIGHT = 58; /// Default escapement font height. /** Property names for Western font settings without font name. */ const sal_Char *const *const sppcPropNamesChWstrnNoName = sppcPropNamesChWstrn + 1; @@ -622,6 +627,7 @@ XclFontPropSetHelper::XclFontPropSetHelper() : maHlpChWstrnNoName( sppcPropNamesChWstrnNoName ), maHlpChAsianNoName( sppcPropNamesChAsianNoName ), maHlpChCmplxNoName( sppcPropNamesChCmplxNoName ), + maHlpChEscapement( sppcPropNamesChEscapement ), maHlpControl( sppcPropNamesControl ) { } @@ -635,7 +641,7 @@ void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData, { String aApiFontName; float fApiHeight, fApiWeight; - sal_Int16 nApiUnderl = 0, nApiStrikeout = 0, nApiEscapement = 0; + sal_Int16 nApiUnderl = 0, nApiStrikeout = 0; Awt::FontSlant eApiPosture; // read script type dependent properties @@ -646,7 +652,6 @@ void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData, maHlpChCommon.ReadFromPropertySet( rPropSet ); maHlpChCommon >> nApiUnderl >> nApiStrikeout - >> nApiEscapement >> rFontData.maColor >> rFontData.mbOutline >> rFontData.mbShadow; @@ -654,6 +659,11 @@ void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData, // convert API property values to Excel settings lclSetApiFontSettings( rFontData, aApiFontName, fApiHeight, fApiWeight, eApiPosture, nApiUnderl, nApiStrikeout ); + + // font escapement + sal_Int16 nApiEscapement; + sal_Int8 nApiEscHeight; + maHlpChEscapement >> nApiEscapement >> nApiEscHeight; rFontData.SetApiEscapement( nApiEscapement ); } break; @@ -701,15 +711,22 @@ void XclFontPropSetHelper::WriteFontProperties( const Color& rColor = pFontColor ? *pFontColor : rFontData.maColor; maHlpChCommon << rFontData.GetApiUnderline() << rFontData.GetApiStrikeout() - << rFontData.GetApiEscapement() << rColor << rFontData.mbOutline << rFontData.mbShadow; maHlpChCommon.WriteToPropertySet( rPropSet ); + // write script type dependent properties lclWriteChartFont( rPropSet, maHlpChWstrn, maHlpChWstrnNoName, rFontData, bHasWstrn ); lclWriteChartFont( rPropSet, maHlpChAsian, maHlpChAsianNoName, rFontData, bHasAsian ); lclWriteChartFont( rPropSet, maHlpChCmplx, maHlpChCmplxNoName, rFontData, bHasCmplx ); + + // font escapement + if( rFontData.GetScEscapement() != SVX_ESCAPEMENT_OFF ) + { + maHlpChEscapement << rFontData.GetApiEscapement() << EXC_API_ESC_HEIGHT; + maHlpChEscapement.WriteToPropertySet( rPropSet ); + } } break; diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx index 6087914c8af9..303da212d262 100644 --- a/sc/source/filter/inc/xlstyle.hxx +++ b/sc/source/filter/inc/xlstyle.hxx @@ -438,6 +438,7 @@ private: ScfPropSetHelper maHlpChWstrnNoName; /// Chart properties for Western script, no font name. ScfPropSetHelper maHlpChAsianNoName; /// Chart properties for Asian script, no font name. ScfPropSetHelper maHlpChCmplxNoName; /// Chart properties for Complex script, no font name. + ScfPropSetHelper maHlpChEscapement; /// Chart properties for font escapement. ScfPropSetHelper maHlpControl; /// Properties for form controls. }; diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 3c21646cc50e..ac6cef7e54ec 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -874,7 +874,16 @@ uno::Reference < XNameContainer > { uno::Reference< XNameAccess > xFamilies(xFamiliesSupp->getStyleFamilies()); - xStyles.set(xFamilies->getByName( sName ), uno::UNO_QUERY); + try + { + xStyles.set(xFamilies->getByName( sName ), uno::UNO_QUERY); + } + catch ( uno::Exception& ) + { + // #i97680# Named table/column/row styles aren't supported, getByName will throw an exception. + // For better interoperability, these styles should then be handled as automatic styles. + // For now, NULL is returned (and the style is ignored). + } switch( nFamily ) { case XML_STYLE_FAMILY_TABLE_TABLE: diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx index 437c63113253..bf957b889d82 100644 --- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx +++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx @@ -118,21 +118,11 @@ void ScZoomSliderControl::StateChanged( USHORT /*nSID*/, SfxItemState eState, Window* ScZoomSliderControl::CreateItemWindow( Window *pParent ) { - SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - ScDocShell* pDocShell = (ScDocShell*)pViewFrame->GetObjectShell(); - SCTAB nTab = ScDocShell::GetCurTab(); - ScDocument* pDoc = pDocShell->GetDocument(); - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); - SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ); - USHORT nCurrentZoom = 0; - if ( pStyleSheet ) - { - SfxItemSet& rStyleSet = pStyleSheet->GetItemSet(); - nCurrentZoom = ((const SfxUInt16Item&)rStyleSet.Get(ATTR_PAGE_SCALE)).GetValue(); - } + // #i98000# Don't try to get a value via SfxViewFrame::Current here. + // The view's value is always notified via StateChanged later. ScZoomSliderWnd* pSlider = new ScZoomSliderWnd( pParent, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >( m_xFrame->getController(), - ::com::sun::star::uno::UNO_QUERY ), m_xFrame, nCurrentZoom ? nCurrentZoom : 100 ); + ::com::sun::star::uno::UNO_QUERY ), m_xFrame, 100 ); return pSlider; } |