Kaydet (Commit) ed834ce6 authored tarafından Matteo Casalin's avatar Matteo Casalin Kaydeden (comit) Michael Stahl

String to OUString

Change-Id: I54c8f641b6db1762404916c4e4174d1f0e15cc39
Reviewed-on: https://gerrit.libreoffice.org/5613Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst d598bb3e
......@@ -31,6 +31,8 @@ namespace com { namespace sun { namespace star {
}
}}}
namespace rtl {class OUString;}
class String;
class DateTime;
......@@ -60,9 +62,9 @@ SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const String& rURL );
// pDateTime != 0 -> returns also the modified date/time of
// the files in a vector -->
// !! objects must be deleted from the caller!!
bool UCB_GetFileListOfFolder( const String& rURL,
std::vector<String*>& rList,
const String* pExtension = 0,
bool UCB_GetFileListOfFolder( const OUString& rURL,
std::vector<OUString*>& rList,
const OUString* pExtension = 0,
std::vector<DateTime*>* pDateTimeList = 0 );
// is the URL an existing file?
......
......@@ -32,6 +32,7 @@
#include <tools/urlobj.hxx>
#include <tools/datetime.hxx>
#include <tools/string.hxx>
#include "rtl/ustring.hxx"
#include <ucbhelper/contentidentifier.hxx>
#include <ucbhelper/content.hxx>
#include <swunohelper.hxx>
......@@ -186,9 +187,9 @@ sal_Bool UCB_IsDirectory( const String& rURL )
// pDateTime != 0 -> returns also the modified date/time of
// the files in a std::vector<String*> -->
// !! objects must be deleted from the caller!!
bool UCB_GetFileListOfFolder( const String& rURL,
std::vector<String*>& rList,
const String* pExtension,
bool UCB_GetFileListOfFolder( const OUString& rURL,
std::vector<OUString*>& rList,
const OUString* pExtension,
std::vector< ::DateTime* >* pDateTimeList )
{
bool bOk = false;
......@@ -216,19 +217,18 @@ bool UCB_GetFileListOfFolder( const String& rURL,
if( xResultSet.is() )
{
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > xRow( xResultSet, ::com::sun::star::uno::UNO_QUERY );
xub_StrLen nExtLen = pExtension ? pExtension->Len() : 0;
const sal_Int32 nExtLen = pExtension ? pExtension->getLength() : 0;
try
{
if( xResultSet->first() )
{
do {
String sTitle( xRow->getString( 1 ) );
const OUString sTitle( xRow->getString( 1 ) );
if( !nExtLen ||
( sTitle.Len() > nExtLen &&
sTitle.Equals( *pExtension,
sTitle.Len() - nExtLen, nExtLen )) )
( sTitle.getLength() > nExtLen &&
sTitle.endsWith( *pExtension )) )
{
rList.push_back( new String(sTitle) );
rList.push_back( new OUString(sTitle) );
if( pDateTimeList )
{
......
......@@ -119,8 +119,7 @@ void SwGlossaryHdl::SetCurGroup(const OUString &rGrp, sal_Bool bApi, sal_Bool bA
const OUString sCurBase = aTemp.getBase();
aTemp.removeSegment();
const OUString sCurEntryPath = aTemp.GetMainURL(INetURLObject::NO_DECODE);
const std::vector<String> & rPathArr =
rStatGlossaries.GetPathArray();
const std::vector<OUString> & rPathArr = rStatGlossaries.GetPathArray();
sal_uInt16 nCurrentPath = USHRT_MAX;
for (size_t nPath = 0; nPath < rPathArr.size(); ++nPath)
{
......
......@@ -17,8 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _GLOSBIB_HXX
#define _GLOSBIB_HXX
#ifndef GLOSBIB_HXX
#define GLOSBIB_HXX
#include <vcl/edit.hxx>
#include <svx/stddlg.hxx>
......@@ -28,6 +28,7 @@
#include <vcl/button.hxx>
#include <vcl/fixed.hxx>
#include "rtl/ustring.hxx"
#include <vector>
......@@ -103,7 +104,7 @@ protected:
public:
SwGlossaryGroupDlg(Window * pParent,
std::vector<String> const& rPathArr,
std::vector<OUString> const& rPathArr,
SwGlossaryHdl *pGlosHdl);
~SwGlossaryGroupDlg();
......
......@@ -16,10 +16,10 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _GLOSDOC_HXX
#define _GLOSDOC_HXX
#ifndef GLOSDOC_HXX
#define GLOSDOC_HXX
#include <tools/string.hxx>
#include "rtl/ustring.hxx"
#include <com/sun/star/text/XAutoTextGroup.hpp>
class SwTextBlocks;
......@@ -49,17 +49,17 @@ class SW_DLLPUBLIC SwGlossaries
UnoAutoTextGroups m_aGlossaryGroups;
UnoAutoTextEntries m_aGlossaryEntries;
String m_aPath;
std::vector<rtl::OUString> m_aInvalidPaths;
std::vector<String> m_PathArr;
std::vector<String> m_GlosArr;
OUString m_aPath;
std::vector<OUString> m_aInvalidPaths;
std::vector<OUString> m_PathArr;
std::vector<OUString> m_GlosArr;
sal_Bool m_bError;
SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, sal_Bool bCreate = sal_True) const;
SW_DLLPRIVATE std::vector<String> & GetNameList();
SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const OUString &rName, sal_Bool bCreate = sal_True) const;
SW_DLLPRIVATE std::vector<OUString> & GetNameList();
// implementation in unoatxt.cxx
SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup );
SW_DLLPRIVATE void RemoveFileFromList( const OUString& rGroup );
SW_DLLPRIVATE void InvalidateUNOOjects();
public:
......@@ -98,39 +98,39 @@ public:
*/
::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry >
GetAutoTextEntry(
const String& _rCompleteGroupName,
const OUString& _rCompleteGroupName,
const OUString& _rGroupName,
const OUString& _rEntryName,
bool _bCreate = false
);
sal_uInt16 GetGroupCnt();
String GetGroupName(sal_uInt16 );
String GetGroupTitle( const String& rGroupName );
OUString GetGroupName(sal_uInt16 );
OUString GetGroupTitle( const OUString& rGroupName );
sal_Bool FindGroupName(OUString& rGroup);
SwTextBlocks* GetGroupDoc(const String &rName,
SwTextBlocks* GetGroupDoc(const OUString &rName,
sal_Bool bCreate = sal_False);
SwTextBlocks* GetDefGroupDoc() { return GetGroupDoc(GetDefName()); }
void PutGroupDoc(SwTextBlocks *pBlock);
static String GetDefName();
static String GetExtension();
static OUString GetDefName();
static OUString GetExtension();
String GetCompleteGroupName( const OUString& GroupName );
OUString GetCompleteGroupName( const OUString& GroupName );
sal_Bool NewGroupDoc(OUString &rGroupName, const OUString& rTitle);
sal_Bool RenameGroupDoc(const OUString& sOldGroup, OUString& sNewGroup, const OUString& rNewTitle);
sal_Bool DelGroupDoc(const String &);
SwDocShellRef EditGroupDoc(const String &rGrpName, const String& rShortName, sal_Bool bShow = sal_True );
void SaveGroupDoc(const String &rGrpName, const String& rLongName );
sal_Bool DelGroupDoc(const OUString &);
SwDocShellRef EditGroupDoc(const OUString &rGrpName, const OUString& rShortName, sal_Bool bShow = sal_True );
void SaveGroupDoc(const OUString &rGrpName, const OUString& rLongName );
void UpdateGlosPath(sal_Bool bFull);
void ShowError();
inline sal_uLong IsGlosPathErr() { return m_bError; }
std::vector<String> const& GetPathArray() const { return m_PathArr; }
std::vector<OUString> const& GetPathArray() const { return m_PathArr; }
};
#endif // _GLOSDOC_HXX
#endif // GLOSDOC_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -42,7 +42,7 @@
#define RENAME_TOKEN_DELIM (sal_Unicode)1
SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent,
std::vector<String> const& rPathArr, SwGlossaryHdl *pHdl)
std::vector<OUString> const& rPathArr, SwGlossaryHdl *pHdl)
: SvxStandardDialog(pParent, "EditCategoriesDialog",
"modules/swriter/ui/editcategories.ui")
, pGlosHdl(pHdl)
......@@ -76,9 +76,8 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent,
for (size_t i = 0; i < rPathArr.size(); ++i)
{
OUString sPath(rPathArr[i]);
INetURLObject aTempURL(sPath);
sPath = aTempURL.GetMainURL(INetURLObject::DECODE_WITH_CHARSET );
INetURLObject aTempURL(rPathArr[i]);
const OUString sPath = aTempURL.GetMainURL(INetURLObject::DECODE_WITH_CHARSET );
m_pPathLB->InsertEntry(sPath);
sal_uLong nCaseReadonly = 0;
utl::TempFile aTempFile(&sPath);
......
This diff is collapsed.
......@@ -880,7 +880,7 @@ void SwGlTreeListBox::RequestHelp( const HelpEvent& rHEvt )
if(!GetParent(pEntry))
{
GroupUserData* pData = (GroupUserData*)pEntry->GetUserData();
const std::vector<String> & rPathArr = ::GetGlossaries()->GetPathArray();
const std::vector<OUString> & rPathArr = ::GetGlossaries()->GetPathArray();
if( !rPathArr.empty() )
{
sMsg = rPathArr[pData->nPathIdx];
......
......@@ -95,8 +95,8 @@ static void lcl_GetState( SwDocShell& rSh, SfxItemSet& rSet )
}
}
static sal_Bool lcl_Save( SwWrtShell& rSh, const String& rGroupName,
const String& rShortNm, const String& rLongNm )
static sal_Bool lcl_Save( SwWrtShell& rSh, const OUString& rGroupName,
const OUString& rShortNm, const OUString& rLongNm )
{
const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get();
SwTextBlocks * pBlock = ::GetGlossaries()->GetGroupDoc( rGroupName );
......@@ -197,7 +197,7 @@ sal_Bool SwWebGlosDocShell::Save()
SV_IMPL_REF ( SwDocShell )
SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rShortName, sal_Bool bShow )
SwDocShellRef SwGlossaries::EditGroupDoc( const OUString& rGroup, const OUString& rShortName, sal_Bool bShow )
{
SwDocShellRef xDocSh;
......@@ -206,7 +206,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS
{
// query which view is registered. In WebWriter there is no normal view
sal_uInt16 nViewId = 0 != &SwView::Factory() ? 2 : 6;
String sLongName = pGroup->GetLongName(pGroup->GetIndex( rShortName ));
const OUString sLongName = pGroup->GetLongName(pGroup->GetIndex( rShortName ));
if( 6 == nViewId )
{
......@@ -229,9 +229,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS
// set document title
SfxViewFrame* pFrame = bShow ? SfxViewFrame::LoadDocument( *xDocSh, nViewId ) : SfxViewFrame::LoadHiddenDocument( *xDocSh, nViewId );
String aDocTitle(SW_RES( STR_GLOSSARY ));
aDocTitle += ' ';
aDocTitle += sLongName;
const OUString aDocTitle(SW_RESSTR( STR_GLOSSARY ) + " " + sLongName);
bool const bDoesUndo =
xDocSh->GetDoc()->GetIDocumentUndoRedo().DoesUndo();
......
......@@ -247,8 +247,8 @@ void SwGlossaryList::Update()
ClearGroups();
}
SwGlossaries* pGlossaries = ::GetGlossaries();
const std::vector<String> & rPathArr = pGlossaries->GetPathArray();
String sExt( SwGlossaries::GetExtension() );
const std::vector<OUString> & rPathArr = pGlossaries->GetPathArray();
const OUString sExt( SwGlossaries::GetExtension() );
if(!bFilled)
{
sal_uInt16 nGroupCount = pGlossaries->GetGroupCnt();
......@@ -278,21 +278,20 @@ void SwGlossaryList::Update()
for( size_t nPath = 0; nPath < rPathArr.size(); nPath++ )
{
std::vector<String> aFoundGroupNames;
std::vector<String*> aFiles;
std::vector<OUString*> aFiles;
std::vector<DateTime*> aDateTimeArr;
SWUnoHelper::UCB_GetFileListOfFolder( rPathArr[nPath], aFiles,
&sExt, &aDateTimeArr );
for( size_t nFiles = 0; nFiles < aFiles.size(); ++nFiles )
{
String* pTitle = aFiles[ nFiles ];
const OUString* pTitle = aFiles[ nFiles ];
::DateTime* pDT = (::DateTime*) aDateTimeArr[ static_cast<sal_uInt16>(nFiles) ];
OUString sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() ));
OUString sName( pTitle->copy( 0, pTitle->getLength() - sExt.getLength() ));
aFoundGroupNames.push_back(sName);
sName += OUString(GLOS_DELIM);
sName += OUString::number( static_cast<sal_uInt16>(nPath) );
sName += OUString(GLOS_DELIM) + OUString::number( static_cast<sal_uInt16>(nPath) );
AutoTextGroup* pFound = FindGroup( sName );
if( !pFound )
{
......
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