Kaydet (Commit) 83d874ec authored tarafından Matteo Casalin's avatar Matteo Casalin Kaydeden (comit) Caolán McNamara

String to OUString, some small cleanup

Change-Id: I2cb6b2c2169e5ba72ac8866f4a797421bd779a8b
Reviewed-on: https://gerrit.libreoffice.org/5473Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 33b631c4
...@@ -39,7 +39,7 @@ class SW_DLLPUBLIC SwOLEObj ...@@ -39,7 +39,7 @@ class SW_DLLPUBLIC SwOLEObj
/** Either ref or name are known. If only name is known, ref is obtained /** Either ref or name are known. If only name is known, ref is obtained
on demand by GetOleRef() from Sfx. */ on demand by GetOleRef() from Sfx. */
svt::EmbeddedObjectRef xOLERef; svt::EmbeddedObjectRef xOLERef;
String aName; OUString aName;
SwOLEObj( const SwOLEObj& rObj ); /// Not allowed. SwOLEObj( const SwOLEObj& rObj ); /// Not allowed.
SwOLEObj(); SwOLEObj();
...@@ -48,7 +48,7 @@ class SW_DLLPUBLIC SwOLEObj ...@@ -48,7 +48,7 @@ class SW_DLLPUBLIC SwOLEObj
public: public:
SwOLEObj( const svt::EmbeddedObjectRef& pObj ); SwOLEObj( const svt::EmbeddedObjectRef& pObj );
SwOLEObj( const String &rName, sal_Int64 nAspect ); SwOLEObj( const OUString &rName, sal_Int64 nAspect );
~SwOLEObj(); ~SwOLEObj();
sal_Bool UnloadObject(); sal_Bool UnloadObject();
...@@ -56,11 +56,11 @@ public: ...@@ -56,11 +56,11 @@ public:
const SwDoc* pDoc, const SwDoc* pDoc,
sal_Int64 nAspect ); sal_Int64 nAspect );
String GetDescription(); OUString GetDescription();
const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef(); const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef();
svt::EmbeddedObjectRef& GetObject(); svt::EmbeddedObjectRef& GetObject();
const String& GetCurrentPersistName() const { return aName; } OUString GetCurrentPersistName() const { return aName; }
sal_Bool IsOleRef() const; ///< To avoid unneccessary loading of object. sal_Bool IsOleRef() const; ///< To avoid unneccessary loading of object.
}; };
......
...@@ -298,7 +298,7 @@ sal_Bool SwOLENode::RestorePersistentData() ...@@ -298,7 +298,7 @@ sal_Bool SwOLENode::RestorePersistentData()
if ( xChild.is() ) if ( xChild.is() )
xChild->setParent( p->GetModel() ); xChild->setParent( p->GetModel() );
OSL_ENSURE( aOLEObj.aName.Len(), "No object name!" ); OSL_ENSURE( !aOLEObj.aName.isEmpty(), "No object name!" );
OUString aObjName; OUString aObjName;
if ( !p->GetEmbeddedObjectContainer().InsertEmbeddedObject( aOLEObj.xOLERef.GetObject(), aObjName ) ) if ( !p->GetEmbeddedObjectContainer().InsertEmbeddedObject( aOLEObj.xOLERef.GetObject(), aObjName ) )
{ {
...@@ -668,7 +668,7 @@ SwOLEObj::SwOLEObj( const svt::EmbeddedObjectRef& xObj ) : ...@@ -668,7 +668,7 @@ SwOLEObj::SwOLEObj( const svt::EmbeddedObjectRef& xObj ) :
} }
SwOLEObj::SwOLEObj( const String &rString, sal_Int64 nAspect ) : SwOLEObj::SwOLEObj( const OUString &rString, sal_Int64 nAspect ) :
pOLENd( 0 ), pOLENd( 0 ),
pListener( 0 ), pListener( 0 ),
aName( rString ) aName( rString )
...@@ -737,7 +737,7 @@ SwOLEObj::~SwOLEObj() ...@@ -737,7 +737,7 @@ SwOLEObj::~SwOLEObj()
void SwOLEObj::SetNode( SwOLENode* pNode ) void SwOLEObj::SetNode( SwOLENode* pNode )
{ {
pOLENd = pNode; pOLENd = pNode;
if ( !aName.Len() ) if ( aName.isEmpty() )
{ {
SwDoc* pDoc = pNode->GetDoc(); SwDoc* pDoc = pNode->GetDoc();
...@@ -895,22 +895,20 @@ sal_Bool SwOLEObj::UnloadObject( uno::Reference< embed::XEmbeddedObject > xObj, ...@@ -895,22 +895,20 @@ sal_Bool SwOLEObj::UnloadObject( uno::Reference< embed::XEmbeddedObject > xObj,
return bRet; return bRet;
} }
String SwOLEObj::GetDescription() OUString SwOLEObj::GetDescription()
{ {
String aResult;
uno::Reference< embed::XEmbeddedObject > xEmbObj = GetOleRef(); uno::Reference< embed::XEmbeddedObject > xEmbObj = GetOleRef();
if ( xEmbObj.is() ) if ( !xEmbObj.is() )
{ return OUString();
SvGlobalName aClassID( xEmbObj->getClassID() );
if ( SotExchange::IsMath( aClassID ) ) SvGlobalName aClassID( xEmbObj->getClassID() );
aResult = SW_RESSTR(STR_MATH_FORMULA); if ( SotExchange::IsMath( aClassID ) )
else if ( SotExchange::IsChart( aClassID ) ) return SW_RESSTR(STR_MATH_FORMULA);
aResult = SW_RESSTR(STR_CHART);
else if ( SotExchange::IsChart( aClassID ) )
aResult = SW_RESSTR(STR_OLE); return SW_RESSTR(STR_CHART);
}
return aResult; return SW_RESSTR(STR_OLE);
} }
......
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