diff options
Diffstat (limited to 'chart2/source/controller/dialogs/DataBrowser.cxx')
-rw-r--r-- | chart2/source/controller/dialogs/DataBrowser.cxx | 84 |
1 files changed, 49 insertions, 35 deletions
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 56ef98b159ba..67930fc6f7a7 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DataBrowser.cxx,v $ - * $Revision: 1.9.8.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -36,10 +33,10 @@ #ifndef _ZFORLIST_DECLARE_TABLE #define _ZFORLIST_DECLARE_TABLE #endif -#include <svtools/zformat.hxx> +#include <svl/zformat.hxx> #endif // header for SvNumberFormatter -#include <svtools/zforlist.hxx> +#include <svl/zforlist.hxx> #include "DataBrowser.hxx" #include "DataBrowserModel.hxx" @@ -48,6 +45,8 @@ #include "DataSeriesHelper.hxx" #include "DiagramHelper.hxx" #include "ChartModelHelper.hxx" +#include "CommonConverters.hxx" +#include "macros.hxx" #include "chartview/NumberFormatterWrapper.hxx" #include "servicenames_charttypes.hxx" #include "ResId.hxx" @@ -190,6 +189,8 @@ public: sal_Int32 GetStartColumn() const; sal_Int32 GetEndColumn() const; + static sal_Int32 GetRelativeAppFontXPosForNameField(); + void Show(); /** call this before destroying the class. This notifies the listeners to @@ -265,23 +266,30 @@ void SeriesHeader::SetColor( const Color & rCol ) m_spColorBar->SetControlBackground( rCol ); } +const sal_Int32 nSymbolHeight = 10; +const sal_Int32 nSymbolDistance = 2; + +sal_Int32 SeriesHeader::GetRelativeAppFontXPosForNameField() +{ + return nSymbolHeight + nSymbolDistance; +} + void SeriesHeader::SetPos( const Point & rPos ) { m_aPos = rPos; // chart type symbol - sal_Int32 nHeight = 10; Point aPos( rPos ); - aPos.setY( aPos.getY() + 2 ); - Size aSize( nHeight, nHeight ); + aPos.setY( aPos.getY() + nSymbolDistance ); + Size aSize( nSymbolHeight, nSymbolHeight ); m_spSymbol->SetPosPixel( m_pDevice->LogicToPixel( aPos, MAP_APPFONT )); m_spSymbol->SetSizePixel( m_pDevice->LogicToPixel( aSize, MAP_APPFONT )); - aPos.setY( aPos.getY() - 2 ); + aPos.setY( aPos.getY() - nSymbolDistance ); // series name edit field - aPos.setX( aPos.getX() + nHeight + 2 ); - aSize.setWidth( m_nWidth - nHeight - 2 ); - nHeight = 12; + aPos.setX( aPos.getX() + nSymbolHeight + nSymbolDistance ); + aSize.setWidth( m_nWidth - nSymbolHeight - nSymbolDistance ); + sal_Int32 nHeight = 12; aSize.setHeight( nHeight ); m_spSeriesName->SetPosPixel( m_pDevice->LogicToPixel( aPos, MAP_APPFONT )); m_spSeriesName->SetSizePixel( m_pDevice->LogicToPixel( aSize, MAP_APPFONT )); @@ -556,25 +564,14 @@ bool DataBrowser::MaySwapColumns() const return (static_cast< sal_uInt32 >( nColIndex ) < (m_aSeriesHeaders.size() - 1)); } + sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); return ! IsReadOnly() - && ( GetCurColumnId() > 1 ) - && ( GetCurColumnId() < ColCount() - 1 ); + && ( nColIdx > 0 ) + && ( nColIdx < ColCount()-2 ) + && m_apDataBrowserModel.get() + && !m_apDataBrowserModel->isCategoriesColumn( nColIdx ); } -// bool DataBrowser::MaySortRow() const -// { -// // not implemented -// return false; -// // return ! IsReadOnly() && ( GetCurRow() >= 0 ); -// } - -// bool DataBrowser::MaySortColumn() const -// { -// // not implemented -// return false; -// // return ! IsReadOnly() && ( GetCurColumnId() > 1 ); -// } - void DataBrowser::clearHeaders() { ::std::for_each( m_aSeriesHeaders.begin(), m_aSeriesHeaders.end(), impl::applyChangesFunctor()); @@ -604,9 +601,10 @@ void DataBrowser::RenewTable() InsertHandleColumn( static_cast< sal_uInt16 >( GetDataWindow().LogicToPixel( Size( 42, 0 )).getWidth() )); - const sal_Int32 nDefaultColumnWidth = 94; - - sal_Int32 nColumnWidth( GetDataWindow().LogicToPixel( Size( nDefaultColumnWidth, 0 )).getWidth()); + OUString aDefaultSeriesName( ::chart::SchResId::getResString( STR_COLUMN_LABEL )); + replaceParamterInString( aDefaultSeriesName, C2U("%COLUMNNUMBER"), OUString::valueOf( sal_Int32(24) ) ); + sal_Int32 nColumnWidth = GetDataWindow().GetTextWidth( aDefaultSeriesName ) + + GetDataWindow().LogicToPixel( Point( 4 + impl::SeriesHeader::GetRelativeAppFontXPosForNameField(), 0 ), MAP_APPFONT ).X(); sal_Int32 nColumnCount = m_apDataBrowserModel->getColumnCount(); // nRowCount is a member of a base class sal_Int32 nRowCountLocal = m_apDataBrowserModel->getMaxRowCount(); @@ -628,7 +626,7 @@ void DataBrowser::RenewTable() const DataBrowserModel::tDataHeaderVector& aHeaders( m_apDataBrowserModel->getDataHeaders()); Link aFocusLink( LINK( this, DataBrowser, SeriesHeaderGotFocus )); Link aSeriesHeaderChangedLink( LINK( this, DataBrowser, SeriesHeaderChanged )); - bool bIsHighContrast = pWin ? (pWin->GetDisplayBackground().GetColor().IsDark()) : false; + bool bIsHighContrast = pWin ? (pWin->GetSettings().GetStyleSettings().GetHighContrastMode()) : false; for( DataBrowserModel::tDataHeaderVector::const_iterator aIt( aHeaders.begin()); aIt != aHeaders.end(); ++aIt ) @@ -885,6 +883,22 @@ void DataBrowser::InsertColumn() } } +void DataBrowser::InsertTextColumn() +{ + sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); + + if( nColIdx >= 0 && + m_apDataBrowserModel.get()) + { + // save changes made to edit-field + if( IsModified() ) + SaveModified(); + + m_apDataBrowserModel->insertComplexCategoryLevel( nColIdx ); + RenewTable(); + } +} + void DataBrowser::RemoveColumn() { sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders ); @@ -897,7 +911,7 @@ void DataBrowser::RemoveColumn() SaveModified(); m_bDataValid = true; - m_apDataBrowserModel->removeDataSeries( nColIdx ); + m_apDataBrowserModel->removeDataSeriesOrComplexCategoryLevel( nColIdx ); RenewTable(); } } @@ -1230,7 +1244,7 @@ void DataBrowser::RenewSeriesHeaders() DataBrowserModel::tDataHeaderVector aHeaders( m_apDataBrowserModel->getDataHeaders()); Link aFocusLink( LINK( this, DataBrowser, SeriesHeaderGotFocus )); Link aSeriesHeaderChangedLink( LINK( this, DataBrowser, SeriesHeaderChanged )); - bool bIsHighContrast = pWin ? (pWin->GetDisplayBackground().GetColor().IsDark()) : false; + bool bIsHighContrast = pWin ? (pWin->GetSettings().GetStyleSettings().GetHighContrastMode()) : false; for( DataBrowserModel::tDataHeaderVector::const_iterator aIt( aHeaders.begin()); aIt != aHeaders.end(); ++aIt ) |