summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-01-16 13:03:52 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-01-16 14:54:03 -0500
commit5159695813b9dc08743de4bbcf7807f41e160b8f (patch)
tree6c46c8d27b7e2bbd25b2464a99d504b6da200f11 /svx
parentff3e2a4a1ec23548dd42cab2e9a748bcd9156119 (diff)
Some cleanup of SdrLayer class.
String replacement, proper use of initializer in constructors etc. Change-Id: Ic5e04c614ad044efcb32329a31540402524afe85
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/svdlayer.hxx24
-rw-r--r--svx/source/svdraw/svdlayer.cxx41
2 files changed, 33 insertions, 32 deletions
diff --git a/svx/inc/svx/svdlayer.hxx b/svx/inc/svx/svdlayer.hxx
index d0ddefe160b1..19d053ec64ed 100644
--- a/svx/inc/svx/svdlayer.hxx
+++ b/svx/inc/svx/svdlayer.hxx
@@ -33,29 +33,29 @@ class SVX_DLLPUBLIC SdrLayer
{
friend class SdrLayerAdmin;
- String aName;
- String maTitle;
- String maDescription;
+ OUString maName;
+ OUString maTitle;
+ OUString maDescription;
SdrModel* pModel; // zum Broadcasten
sal_uInt16 nType; // 0=Userdefined,1=Standardlayer
SdrLayerID nID;
- SdrLayer(SdrLayerID nNewID, const String& rNewName) { nID=nNewID; aName=rNewName; nType=0; pModel=NULL; }
- void SetID(SdrLayerID nNewID) { nID=nNewID; }
+ SdrLayer(SdrLayerID nNewID, const OUString& rNewName);
+ void SetID(SdrLayerID nNewID);
public:
- SdrLayer(): pModel(NULL),nType(0),nID(0) {}
+ SdrLayer();
bool operator==(const SdrLayer& rCmpLayer) const;
bool operator!=(const SdrLayer& rCmpLayer) const { return !operator==(rCmpLayer); }
- void SetName(const String& rNewName);
- const String& GetName() const { return aName; }
+ void SetName(const OUString& rNewName);
+ const OUString& GetName() const { return maName; }
- void SetTitle(const String& rTitle) { maTitle = rTitle; }
- const String& GetTitle() const { return maTitle; }
+ void SetTitle(const OUString& rTitle) { maTitle = rTitle; }
+ const OUString& GetTitle() const { return maTitle; }
- void SetDescription(const String& rDesc) { maDescription = rDesc; }
- const String& GetDescription() const { return maDescription; }
+ void SetDescription(const OUString& rDesc) { maDescription = rDesc; }
+ const OUString& GetDescription() const { return maDescription; }
SdrLayerID GetID() const { return nID; }
void SetModel(SdrModel* pNewModel) { pModel=pNewModel; }
diff --git a/svx/source/svdraw/svdlayer.cxx b/svx/source/svdraw/svdlayer.cxx
index 7e851625132f..a28f307ca917 100644
--- a/svx/source/svdraw/svdlayer.cxx
+++ b/svx/source/svdraw/svdlayer.cxx
@@ -24,10 +24,6 @@
#include "svx/svdglob.hxx" // StringCache
#include "svx/svdstr.hrc" // names taken from the resource
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// SetOfByte
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
sal_Bool SetOfByte::IsEmpty() const
{
for(sal_uInt16 i(0); i < 32; i++)
@@ -104,15 +100,21 @@ void SetOfByte::QueryValue( com::sun::star::uno::Any & rAny ) const
rAny <<= aSeq;
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// SdrLayer
-////////////////////////////////////////////////////////////////////////////////////////////////////
+SdrLayer::SdrLayer() : pModel(NULL), nType(0), nID(0) {}
+
+SdrLayer::SdrLayer(SdrLayerID nNewID, const OUString& rNewName) :
+ maName(rNewName), pModel(NULL), nType(0), nID(nNewID) {}
+
+void SdrLayer::SetID(SdrLayerID nNewID)
+{
+ nID = nNewID;
+}
void SdrLayer::SetStandardLayer(bool bStd)
{
nType=(sal_uInt16)bStd;
if (bStd) {
- aName=ImpGetResStr(STR_StandardLayerName);
+ maName = ImpGetResStr(STR_StandardLayerName);
}
if (pModel!=NULL) {
SdrHint aHint(HINT_LAYERCHG);
@@ -121,20 +123,19 @@ void SdrLayer::SetStandardLayer(bool bStd)
}
}
-void SdrLayer::SetName(const XubString& rNewName)
+void SdrLayer::SetName(const OUString& rNewName)
{
- if(!rNewName.Equals(aName))
- {
- aName = rNewName;
- nType = 0; // user defined
+ if (rNewName == maName)
+ return;
- if(pModel)
- {
- SdrHint aHint(HINT_LAYERCHG);
+ maName = rNewName;
+ nType = 0; // user defined
- pModel->Broadcast(aHint);
- pModel->SetChanged();
- }
+ if (pModel)
+ {
+ SdrHint aHint(HINT_LAYERCHG);
+ pModel->Broadcast(aHint);
+ pModel->SetChanged();
}
}
@@ -142,7 +143,7 @@ bool SdrLayer::operator==(const SdrLayer& rCmpLayer) const
{
return (nID == rCmpLayer.nID
&& nType == rCmpLayer.nType
- && aName.Equals(rCmpLayer.aName));
+ && maName == rCmpLayer.maName);
}
////////////////////////////////////////////////////////////////////////////////////////////////////