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

String to OUString

Change-Id: If5569249cc4fd5de99fdf634af1c338d02ddb84b
Reviewed-on: https://gerrit.libreoffice.org/6027Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 3b748229
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/text/XAutoTextContainer2.hpp> #include <com/sun/star/text/XAutoTextContainer2.hpp>
#include "rtl/ustring.hxx"
#include <actctrl.hxx> #include <actctrl.hxx>
class SwGlossaryHdl; class SwGlossaryHdl;
...@@ -53,7 +55,7 @@ const short RET_EDIT = 100; ...@@ -53,7 +55,7 @@ const short RET_EDIT = 100;
class SwGlTreeListBox : public SvTreeListBox class SwGlTreeListBox : public SvTreeListBox
{ {
const String sReadonly; const OUString sReadonly;
SvTreeListEntry* pDragEntry; SvTreeListEntry* pDragEntry;
...@@ -103,15 +105,15 @@ class SwGlossaryDlg : public SvxStandardDialog ...@@ -103,15 +105,15 @@ class SwGlossaryDlg : public SvxStandardDialog
PushButton* m_pBibBtn; PushButton* m_pBibBtn;
PushButton* m_pPathBtn; PushButton* m_pPathBtn;
String sReadonlyPath; OUString sReadonlyPath;
::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextContainer2 > m_xAutoText; ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextContainer2 > m_xAutoText;
SwOneExampleFrame* pExampleFrame; SwOneExampleFrame* pExampleFrame;
SwGlossaryHdl* pGlossaryHdl; SwGlossaryHdl* pGlossaryHdl;
String sResumeGroup; OUString sResumeGroup;
String sResumeShortName; OUString sResumeShortName;
sal_Bool bResume; sal_Bool bResume;
...@@ -140,30 +142,30 @@ class SwGlossaryDlg : public SvxStandardDialog ...@@ -140,30 +142,30 @@ class SwGlossaryDlg : public SvxStandardDialog
virtual void Apply(); virtual void Apply();
void Init(); void Init();
SvTreeListEntry* DoesBlockExist(const String& sBlock, const String& rShort); SvTreeListEntry* DoesBlockExist(const OUString& sBlock, const OUString& rShort);
void ShowAutoText(const String& rGroup, const String& rShortName); void ShowAutoText(const OUString& rGroup, const OUString& rShortName);
void ResumeShowAutoText(); void ResumeShowAutoText();
sal_Bool GetResumeData(String& rGroup, String& rShortName) sal_Bool GetResumeData(OUString& rGroup, OUString& rShortName)
{rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;} {rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;}
void SetResumeData(const String& rGroup, const String& rShortName) void SetResumeData(const OUString& rGroup, const OUString& rShortName)
{sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = sal_True;} {sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = sal_True;}
void ResetResumeData() {bResume = sal_False;} void ResetResumeData() {bResume = sal_False;}
public: public:
SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell); SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
~SwGlossaryDlg(); ~SwGlossaryDlg();
String GetCurrGrpName() const; OUString GetCurrGrpName() const;
String GetCurrLongName() const OUString GetCurrLongName() const
{ {
return m_pNameED->GetText(); return m_pNameED->GetText();
} }
String GetCurrShortName() const OUString GetCurrShortName() const
{ {
return m_pShortNameEdit->GetText(); return m_pShortNameEdit->GetText();
} }
static OUString GetCurrGroup(); static OUString GetCurrGroup();
static void SetActGroup(const OUString& rNewGroup); static void SetActGroup(const OUString& rNewGroup);
static String GetExtension(); static OUString GetExtension();
}; };
#endif #endif
......
...@@ -78,23 +78,23 @@ using namespace ::com::sun::star::ui::dialogs; ...@@ -78,23 +78,23 @@ using namespace ::com::sun::star::ui::dialogs;
using namespace ::ucbhelper; using namespace ::ucbhelper;
using namespace ::sfx2; using namespace ::sfx2;
static String lcl_GetValidShortCut( const String& rName ) static OUString lcl_GetValidShortCut( const OUString& rName )
{ {
const sal_uInt16 nSz = rName.Len(); const sal_Int32 nSz = rName.getLength();
if ( 0 == nSz ) if ( 0 == nSz )
return rName; return rName;
sal_uInt16 nStart = 1; sal_Int32 nStart = 1;
while( rName.GetChar( nStart-1 ) == ' ' && nStart < nSz ) while( rName[nStart-1]==' ' && nStart < nSz )
nStart++; nStart++;
String aBuf = OUString(rName.GetChar(nStart-1)); OUString aBuf = OUString(rName[nStart-1]);
for( ; nStart < nSz; ++nStart ) for( ; nStart < nSz; ++nStart )
{ {
if( rName.GetChar( nStart-1 ) == ' ' && rName.GetChar( nStart ) != ' ') if( rName[nStart-1]==' ' && rName[nStart]!=' ')
aBuf += rName.GetChar( nStart ); aBuf += OUString(rName[nStart]);
} }
return aBuf; return aBuf;
} }
...@@ -258,7 +258,7 @@ IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox ) ...@@ -258,7 +258,7 @@ IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox )
{ {
OUString aName(pBox->GetEntryText(pEntry)); OUString aName(pBox->GetEntryText(pEntry));
m_pNameED->SetText(aName); m_pNameED->SetText(aName);
m_pShortNameEdit->SetText(*(String*)pEntry->GetUserData()); m_pShortNameEdit->SetText(*reinterpret_cast<OUString*>(pEntry->GetUserData()));
pEntry = pBox->GetParent(pEntry); pEntry = pBox->GetParent(pEntry);
m_pInsertBtn->Enable( !bIsDocReadOnly); m_pInsertBtn->Enable( !bIsDocReadOnly);
ShowAutoText(::GetCurrGlosGroup(), m_pShortNameEdit->GetText()); ShowAutoText(::GetCurrGlosGroup(), m_pShortNameEdit->GetText());
...@@ -282,8 +282,11 @@ IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox ) ...@@ -282,8 +282,11 @@ IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox )
void SwGlossaryDlg::Apply() void SwGlossaryDlg::Apply()
{ {
const String aGlosName(m_pShortNameEdit->GetText()); const OUString aGlosName(m_pShortNameEdit->GetText());
if(aGlosName.Len()) pGlossaryHdl->InsertGlossary(aGlosName); if (!aGlosName.isEmpty())
{
pGlossaryHdl->InsertGlossary(aGlosName);
}
if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) ) if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
{ {
SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_INSERT_GLOSSARY ); SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_INSERT_GLOSSARY );
...@@ -306,8 +309,8 @@ void SwGlossaryDlg::EnableShortName(sal_Bool bOn) ...@@ -306,8 +309,8 @@ void SwGlossaryDlg::EnableShortName(sal_Bool bOn)
/* -------------------------------------------------- /* --------------------------------------------------
* does the title exist in the selected group? * does the title exist in the selected group?
* --------------------------------------------------*/ * --------------------------------------------------*/
SvTreeListEntry* SwGlossaryDlg::DoesBlockExist(const String& rBlock, SvTreeListEntry* SwGlossaryDlg::DoesBlockExist(const OUString& rBlock,
const String& rShort) const OUString& rShort)
{ {
// look for possible entry in TreeListBox // look for possible entry in TreeListBox
SvTreeListEntry* pEntry = m_pCategoryBox->FirstSelected(); SvTreeListEntry* pEntry = m_pCategoryBox->FirstSelected();
...@@ -319,8 +322,10 @@ SvTreeListEntry* SwGlossaryDlg::DoesBlockExist(const String& rBlock, ...@@ -319,8 +322,10 @@ SvTreeListEntry* SwGlossaryDlg::DoesBlockExist(const String& rBlock,
for(sal_uInt32 i = 0; i < nChildCount; i++) for(sal_uInt32 i = 0; i < nChildCount; i++)
{ {
SvTreeListEntry* pChild = m_pCategoryBox->GetEntry( pEntry, i ); SvTreeListEntry* pChild = m_pCategoryBox->GetEntry( pEntry, i );
if(rBlock == m_pCategoryBox->GetEntryText(pChild) && if (rBlock == m_pCategoryBox->GetEntryText(pChild) &&
(!rShort.Len() || rShort == *(String*)pChild->GetUserData())) (rShort.isEmpty() ||
rShort==*reinterpret_cast<OUString*>(pChild->GetUserData()))
)
{ {
return pChild; return pChild;
} }
...@@ -331,19 +336,16 @@ SvTreeListEntry* SwGlossaryDlg::DoesBlockExist(const String& rBlock, ...@@ -331,19 +336,16 @@ SvTreeListEntry* SwGlossaryDlg::DoesBlockExist(const String& rBlock,
IMPL_LINK( SwGlossaryDlg, NameModify, Edit *, pEdit ) IMPL_LINK( SwGlossaryDlg, NameModify, Edit *, pEdit )
{ {
String aName(m_pNameED->GetText()); const OUString aName(m_pNameED->GetText());
bool bNameED = pEdit == m_pNameED; bool bNameED = pEdit == m_pNameED;
if( !aName.Len() ) if( aName.isEmpty() )
{ {
if(bNameED) if(bNameED)
m_pShortNameEdit->SetText(aName); m_pShortNameEdit->SetText(aName);
m_pInsertBtn->Enable(sal_False); m_pInsertBtn->Enable(sal_False);
return 0; return 0;
} }
String sShortSearch; const bool bNotFound = !DoesBlockExist(aName, bNameED ? OUString() : pEdit->GetText());
if(!bNameED)
sShortSearch = pEdit->GetText();
bool bNotFound = !DoesBlockExist(aName, sShortSearch);
if(bNameED) if(bNameED)
{ {
// did the text get in to the Listbbox in the Edit with a click? // did the text get in to the Listbbox in the Edit with a click?
...@@ -385,8 +387,8 @@ IMPL_LINK( SwGlossaryDlg, EnableHdl, Menu *, pMn ) ...@@ -385,8 +387,8 @@ IMPL_LINK( SwGlossaryDlg, EnableHdl, Menu *, pMn )
{ {
SvTreeListEntry* pEntry = m_pCategoryBox->FirstSelected(); SvTreeListEntry* pEntry = m_pCategoryBox->FirstSelected();
const String aEditText(m_pNameED->GetText()); const OUString aEditText(m_pNameED->GetText());
const bool bHasEntry = aEditText.Len() && !m_pShortNameEdit->GetText().isEmpty(); const bool bHasEntry = !aEditText.isEmpty() && !m_pShortNameEdit->GetText().isEmpty();
const bool bExists = 0 != DoesBlockExist(aEditText, m_pShortNameEdit->GetText()); const bool bExists = 0 != DoesBlockExist(aEditText, m_pShortNameEdit->GetText());
const bool bIsGroup = pEntry && !m_pCategoryBox->GetParent(pEntry); const bool bIsGroup = pEntry && !m_pCategoryBox->GetParent(pEntry);
pMn->EnableItem("new", bSelection && bHasEntry && !bExists); pMn->EnableItem("new", bSelection && bHasEntry && !bExists);
...@@ -423,8 +425,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) ...@@ -423,8 +425,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
{ {
bool bNoAttr = sItemIdent == "newtext"; bool bNoAttr = sItemIdent == "newtext";
const String aStr(m_pNameED->GetText()); const OUString aStr(m_pNameED->GetText());
const String aShortName(m_pShortNameEdit->GetText()); const OUString aShortName(m_pShortNameEdit->GetText());
if(pGlossaryHdl->HasShortName(aShortName)) if(pGlossaryHdl->HasShortName(aShortName))
{ {
InfoBox(this, SW_RES(MSG_DOUBLE_SHORTNAME)).Execute(); InfoBox(this, SW_RES(MSG_DOUBLE_SHORTNAME)).Execute();
...@@ -439,7 +441,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) ...@@ -439,7 +441,7 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
pEntry = m_pCategoryBox->GetParent(pEntry); pEntry = m_pCategoryBox->GetParent(pEntry);
SvTreeListEntry* pChild = m_pCategoryBox->InsertEntry(aStr, pEntry); SvTreeListEntry* pChild = m_pCategoryBox->InsertEntry(aStr, pEntry);
pChild->SetUserData(new String(aShortName)); pChild->SetUserData(new OUString(aShortName));
m_pNameED->SetText(aStr); m_pNameED->SetText(aStr);
m_pShortNameEdit->SetText(aShortName); m_pShortNameEdit->SetText(aShortName);
NameModify(m_pNameED); // for toggling the buttons NameModify(m_pNameED); // for toggling the buttons
...@@ -475,8 +477,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) ...@@ -475,8 +477,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
SvTreeListEntry* pEntry = m_pCategoryBox->FirstSelected(); SvTreeListEntry* pEntry = m_pCategoryBox->FirstSelected();
SvTreeListEntry* pNewEntry = m_pCategoryBox->InsertEntry( SvTreeListEntry* pNewEntry = m_pCategoryBox->InsertEntry(
pNewNameDlg->GetNewName(), m_pCategoryBox->GetParent(pEntry)); pNewNameDlg->GetNewName(), m_pCategoryBox->GetParent(pEntry));
pNewEntry->SetUserData(new String(pNewNameDlg->GetNewShort())); pNewEntry->SetUserData(new OUString(pNewNameDlg->GetNewShort()));
delete (String*)pEntry->GetUserData(); delete reinterpret_cast<OUString*>(pEntry->GetUserData());
m_pCategoryBox->GetModel()->Remove(pEntry); m_pCategoryBox->GetModel()->Remove(pEntry);
m_pCategoryBox->Select(pNewEntry); m_pCategoryBox->Select(pNewEntry);
m_pCategoryBox->MakeVisible(pNewEntry); m_pCategoryBox->MakeVisible(pNewEntry);
...@@ -489,9 +491,9 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) ...@@ -489,9 +491,9 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
QueryBox aQuery(this, SW_RES(MSG_QUERY_DELETE)); QueryBox aQuery(this, SW_RES(MSG_QUERY_DELETE));
if(RET_YES == aQuery.Execute()) if(RET_YES == aQuery.Execute())
{ {
const String aShortName(m_pShortNameEdit->GetText()); const OUString aShortName(m_pShortNameEdit->GetText());
const String aTitle(m_pNameED->GetText()); const OUString aTitle(m_pNameED->GetText());
if(aTitle.Len() && pGlossaryHdl->DelGlossary(aShortName)) if (!aTitle.isEmpty() && pGlossaryHdl->DelGlossary(aShortName))
{ {
SvTreeListEntry* pChild = DoesBlockExist(aTitle, aShortName); SvTreeListEntry* pChild = DoesBlockExist(aTitle, aShortName);
OSL_ENSURE(pChild, "entry not found!"); OSL_ENSURE(pChild, "entry not found!");
...@@ -590,13 +592,13 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl) ...@@ -590,13 +592,13 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl)
{ {
//check if at least one glossary path is write enabled //check if at least one glossary path is write enabled
SvtPathOptions aPathOpt; SvtPathOptions aPathOpt;
String sGlosPath( aPathOpt.GetAutoTextPath() ); const OUString sGlosPath( aPathOpt.GetAutoTextPath() );
sal_uInt16 nPaths = comphelper::string::getTokenCount(sGlosPath, ';'); sal_uInt16 nPaths = comphelper::string::getTokenCount(sGlosPath, ';');
bool bIsWritable = false; bool bIsWritable = false;
for(sal_uInt16 nPath = 0; nPath < nPaths; nPath++) for(sal_uInt16 nPath = 0; nPath < nPaths; nPath++)
{ {
String sPath = URIHelper::SmartRel2Abs( const OUString sPath = URIHelper::SmartRel2Abs(
INetURLObject(), sGlosPath.GetToken(nPath, ';'), INetURLObject(), sGlosPath.getToken(nPath, ';'),
URIHelper::GetMaybeFileHdl()); URIHelper::GetMaybeFileHdl());
try try
{ {
...@@ -623,16 +625,16 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl) ...@@ -623,16 +625,16 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl)
{ {
Init(); Init();
//if new groups were created - select one of them //if new groups were created - select one of them
String sNewGroup = pDlg->GetCreatedGroupName(); const OUString sNewGroup = pDlg->GetCreatedGroupName();
SvTreeListEntry* pEntry = m_pCategoryBox->First(); SvTreeListEntry* pEntry = m_pCategoryBox->First();
while(sNewGroup.Len() && pEntry) while (!sNewGroup.isEmpty() && pEntry)
{ {
if(!m_pCategoryBox->GetParent(pEntry)) if(!m_pCategoryBox->GetParent(pEntry))
{ {
GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData(); GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData();
String sGroup = pGroupData->sGroupName; const OUString sGroup = pGroupData->sGroupName
sGroup += GLOS_DELIM; + OUString(GLOS_DELIM)
sGroup += OUString::number(pGroupData->nPathIdx); + OUString::number(pGroupData->nPathIdx);
if(sGroup == sNewGroup) if(sGroup == sNewGroup)
{ {
m_pCategoryBox->Select(pEntry); m_pCategoryBox->Select(pEntry);
...@@ -700,10 +702,9 @@ void SwGlossaryDlg::Init() ...@@ -700,10 +702,9 @@ void SwGlossaryDlg::Init()
const sal_uInt16 nCount = pGlossaryHdl->GetGlossaryCnt(); const sal_uInt16 nCount = pGlossaryHdl->GetGlossaryCnt();
for(sal_uInt16 i = 0; i < nCount; ++i) for(sal_uInt16 i = 0; i < nCount; ++i)
{ {
String sGroupTitle(pGlossaryHdl->GetGlossaryName(i));
SvTreeListEntry* pChild = m_pCategoryBox->InsertEntry( SvTreeListEntry* pChild = m_pCategoryBox->InsertEntry(
sGroupTitle, pEntry); pGlossaryHdl->GetGlossaryName(i), pEntry);
pChild->SetUserData(new String(pGlossaryHdl->GetGlossaryShortName(i))); pChild->SetUserData(new OUString(pGlossaryHdl->GetGlossaryShortName(i)));
} }
} }
} }
...@@ -842,7 +843,7 @@ void SwGlTreeListBox::Clear() ...@@ -842,7 +843,7 @@ void SwGlTreeListBox::Clear()
while(pEntry) while(pEntry)
{ {
if(GetParent(pEntry)) if(GetParent(pEntry))
delete (String*)pEntry->GetUserData(); delete reinterpret_cast<OUString*>(pEntry->GetUserData());
else else
delete (GroupUserData*)pEntry->GetUserData(); delete (GroupUserData*)pEntry->GetUserData();
pEntry = Next(pEntry); pEntry = Next(pEntry);
...@@ -869,33 +870,27 @@ void SwGlTreeListBox::RequestHelp( const HelpEvent& rHEvt ) ...@@ -869,33 +870,27 @@ void SwGlTreeListBox::RequestHelp( const HelpEvent& rHEvt )
aSize.Width() = GetSizePixel().Width() - aPos.X(); aSize.Width() = GetSizePixel().Width() - aPos.X();
aPos = OutputToScreenPixel(aPos); aPos = OutputToScreenPixel(aPos);
Rectangle aItemRect( aPos, aSize ); Rectangle aItemRect( aPos, aSize );
String sMsg; OUString sMsg;
if(!GetParent(pEntry)) if(!GetParent(pEntry))
{ {
GroupUserData* pData = (GroupUserData*)pEntry->GetUserData(); GroupUserData* pData = (GroupUserData*)pEntry->GetUserData();
const std::vector<OUString> & rPathArr = ::GetGlossaries()->GetPathArray(); const std::vector<OUString> & rPathArr = ::GetGlossaries()->GetPathArray();
if( !rPathArr.empty() ) if( !rPathArr.empty() )
{ {
sMsg = rPathArr[pData->nPathIdx]; INetURLObject aTmp(rPathArr[pData->nPathIdx]
sMsg += INET_PATH_TOKEN; + OUString(INET_PATH_TOKEN)
sMsg += pData->sGroupName; + pData->sGroupName
sMsg += SwGlossaries::GetExtension(); + SwGlossaries::GetExtension());
INetURLObject aTmp(sMsg);
sMsg = aTmp.GetPath(); sMsg = aTmp.GetPath();
if(pData->bReadonly) if(pData->bReadonly)
{ {
sMsg += ' '; sMsg += " (" + sReadonly + ")";
sMsg += '(';
sMsg += sReadonly;
sMsg += ')';
} }
} }
} }
else else
sMsg = *(String*)pEntry->GetUserData(); sMsg = *reinterpret_cast<OUString*>(pEntry->GetUserData());
Help::ShowQuickHelp( this, aItemRect, sMsg, Help::ShowQuickHelp( this, aItemRect, sMsg,
QUICKHELP_LEFT|QUICKHELP_VCENTER ); QUICKHELP_LEFT|QUICKHELP_VCENTER );
} }
...@@ -987,7 +982,7 @@ sal_Bool SwGlTreeListBox::NotifyCopyingOrMoving( ...@@ -987,7 +982,7 @@ sal_Bool SwGlTreeListBox::NotifyCopyingOrMoving(
pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup); pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup);
OUString sTitle(GetEntryText(pEntry)); OUString sTitle(GetEntryText(pEntry));
OUString sShortName(*(String*)pEntry->GetUserData()); OUString sShortName(*reinterpret_cast<OUString*>(pEntry->GetUserData()));
GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData(); GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData();
OUString sDestName = pDestData->sGroupName OUString sDestName = pDestData->sGroupName
...@@ -999,7 +994,7 @@ sal_Bool SwGlTreeListBox::NotifyCopyingOrMoving( ...@@ -999,7 +994,7 @@ sal_Bool SwGlTreeListBox::NotifyCopyingOrMoving(
if(bRet) if(bRet)
{ {
SvTreeListEntry* pChild = InsertEntry(sTitle, pDestParent); SvTreeListEntry* pChild = InsertEntry(sTitle, pDestParent);
pChild->SetUserData(new String(sShortName)); pChild->SetUserData(new OUString(sShortName));
if (bIsMove) if (bIsMove)
{ {
GetModel()->Remove(pEntry); GetModel()->Remove(pEntry);
...@@ -1009,20 +1004,17 @@ sal_Bool SwGlTreeListBox::NotifyCopyingOrMoving( ...@@ -1009,20 +1004,17 @@ sal_Bool SwGlTreeListBox::NotifyCopyingOrMoving(
return sal_False; // otherwise the entry is being set automatically return sal_False; // otherwise the entry is being set automatically
} }
String SwGlossaryDlg::GetCurrGrpName() const OUString SwGlossaryDlg::GetCurrGrpName() const
{ {
SvTreeListEntry* pEntry = m_pCategoryBox->FirstSelected(); SvTreeListEntry* pEntry = m_pCategoryBox->FirstSelected();
String sRet;
if(pEntry) if(pEntry)
{ {
pEntry = pEntry =
m_pCategoryBox->GetParent(pEntry) ? m_pCategoryBox->GetParent(pEntry) : pEntry; m_pCategoryBox->GetParent(pEntry) ? m_pCategoryBox->GetParent(pEntry) : pEntry;
GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData(); GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData();
sRet = pGroupData->sGroupName; return pGroupData->sGroupName + OUString(GLOS_DELIM) + OUString::number(pGroupData->nPathIdx);
sRet += GLOS_DELIM;
sRet += OUString::number(pGroupData->nPathIdx);
} }
return sRet; return OUString();
} }
IMPL_LINK( SwGlossaryDlg, PathHdl, Button *, pBtn ) IMPL_LINK( SwGlossaryDlg, PathHdl, Button *, pBtn )
...@@ -1033,11 +1025,11 @@ IMPL_LINK( SwGlossaryDlg, PathHdl, Button *, pBtn ) ...@@ -1033,11 +1025,11 @@ IMPL_LINK( SwGlossaryDlg, PathHdl, Button *, pBtn )
AbstractSvxMultiPathDialog* pDlg = pFact->CreateSvxMultiPathDialog( pBtn ); AbstractSvxMultiPathDialog* pDlg = pFact->CreateSvxMultiPathDialog( pBtn );
OSL_ENSURE(pDlg, "Dialogdiet fail!"); OSL_ENSURE(pDlg, "Dialogdiet fail!");
SvtPathOptions aPathOpt; SvtPathOptions aPathOpt;
String sGlosPath( aPathOpt.GetAutoTextPath() ); const OUString sGlosPath( aPathOpt.GetAutoTextPath() );
pDlg->SetPath(sGlosPath); pDlg->SetPath(sGlosPath);
if(RET_OK == pDlg->Execute()) if(RET_OK == pDlg->Execute())
{ {
String sTmp(pDlg->GetPath()); const OUString sTmp(pDlg->GetPath());
if(sTmp != sGlosPath) if(sTmp != sGlosPath)
{ {
aPathOpt.SetAutoTextPath( sTmp ); aPathOpt.SetAutoTextPath( sTmp );
...@@ -1075,7 +1067,7 @@ IMPL_LINK_NOARG(SwGlossaryDlg, PreviewLoadedHdl) ...@@ -1075,7 +1067,7 @@ IMPL_LINK_NOARG(SwGlossaryDlg, PreviewLoadedHdl)
return 0; return 0;
} }
void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName) void SwGlossaryDlg::ShowAutoText(const OUString& rGroup, const OUString& rShortName)
{ {
if(m_pExampleWIN->IsVisible()) if(m_pExampleWIN->IsVisible())
{ {
...@@ -1087,7 +1079,8 @@ void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName) ...@@ -1087,7 +1079,8 @@ void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName)
void SwGlossaryDlg::ResumeShowAutoText() void SwGlossaryDlg::ResumeShowAutoText()
{ {
String sGroup, sShortName; OUString sGroup;
OUString sShortName;
if(GetResumeData(sGroup, sShortName) && m_pExampleWIN->IsVisible()) if(GetResumeData(sGroup, sShortName) && m_pExampleWIN->IsVisible())
{ {
if(!m_xAutoText.is()) if(!m_xAutoText.is())
...@@ -1099,7 +1092,7 @@ void SwGlossaryDlg::ResumeShowAutoText() ...@@ -1099,7 +1092,7 @@ void SwGlossaryDlg::ResumeShowAutoText()
uno::Reference< XTextCursor > & xCrsr = pExampleFrame->GetTextCursor(); uno::Reference< XTextCursor > & xCrsr = pExampleFrame->GetTextCursor();
if(xCrsr.is()) if(xCrsr.is())
{ {
if(sShortName.Len()) if (!sShortName.isEmpty())
{ {
uno::Any aGroup = m_xAutoText->getByName(sGroup); uno::Any aGroup = m_xAutoText->getByName(sGroup);
uno::Reference< XAutoTextGroup > xGroup; uno::Reference< XAutoTextGroup > xGroup;
......
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