Hi
Here five patches cleaning up in dpsave.hxx/.cxx in sc
0001: replacing tools/solar.h data types by sal data types
0002: cleaning up spacings
0003-0005: replacing String with OUString in the three classes, and
changing necessary call sites
the patches compile fine and calc seems to work as expected.
dpsave.hxx/.cxx still depend on tools/string as it is used in DBG_...
macros (supposedly from tools/debug), are those still used/meaningful?
Best Regards
Sören Möller + Thies Pierdola
From 5c37e944cfc090c3627edf71f495449f5d724f6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20M=C3=B6ller?= <soerenmoeller2001@gmail.com>
Date: Mon, 31 Jan 2011 19:42:06 +0100
Subject: [PATCH 1/5] Replaced tools/solar.h types with sal types
---
sc/inc/dpsave.hxx | 105 ++++++++++++++--------------
sc/source/core/data/dpsave.cxx | 147 ++++++++++++++++++++--------------------
2 files changed, 127 insertions(+), 125 deletions(-)
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index 742ecd4..7ea7472 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -29,6 +29,7 @@
#ifndef SC_DPSAVE_HXX
#define SC_DPSAVE_HXX
+#include <sal/types.h>
#include <tools/string.hxx>
#include <tools/list.hxx>
#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
@@ -59,23 +60,23 @@ class ScDPSaveMember
private:
String aName;
::std::auto_ptr<rtl::OUString> mpLayoutName; // custom name to be displayed in the table.
- USHORT nVisibleMode;
- USHORT nShowDetailsMode;
+ sal_uInt16 nVisibleMode;
+ sal_uInt16 nShowDetailsMode;
public:
ScDPSaveMember(const String& rName);
ScDPSaveMember(const ScDPSaveMember& r);
~ScDPSaveMember();
- BOOL operator== ( const ScDPSaveMember& r ) const;
+ bool operator== ( const ScDPSaveMember& r ) const;
const String& GetName() const { return aName; }
- BOOL HasIsVisible() const;
- SC_DLLPUBLIC void SetIsVisible(BOOL bSet);
- BOOL GetIsVisible() const { return BOOL(nVisibleMode); }
- BOOL HasShowDetails() const;
- SC_DLLPUBLIC void SetShowDetails(BOOL bSet);
- BOOL GetShowDetails() const { return BOOL(nShowDetailsMode); }
+ bool HasIsVisible() const;
+ SC_DLLPUBLIC void SetIsVisible(bool bSet);
+ bool GetIsVisible() const { return bool(nVisibleMode); }
+ bool HasShowDetails() const;
+ SC_DLLPUBLIC void SetShowDetails(bool bSet);
+ bool GetShowDetails() const { return bool(nShowDetailsMode); }
void SetName( const String& rNew ); // used if the source member was
renamed (groups)
@@ -99,15 +100,15 @@ private:
String* pSelectedPage;
::std::auto_ptr<rtl::OUString> mpLayoutName;
::std::auto_ptr<rtl::OUString> mpSubtotalName;
- BOOL bIsDataLayout;
- BOOL bDupFlag;
- USHORT nOrientation;
- USHORT nFunction; // enum GeneralFunction, for data dimensions
+ bool bIsDataLayout;
+ bool bDupFlag;
+ sal_uInt16 nOrientation;
+ sal_uInt16 nFunction; // enum GeneralFunction, for data dimensions
long nUsedHierarchy;
- USHORT nShowEmptyMode; //! at level
- BOOL bSubTotalDefault; //! at level
+ sal_uInt16 nShowEmptyMode; //! at level
+ bool bSubTotalDefault; //! at level
long nSubTotalCount;
- USHORT* pSubTotalFuncs; // enum GeneralFunction
+ sal_uInt16* pSubTotalFuncs; // enum GeneralFunction
::com::sun::star::sheet::DataPilotFieldReference* pReferenceValue;
::com::sun::star::sheet::DataPilotFieldSortInfo* pSortInfo; // (level)
::com::sun::star::sheet::DataPilotFieldAutoShowInfo* pAutoShowInfo; // (level)
@@ -120,32 +121,32 @@ private:
MemberHash maMemberHash;
MemberList maMemberList;
public:
- ScDPSaveDimension(const String& rName, BOOL bDataLayout);
+ ScDPSaveDimension(const String& rName, bool bDataLayout);
ScDPSaveDimension(const ScDPSaveDimension& r);
~ScDPSaveDimension();
- BOOL operator== ( const ScDPSaveDimension& r ) const;
+ bool operator== ( const ScDPSaveDimension& r ) const;
const MemberList& GetMembers() const { return maMemberList; }
void AddMember(ScDPSaveMember* pMember);
- void SetDupFlag(BOOL bSet) { bDupFlag = bSet; }
- BOOL GetDupFlag() const { return bDupFlag; }
+ void SetDupFlag(bool bSet) { bDupFlag = bSet; }
+ bool GetDupFlag() const { return bDupFlag; }
const String& GetName() const { return aName; }
- BOOL IsDataLayout() const { return bIsDataLayout; }
+ bool IsDataLayout() const { return bIsDataLayout; }
void SetName( const String& rNew ); // used if the source dim was renamed
(groups)
- void SetOrientation(USHORT nNew);
- void SetSubTotals(long nCount, const USHORT* pFuncs);
+ void SetOrientation(sal_uInt16 nNew);
+ void SetSubTotals(long nCount, const sal_uInt16* pFuncs);
long GetSubTotalsCount() const { return nSubTotalCount; }
- USHORT GetSubTotalFunc(long nIndex) const { return pSubTotalFuncs[nIndex]; }
+ sal_uInt16 GetSubTotalFunc(long nIndex) const { return
pSubTotalFuncs[nIndex]; }
bool HasShowEmpty() const;
- void SetShowEmpty(BOOL bSet);
- BOOL GetShowEmpty() const { return BOOL(nShowEmptyMode); }
- void SetFunction(USHORT nNew); // enum
GeneralFunction
- USHORT GetFunction() const { return nFunction; }
+ void SetShowEmpty(bool bSet);
+ bool GetShowEmpty() const { return bool(nShowEmptyMode); }
+ void SetFunction(sal_uInt16 nNew); // enum
GeneralFunction
+ sal_uInt16 GetFunction() const { return nFunction; }
void SetUsedHierarchy(long nNew);
long GetUsedHierarchy() const { return nUsedHierarchy; }
@@ -168,10 +169,10 @@ public:
void SetLayoutInfo(const ::com::sun::star::sheet::DataPilotFieldLayoutInfo*
pNew);
void SetCurrentPage( const String* pPage ); //
NULL = no selection (all)
- BOOL HasCurrentPage() const;
+ bool HasCurrentPage() const;
const String& GetCurrentPage() const;
- USHORT GetOrientation() const { return nOrientation; }
+ sal_uInt16 GetOrientation() const { return nOrientation; }
ScDPSaveMember* GetExistingMemberByName(const String& rName);
@@ -205,12 +206,12 @@ class ScDPSaveData
private:
List aDimList;
ScDPDimensionSaveData* pDimensionData; // settings that create new dimensions
- USHORT nColumnGrandMode;
- USHORT nRowGrandMode;
- USHORT nIgnoreEmptyMode;
- USHORT nRepeatEmptyMode;
- BOOL bFilterButton; // not passed to DataPilotSource
- BOOL bDrillDown; // not passed to DataPilotSource
+ sal_uInt16 nColumnGrandMode;
+ sal_uInt16 nRowGrandMode;
+ sal_uInt16 nIgnoreEmptyMode;
+ sal_uInt16 nRepeatEmptyMode;
+ bool bFilterButton; // not passed to DataPilotSource
+ bool bDrillDown; // not passed to DataPilotSource
long mnCacheId;
/** if true, all dimensions already have all of their member instances
@@ -226,7 +227,7 @@ public:
ScDPSaveData& operator= ( const ScDPSaveData& r );
- BOOL operator== ( const ScDPSaveData& r ) const;
+ bool operator== ( const ScDPSaveData& r ) const;
SC_DLLPUBLIC void SetGrandTotalName(const ::rtl::OUString& rName);
SC_DLLPUBLIC const ::rtl::OUString* GetGrandTotalName() const;
@@ -256,31 +257,31 @@ public:
void RemoveDimensionByName(const String& rName);
- ScDPSaveDimension* GetInnermostDimension(USHORT nOrientation);
+ ScDPSaveDimension* GetInnermostDimension(sal_uInt16 nOrientation);
ScDPSaveDimension* GetFirstDimension(::com::sun::star::sheet::DataPilotFieldOrientation
eOrientation);
long GetDataDimensionCount() const;
void SetPosition( ScDPSaveDimension* pDim, long nNew );
- SC_DLLPUBLIC void SetColumnGrand( BOOL bSet );
- BOOL GetColumnGrand() const { return
BOOL(nColumnGrandMode); }
- SC_DLLPUBLIC void SetRowGrand( BOOL bSet );
- BOOL GetRowGrand() const { return BOOL(nRowGrandMode); }
- void SetIgnoreEmptyRows( BOOL bSet );
- BOOL GetIgnoreEmptyRows() const { return
BOOL(nIgnoreEmptyMode); }
- void SetRepeatIfEmpty( BOOL bSet );
- BOOL GetRepeatIfEmpty() const { return
BOOL(nRepeatEmptyMode); }
-
- SC_DLLPUBLIC void SetFilterButton( BOOL bSet );
- BOOL GetFilterButton() const { return bFilterButton; }
- SC_DLLPUBLIC void SetDrillDown( BOOL bSet );
- BOOL GetDrillDown() const { return bDrillDown; }
+ SC_DLLPUBLIC void SetColumnGrand( bool bSet );
+ bool GetColumnGrand() const { return
bool(nColumnGrandMode); }
+ SC_DLLPUBLIC void SetRowGrand( bool bSet );
+ bool GetRowGrand() const { return bool(nRowGrandMode); }
+ void SetIgnoreEmptyRows( bool bSet );
+ bool GetIgnoreEmptyRows() const { return
bool(nIgnoreEmptyMode); }
+ void SetRepeatIfEmpty( bool bSet );
+ bool GetRepeatIfEmpty() const { return
bool(nRepeatEmptyMode); }
+
+ SC_DLLPUBLIC void SetFilterButton( bool bSet );
+ bool GetFilterButton() const { return bFilterButton; }
+ SC_DLLPUBLIC void SetDrillDown( bool bSet );
+ bool GetDrillDown() const { return bDrillDown; }
void WriteToSource( const com::sun::star::uno::Reference<
com::sun::star::sheet::XDimensionsSupplier>& xSource );
void Refresh( const com::sun::star::uno::Reference<
com::sun::star::sheet::XDimensionsSupplier>& xSource );
- BOOL IsEmpty() const;
+ bool IsEmpty() const;
inline long GetCacheId() const{ return mnCacheId; }
inline void SetCacheId( long nCacheId ){ mnCacheId = nCacheId; }
const ScDPDimensionSaveData* GetExistingDimensionData() const { return pDimensionData; }
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 5502e39..05b8075 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -40,6 +40,7 @@
#include "unonames.hxx"
#include "global.hxx"
+#include <sal/types.h>
#include <tools/debug.hxx>
#include <com/sun/star/sheet/GeneralFunction.hpp>
@@ -112,32 +113,32 @@ ScDPSaveMember::~ScDPSaveMember()
{
}
-BOOL ScDPSaveMember::operator== ( const ScDPSaveMember& r ) const
+bool ScDPSaveMember::operator== ( const ScDPSaveMember& r ) const
{
if ( aName != r.aName ||
nVisibleMode != r.nVisibleMode ||
nShowDetailsMode != r.nShowDetailsMode )
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
-BOOL ScDPSaveMember::HasIsVisible() const
+bool ScDPSaveMember::HasIsVisible() const
{
return nVisibleMode != SC_DPSAVEMODE_DONTKNOW;
}
-void ScDPSaveMember::SetIsVisible(BOOL bSet)
+void ScDPSaveMember::SetIsVisible(bool bSet)
{
nVisibleMode = bSet;
}
-BOOL ScDPSaveMember::HasShowDetails() const
+bool ScDPSaveMember::HasShowDetails() const
{
return nShowDetailsMode != SC_DPSAVEMODE_DONTKNOW;
}
-void ScDPSaveMember::SetShowDetails(BOOL bSet)
+void ScDPSaveMember::SetShowDetails(bool bSet)
{
nShowDetailsMode = bSet;
}
@@ -175,11 +176,11 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>&
xMemb
if ( nVisibleMode != SC_DPSAVEMODE_DONTKNOW )
lcl_SetBoolProperty( xMembProp,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_ISVISIBLE)),
(BOOL)nVisibleMode );
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_ISVISIBLE)),
(bool)nVisibleMode );
if ( nShowDetailsMode != SC_DPSAVEMODE_DONTKNOW )
lcl_SetBoolProperty( xMembProp,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_SHOWDETAILS)),
(BOOL)nShowDetailsMode );
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_SHOWDETAILS)),
(bool)nShowDetailsMode );
if (mpLayoutName.get())
ScUnoHelpFunctions::SetOptionalPropertyValue(xMembProp, SC_UNO_LAYOUTNAME,
*mpLayoutName);
@@ -191,18 +192,18 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>&
xMemb
// -----------------------------------------------------------------------
-ScDPSaveDimension::ScDPSaveDimension(const String& rName, BOOL bDataLayout) :
+ScDPSaveDimension::ScDPSaveDimension(const String& rName, bool bDataLayout) :
aName( rName ),
pSelectedPage( NULL ),
mpLayoutName(NULL),
mpSubtotalName(NULL),
bIsDataLayout( bDataLayout ),
- bDupFlag( FALSE ),
+ bDupFlag( false ),
nOrientation( sheet::DataPilotFieldOrientation_HIDDEN ),
nFunction( sheet::GeneralFunction_AUTO ),
nUsedHierarchy( -1 ),
nShowEmptyMode( SC_DPSAVEMODE_DONTKNOW ),
- bSubTotalDefault( TRUE ),
+ bSubTotalDefault( true ),
nSubTotalCount( 0 ),
pSubTotalFuncs( NULL ),
pReferenceValue( NULL ),
@@ -228,7 +229,7 @@ ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
{
if ( nSubTotalCount && r.pSubTotalFuncs )
{
- pSubTotalFuncs = new USHORT[nSubTotalCount];
+ pSubTotalFuncs = new sal_uInt16[nSubTotalCount];
for (long nSub=0; nSub<nSubTotalCount; nSub++)
pSubTotalFuncs[nSub] = r.pSubTotalFuncs[nSub];
}
@@ -278,7 +279,7 @@ ScDPSaveDimension::~ScDPSaveDimension()
delete [] pSubTotalFuncs;
}
-BOOL ScDPSaveDimension::operator== ( const ScDPSaveDimension& r ) const
+bool ScDPSaveDimension::operator== ( const ScDPSaveDimension& r ) const
{
if ( aName != r.aName ||
bIsDataLayout != r.bIsDataLayout ||
@@ -289,71 +290,71 @@ BOOL ScDPSaveDimension::operator== ( const ScDPSaveDimension& r ) const
nShowEmptyMode != r.nShowEmptyMode ||
bSubTotalDefault != r.bSubTotalDefault ||
nSubTotalCount != r.nSubTotalCount )
- return FALSE;
+ return false;
if ( nSubTotalCount && ( !pSubTotalFuncs || !r.pSubTotalFuncs ) ) // should not happen
- return FALSE;
+ return false;
long i;
for (i=0; i<nSubTotalCount; i++)
if ( pSubTotalFuncs[i] != r.pSubTotalFuncs[i] )
- return FALSE;
+ return false;
if (maMemberHash.size() != r.maMemberHash.size() )
- return FALSE;
+ return false;
MemberList::const_iterator a=maMemberList.begin();
MemberList::const_iterator b=r.maMemberList.begin();
for (; a != maMemberList.end() ; ++a, ++b)
if (!(**a == **b))
- return FALSE;
+ return false;
if ( this->HasCurrentPage() && r.HasCurrentPage() )
{
if ( this->GetCurrentPage() != r.GetCurrentPage() )
{
- return FALSE;
+ return false;
}
}
else if ( this->HasCurrentPage() || r.HasCurrentPage() )
{
- return FALSE;
+ return false;
}
if( pReferenceValue && r.pReferenceValue )
{
if ( !(*pReferenceValue == *r.pReferenceValue) )
{
- return FALSE;
+ return false;
}
}
else if ( pReferenceValue || r.pReferenceValue )
{
- return FALSE;
+ return false;
}
if( this->pSortInfo && r.pSortInfo )
{
if ( !(*this->pSortInfo == *r.pSortInfo) )
{
- return FALSE;
+ return false;
}
}
else if ( this->pSortInfo || r.pSortInfo )
{
- return FALSE;
+ return false;
}
if( this->pAutoShowInfo && r.pAutoShowInfo )
{
if ( !(*this->pAutoShowInfo == *r.pAutoShowInfo) )
{
- return FALSE;
+ return false;
}
}
else if ( this->pAutoShowInfo || r.pAutoShowInfo )
{
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void ScDPSaveDimension::AddMember(ScDPSaveMember* pMember)
@@ -382,26 +383,26 @@ void ScDPSaveDimension::SetName( const String& rNew )
aName = rNew;
}
-void ScDPSaveDimension::SetOrientation(USHORT nNew)
+void ScDPSaveDimension::SetOrientation(sal_uInt16 nNew)
{
nOrientation = nNew;
}
-void ScDPSaveDimension::SetSubTotals(long nCount, const USHORT* pFuncs)
+void ScDPSaveDimension::SetSubTotals(long nCount, const sal_uInt16* pFuncs)
{
if (pSubTotalFuncs)
delete [] pSubTotalFuncs;
nSubTotalCount = nCount;
if ( nCount && pFuncs )
{
- pSubTotalFuncs = new USHORT[nCount];
+ pSubTotalFuncs = new sal_uInt16[nCount];
for (long i=0; i<nCount; i++)
pSubTotalFuncs[i] = pFuncs[i];
}
else
pSubTotalFuncs = NULL;
- bSubTotalDefault = FALSE;
+ bSubTotalDefault = false;
}
bool ScDPSaveDimension::HasShowEmpty() const
@@ -409,12 +410,12 @@ bool ScDPSaveDimension::HasShowEmpty() const
return nShowEmptyMode != SC_DPSAVEMODE_DONTKNOW;
}
-void ScDPSaveDimension::SetShowEmpty(BOOL bSet)
+void ScDPSaveDimension::SetShowEmpty(bool bSet)
{
nShowEmptyMode = bSet;
}
-void ScDPSaveDimension::SetFunction(USHORT nNew)
+void ScDPSaveDimension::SetFunction(sal_uInt16 nNew)
{
nFunction = nNew;
}
@@ -510,7 +511,7 @@ void ScDPSaveDimension::SetCurrentPage( const String* pPage )
pSelectedPage = NULL;
}
-BOOL ScDPSaveDimension::HasCurrentPage() const
+bool ScDPSaveDimension::HasCurrentPage() const
{
return ( pSelectedPage != NULL );
}
@@ -658,7 +659,7 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
}
if ( nShowEmptyMode != SC_DPSAVEMODE_DONTKNOW )
lcl_SetBoolProperty( xLevProp,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_SHOWEMPTY)),
(BOOL)nShowEmptyMode );
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_SHOWEMPTY)),
(bool)nShowEmptyMode );
if ( pSortInfo )
ScUnoHelpFunctions::SetOptionalPropertyValue(xLevProp, SC_UNO_SORTING,
*pSortInfo);
@@ -745,8 +746,8 @@ ScDPSaveData::ScDPSaveData() :
nRowGrandMode( SC_DPSAVEMODE_DONTKNOW ),
nIgnoreEmptyMode( SC_DPSAVEMODE_DONTKNOW ),
nRepeatEmptyMode( SC_DPSAVEMODE_DONTKNOW ),
- bFilterButton( TRUE ),
- bDrillDown( TRUE ),
+ bFilterButton( true ),
+ bDrillDown( true ),
mnCacheId( -1),
mbDimensionMembersBuilt(false),
mpGrandTotalName(NULL)
@@ -790,7 +791,7 @@ ScDPSaveData& ScDPSaveData::operator= ( const ScDPSaveData& r )
return *this;
}
-BOOL ScDPSaveData::operator== ( const ScDPSaveData& r ) const
+bool ScDPSaveData::operator== ( const ScDPSaveData& r ) const
{
if ( nColumnGrandMode != r.nColumnGrandMode ||
nRowGrandMode != r.nRowGrandMode ||
@@ -800,20 +801,20 @@ BOOL ScDPSaveData::operator== ( const ScDPSaveData& r ) const
mnCacheId != r.mnCacheId ||
bDrillDown != r.bDrillDown ||
mbDimensionMembersBuilt != r.mbDimensionMembersBuilt)
- return FALSE;
+ return false;
if ( pDimensionData || r.pDimensionData )
if ( !pDimensionData || !r.pDimensionData || !( *pDimensionData == *r.pDimensionData ) )
- return FALSE;
+ return false;
- ULONG nCount = aDimList.Count();
+ sal_uInt32 nCount = aDimList.Count();
if ( nCount != r.aDimList.Count() )
- return FALSE;
+ return false;
- for (ULONG i=0; i<nCount; i++)
+ for (sal_uInt32 i=0; i<nCount; i++)
if ( !( *(ScDPSaveDimension*)aDimList.GetObject(i) ==
*(ScDPSaveDimension*)r.aDimList.GetObject(i) ) )
- return FALSE;
+ return false;
if (mpGrandTotalName.get())
{
@@ -825,7 +826,7 @@ BOOL ScDPSaveData::operator== ( const ScDPSaveData& r ) const
else if (r.mpGrandTotalName.get())
return false;
- return TRUE;
+ return true;
}
ScDPSaveData::~ScDPSaveData()
@@ -857,7 +858,7 @@ ScDPSaveDimension* ScDPSaveData::GetDimensionByName(const String& rName)
if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
return pDim;
}
- ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, FALSE );
+ ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, false );
aDimList.Insert( pNew, LIST_APPEND );
return pNew;
}
@@ -883,7 +884,7 @@ ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const String& rName)
if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
return DuplicateDimension(rName);
}
- ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, FALSE );
+ ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, false );
aDimList.Insert( pNew, LIST_APPEND );
return pNew;
}
@@ -894,7 +895,7 @@ ScDPSaveDimension* ScDPSaveData::GetDataLayoutDimension()
if (pDim)
return pDim;
- ScDPSaveDimension* pNew = new ScDPSaveDimension( String(), TRUE );
+ ScDPSaveDimension* pNew = new ScDPSaveDimension( String(), true );
aDimList.Insert( pNew, LIST_APPEND );
return pNew;
}
@@ -918,7 +919,7 @@ ScDPSaveDimension* ScDPSaveData::DuplicateDimension(const String& rName)
ScDPSaveDimension* pOld = GetDimensionByName( rName );
ScDPSaveDimension* pNew = new ScDPSaveDimension( *pOld );
- pNew->SetDupFlag( TRUE );
+ pNew->SetDupFlag( true );
aDimList.Insert( pNew, LIST_APPEND );
return pNew;
}
@@ -941,12 +942,12 @@ void ScDPSaveData::RemoveDimensionByName(const String& rName)
ScDPSaveDimension& ScDPSaveData::DuplicateDimension( const ScDPSaveDimension& rDim )
{
ScDPSaveDimension* pNew = new ScDPSaveDimension( rDim );
- pNew->SetDupFlag( TRUE );
+ pNew->SetDupFlag( true );
aDimList.Insert( pNew, LIST_APPEND );
return *pNew;
}
-ScDPSaveDimension* ScDPSaveData::GetInnermostDimension(USHORT nOrientation)
+ScDPSaveDimension* ScDPSaveData::GetInnermostDimension(sal_uInt16 nOrientation)
{
// return the innermost dimension for the given orientation,
// excluding data layout dimension
@@ -993,12 +994,12 @@ void ScDPSaveData::SetPosition( ScDPSaveDimension* pDim, long nNew )
{
// position (nNew) is counted within dimensions of the same orientation
- USHORT nOrient = pDim->GetOrientation();
+ sal_uInt16 nOrient = pDim->GetOrientation();
aDimList.Remove( pDim );
- ULONG nCount = aDimList.Count(); // after remove
+ sal_uInt32 nCount = aDimList.Count(); // after remove
- ULONG nInsPos = 0;
+ sal_uInt32 nInsPos = 0;
while ( nNew > 0 && nInsPos < nCount )
{
if ( ((ScDPSaveDimension*)aDimList.GetObject(nInsPos))->GetOrientation() == nOrient )
@@ -1009,32 +1010,32 @@ void ScDPSaveData::SetPosition( ScDPSaveDimension* pDim, long nNew )
aDimList.Insert( pDim, nInsPos );
}
-void ScDPSaveData::SetColumnGrand(BOOL bSet)
+void ScDPSaveData::SetColumnGrand(bool bSet)
{
nColumnGrandMode = bSet;
}
-void ScDPSaveData::SetRowGrand(BOOL bSet)
+void ScDPSaveData::SetRowGrand(bool bSet)
{
nRowGrandMode = bSet;
}
-void ScDPSaveData::SetIgnoreEmptyRows(BOOL bSet)
+void ScDPSaveData::SetIgnoreEmptyRows(bool bSet)
{
nIgnoreEmptyMode = bSet;
}
-void ScDPSaveData::SetRepeatIfEmpty(BOOL bSet)
+void ScDPSaveData::SetRepeatIfEmpty(bool bSet)
{
nRepeatEmptyMode = bSet;
}
-void ScDPSaveData::SetFilterButton(BOOL bSet)
+void ScDPSaveData::SetFilterButton(bool bSet)
{
bFilterButton = bSet;
}
-void ScDPSaveData::SetDrillDown(BOOL bSet)
+void ScDPSaveData::SetDrillDown(bool bSet)
{
bDrillDown = bSet;
}
@@ -1077,10 +1078,10 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
{
if ( nIgnoreEmptyMode != SC_DPSAVEMODE_DONTKNOW )
lcl_SetBoolProperty( xSourceProp,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_IGNOREEMPTY)),
(BOOL)nIgnoreEmptyMode );
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_IGNOREEMPTY)),
(bool)nIgnoreEmptyMode );
if ( nRepeatEmptyMode != SC_DPSAVEMODE_DONTKNOW )
lcl_SetBoolProperty( xSourceProp,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_REPEATIFEMPTY)),
(BOOL)nRepeatEmptyMode );
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_REPEATIFEMPTY)),
(bool)nRepeatEmptyMode );
}
catch(uno::Exception&)
{
@@ -1110,14 +1111,14 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
DBG_TRACESTR(pDim->GetName());
- BOOL bData = pDim->IsDataLayout();
+ bool bData = pDim->IsDataLayout();
//! getByName for ScDPSource, including DataLayoutDimension !!!!!!!!
uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
uno::Reference<container::XIndexAccess> xIntDims = new ScNameToIndexAccess( xDimsName
);
long nIntCount = xIntDims->getCount();
- BOOL bFound = FALSE;
+ bool bFound = false;
for (long nIntDim=0; nIntDim<nIntCount && !bFound; nIntDim++)
{
uno::Reference<uno::XInterface> xIntDim = ScUnoHelpFunctions::AnyToInterface(
xIntDims->getByIndex(nIntDim) );
@@ -1135,7 +1136,7 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
{
uno::Reference<container::XNamed> xDimName( xIntDim, uno::UNO_QUERY );
if ( xDimName.is() && xDimName->getName() == aName )
- bFound = TRUE;
+ bFound = true;
}
if ( bFound )
@@ -1172,10 +1173,10 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
{
if ( nColumnGrandMode != SC_DPSAVEMODE_DONTKNOW )
lcl_SetBoolProperty( xSourceProp,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_COLUMNGRAND)),
(BOOL)nColumnGrandMode );
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_COLUMNGRAND)),
(bool)nColumnGrandMode );
if ( nRowGrandMode != SC_DPSAVEMODE_DONTKNOW )
lcl_SetBoolProperty( xSourceProp,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_ROWGRAND)),
(BOOL)nRowGrandMode );
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_ROWGRAND)),
(bool)nRowGrandMode );
}
}
catch(uno::Exception&)
@@ -1184,16 +1185,16 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
}
}
-BOOL ScDPSaveData::IsEmpty() const
+bool ScDPSaveData::IsEmpty() const
{
long nCount = aDimList.Count();
for (long i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
if ( pDim->GetOrientation() != sheet::DataPilotFieldOrientation_HIDDEN &&
!pDim->IsDataLayout() )
- return FALSE;
+ return false;
}
- return TRUE; // no entries that are not hidden
+ return true; // no entries that are not hidden
}
ScDPDimensionSaveData* ScDPSaveData::GetDimensionData()
@@ -1286,13 +1287,13 @@ void ScDPSaveData::Refresh( const
uno::Reference<sheet::XDimensionsSupplier>& xS
uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
uno::Reference<container::XIndexAccess> xIntDims = new ScNameToIndexAccess( xDimsName
);
long nIntCount = xIntDims->getCount();
- BOOL bFound = FALSE;
+ bool bFound = false;
for (long nIntDim=0; nIntDim<nIntCount && !bFound; nIntDim++)
{
uno::Reference<uno::XInterface> xIntDim = ScUnoHelpFunctions::AnyToInterface(
xIntDims->getByIndex(nIntDim) );
uno::Reference<container::XNamed> xDimName( xIntDim, uno::UNO_QUERY );
if ( xDimName.is() && xDimName->getName() == aName )
- bFound = TRUE;
+ bFound = true;
}
if ( !bFound )
{
--
1.7.0.4
From cd19a458032b6c998de287d4ae600d5642774721 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20M=C3=B6ller?= <soerenmoeller2001@gmail.com>
Date: Mon, 31 Jan 2011 20:30:59 +0100
Subject: [PATCH 2/5] Cleaned up spacings in dpsave.hxx/.cxx
---
sc/inc/dpsave.hxx | 348 +++++++++++++++++++++++-----------------
sc/source/core/data/dpsave.cxx | 121 ++++++--------
2 files changed, 250 insertions(+), 219 deletions(-)
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index 7ea7472..ffb870c 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -51,130 +51,163 @@ class ScDPTableData;
// --------------------------------------------------------------------
//
-// classes to save Data Pilot settings
+// classes to save Data Pilot settings
//
class ScDPSaveMember
{
private:
- String aName;
+ String aName;
::std::auto_ptr<rtl::OUString> mpLayoutName; // custom name to be displayed in the table.
- sal_uInt16 nVisibleMode;
- sal_uInt16 nShowDetailsMode;
+ sal_uInt16 nVisibleMode;
+ sal_uInt16 nShowDetailsMode;
public:
- ScDPSaveMember(const String& rName);
- ScDPSaveMember(const ScDPSaveMember& r);
- ~ScDPSaveMember();
+ ScDPSaveMember(const String& rName);
+ ScDPSaveMember(const ScDPSaveMember& r);
+ ~ScDPSaveMember();
- bool operator== ( const ScDPSaveMember& r ) const;
+ bool operator== ( const ScDPSaveMember& r ) const;
- const String& GetName() const { return aName; }
- bool HasIsVisible() const;
- SC_DLLPUBLIC void SetIsVisible(bool bSet);
- bool GetIsVisible() const { return bool(nVisibleMode); }
- bool HasShowDetails() const;
- SC_DLLPUBLIC void SetShowDetails(bool bSet);
- bool GetShowDetails() const { return bool(nShowDetailsMode); }
+ const String& GetName() const
+ { return aName; }
- void SetName( const String& rNew ); // used if the source member was
renamed (groups)
+ bool HasIsVisible() const;
+ SC_DLLPUBLIC void SetIsVisible(bool bSet);
+ bool GetIsVisible() const
+ { return bool(nVisibleMode); }
- SC_DLLPUBLIC void SetLayoutName( const ::rtl::OUString& rName );
+ bool HasShowDetails() const;
+ SC_DLLPUBLIC void SetShowDetails(bool bSet);
+ bool GetShowDetails() const
+ { return bool(nShowDetailsMode); }
+
+ void SetName( const String& rNew ); // used if the source member was renamed (groups)
+
+ SC_DLLPUBLIC void SetLayoutName( const ::rtl::OUString& rName );
SC_DLLPUBLIC const ::rtl::OUString* GetLayoutName() const;
- void RemoveLayoutName();
+ void RemoveLayoutName();
- void WriteToSource( const com::sun::star::uno::Reference<
- com::sun::star::uno::XInterface>& xMember,
- sal_Int32 nPosition );
+ void WriteToSource( const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>&
xMember,
+ sal_Int32 nPosition );
};
bool operator == (const ::com::sun::star::sheet::DataPilotFieldSortInfo &l, const
::com::sun::star::sheet::DataPilotFieldSortInfo &r );
bool operator == (const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo &l, const
::com::sun::star::sheet::DataPilotFieldAutoShowInfo &r );
bool operator == (const ::com::sun::star::sheet::DataPilotFieldReference &l, const
::com::sun::star::sheet::DataPilotFieldReference &r );
+
class SC_DLLPUBLIC ScDPSaveDimension
{
private:
- String aName;
- String* pSelectedPage;
+ String aName;
+ String* pSelectedPage;
::std::auto_ptr<rtl::OUString> mpLayoutName;
::std::auto_ptr<rtl::OUString> mpSubtotalName;
- bool bIsDataLayout;
- bool bDupFlag;
- sal_uInt16 nOrientation;
- sal_uInt16 nFunction; // enum GeneralFunction, for data dimensions
- long nUsedHierarchy;
- sal_uInt16 nShowEmptyMode; //! at level
- bool bSubTotalDefault; //! at level
- long nSubTotalCount;
- sal_uInt16* pSubTotalFuncs; // enum GeneralFunction
+ bool bIsDataLayout;
+ bool bDupFlag;
+ sal_uInt16 nOrientation;
+ sal_uInt16 nFunction; // enum GeneralFunction, for data dimensions
+ long nUsedHierarchy;
+ sal_uInt16 nShowEmptyMode; //! at level
+ bool bSubTotalDefault; //! at level
+ long nSubTotalCount;
+ sal_uInt16* pSubTotalFuncs; // enum GeneralFunction
::com::sun::star::sheet::DataPilotFieldReference* pReferenceValue;
- ::com::sun::star::sheet::DataPilotFieldSortInfo* pSortInfo; // (level)
- ::com::sun::star::sheet::DataPilotFieldAutoShowInfo* pAutoShowInfo; // (level)
- ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pLayoutInfo; // (level)
+ ::com::sun::star::sheet::DataPilotFieldSortInfo* pSortInfo; // (level)
+ ::com::sun::star::sheet::DataPilotFieldAutoShowInfo* pAutoShowInfo; // (level)
+ ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pLayoutInfo; // (level)
public:
- typedef std::hash_map <String, ScDPSaveMember*, rtl::OUStringHash> MemberHash;
- typedef std::list <ScDPSaveMember*> MemberList;
+ typedef std::hash_map <String, ScDPSaveMember*, rtl::OUStringHash> MemberHash;
+ typedef std::list <ScDPSaveMember*> MemberList;
+
private:
MemberHash maMemberHash;
MemberList maMemberList;
+
public:
- ScDPSaveDimension(const String& rName, bool bDataLayout);
- ScDPSaveDimension(const ScDPSaveDimension& r);
- ~ScDPSaveDimension();
+ ScDPSaveDimension(const String& rName, bool bDataLayout);
+ ScDPSaveDimension(const ScDPSaveDimension& r);
+ ~ScDPSaveDimension();
+
+ bool operator== ( const ScDPSaveDimension& r ) const;
+
+ const MemberList& GetMembers() const
+ { return maMemberList; }
+
+ void AddMember(ScDPSaveMember* pMember);
+
+ void SetDupFlag(bool bSet)
+ { bDupFlag = bSet; }
+
+ bool GetDupFlag() const
+ { return bDupFlag; }
+
+ const String& GetName() const
+ { return aName; }
+
+ bool IsDataLayout() const
+ { return bIsDataLayout; }
+
+ void SetName( const String& rNew ); // used if the source dim was renamed (groups)
+
+ void SetOrientation(sal_uInt16 nNew);
+ void SetSubTotals(long nCount, const sal_uInt16* pFuncs);
+ long GetSubTotalsCount() const
+ { return nSubTotalCount; }
+
+ sal_uInt16 GetSubTotalFunc(long nIndex) const
+ { return pSubTotalFuncs[nIndex]; }
+
+ bool HasShowEmpty() const;
+ void SetShowEmpty(bool bSet);
+ bool GetShowEmpty() const
+ { return bool(nShowEmptyMode); }
- bool operator== ( const ScDPSaveDimension& r ) const;
+ void SetFunction(sal_uInt16 nNew); // enum GeneralFunction
+ sal_uInt16 GetFunction() const
+ { return nFunction; }
- const MemberList& GetMembers() const { return maMemberList; }
- void AddMember(ScDPSaveMember* pMember);
+ void SetUsedHierarchy(long nNew);
+ long GetUsedHierarchy() const
+ { return nUsedHierarchy; }
- void SetDupFlag(bool bSet) { bDupFlag = bSet; }
- bool GetDupFlag() const { return bDupFlag; }
+ void SetLayoutName(const ::rtl::OUString& rName);
+ const ::rtl::OUString* GetLayoutName() const;
+ void RemoveLayoutName();
+ void SetSubtotalName(const ::rtl::OUString& rName);
+ const ::rtl::OUString* GetSubtotalName() const;
- const String& GetName() const { return aName; }
- bool IsDataLayout() const { return bIsDataLayout; }
+ bool IsMemberNameInUse(const ::rtl::OUString& rName) const;
- void SetName( const String& rNew ); // used if the source dim was renamed
(groups)
+ const ::com::sun::star::sheet::DataPilotFieldReference* GetReferenceValue() const
+ { return pReferenceValue; }
- void SetOrientation(sal_uInt16 nNew);
- void SetSubTotals(long nCount, const sal_uInt16* pFuncs);
- long GetSubTotalsCount() const { return nSubTotalCount; }
- sal_uInt16 GetSubTotalFunc(long nIndex) const { return
pSubTotalFuncs[nIndex]; }
- bool HasShowEmpty() const;
- void SetShowEmpty(bool bSet);
- bool GetShowEmpty() const { return bool(nShowEmptyMode); }
- void SetFunction(sal_uInt16 nNew); // enum
GeneralFunction
- sal_uInt16 GetFunction() const { return nFunction; }
- void SetUsedHierarchy(long nNew);
- long GetUsedHierarchy() const { return nUsedHierarchy; }
+ void SetReferenceValue(const ::com::sun::star::sheet::DataPilotFieldReference* pNew);
- void SetLayoutName(const ::rtl::OUString& rName);
- const ::rtl::OUString* GetLayoutName() const;
- void RemoveLayoutName();
- void SetSubtotalName(const ::rtl::OUString& rName);
- const ::rtl::OUString* GetSubtotalName() const;
+ const ::com::sun::star::sheet::DataPilotFieldSortInfo* GetSortInfo() const
+ { return pSortInfo; }
- bool IsMemberNameInUse(const ::rtl::OUString& rName) const;
+ void SetSortInfo(const ::com::sun::star::sheet::DataPilotFieldSortInfo* pNew);
+ const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo* GetAutoShowInfo() const
+ { return pAutoShowInfo; }
- const ::com::sun::star::sheet::DataPilotFieldReference* GetReferenceValue() const { return
pReferenceValue; }
- void SetReferenceValue(const
::com::sun::star::sheet::DataPilotFieldReference* pNew);
+ void SetAutoShowInfo(const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo* pNew);
+ const ::com::sun::star::sheet::DataPilotFieldLayoutInfo* GetLayoutInfo() const
+ { return pLayoutInfo; }
- const ::com::sun::star::sheet::DataPilotFieldSortInfo* GetSortInfo() const { return
pSortInfo; }
- void SetSortInfo(const ::com::sun::star::sheet::DataPilotFieldSortInfo*
pNew);
- const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo* GetAutoShowInfo() const { return
pAutoShowInfo; }
- void SetAutoShowInfo(const
::com::sun::star::sheet::DataPilotFieldAutoShowInfo* pNew);
- const ::com::sun::star::sheet::DataPilotFieldLayoutInfo* GetLayoutInfo() const { return
pLayoutInfo; }
- void SetLayoutInfo(const ::com::sun::star::sheet::DataPilotFieldLayoutInfo*
pNew);
+ void SetLayoutInfo(const ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pNew);
- void SetCurrentPage( const String* pPage ); //
NULL = no selection (all)
- bool HasCurrentPage() const;
- const String& GetCurrentPage() const;
+ void SetCurrentPage( const String* pPage ); // NULL = no selection (all)
+ bool HasCurrentPage() const;
+ const String& GetCurrentPage() const;
- sal_uInt16 GetOrientation() const { return nOrientation; }
+ sal_uInt16 GetOrientation() const
+ { return nOrientation; }
- ScDPSaveMember* GetExistingMemberByName(const String& rName);
+ ScDPSaveMember* GetExistingMemberByName(const String& rName);
/**
* Get a member object by its name. If one doesn't exist, creat a new
@@ -185,55 +218,56 @@ public:
*
* @return pointer to the member object.
*/
- ScDPSaveMember* GetMemberByName(const String& rName);
+ ScDPSaveMember* GetMemberByName(const String& rName);
- void SetMemberPosition( const String& rName, sal_Int32 nNewPos );
+ void SetMemberPosition( const String& rName, sal_Int32 nNewPos );
- void WriteToSource( const com::sun::star::uno::Reference<
- com::sun::star::uno::XInterface>& xDim );
- void Refresh( const com::sun::star::uno::Reference<
- com::sun::star::sheet::XDimensionsSupplier>& xSource ,
- const std::list<String> & deletedDims);
+ void WriteToSource( const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>&
xDim );
+ void Refresh( const
com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& xSource ,
+ const std::list<String> & deletedDims);
- void UpdateMemberVisibility(const ::std::hash_map< ::rtl::OUString, bool,
::rtl::OUStringHash>& rData);
+ void UpdateMemberVisibility(const ::std::hash_map< ::rtl::OUString, bool,
::rtl::OUStringHash>& rData);
- bool HasInvisibleMember() const;
+ bool HasInvisibleMember() const;
};
class ScDPSaveData
{
private:
- List aDimList;
- ScDPDimensionSaveData* pDimensionData; // settings that create new dimensions
- sal_uInt16 nColumnGrandMode;
- sal_uInt16 nRowGrandMode;
- sal_uInt16 nIgnoreEmptyMode;
- sal_uInt16 nRepeatEmptyMode;
- bool bFilterButton; // not passed to DataPilotSource
- bool bDrillDown; // not passed to DataPilotSource
- long mnCacheId;
+ List aDimList;
+ ScDPDimensionSaveData* pDimensionData; // settings that create new dimensions
+ sal_uInt16 nColumnGrandMode;
+ sal_uInt16 nRowGrandMode;
+ sal_uInt16 nIgnoreEmptyMode;
+ sal_uInt16 nRepeatEmptyMode;
+ bool bFilterButton; // not passed to DataPilotSource
+ bool bDrillDown; // not passed to DataPilotSource
+ long mnCacheId;
/** if true, all dimensions already have all of their member instances
* created. */
- bool mbDimensionMembersBuilt;
+ bool mbDimensionMembersBuilt;
::std::auto_ptr<rtl::OUString> mpGrandTotalName;
public:
- SC_DLLPUBLIC ScDPSaveData();
- ScDPSaveData(const ScDPSaveData& r);
- SC_DLLPUBLIC ~ScDPSaveData();
+ SC_DLLPUBLIC ScDPSaveData();
+ ScDPSaveData(const ScDPSaveData& r);
+ SC_DLLPUBLIC ~ScDPSaveData();
- ScDPSaveData& operator= ( const ScDPSaveData& r );
+ ScDPSaveData& operator= ( const ScDPSaveData& r );
- bool operator== ( const ScDPSaveData& r ) const;
+ bool operator== ( const ScDPSaveData& r ) const;
- SC_DLLPUBLIC void SetGrandTotalName(const ::rtl::OUString& rName);
- SC_DLLPUBLIC const ::rtl::OUString* GetGrandTotalName() const;
+ SC_DLLPUBLIC void SetGrandTotalName(const ::rtl::OUString& rName);
+ SC_DLLPUBLIC const ::rtl::OUString* GetGrandTotalName() const;
- const List& GetDimensions() const { return aDimList; }
- void AddDimension(ScDPSaveDimension* pDim) {
aDimList.Insert(pDim, LIST_APPEND); }
+ const List& GetDimensions() const
+ { return aDimList; }
+
+ void AddDimension(ScDPSaveDimension* pDim)
+ { aDimList.Insert(pDim, LIST_APPEND); }
/**
* Get a dimension object by its name. <i>If one doesn't exist for the
@@ -245,59 +279,71 @@ public:
* manages its life cycle; hence the caller must
* <i>not</i> delete this object.
*/
- ScDPSaveDimension* GetDimensionByName(const String& rName);
- SC_DLLPUBLIC ScDPSaveDimension* GetDataLayoutDimension();
- SC_DLLPUBLIC ScDPSaveDimension* GetExistingDataLayoutDimension() const;
-
- ScDPSaveDimension* DuplicateDimension(const String& rName);
- SC_DLLPUBLIC ScDPSaveDimension& DuplicateDimension(const ScDPSaveDimension& rDim);
-
- SC_DLLPUBLIC ScDPSaveDimension* GetExistingDimensionByName(const String& rName)
const;
- SC_DLLPUBLIC ScDPSaveDimension* GetNewDimensionByName(const String& rName);
-
- void RemoveDimensionByName(const String& rName);
-
- ScDPSaveDimension* GetInnermostDimension(sal_uInt16 nOrientation);
- ScDPSaveDimension* GetFirstDimension(::com::sun::star::sheet::DataPilotFieldOrientation
eOrientation);
- long GetDataDimensionCount() const;
-
-
- void SetPosition( ScDPSaveDimension* pDim, long nNew );
- SC_DLLPUBLIC void SetColumnGrand( bool bSet );
- bool GetColumnGrand() const { return
bool(nColumnGrandMode); }
- SC_DLLPUBLIC void SetRowGrand( bool bSet );
- bool GetRowGrand() const { return bool(nRowGrandMode); }
- void SetIgnoreEmptyRows( bool bSet );
- bool GetIgnoreEmptyRows() const { return
bool(nIgnoreEmptyMode); }
- void SetRepeatIfEmpty( bool bSet );
- bool GetRepeatIfEmpty() const { return
bool(nRepeatEmptyMode); }
-
- SC_DLLPUBLIC void SetFilterButton( bool bSet );
- bool GetFilterButton() const { return bFilterButton; }
- SC_DLLPUBLIC void SetDrillDown( bool bSet );
- bool GetDrillDown() const { return bDrillDown; }
-
- void WriteToSource( const com::sun::star::uno::Reference<
- com::sun::star::sheet::XDimensionsSupplier>& xSource );
- void Refresh( const com::sun::star::uno::Reference<
- com::sun::star::sheet::XDimensionsSupplier>& xSource );
- bool IsEmpty() const;
- inline long GetCacheId() const{ return mnCacheId; }
- inline void SetCacheId( long nCacheId ){ mnCacheId = nCacheId; }
- const ScDPDimensionSaveData* GetExistingDimensionData() const { return pDimensionData; }
- SC_DLLPUBLIC ScDPDimensionSaveData* GetDimensionData(); // create if not there
- void SetDimensionData( const ScDPDimensionSaveData* pNew ); // copied
- void BuildAllDimensionMembers(ScDPTableData* pData);
+ ScDPSaveDimension* GetDimensionByName(const String& rName);
+ SC_DLLPUBLIC ScDPSaveDimension* GetDataLayoutDimension();
+ SC_DLLPUBLIC ScDPSaveDimension* GetExistingDataLayoutDimension() const;
+
+ ScDPSaveDimension* DuplicateDimension(const String& rName);
+ SC_DLLPUBLIC ScDPSaveDimension& DuplicateDimension(const ScDPSaveDimension& rDim);
+
+ SC_DLLPUBLIC ScDPSaveDimension* GetExistingDimensionByName(const String& rName) const;
+ SC_DLLPUBLIC ScDPSaveDimension* GetNewDimensionByName(const String& rName);
+
+ void RemoveDimensionByName(const String& rName);
+
+ ScDPSaveDimension* GetInnermostDimension(sal_uInt16 nOrientation);
+ ScDPSaveDimension* GetFirstDimension(::com::sun::star::sheet::DataPilotFieldOrientation
eOrientation);
+ long GetDataDimensionCount() const;
+
+ void SetPosition( ScDPSaveDimension* pDim, long nNew );
+ SC_DLLPUBLIC void SetColumnGrand( bool bSet );
+ bool GetColumnGrand() const
+ { return bool(nColumnGrandMode); }
+
+ SC_DLLPUBLIC void SetRowGrand( bool bSet );
+ bool GetRowGrand() const
+ { return bool(nRowGrandMode); }
+
+ void SetIgnoreEmptyRows( bool bSet );
+ bool GetIgnoreEmptyRows() const
+ { return bool(nIgnoreEmptyMode); }
+
+ void SetRepeatIfEmpty( bool bSet );
+ bool GetRepeatIfEmpty() const
+ { return bool(nRepeatEmptyMode); }
+
+ SC_DLLPUBLIC void SetFilterButton( bool bSet );
+ bool GetFilterButton() const
+ { return bFilterButton; }
+
+ SC_DLLPUBLIC void SetDrillDown( bool bSet );
+ bool GetDrillDown() const
+ { return bDrillDown; }
+
+ void WriteToSource( const
com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& xSource );
+ void Refresh( const
com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& xSource );
+ bool IsEmpty() const;
+ inline long GetCacheId() const
+ { return mnCacheId; }
+
+ inline void SetCacheId( long nCacheId )
+ { mnCacheId = nCacheId; }
+
+ const ScDPDimensionSaveData* GetExistingDimensionData() const
+ { return pDimensionData; }
+
+ SC_DLLPUBLIC ScDPDimensionSaveData* GetDimensionData(); // create if not there
+ void SetDimensionData( const ScDPDimensionSaveData* pNew ); // copied
+ void BuildAllDimensionMembers(ScDPTableData* pData);
/**
* Check whether a dimension has one or more invisible members.
*
* @param rDimName dimension name
*/
- SC_DLLPUBLIC bool HasInvisibleMember(const ::rtl::OUString& rDimName) const;
+ SC_DLLPUBLIC bool HasInvisibleMember(const ::rtl::OUString& rDimName) const;
};
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 05b8075..1aed8d7 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -29,8 +29,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
// INCLUDE ---------------------------------------------------------------
#include "dpsave.hxx"
@@ -73,24 +71,18 @@ using ::rtl::OUStringHash;
using ::std::hash_map;
using ::std::auto_ptr;
-// -----------------------------------------------------------------------
-
-#define SC_DPSAVEMODE_NO 0
-#define SC_DPSAVEMODE_YES 1
-#define SC_DPSAVEMODE_DONTKNOW 2
-
-// -----------------------------------------------------------------------
+#define SC_DPSAVEMODE_NO 0
+#define SC_DPSAVEMODE_YES 1
+#define SC_DPSAVEMODE_DONTKNOW 2
void lcl_SetBoolProperty( const uno::Reference<beans::XPropertySet>& xProp,
const rtl::OUString& rName, sal_Bool bValue )
{
- //! move to ScUnoHelpFunctions?
+ //! move to ScUnoHelpFunctions?
xProp->setPropertyValue( rName, uno::Any( &bValue, getBooleanCppuType() ) );
}
-// -----------------------------------------------------------------------
-
ScDPSaveMember::ScDPSaveMember(const String& rName) :
aName( rName ),
mpLayoutName(NULL),
@@ -115,8 +107,8 @@ ScDPSaveMember::~ScDPSaveMember()
bool ScDPSaveMember::operator== ( const ScDPSaveMember& r ) const
{
- if ( aName != r.aName ||
- nVisibleMode != r.nVisibleMode ||
+ if ( aName != r.aName ||
+ nVisibleMode != r.nVisibleMode ||
nShowDetailsMode != r.nShowDetailsMode )
return false;
@@ -190,8 +182,6 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMemb
}
}
-// -----------------------------------------------------------------------
-
ScDPSaveDimension::ScDPSaveDimension(const String& rName, bool bDataLayout) :
aName( rName ),
pSelectedPage( NULL ),
@@ -281,18 +271,18 @@ ScDPSaveDimension::~ScDPSaveDimension()
bool ScDPSaveDimension::operator== ( const ScDPSaveDimension& r ) const
{
- if ( aName != r.aName ||
- bIsDataLayout != r.bIsDataLayout ||
- bDupFlag != r.bDupFlag ||
- nOrientation != r.nOrientation ||
- nFunction != r.nFunction ||
+ if ( aName != r.aName ||
+ bIsDataLayout != r.bIsDataLayout ||
+ bDupFlag != r.bDupFlag ||
+ nOrientation != r.nOrientation ||
+ nFunction != r.nFunction ||
nUsedHierarchy != r.nUsedHierarchy ||
nShowEmptyMode != r.nShowEmptyMode ||
bSubTotalDefault != r.bSubTotalDefault ||
- nSubTotalCount != r.nSubTotalCount )
+ nSubTotalCount != r.nSubTotalCount )
return false;
- if ( nSubTotalCount && ( !pSubTotalFuncs || !r.pSubTotalFuncs ) ) // should not happen
+ if ( nSubTotalCount && ( !pSubTotalFuncs || !r.pSubTotalFuncs ) ) // should not happen
return false;
long i;
@@ -531,7 +521,6 @@ ScDPSaveMember* ScDPSaveDimension::GetExistingMemberByName(const String& rName)
return NULL;
}
-
ScDPSaveMember* ScDPSaveDimension::GetMemberByName(const String& rName)
{
MemberHash::const_iterator res = maMemberHash.find (rName);
@@ -546,7 +535,7 @@ ScDPSaveMember* ScDPSaveDimension::GetMemberByName(const String& rName)
void ScDPSaveDimension::SetMemberPosition( const String& rName, sal_Int32 nNewPos )
{
- ScDPSaveMember* pMember = GetMemberByName( rName ); // make sure it exists and is in the
hash
+ ScDPSaveMember* pMember = GetMemberByName( rName ); // make sure it exists and is in the hash
maMemberList.remove( pMember );
@@ -606,8 +595,8 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
ScUnoHelpFunctions::SetOptionalPropertyValue(xDimProp, SC_UNO_FIELD_SUBTOTALNAME,
*pSubTotalName);
}
- // Level loop outside of maMemberList loop
- // because SubTotals have to be set independently of known members
+ // Level loop outside of maMemberList loop
+ // because SubTotals have to be set independently of known members
long nCount = maMemberHash.size();
@@ -681,7 +670,7 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
uno::Reference<container::XNameAccess> xMembers = xMembSupp->getMembers();
if ( xMembers.is() )
{
- sal_Int32 nPosition = -1; // set position only in manual mode
+ sal_Int32 nPosition = -1; // set position only in manual mode
if ( !pSortInfo || pSortInfo->Mode ==
sheet::DataPilotFieldSortMode::MANUAL )
nPosition = 0;
@@ -698,7 +687,7 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
pMember->WriteToSource( xMemberInt, nPosition );
if ( nPosition >= 0 )
- ++nPosition; // increase if initialized
+ ++nPosition; // increase if initialized
}
// missing member is no error
}
@@ -738,8 +727,6 @@ bool ScDPSaveDimension::HasInvisibleMember() const
return false;
}
-// -----------------------------------------------------------------------
-
ScDPSaveData::ScDPSaveData() :
pDimensionData( NULL ),
nColumnGrandMode( SC_DPSAVEMODE_DONTKNOW ),
@@ -794,12 +781,12 @@ ScDPSaveData& ScDPSaveData::operator= ( const ScDPSaveData& r )
bool ScDPSaveData::operator== ( const ScDPSaveData& r ) const
{
if ( nColumnGrandMode != r.nColumnGrandMode ||
- nRowGrandMode != r.nRowGrandMode ||
+ nRowGrandMode != r.nRowGrandMode ||
nIgnoreEmptyMode != r.nIgnoreEmptyMode ||
nRepeatEmptyMode != r.nRepeatEmptyMode ||
bFilterButton != r.bFilterButton ||
- mnCacheId != r.mnCacheId ||
- bDrillDown != r.bDrillDown ||
+ mnCacheId != r.mnCacheId ||
+ bDrillDown != r.bDrillDown ||
mbDimensionMembersBuilt != r.mbDimensionMembersBuilt)
return false;
@@ -872,7 +859,7 @@ ScDPSaveDimension* ScDPSaveData::GetExistingDimensionByName(const String& rName)
if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
return pDim;
}
- return NULL; // don't create new
+ return NULL; // don't create new
}
ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const String& rName)
@@ -914,8 +901,8 @@ ScDPSaveDimension* ScDPSaveData::GetExistingDataLayoutDimension() const
ScDPSaveDimension* ScDPSaveData::DuplicateDimension(const String& rName)
{
- // always insert new
- //! check if dimension is there?
+ // always insert new
+ //! check if dimension is there?
ScDPSaveDimension* pOld = GetDimensionByName( rName );
ScDPSaveDimension* pNew = new ScDPSaveDimension( *pOld );
@@ -949,8 +936,8 @@ ScDPSaveDimension& ScDPSaveData::DuplicateDimension( const ScDPSaveDimension& rD
ScDPSaveDimension* ScDPSaveData::GetInnermostDimension(sal_uInt16 nOrientation)
{
- // return the innermost dimension for the given orientation,
- // excluding data layout dimension
+ // return the innermost dimension for the given orientation,
+ // excluding data layout dimension
ScDPSaveDimension* pInner = NULL;
long nCount = aDimList.Count();
@@ -960,7 +947,7 @@ ScDPSaveDimension* ScDPSaveData::GetInnermostDimension(sal_uInt16 nOrientation)
if ( pDim->GetOrientation() == nOrientation && !pDim->IsDataLayout() )
pInner = pDim;
}
- return pInner; // the last matching one
+ return pInner; // the last matching one
}
ScDPSaveDimension* ScDPSaveData::GetFirstDimension(sheet::DataPilotFieldOrientation eOrientation)
@@ -992,12 +979,12 @@ long ScDPSaveData::GetDataDimensionCount() const
void ScDPSaveData::SetPosition( ScDPSaveDimension* pDim, long nNew )
{
- // position (nNew) is counted within dimensions of the same orientation
+ // position (nNew) is counted within dimensions of the same orientation
sal_uInt16 nOrient = pDim->GetOrientation();
aDimList.Remove( pDim );
- sal_uInt32 nCount = aDimList.Count(); // after remove
+ sal_uInt32 nCount = aDimList.Count(); // after remove
sal_uInt32 nInsPos = 0;
while ( nNew > 0 && nInsPos < nCount )
@@ -1065,14 +1052,14 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
if (!xSource.is())
return;
- // source options must be first!
+ // source options must be first!
uno::Reference<beans::XPropertySet> xSourceProp( xSource, uno::UNO_QUERY );
DBG_ASSERT( xSourceProp.is(), "no properties at source" );
if ( xSourceProp.is() )
{
- // source options are not available for external sources
- //! use XPropertySetInfo to test for availability?
+ // source options are not available for external sources
+ //! use XPropertySetInfo to test for availability?
try
{
@@ -1096,9 +1083,9 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
// exceptions in the other calls are errors
try
{
- // reset all orientations
- //! "forgetSettings" or similar at source ?????
- //! reset all duplicated dimensions, or reuse them below !!!
+ // reset all orientations
+ //! "forgetSettings" or similar at source ?????
+ //! reset all duplicated dimensions, or reuse them below !!!
DBG_TRACE( "ScDPSaveData::WriteToSource" );
lcl_ResetOrient( xSource );
@@ -1110,10 +1097,10 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
rtl::OUString aName = pDim->GetName();
DBG_TRACESTR(pDim->GetName());
-
+
bool bData = pDim->IsDataLayout();
- //! getByName for ScDPSource, including DataLayoutDimension !!!!!!!!
+ //! getByName for ScDPSource, including DataLayoutDimension !!!!!!!!
uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions();
uno::Reference<container::XIndexAccess> xIntDims = new ScNameToIndexAccess( xDimsName
);
@@ -1129,7 +1116,7 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
{
bFound = ScUnoHelpFunctions::GetBoolProperty( xDimProp,
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(DP_PROP_ISDATALAYOUT)) );
- //! error checking -- is "IsDataLayoutDimension" property required??
+ //! error checking -- is "IsDataLayoutDimension" property required??
}
}
else
@@ -1146,8 +1133,8 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
String aNewName = pDim->GetName();
// different name for each duplication of a (real) dimension...
- for (long j=0; j<=i; j++) //! Test !!!!!!
- aNewName += '*'; //! modify name at creation of SaveDimension
+ for (long j=0; j<=i; j++) //! Test !!!!!!
+ aNewName += '*'; //! modify name at creation of SaveDimension
uno::Reference<util::XCloneable> xCloneable( xIntDim, uno::UNO_QUERY );
DBG_ASSERT( xCloneable.is(), "cannot clone dimension" );
@@ -1194,7 +1181,7 @@ bool ScDPSaveData::IsEmpty() const
if ( pDim->GetOrientation() != sheet::DataPilotFieldOrientation_HIDDEN &&
!pDim->IsDataLayout() )
return false;
}
- return true; // no entries that are not hidden
+ return true; // no entries that are not hidden
}
ScDPDimensionSaveData* ScDPSaveData::GetDimensionData()
@@ -1233,12 +1220,12 @@ void ScDPSaveData::BuildAllDimensionMembers(ScDPTableData* pData)
ScDPSaveDimension* pDim = static_cast<ScDPSaveDimension*>(aDimList.GetObject(i));
const String& rDimName = pDim->GetName();
if (!rDimName.Len())
- // empty dimension name. It must be data layout.
+ // empty dimension name. It must be data layout.
continue;
NameIndexMap::const_iterator itr = aMap.find(rDimName);
if (itr == itrEnd)
- // dimension name not in the data. This should never happen!
+ // dimension name not in the data. This should never happen!
continue;
long nDimIndex = itr->second;
@@ -1249,7 +1236,7 @@ void ScDPSaveData::BuildAllDimensionMembers(ScDPTableData* pData)
const ScDPItemData* pMemberData = pData->GetMemberById( nDimIndex, rMembers[j] );
String aMemName = pMemberData->GetString();
if (pDim->GetExistingMemberByName(aMemName))
- // this member instance already exists. nothing to do.
+ // this member instance already exists. nothing to do.
continue;
auto_ptr<ScDPSaveMember> pNewMember(new ScDPSaveMember(aMemName));
@@ -1300,13 +1287,13 @@ void ScDPSaveData::Refresh( const
uno::Reference<sheet::XDimensionsSupplier>& xS
deletedDims.push_back( aName );
aDimList.Remove(i);
DBG_TRACE( "\n Remove dim: \t" );
- DBG_TRACESTR( String( aName ) );
+ DBG_TRACESTR( String( aName ) );
}
}
nCount = aDimList.Count();
- for (long i=nCount-1; i >=0 ; i--) //check every dimension ??
+ for (long i=nCount-1; i >=0 ; i--) //check every dimension ??
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
@@ -1317,7 +1304,7 @@ void ScDPSaveData::Refresh( const uno::Reference<sheet::XDimensionsSupplier>&
xS
}
- mbDimensionMembersBuilt = false; // there may be new members
+ mbDimensionMembersBuilt = false; // there may be new members
}
catch(uno::Exception&)
{
@@ -1337,7 +1324,7 @@ void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference<
return;
SCCOL nSrcDim = pCache->GetDimensionIndex( GetName() );
-
+
if ( nSrcDim == -1 )
return;
if ( pSelectedPage )
@@ -1377,7 +1364,7 @@ void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference<
case sheet::DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE:
case sheet::DataPilotFieldReferenceType::RUNNING_TOTAL:
{
- if( pReferenceValue->ReferenceItemType ==
DataPilotFieldReferenceItemType::NAMED )
+ if( pReferenceValue->ReferenceItemType ==
DataPilotFieldReferenceItemType::NAMED )
{
const String& sReferenceFieldName = pReferenceValue->ReferenceField;
DBG_TRACESTR( sReferenceFieldName );
@@ -1411,25 +1398,23 @@ void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference<
DBG_TRACE( "\n DataPilotFieldSortMode::DATA \n" );
const String& sFieldDimName = pSortInfo->Field;
std::list<String>::const_iterator iter = std::find( deletedDims.begin(),
deletedDims.end(), sFieldDimName );
- if ( iter != deletedDims.end() && pCache->GetDimensionIndex( sFieldDimName ) == -1
)
- {
+ if ( iter != deletedDims.end() && pCache->GetDimensionIndex( sFieldDimName ) == -1
)
+ {
pSortInfo->Mode = DataPilotFieldSortMode::MANUAL;
pSortInfo->Field = GetName();
}
}
-
};
if ( pAutoShowInfo )
{ //check autoshow
const String& sFieldDimName = pAutoShowInfo->DataField;
std::list<String>::const_iterator iter = std::find( deletedDims.begin(),
deletedDims.end(), sFieldDimName );
- if ( iter != deletedDims.end() && pCache->GetDimensionIndex( sFieldDimName ) == -1 )
- {
+ if ( iter != deletedDims.end() && pCache->GetDimensionIndex( sFieldDimName ) == -1 )
+ {
delete pAutoShowInfo;
pAutoShowInfo = NULL;
}
-
};
//remove unused members
--
1.7.0.4
From 4a554a7994a9990c902ae2efa422eb941f3f3b3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20M=C3=B6ller?= <soerenmoeller2001@gmail.com>
Date: Mon, 31 Jan 2011 20:50:47 +0100
Subject: [PATCH 3/5] Replaced tools/string with rtl::OUString in ScDPSaveMember
Corrected comparison with return value in dbfunc3.cxx
---
sc/inc/dpsave.hxx | 9 +++++----
sc/source/core/data/dpsave.cxx | 4 ++--
sc/source/ui/view/dbfunc3.cxx | 2 +-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index ffb870c..601c99b 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -29,6 +29,7 @@
#ifndef SC_DPSAVE_HXX
#define SC_DPSAVE_HXX
+#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <tools/string.hxx>
#include <tools/list.hxx>
@@ -58,19 +59,19 @@ class ScDPTableData;
class ScDPSaveMember
{
private:
- String aName;
+ ::rtl::OUString aName;
::std::auto_ptr<rtl::OUString> mpLayoutName; // custom name to be displayed in the table.
sal_uInt16 nVisibleMode;
sal_uInt16 nShowDetailsMode;
public:
- ScDPSaveMember(const String& rName);
+ ScDPSaveMember(const ::rtl::OUString& rName);
ScDPSaveMember(const ScDPSaveMember& r);
~ScDPSaveMember();
bool operator== ( const ScDPSaveMember& r ) const;
- const String& GetName() const
+ const ::rtl::OUString& GetName() const
{ return aName; }
bool HasIsVisible() const;
@@ -83,7 +84,7 @@ public:
bool GetShowDetails() const
{ return bool(nShowDetailsMode); }
- void SetName( const String& rNew ); // used if the source member was renamed (groups)
+ void SetName( const ::rtl::OUString& rNew ); // used if the source member was renamed (groups)
SC_DLLPUBLIC void SetLayoutName( const ::rtl::OUString& rName );
SC_DLLPUBLIC const ::rtl::OUString* GetLayoutName() const;
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 1aed8d7..9cdfe14 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -83,7 +83,7 @@ void lcl_SetBoolProperty( const uno::Reference<beans::XPropertySet>& xProp,
xProp->setPropertyValue( rName, uno::Any( &bValue, getBooleanCppuType() ) );
}
-ScDPSaveMember::ScDPSaveMember(const String& rName) :
+ScDPSaveMember::ScDPSaveMember(const ::rtl::OUString& rName) :
aName( rName ),
mpLayoutName(NULL),
nVisibleMode( SC_DPSAVEMODE_DONTKNOW ),
@@ -135,7 +135,7 @@ void ScDPSaveMember::SetShowDetails(bool bSet)
nShowDetailsMode = bSet;
}
-void ScDPSaveMember::SetName( const String& rNew )
+void ScDPSaveMember::SetName( const ::rtl::OUString& rNew )
{
// Used only if the source member was renamed (groups).
// For UI renaming of members, a layout name must be used.
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 440eb22..2d434e2 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1680,7 +1680,7 @@ void ScDBFunc::DataPilotInput( const ScAddress& rPos, const String& rString )
// already used.
if (rString.Len())
{
- if (rString.EqualsIgnoreCaseAscii(pMem->GetName()))
+ if
(::rtl::OUString(rString).equalsIgnoreAsciiCase(pMem->GetName()))
{
pMem->RemoveLayoutName();
bChange = true;
--
1.7.0.4
From 47f6fe85450004bef2b0d116e37ed41799511ea6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20M=C3=B6ller?= <soerenmoeller2001@gmail.com>
Date: Mon, 31 Jan 2011 21:57:02 +0100
Subject: [PATCH 4/5] Replaced tools/string with ::rtl::OUString in ScDPSaveDimension
Changed comparisions and calls in different files
---
sc/inc/dpsave.hxx | 24 +++++++-------
sc/source/core/data/dpsave.cxx | 63 ++++++++++++++++++-----------------
sc/source/filter/excel/xipivot.cxx | 5 ++-
sc/source/filter/xml/xmldpimp.cxx | 2 +-
sc/source/ui/unoobj/dapiuno.cxx | 8 ++--
sc/source/ui/view/dbfunc3.cxx | 2 +-
sc/source/ui/view/gridwin.cxx | 5 ++-
7 files changed, 58 insertions(+), 51 deletions(-)
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index 601c99b..f0270e0 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -102,8 +102,8 @@ bool operator == (const ::com::sun::star::sheet::DataPilotFieldReference &l, con
class SC_DLLPUBLIC ScDPSaveDimension
{
private:
- String aName;
- String* pSelectedPage;
+ ::rtl::OUString aName;
+ ::rtl::OUString* pSelectedPage;
::std::auto_ptr<rtl::OUString> mpLayoutName;
::std::auto_ptr<rtl::OUString> mpSubtotalName;
bool bIsDataLayout;
@@ -121,7 +121,7 @@ private:
::com::sun::star::sheet::DataPilotFieldLayoutInfo* pLayoutInfo; // (level)
public:
- typedef std::hash_map <String, ScDPSaveMember*, rtl::OUStringHash> MemberHash;
+ typedef std::hash_map <rtl::OUString, ScDPSaveMember*, rtl::OUStringHash> MemberHash;
typedef std::list <ScDPSaveMember*> MemberList;
private:
@@ -129,7 +129,7 @@ private:
MemberList maMemberList;
public:
- ScDPSaveDimension(const String& rName, bool bDataLayout);
+ ScDPSaveDimension(const ::rtl::OUString& rName, bool bDataLayout);
ScDPSaveDimension(const ScDPSaveDimension& r);
~ScDPSaveDimension();
@@ -146,13 +146,13 @@ public:
bool GetDupFlag() const
{ return bDupFlag; }
- const String& GetName() const
+ const ::rtl::OUString& GetName() const
{ return aName; }
bool IsDataLayout() const
{ return bIsDataLayout; }
- void SetName( const String& rNew ); // used if the source dim was renamed (groups)
+ void SetName( const ::rtl::OUString& rNew ); // used if the source dim was renamed (groups)
void SetOrientation(sal_uInt16 nNew);
void SetSubTotals(long nCount, const sal_uInt16* pFuncs);
@@ -201,14 +201,14 @@ public:
void SetLayoutInfo(const ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pNew);
- void SetCurrentPage( const String* pPage ); // NULL = no selection (all)
+ void SetCurrentPage( const ::rtl::OUString* pPage ); // NULL = no selection (all)
bool HasCurrentPage() const;
- const String& GetCurrentPage() const;
+ const ::rtl::OUString& GetCurrentPage() const;
sal_uInt16 GetOrientation() const
{ return nOrientation; }
- ScDPSaveMember* GetExistingMemberByName(const String& rName);
+ ScDPSaveMember* GetExistingMemberByName(const ::rtl::OUString& rName);
/**
* Get a member object by its name. If one doesn't exist, creat a new
@@ -219,13 +219,13 @@ public:
*
* @return pointer to the member object.
*/
- ScDPSaveMember* GetMemberByName(const String& rName);
+ ScDPSaveMember* GetMemberByName(const ::rtl::OUString& rName);
- void SetMemberPosition( const String& rName, sal_Int32 nNewPos );
+ void SetMemberPosition( const ::rtl::OUString& rName, sal_Int32 nNewPos );
void WriteToSource( const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>&
xDim );
void Refresh( const
com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& xSource ,
- const std::list<String> & deletedDims);
+ const std::list<rtl::OUString> & deletedDims);
void UpdateMemberVisibility(const ::std::hash_map< ::rtl::OUString, bool,
::rtl::OUStringHash>& rData);
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 9cdfe14..bb0264a 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -182,7 +182,7 @@ void ScDPSaveMember::WriteToSource( const uno::Reference<uno::XInterface>& xMemb
}
}
-ScDPSaveDimension::ScDPSaveDimension(const String& rName, bool bDataLayout) :
+ScDPSaveDimension::ScDPSaveDimension(const ::rtl::OUString& rName, bool bDataLayout) :
aName( rName ),
pSelectedPage( NULL ),
mpLayoutName(NULL),
@@ -226,7 +226,7 @@ ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
for (MemberList::const_iterator i=r.maMemberList.begin(); i != r.maMemberList.end() ; ++i)
{
- const String& rName = (*i)->GetName();
+ const ::rtl::OUString& rName = (*i)->GetName();
ScDPSaveMember* pNew = new ScDPSaveMember( **i );
maMemberHash[rName] = pNew;
maMemberList.push_back( pNew );
@@ -248,7 +248,7 @@ ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
else
pLayoutInfo = NULL;
if (r.pSelectedPage)
- pSelectedPage = new String( *(r.pSelectedPage) );
+ pSelectedPage = new ::rtl::OUString( *(r.pSelectedPage) );
else
pSelectedPage = NULL;
if (r.mpLayoutName.get())
@@ -349,11 +349,11 @@ bool ScDPSaveDimension::operator== ( const ScDPSaveDimension& r ) const
void ScDPSaveDimension::AddMember(ScDPSaveMember* pMember)
{
- const String & rName = pMember->GetName();
+ const ::rtl::OUString & rName = pMember->GetName();
MemberHash::iterator aExisting = maMemberHash.find( rName );
if ( aExisting == maMemberHash.end() )
{
- std::pair< const String, ScDPSaveMember *> key( rName, pMember );
+ std::pair< const ::rtl::OUString, ScDPSaveMember *> key( rName, pMember );
maMemberHash.insert ( key );
}
else
@@ -365,7 +365,7 @@ void ScDPSaveDimension::AddMember(ScDPSaveMember* pMember)
maMemberList.push_back( pMember );
}
-void ScDPSaveDimension::SetName( const String& rNew )
+void ScDPSaveDimension::SetName( const ::rtl::OUString& rNew )
{
// Used only if the source dim was renamed (groups).
// For UI renaming of dimensions, the layout name must be used.
@@ -492,11 +492,11 @@ void ScDPSaveDimension::SetLayoutInfo(const sheet::DataPilotFieldLayoutInfo*
pNe
pLayoutInfo = NULL;
}
-void ScDPSaveDimension::SetCurrentPage( const String* pPage )
+void ScDPSaveDimension::SetCurrentPage( const ::rtl::OUString* pPage )
{
delete pSelectedPage;
if (pPage)
- pSelectedPage = new String( *pPage );
+ pSelectedPage = new ::rtl::OUString( *pPage );
else
pSelectedPage = NULL;
}
@@ -506,14 +506,15 @@ bool ScDPSaveDimension::HasCurrentPage() const
return ( pSelectedPage != NULL );
}
-const String& ScDPSaveDimension::GetCurrentPage() const
+const ::rtl::OUString& ScDPSaveDimension::GetCurrentPage() const
{
+ static const ::rtl::OUString emptyOUString = ::rtl::OUString();
if (pSelectedPage)
return *pSelectedPage;
- return EMPTY_STRING;
+ return emptyOUString;
}
-ScDPSaveMember* ScDPSaveDimension::GetExistingMemberByName(const String& rName)
+ScDPSaveMember* ScDPSaveDimension::GetExistingMemberByName(const ::rtl::OUString& rName)
{
MemberHash::const_iterator res = maMemberHash.find (rName);
if (res != maMemberHash.end())
@@ -521,7 +522,7 @@ ScDPSaveMember* ScDPSaveDimension::GetExistingMemberByName(const String& rName)
return NULL;
}
-ScDPSaveMember* ScDPSaveDimension::GetMemberByName(const String& rName)
+ScDPSaveMember* ScDPSaveDimension::GetMemberByName(const ::rtl::OUString& rName)
{
MemberHash::const_iterator res = maMemberHash.find (rName);
if (res != maMemberHash.end())
@@ -533,7 +534,7 @@ ScDPSaveMember* ScDPSaveDimension::GetMemberByName(const String& rName)
return pNew;
}
-void ScDPSaveDimension::SetMemberPosition( const String& rName, sal_Int32 nNewPos )
+void ScDPSaveDimension::SetMemberPosition( const ::rtl::OUString& rName, sal_Int32 nNewPos )
{
ScDPSaveMember* pMember = GetMemberByName( rName ); // make sure it exists and is in the hash
@@ -708,7 +709,7 @@ void ScDPSaveDimension::UpdateMemberVisibility(const hash_map<OUString, bool, OU
for (; itrMem != itrMemEnd; ++itrMem)
{
ScDPSaveMember* pMem = *itrMem;
- const String& rMemName = pMem->GetName();
+ const ::rtl::OUString& rMemName = pMem->GetName();
DataMap::const_iterator itr = rData.find(rMemName);
if (itr != rData.end())
pMem->SetIsVisible(itr->second);
@@ -842,7 +843,7 @@ ScDPSaveDimension* ScDPSaveData::GetDimensionByName(const String& rName)
for (long i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
+ if ( pDim->GetName() == ::rtl::OUString(rName) && !pDim->IsDataLayout() )
return pDim;
}
ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, false );
@@ -856,7 +857,7 @@ ScDPSaveDimension* ScDPSaveData::GetExistingDimensionByName(const String& rName)
for (long i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
+ if ( pDim->GetName() == ::rtl::OUString(rName) && !pDim->IsDataLayout() )
return pDim;
}
return NULL; // don't create new
@@ -868,7 +869,7 @@ ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const String& rName)
for (long i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
+ if ( pDim->GetName() == ::rtl::OUString(rName) && !pDim->IsDataLayout() )
return DuplicateDimension(rName);
}
ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, false );
@@ -917,7 +918,7 @@ void ScDPSaveData::RemoveDimensionByName(const String& rName)
for (long i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
+ if ( pDim->GetName() == ::rtl::OUString(rName) && !pDim->IsDataLayout() )
{
delete pDim;
aDimList.Remove(i);
@@ -1096,7 +1097,7 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
rtl::OUString aName = pDim->GetName();
- DBG_TRACESTR(pDim->GetName());
+ DBG_TRACESTR(String(pDim->GetName()));
bool bData = pDim->IsDataLayout();
@@ -1262,7 +1263,7 @@ void ScDPSaveData::Refresh( const uno::Reference<sheet::XDimensionsSupplier>&
xS
try
{
long nCount = aDimList.Count();
- std::list<String> deletedDims;
+ std::list<rtl::OUString> deletedDims;
for (long i=nCount-1; i >=0 ; i--)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
@@ -1284,7 +1285,7 @@ void ScDPSaveData::Refresh( const uno::Reference<sheet::XDimensionsSupplier>&
xS
}
if ( !bFound )
{
- deletedDims.push_back( aName );
+ deletedDims.push_back( ::rtl::OUString(aName) );
aDimList.Remove(i);
DBG_TRACE( "\n Remove dim: \t" );
DBG_TRACESTR( String( aName ) );
@@ -1314,7 +1315,7 @@ void ScDPSaveData::Refresh( const uno::Reference<sheet::XDimensionsSupplier>&
xS
}
void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference<
com::sun::star::sheet::XDimensionsSupplier>& xSource ,
- const std::list<String>& deletedDims)
+ const std::list<rtl::OUString>& deletedDims)
{
if ( xSource.is() )
{
@@ -1329,7 +1330,7 @@ void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference<
return;
if ( pSelectedPage )
{//check pSelected page
- DBG_TRACESTR( (*pSelectedPage) );
+ DBG_TRACESTR( String(*pSelectedPage) );
if ( pCache->GetIdByItemData( nSrcDim, *pSelectedPage ) == -1 )
{
delete pSelectedPage;
@@ -1366,16 +1367,16 @@ void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference<
{
if( pReferenceValue->ReferenceItemType ==
DataPilotFieldReferenceItemType::NAMED )
{
- const String& sReferenceFieldName = pReferenceValue->ReferenceField;
- DBG_TRACESTR( sReferenceFieldName );
+ const ::rtl::OUString& sReferenceFieldName =
pReferenceValue->ReferenceField;
+ DBG_TRACESTR( String(sReferenceFieldName) );
SCCOL nRefDim = pCache->GetDimensionIndex( sReferenceFieldName );
bool bValid = true;
if ( nRefDim == -1 )
bValid = false;
else if ( pReferenceValue->ReferenceType !=
sheet::DataPilotFieldReferenceType::RUNNING_TOTAL )
{ //running total has not reference item
- const String& sReferenceItemName = pReferenceValue->ReferenceItemName;
- DBG_TRACESTR( sReferenceItemName );
+ const ::rtl::OUString& sReferenceItemName =
pReferenceValue->ReferenceItemName;
+ DBG_TRACESTR( String(sReferenceItemName) );
if ( pCache->GetIdByItemData( nRefDim, sReferenceItemName ) == -1 )
bValid = false;
}
@@ -1396,8 +1397,8 @@ void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference<
if ( pSortInfo->Mode == DataPilotFieldSortMode::DATA )
{
DBG_TRACE( "\n DataPilotFieldSortMode::DATA \n" );
- const String& sFieldDimName = pSortInfo->Field;
- std::list<String>::const_iterator iter = std::find( deletedDims.begin(),
deletedDims.end(), sFieldDimName );
+ const ::rtl::OUString& sFieldDimName = pSortInfo->Field;
+ std::list<rtl::OUString>::const_iterator iter = std::find( deletedDims.begin(),
deletedDims.end(), sFieldDimName );
if ( iter != deletedDims.end() && pCache->GetDimensionIndex( sFieldDimName ) == -1
)
{
pSortInfo->Mode = DataPilotFieldSortMode::MANUAL;
@@ -1408,8 +1409,8 @@ void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference<
if ( pAutoShowInfo )
{ //check autoshow
- const String& sFieldDimName = pAutoShowInfo->DataField;
- std::list<String>::const_iterator iter = std::find( deletedDims.begin(),
deletedDims.end(), sFieldDimName );
+ const ::rtl::OUString& sFieldDimName = pAutoShowInfo->DataField;
+ std::list<rtl::OUString>::const_iterator iter = std::find( deletedDims.begin(),
deletedDims.end(), sFieldDimName );
if ( iter != deletedDims.end() && pCache->GetDimensionIndex( sFieldDimName ) == -1 )
{
delete pAutoShowInfo;
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index a860353..2ee15b0 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -1010,7 +1010,10 @@ void XclImpPTField::ConvertPageField( ScDPSaveData& rSaveData ) const
{
DBG_ASSERT( maFieldInfo.mnAxes & EXC_SXVD_AXIS_PAGE, "XclImpPTField::ConvertPageField - no
page field" );
if( ScDPSaveDimension* pSaveDim = ConvertRCPField( rSaveData ) )
- pSaveDim->SetCurrentPage( GetItemName( maPageInfo.mnSelItem ) );
+ {
+ const rtl::OUString rOUStr = *GetItemName( maPageInfo.mnSelItem );
+ pSaveDim->SetCurrentPage( &rOUStr );
+ }
}
// hidden fields --------------------------------------------------------------
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index dc644dc..1b88a6f 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -1044,7 +1044,7 @@ void ScXMLDataPilotFieldContext::EndElement()
pDim->SetOrientation(nOrientation);
if (bSelectedPage)
{
- String sPage(sSelectedPage);
+ const ::rtl::OUString sPage(sSelectedPage);
pDim->SetCurrentPage(&sPage);
}
pDataPilotTable->AddDimension(pDim, mbHasHiddenMember);
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 5c3ad2c..bf17ac5 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -1522,7 +1522,7 @@ ScDPSaveDimension* ScDataPilotChildObjBase::GetDPDimension( ScDPObject**
ppDPObj
for( ULONG nDim = 0; nDim < nDimCount; ++nDim )
{
ScDPSaveDimension* pDim = static_cast< ScDPSaveDimension* >(
rDimensions.GetObject( nDim ) );
- if( !pDim->IsDataLayout() && (pDim->GetName() == aFieldName) )
+ if( !pDim->IsDataLayout() && (pDim->GetName() == ::rtl::OUString(aFieldName)) )
{
if( nFoundIdx == maFieldId.mnFieldIdx )
return pDim;
@@ -2085,7 +2085,7 @@ void ScDataPilotFieldObj::setOrientation(DataPilotFieldOrientation eNew)
for ( sal_Int32 nDim = 0; nDim < nDimCount && !pNewDim; nDim++ )
{
ScDPSaveDimension* pOneDim =
static_cast<ScDPSaveDimension*>(rDimensions.GetObject(nDim));
- if ( !pOneDim->IsDataLayout() && (pOneDim->GetName() == aNameStr) )
+ if ( !pOneDim->IsDataLayout() && (pOneDim->GetName() == ::rtl::OUString(aNameStr))
)
{
if ( pOneDim->GetOrientation() == DataPilotFieldOrientation_HIDDEN )
pNewDim = pOneDim; // use this one
@@ -2237,7 +2237,7 @@ void ScDataPilotFieldObj::setCurrentPage( const OUString& rPage )
ScDPObject* pDPObj = 0;
if( ScDPSaveDimension* pDim = GetDPDimension( &pDPObj ) )
{
- String aPage( rPage );
+ const ::rtl::OUString aPage( rPage );
pDim->SetCurrentPage( &aPage );
SetDPObject( pDPObj );
}
@@ -2262,7 +2262,7 @@ void ScDataPilotFieldObj::setUseCurrentPage( sal_Bool bUse )
true, because it is still needed to set an explicit page name. */
if( !pDim->HasCurrentPage() )
{
- String aPage;
+ const ::rtl::OUString aPage;
pDim->SetCurrentPage( &aPage );
}
}
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index 2d434e2..9832c50 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -1534,7 +1534,7 @@ void ScDBFunc::DataPilotInput( const ScAddress& rPos, const String& rString )
{
if (rString.Len())
{
- if (rString.EqualsIgnoreCaseAscii(pDim->GetName()))
+ if (::rtl::OUString(rString).equalsIgnoreAsciiCase(pDim->GetName()))
{
pDim->RemoveLayoutName();
bChange = true;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 6cc6587..d7e4070 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -563,7 +563,10 @@ void ScGridWindow::ExecPageFieldSelect( SCCOL nCol, SCROW nRow, BOOL
bHasSelecti
ScDPSaveDimension* pDim = aSaveData.GetDimensionByName(aDimName);
if ( bHasSelection )
- pDim->SetCurrentPage( &rStr );
+ {
+ const ::rtl::OUString rOUStr = rStr;
+ pDim->SetCurrentPage( &rOUStr );
+ }
else
pDim->SetCurrentPage( NULL );
--
1.7.0.4
From 3f16dcfa1b275326c8efb3a9e7c42d7c030736e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20M=C3=B6ller?= <soerenmoeller2001@gmail.com>
Date: Mon, 31 Jan 2011 22:15:58 +0100
Subject: [PATCH 5/5] Replaced tools/string with rtl::OUString in ScDPSaveData
---
sc/inc/dpsave.hxx | 10 +++++-----
sc/source/core/data/dpsave.cxx | 32 ++++++++++++++++----------------
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index f0270e0..f5e5f37 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -280,17 +280,17 @@ public:
* manages its life cycle; hence the caller must
* <i>not</i> delete this object.
*/
- ScDPSaveDimension* GetDimensionByName(const String& rName);
+ ScDPSaveDimension* GetDimensionByName(const ::rtl::OUString& rName);
SC_DLLPUBLIC ScDPSaveDimension* GetDataLayoutDimension();
SC_DLLPUBLIC ScDPSaveDimension* GetExistingDataLayoutDimension() const;
- ScDPSaveDimension* DuplicateDimension(const String& rName);
+ ScDPSaveDimension* DuplicateDimension(const ::rtl::OUString& rName);
SC_DLLPUBLIC ScDPSaveDimension& DuplicateDimension(const ScDPSaveDimension& rDim);
- SC_DLLPUBLIC ScDPSaveDimension* GetExistingDimensionByName(const String& rName) const;
- SC_DLLPUBLIC ScDPSaveDimension* GetNewDimensionByName(const String& rName);
+ SC_DLLPUBLIC ScDPSaveDimension* GetExistingDimensionByName(const ::rtl::OUString& rName) const;
+ SC_DLLPUBLIC ScDPSaveDimension* GetNewDimensionByName(const ::rtl::OUString& rName);
- void RemoveDimensionByName(const String& rName);
+ void RemoveDimensionByName(const ::rtl::OUString& rName);
ScDPSaveDimension* GetInnermostDimension(sal_uInt16 nOrientation);
ScDPSaveDimension* GetFirstDimension(::com::sun::star::sheet::DataPilotFieldOrientation
eOrientation);
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index bb0264a..54e6ff4 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -837,13 +837,13 @@ const OUString* ScDPSaveData::GetGrandTotalName() const
return mpGrandTotalName.get();
}
-ScDPSaveDimension* ScDPSaveData::GetDimensionByName(const String& rName)
+ScDPSaveDimension* ScDPSaveData::GetDimensionByName(const ::rtl::OUString& rName)
{
long nCount = aDimList.Count();
for (long i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == ::rtl::OUString(rName) && !pDim->IsDataLayout() )
+ if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
return pDim;
}
ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, false );
@@ -851,25 +851,25 @@ ScDPSaveDimension* ScDPSaveData::GetDimensionByName(const String& rName)
return pNew;
}
-ScDPSaveDimension* ScDPSaveData::GetExistingDimensionByName(const String& rName) const
+ScDPSaveDimension* ScDPSaveData::GetExistingDimensionByName(const ::rtl::OUString& rName) const
{
long nCount = aDimList.Count();
for (long i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == ::rtl::OUString(rName) && !pDim->IsDataLayout() )
+ if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
return pDim;
}
return NULL; // don't create new
}
-ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const String& rName)
+ScDPSaveDimension* ScDPSaveData::GetNewDimensionByName(const ::rtl::OUString& rName)
{
long nCount = aDimList.Count();
for (long i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == ::rtl::OUString(rName) && !pDim->IsDataLayout() )
+ if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
return DuplicateDimension(rName);
}
ScDPSaveDimension* pNew = new ScDPSaveDimension( rName, false );
@@ -883,7 +883,7 @@ ScDPSaveDimension* ScDPSaveData::GetDataLayoutDimension()
if (pDim)
return pDim;
- ScDPSaveDimension* pNew = new ScDPSaveDimension( String(), true );
+ ScDPSaveDimension* pNew = new ScDPSaveDimension( ::rtl::OUString(), true );
aDimList.Insert( pNew, LIST_APPEND );
return pNew;
}
@@ -900,7 +900,7 @@ ScDPSaveDimension* ScDPSaveData::GetExistingDataLayoutDimension() const
return NULL;
}
-ScDPSaveDimension* ScDPSaveData::DuplicateDimension(const String& rName)
+ScDPSaveDimension* ScDPSaveData::DuplicateDimension(const ::rtl::OUString& rName)
{
// always insert new
//! check if dimension is there?
@@ -912,13 +912,13 @@ ScDPSaveDimension* ScDPSaveData::DuplicateDimension(const String& rName)
return pNew;
}
-void ScDPSaveData::RemoveDimensionByName(const String& rName)
+void ScDPSaveData::RemoveDimensionByName(const ::rtl::OUString& rName)
{
long nCount = aDimList.Count();
for (long i=0; i<nCount; i++)
{
ScDPSaveDimension* pDim = (ScDPSaveDimension*)aDimList.GetObject(i);
- if ( pDim->GetName() == ::rtl::OUString(rName) && !pDim->IsDataLayout() )
+ if ( pDim->GetName() == rName && !pDim->IsDataLayout() )
{
delete pDim;
aDimList.Remove(i);
@@ -1131,11 +1131,11 @@ void ScDPSaveData::WriteToSource( const
uno::Reference<sheet::XDimensionsSupplie
{
if ( pDim->GetDupFlag() )
{
- String aNewName = pDim->GetName();
+ ::rtl::OUString aNewName = pDim->GetName();
// different name for each duplication of a (real) dimension...
for (long j=0; j<=i; j++) //! Test !!!!!!
- aNewName += '*'; //! modify name at creation of SaveDimension
+ aNewName += ::rtl::OUString::createFromAscii( "*" ); //! modify name
at creation of SaveDimension
uno::Reference<util::XCloneable> xCloneable( xIntDim, uno::UNO_QUERY );
DBG_ASSERT( xCloneable.is(), "cannot clone dimension" );
@@ -1219,8 +1219,8 @@ void ScDPSaveData::BuildAllDimensionMembers(ScDPTableData* pData)
for (sal_uInt32 i = 0; i < n; ++i)
{
ScDPSaveDimension* pDim = static_cast<ScDPSaveDimension*>(aDimList.GetObject(i));
- const String& rDimName = pDim->GetName();
- if (!rDimName.Len())
+ const ::rtl::OUString& rDimName = pDim->GetName();
+ if (!rDimName.getLength())
// empty dimension name. It must be data layout.
continue;
@@ -1235,7 +1235,7 @@ void ScDPSaveData::BuildAllDimensionMembers(ScDPTableData* pData)
for (size_t j = 0; j < mMemberCount; ++j)
{
const ScDPItemData* pMemberData = pData->GetMemberById( nDimIndex, rMembers[j] );
- String aMemName = pMemberData->GetString();
+ ::rtl::OUString aMemName = pMemberData->GetString();
if (pDim->GetExistingMemberByName(aMemName))
// this member instance already exists. nothing to do.
continue;
@@ -1285,7 +1285,7 @@ void ScDPSaveData::Refresh( const uno::Reference<sheet::XDimensionsSupplier>&
xS
}
if ( !bFound )
{
- deletedDims.push_back( ::rtl::OUString(aName) );
+ deletedDims.push_back( aName );
aDimList.Remove(i);
DBG_TRACE( "\n Remove dim: \t" );
DBG_TRACESTR( String( aName ) );
--
1.7.0.4
Context
- [Libreoffice] [PATCH] Cleaned up in dpsave.hxx/.cxx · Soeren Moeller
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.