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