Kaydet (Commit) 34ff5989 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Use a dedicated method instead of manually removing trailing '*'s.

Also, caption shouldn't have a leading ' any more. We have a dedicated
flag for that.
üst d473a369
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "dpglobal.hxx" #include "dpglobal.hxx"
#include "globstr.hrc" #include "globstr.hrc"
#include "queryentry.hxx" #include "queryentry.hxx"
#include "dputil.hxx"
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sdb/XCompletedExecution.hpp> #include <com/sun/star/sdb/XCompletedExecution.hpp>
...@@ -2016,7 +2017,7 @@ bool ScDPObject::FillLabelData(ScPivotParam& rParam) ...@@ -2016,7 +2017,7 @@ bool ScDPObject::FillLabelData(ScPivotParam& rParam)
xDimProp, OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_FIELD_SUBTOTALNAME)), OUString()); xDimProp, OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_DP_FIELD_SUBTOTALNAME)), OUString());
bool bIsValue = true; //! check bool bIsValue = true; //! check
aFieldName = comphelper::string::stripEnd(aFieldName, sal_Unicode('*')); aFieldName = ScDPUtil::getSourceDimensionName(aFieldName);
std::auto_ptr<ScDPLabelData> pNewLabel( std::auto_ptr<ScDPLabelData> pNewLabel(
new ScDPLabelData(aFieldName, static_cast<SCCOL>(nDim), bIsValue)); new ScDPLabelData(aFieldName, static_cast<SCCOL>(nDim), bIsValue));
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "unonames.hxx" #include "unonames.hxx"
#include "sc.hrc" #include "sc.hrc"
#include "stringutil.hxx" #include "stringutil.hxx"
#include "dputil.hxx"
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sheet/DataPilotTableHeaderData.hpp> #include <com/sun/star/sheet/DataPilotTableHeaderData.hpp>
...@@ -1481,7 +1482,7 @@ bool ScDPOutput::GetDataResultPositionData(vector<sheet::DataPilotFieldFilter>& ...@@ -1481,7 +1482,7 @@ bool ScDPOutput::GetDataResultPositionData(vector<sheet::DataPilotFieldFilter>&
// helper functions for ScDPOutput::GetPivotData // helper functions for ScDPOutput::GetPivotData
// //
bool lcl_IsNamedDataField( const ScDPGetPivotDataField& rTarget, const String& rSourceName, const String& rGivenName ) bool lcl_IsNamedDataField( const ScDPGetPivotDataField& rTarget, const rtl::OUString& rSourceName, const rtl::OUString& rGivenName )
{ {
// match one of the names, ignoring case // match one of the names, ignoring case
return ScGlobal::GetpTransliteration()->isEqual( rTarget.maFieldName, rSourceName ) || return ScGlobal::GetpTransliteration()->isEqual( rTarget.maFieldName, rSourceName ) ||
...@@ -1740,13 +1741,10 @@ void lcl_FilterInclude( std::vector< sal_Bool >& rResult, std::vector< sal_Int32 ...@@ -1740,13 +1741,10 @@ void lcl_FilterInclude( std::vector< sal_Bool >& rResult, std::vector< sal_Int32
{ {
// Asterisks are added in ScDPSaveData::WriteToSource to create unique names. // Asterisks are added in ScDPSaveData::WriteToSource to create unique names.
//! preserve original name there? //! preserve original name there?
String aSourceName( aResultEntry.Name ); rtl::OUString aSourceName = ScDPUtil::getSourceDimensionName(aResultEntry.Name);
aSourceName.EraseTrailingChars( '*' );
String aGivenName( aResultEntry.Caption ); //! Should use a stored name when available rResult[j] = lcl_IsNamedDataField(
aGivenName.EraseLeadingChars( '\'' ); rTarget, aSourceName, aResultEntry.Caption);
rResult[j] = lcl_IsNamedDataField( rTarget, aSourceName, aGivenName );
} }
} }
else if ( bHasFilter ) else if ( bHasFilter )
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include "miscuno.hxx" #include "miscuno.hxx"
#include "unonames.hxx" #include "unonames.hxx"
#include "dpitemdata.hxx" #include "dpitemdata.hxx"
#include "dputil.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/sheet/DataPilotFieldFilter.hpp> #include <com/sun/star/sheet/DataPilotFieldFilter.hpp>
...@@ -824,10 +825,9 @@ void ScDPSource::CreateRes_Impl() ...@@ -824,10 +825,9 @@ void ScDPSource::CreateRes_Impl()
aDataNames[i] = pDim->getName(); aDataNames[i] = pDim->getName();
// asterisk is added to duplicated dimension names by ScDPSaveData::WriteToSource
//! modify user visible strings as in ScDPResultData::GetMeasureString instead! //! modify user visible strings as in ScDPResultData::GetMeasureString instead!
aDataNames[i] = comphelper::string::removeTrailingChars(aDataNames[i], '*'); aDataNames[i] = ScDPUtil::getSourceDimensionName(aDataNames[i]);
//! if the name is overridden by user, a flag must be set //! if the name is overridden by user, a flag must be set
//! so the user defined name replaces the function string and field name. //! so the user defined name replaces the function string and field name.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment