Kaydet (Commit) fd7ef5f6 authored tarafından Noel Grandin's avatar Noel Grandin

convert include/sfx2/doctempl.hxx from String to OUString

Change-Id: I0d4232afa37539bafd779b1cc9a323aabb1d6b0e
üst e7cd49eb
...@@ -62,13 +62,13 @@ public: ...@@ -62,13 +62,13 @@ public:
void ReInitFromComponent(); void ReInitFromComponent();
sal_uInt16 GetRegionCount() const; sal_uInt16 GetRegionCount() const;
const String& GetRegionName(sal_uInt16 nIdx) const; //dv! const OUString& GetRegionName(sal_uInt16 nIdx) const; //dv!
String GetFullRegionName(sal_uInt16 nIdx) const; OUString GetFullRegionName(sal_uInt16 nIdx) const;
sal_uInt16 GetCount(sal_uInt16 nRegion) const; sal_uInt16 GetCount(sal_uInt16 nRegion) const;
const String& GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv! const OUString& GetName(sal_uInt16 nRegion, sal_uInt16 nIdx) const; //dv!
String GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const; OUString GetPath(sal_uInt16 nRegion, sal_uInt16 nIdx) const;
// Allows to retrieve the target template URL from the UCB // Allows to retrieve the target template URL from the UCB
OUString GetTemplateTargetURLFromComponent( const OUString& aGroupName, OUString GetTemplateTargetURLFromComponent( const OUString& aGroupName,
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
sal_uInt16 nSourceRegion, sal_uInt16 nSourceRegion,
sal_uInt16 nSourceIdx); sal_uInt16 nSourceIdx);
sal_Bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx); sal_Bool Delete(sal_uInt16 nRegion, sal_uInt16 nIdx);
sal_Bool InsertDir(const String &rText, sal_uInt16 nRegion); sal_Bool InsertDir(const OUString &rText, sal_uInt16 nRegion);
sal_Bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath); sal_Bool InsertTemplate (sal_uInt16 nSourceRegion, sal_uInt16 nIdx, const OUString &rName, const OUString &rPath);
...@@ -109,11 +109,11 @@ public: ...@@ -109,11 +109,11 @@ public:
*/ */
sal_Bool SetName(const OUString &rName, sal_uInt16 nRegion, sal_uInt16 nIdx); sal_Bool SetName(const OUString &rName, sal_uInt16 nRegion, sal_uInt16 nIdx);
sal_Bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const String &rName) const; sal_Bool CopyTo(sal_uInt16 nRegion, sal_uInt16 nIdx, const OUString &rName) const;
sal_Bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, String &rName); sal_Bool CopyFrom(sal_uInt16 nRegion, sal_uInt16 nIdx, OUString &rName);
sal_Bool GetFull( const String& rRegion, const String& rName, String& rPath ); sal_Bool GetFull( const OUString& rRegion, const OUString& rName, OUString& rPath );
sal_Bool GetLogicNames( const String& rPath, String& rRegion, String& rName ) const; sal_Bool GetLogicNames( const OUString& rPath, OUString& rRegion, OUString& rName ) const;
/** updates the configuration where the document templates structure is stored. /** updates the configuration where the document templates structure is stored.
......
...@@ -483,7 +483,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) ...@@ -483,7 +483,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq )
SfxObjectShellLock xDoc; SfxObjectShellLock xDoc;
String aTemplateRegion, aTemplateName, aTemplateFileName; OUString aTemplateRegion, aTemplateName, aTemplateFileName;
sal_Bool bDirect = sal_False; // through FileName instead of Region/Template sal_Bool bDirect = sal_False; // through FileName instead of Region/Template
SfxErrorContext aEc(ERRCTX_SFX_NEWDOC); SfxErrorContext aEc(ERRCTX_SFX_NEWDOC);
if ( !pTemplNameItem && !pTemplFileNameItem ) if ( !pTemplNameItem && !pTemplFileNameItem )
...@@ -535,10 +535,10 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) ...@@ -535,10 +535,10 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq )
if ( !bDirect ) if ( !bDirect )
{ {
SfxDocumentTemplates aTmpFac; SfxDocumentTemplates aTmpFac;
if( !aTemplateFileName.Len() ) if( aTemplateFileName.isEmpty() )
aTmpFac.GetFull( aTemplateRegion, aTemplateName, aTemplateFileName ); aTmpFac.GetFull( aTemplateRegion, aTemplateName, aTemplateFileName );
if( !aTemplateFileName.Len() ) if( aTemplateFileName.isEmpty() )
lErr = ERRCODE_SFX_TEMPLATENOTFOUND; lErr = ERRCODE_SFX_TEMPLATENOTFOUND;
} }
...@@ -558,7 +558,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) ...@@ -558,7 +558,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq )
const SfxPoolItem *pRet=0; const SfxPoolItem *pRet=0;
SfxStringItem aReferer( SID_REFERER, "private:user" ); SfxStringItem aReferer( SID_REFERER, "private:user" );
SfxStringItem aTarget( SID_TARGETNAME, "_default" ); SfxStringItem aTarget( SID_TARGETNAME, "_default" );
if ( aTemplateFileName.Len() ) if ( !aTemplateFileName.isEmpty() )
{ {
DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Illegal URL!" ); DBG_ASSERT( aObj.GetProtocol() != INET_PROT_NOT_VALID, "Illegal URL!" );
......
...@@ -588,7 +588,7 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx ...@@ -588,7 +588,7 @@ bool TemplateLocalView::copyFrom(const sal_uInt16 nRegionItemId, const BitmapEx
nDocId = (pRegionItem->maTemplates.back()).nDocId+1; nDocId = (pRegionItem->maTemplates.back()).nDocId+1;
} }
String aPath(rPath); OUString aPath(rPath);
sal_uInt16 nRegionId = maRegions[i]->mnRegionId; sal_uInt16 nRegionId = maRegions[i]->mnRegionId;
if (mpDocTemplates->CopyFrom(nRegionId,nDocId,aPath)) if (mpDocTemplates->CopyFrom(nRegionId,nDocId,aPath))
...@@ -628,7 +628,7 @@ bool TemplateLocalView::copyFrom(const OUString &rPath) ...@@ -628,7 +628,7 @@ bool TemplateLocalView::copyFrom(const OUString &rPath)
sal_uInt16 nDocId = 0; sal_uInt16 nDocId = 0;
sal_uInt16 nRegionId = pRegItem->mnRegionId; sal_uInt16 nRegionId = pRegItem->mnRegionId;
String aPath(rPath); OUString aPath(rPath);
if (!pRegItem->maTemplates.empty()) if (!pRegItem->maTemplates.empty())
nDocId = (pRegItem->maTemplates.back()).nDocId+1; nDocId = (pRegItem->maTemplates.back()).nDocId+1;
...@@ -659,7 +659,7 @@ bool TemplateLocalView::copyFrom (TemplateContainerItem *pItem, const OUString & ...@@ -659,7 +659,7 @@ bool TemplateLocalView::copyFrom (TemplateContainerItem *pItem, const OUString &
sal_uInt16 nId = 1; sal_uInt16 nId = 1;
sal_uInt16 nDocId = 0; sal_uInt16 nDocId = 0;
sal_uInt16 nRegionId = pItem->mnRegionId; sal_uInt16 nRegionId = pItem->mnRegionId;
String aPath(rPath); OUString aPath(rPath);
if (!pItem->maTemplates.empty()) if (!pItem->maTemplates.empty())
{ {
......
...@@ -282,7 +282,7 @@ static sal_Bool getTextProperty_Impl( Content& rContent, ...@@ -282,7 +282,7 @@ static sal_Bool getTextProperty_Impl( Content& rContent,
//======================================================================== //========================================================================
String SfxDocumentTemplates::GetFullRegionName OUString SfxDocumentTemplates::GetFullRegionName
( (
sal_uInt16 nIdx // Region Index sal_uInt16 nIdx // Region Index
) const ) const
...@@ -297,7 +297,7 @@ String SfxDocumentTemplates::GetFullRegionName ...@@ -297,7 +297,7 @@ String SfxDocumentTemplates::GetFullRegionName
{ {
// First: find the RegionData for the index // First: find the RegionData for the index
String aName; OUString aName;
DocTemplLocker_Impl aLocker( *pImp ); DocTemplLocker_Impl aLocker( *pImp );
...@@ -318,7 +318,7 @@ String SfxDocumentTemplates::GetFullRegionName ...@@ -318,7 +318,7 @@ String SfxDocumentTemplates::GetFullRegionName
//------------------------------------------------------------------------ //------------------------------------------------------------------------
const String& SfxDocumentTemplates::GetRegionName const OUString& SfxDocumentTemplates::GetRegionName
( (
sal_uInt16 nIdx // Region Index sal_uInt16 nIdx // Region Index
) const ) const
...@@ -333,7 +333,7 @@ const String& SfxDocumentTemplates::GetRegionName ...@@ -333,7 +333,7 @@ const String& SfxDocumentTemplates::GetRegionName
*/ */
{ {
static String maTmpString; static OUString maTmpString;
DocTemplLocker_Impl aLocker( *pImp ); DocTemplLocker_Impl aLocker( *pImp );
...@@ -344,10 +344,10 @@ const String& SfxDocumentTemplates::GetRegionName ...@@ -344,10 +344,10 @@ const String& SfxDocumentTemplates::GetRegionName
if ( pData ) if ( pData )
maTmpString = pData->GetTitle(); maTmpString = pData->GetTitle();
else else
maTmpString.Erase(); maTmpString = "";
} }
else else
maTmpString.Erase(); maTmpString = "";
return maTmpString; return maTmpString;
} }
...@@ -408,7 +408,7 @@ sal_uInt16 SfxDocumentTemplates::GetCount ...@@ -408,7 +408,7 @@ sal_uInt16 SfxDocumentTemplates::GetCount
//------------------------------------------------------------------------ //------------------------------------------------------------------------
const String& SfxDocumentTemplates::GetName const OUString& SfxDocumentTemplates::GetName
( (
sal_uInt16 nRegion, // Region Index, in which the entry lies sal_uInt16 nRegion, // Region Index, in which the entry lies
sal_uInt16 nIdx // Index of the entry sal_uInt16 nIdx // Index of the entry
...@@ -426,7 +426,7 @@ const String& SfxDocumentTemplates::GetName ...@@ -426,7 +426,7 @@ const String& SfxDocumentTemplates::GetName
{ {
DocTemplLocker_Impl aLocker( *pImp ); DocTemplLocker_Impl aLocker( *pImp );
static String maTmpString; static OUString maTmpString;
if ( pImp->Construct() ) if ( pImp->Construct() )
{ {
...@@ -439,17 +439,17 @@ const String& SfxDocumentTemplates::GetName ...@@ -439,17 +439,17 @@ const String& SfxDocumentTemplates::GetName
if ( pEntry ) if ( pEntry )
maTmpString = pEntry->GetTitle(); maTmpString = pEntry->GetTitle();
else else
maTmpString.Erase(); maTmpString = "";
} }
else else
maTmpString.Erase(); maTmpString = "";
return maTmpString; return maTmpString;
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
String SfxDocumentTemplates::GetPath OUString SfxDocumentTemplates::GetPath
( (
sal_uInt16 nRegion, // Region Index, in which the entry lies sal_uInt16 nRegion, // Region Index, in which the entry lies
sal_uInt16 nIdx // Index of the entry sal_uInt16 nIdx // Index of the entry
...@@ -467,7 +467,7 @@ String SfxDocumentTemplates::GetPath ...@@ -467,7 +467,7 @@ String SfxDocumentTemplates::GetPath
DocTemplLocker_Impl aLocker( *pImp ); DocTemplLocker_Impl aLocker( *pImp );
if ( !pImp->Construct() ) if ( !pImp->Construct() )
return String(); return OUString();
DocTempl_EntryData_Impl *pEntry = NULL; DocTempl_EntryData_Impl *pEntry = NULL;
RegionData_Impl *pRegion = pImp->GetRegion( nRegion ); RegionData_Impl *pRegion = pImp->GetRegion( nRegion );
...@@ -478,7 +478,7 @@ String SfxDocumentTemplates::GetPath ...@@ -478,7 +478,7 @@ String SfxDocumentTemplates::GetPath
if ( pEntry ) if ( pEntry )
return pEntry->GetTargetURL(); return pEntry->GetTargetURL();
else else
return String(); return OUString();
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
...@@ -713,7 +713,7 @@ sal_Bool SfxDocumentTemplates::CopyTo ...@@ -713,7 +713,7 @@ sal_Bool SfxDocumentTemplates::CopyTo
( (
sal_uInt16 nRegion, // Region of the template to be exported sal_uInt16 nRegion, // Region of the template to be exported
sal_uInt16 nIdx, // Index of the template to be exported sal_uInt16 nIdx, // Index of the template to be exported
const String& rName /* File name under which the template is to const OUString& rName /* File name under which the template is to
be created */ be created */
) const ) const
...@@ -786,7 +786,7 @@ sal_Bool SfxDocumentTemplates::CopyFrom ...@@ -786,7 +786,7 @@ sal_Bool SfxDocumentTemplates::CopyFrom
sal_uInt16 nRegion, /* Region in which the template is to be sal_uInt16 nRegion, /* Region in which the template is to be
imported */ imported */
sal_uInt16 nIdx, // Index of the new template in this Region sal_uInt16 nIdx, // Index of the new template in this Region
String& rName /* File name of the template to be imported OUString& rName /* File name of the template to be imported
as an out parameter of the (automatically as an out parameter of the (automatically
generated from the file name) logical name generated from the file name) logical name
of the template */ of the template */
...@@ -992,7 +992,7 @@ sal_Bool SfxDocumentTemplates::Delete ...@@ -992,7 +992,7 @@ sal_Bool SfxDocumentTemplates::Delete
sal_Bool SfxDocumentTemplates::InsertDir sal_Bool SfxDocumentTemplates::InsertDir
( (
const String& rText, // the logical name of the new Region const OUString& rText, // the logical name of the new Region
sal_uInt16 nRegion // Region Index sal_uInt16 nRegion // Region Index
) )
...@@ -1113,9 +1113,9 @@ sal_Bool SfxDocumentTemplates::SetName( const OUString& rName, sal_uInt16 nRegio ...@@ -1113,9 +1113,9 @@ sal_Bool SfxDocumentTemplates::SetName( const OUString& rName, sal_uInt16 nRegio
sal_Bool SfxDocumentTemplates::GetFull sal_Bool SfxDocumentTemplates::GetFull
( (
const String &rRegion, // Region Name const OUString &rRegion, // Region Name
const String &rName, // Template Name const OUString &rName, // Template Name
String &rPath // Out: Path + File name OUString &rPath // Out: Path + File name
) )
/* [Description] /* [Description]
...@@ -1136,7 +1136,7 @@ sal_Bool SfxDocumentTemplates::GetFull ...@@ -1136,7 +1136,7 @@ sal_Bool SfxDocumentTemplates::GetFull
DocTemplLocker_Impl aLocker( *pImp ); DocTemplLocker_Impl aLocker( *pImp );
// We don't search for empty names! // We don't search for empty names!
if ( ! rName.Len() ) if ( rName.isEmpty() )
return sal_False; return sal_False;
if ( ! pImp->Construct() ) if ( ! pImp->Construct() )
...@@ -1150,7 +1150,7 @@ sal_Bool SfxDocumentTemplates::GetFull ...@@ -1150,7 +1150,7 @@ sal_Bool SfxDocumentTemplates::GetFull
RegionData_Impl *pRegion = pImp->GetRegion( i ); RegionData_Impl *pRegion = pImp->GetRegion( i );
if( pRegion && if( pRegion &&
( !rRegion.Len() || ( rRegion == String( pRegion->GetTitle() ) ) ) ) ( rRegion.isEmpty() || ( rRegion == pRegion->GetTitle() ) ) )
{ {
pEntry = pRegion->GetEntry( rName ); pEntry = pRegion->GetEntry( rName );
...@@ -1169,9 +1169,9 @@ sal_Bool SfxDocumentTemplates::GetFull ...@@ -1169,9 +1169,9 @@ sal_Bool SfxDocumentTemplates::GetFull
sal_Bool SfxDocumentTemplates::GetLogicNames sal_Bool SfxDocumentTemplates::GetLogicNames
( (
const String &rPath, // Full Path to the template const OUString &rPath, // Full Path to the template
String &rRegion, // Out: Region name OUString &rRegion, // Out: Region name
String &rName // Out: Template name OUString &rName // Out: Template name
) const ) const
/* [Description] /* [Description]
......
...@@ -396,7 +396,7 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) ...@@ -396,7 +396,7 @@ void SfxObjectShell::UpdateFromTemplate_Impl( )
uno::Reference<document::XDocumentProperties> xDocProps(getDocProperties()); uno::Reference<document::XDocumentProperties> xDocProps(getDocProperties());
OUString aTemplName( xDocProps->getTemplateName() ); OUString aTemplName( xDocProps->getTemplateName() );
OUString aTemplURL( xDocProps->getTemplateURL() ); OUString aTemplURL( xDocProps->getTemplateURL() );
String aFoundName; OUString aFoundName;
if ( !aTemplName.isEmpty() || (!aTemplURL.isEmpty() && !IsReadOnly()) ) if ( !aTemplName.isEmpty() || (!aTemplURL.isEmpty() && !IsReadOnly()) )
{ {
...@@ -416,13 +416,13 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) ...@@ -416,13 +416,13 @@ void SfxObjectShell::UpdateFromTemplate_Impl( )
} }
} }
if( !aFoundName.Len() && !aTemplName.isEmpty() ) if( aFoundName.isEmpty() && !aTemplName.isEmpty() )
// if the template filename did not lead to success, // if the template filename did not lead to success,
// try to get a file name for the logical template name // try to get a file name for the logical template name
aTempl.GetFull( String(), aTemplName, aFoundName ); aTempl.GetFull( OUString(), aTemplName, aFoundName );
} }
if ( aFoundName.Len() ) if ( !aFoundName.isEmpty() )
{ {
// check existence of template storage // check existence of template storage
aTemplURL = aFoundName; aTemplURL = aFoundName;
...@@ -527,8 +527,8 @@ void SfxObjectShell::ResetFromTemplate( const OUString& rTemplateName, const OUS ...@@ -527,8 +527,8 @@ void SfxObjectShell::ResetFromTemplate( const OUString& rTemplateName, const OUS
if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) ) if( ::utl::LocalFileHelper::IsLocalFile( rFileName ) )
{ {
String aFoundName; OUString aFoundName;
if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( String(), rTemplateName, aFoundName ) ) if( SFX_APP()->Get_Impl()->GetDocumentTemplates()->GetFull( OUString(), rTemplateName, aFoundName ) )
{ {
INetURLObject aObj( rFileName ); INetURLObject aObj( rFileName );
xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) ); xDocProps->setTemplateURL( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) );
......
...@@ -323,7 +323,7 @@ bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedVal ...@@ -323,7 +323,7 @@ bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedVal
const OUString sURL = io_rDescriptor.getOrDefault( "URL", OUString() ); const OUString sURL = io_rDescriptor.getOrDefault( "URL", OUString() );
// determine the full URL of the template to use, if any // determine the full URL of the template to use, if any
String sTemplateURL; OUString sTemplateURL;
if ( !sTemplateRegioName.isEmpty() && !sTemplateName.isEmpty() ) if ( !sTemplateRegioName.isEmpty() && !sTemplateName.isEmpty() )
{ {
SfxDocumentTemplates aTmpFac; SfxDocumentTemplates aTmpFac;
...@@ -337,7 +337,7 @@ bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedVal ...@@ -337,7 +337,7 @@ bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedVal
sTemplateURL = SfxObjectFactory::GetStandardTemplate( SfxObjectShell::GetServiceNameFromFactory( sURL ) ); sTemplateURL = SfxObjectFactory::GetStandardTemplate( SfxObjectShell::GetServiceNameFromFactory( sURL ) );
} }
if ( sTemplateURL.Len() > 0 ) if ( !sTemplateURL.isEmpty() )
{ {
// detect the filter for the template. Might still be NULL (if the template is broken, or does not // detect the filter for the template. Might still be NULL (if the template is broken, or does not
// exist, or some such), but this is handled by our caller the same way as if no template/URL was present. // exist, or some such), but this is handled by our caller the same way as if no template/URL was present.
......
...@@ -618,8 +618,8 @@ OUString SwTemplNameFieldType::Expand(sal_uLong nFmt) const ...@@ -618,8 +618,8 @@ OUString SwTemplNameFieldType::Expand(sal_uLong nFmt) const
// fuers besorgen vom RegionNamen !! // fuers besorgen vom RegionNamen !!
SfxDocumentTemplates aFac; SfxDocumentTemplates aFac;
aFac.Construct(); aFac.Construct();
String sTmp; OUString sTmp;
String sRegion; OUString sRegion;
aFac.GetLogicNames( xDocProps->getTemplateURL(), sRegion, sTmp ); aFac.GetLogicNames( xDocProps->getTemplateURL(), sRegion, sTmp );
aRet = sRegion; aRet = sRegion;
} }
......
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