summaryrefslogtreecommitdiff
path: root/sw/source/uibase/dochdl/gloshdl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase/dochdl/gloshdl.cxx')
-rw-r--r--sw/source/uibase/dochdl/gloshdl.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 9f2e070162c4..4820584268aa 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -196,6 +196,28 @@ void SwGlossaryHdl::RenameGroup(const OUString& rOld, OUString& rNew, const OUSt
}
}
+bool SwGlossaryHdl::CopyOrMove(const OUString& rSourceGroupName, OUString& rSourceShortName,
+ const OUString& rDestGroupName, const OUString& rLongName, bool bMove)
+{
+ std::unique_ptr<SwTextBlocks> pSourceGroup = m_rStatGlossaries.GetGroupDoc(rSourceGroupName);
+ std::unique_ptr<SwTextBlocks> pDestGroup = m_rStatGlossaries.GetGroupDoc(rDestGroupName);
+ if (pDestGroup->IsReadOnly() || (bMove && pSourceGroup->IsReadOnly()) )
+ {
+ return false;
+ }
+
+ //The index must be determined here because rSourceShortName maybe changed in CopyBlock
+ sal_uInt16 nDeleteIdx = pSourceGroup->GetIndex( rSourceShortName );
+ OSL_ENSURE(USHRT_MAX != nDeleteIdx, "entry not found");
+ ErrCode nRet = pSourceGroup->CopyBlock( *pDestGroup, rSourceShortName, rLongName );
+ if(!nRet && bMove)
+ {
+ // the index must be existing
+ nRet = pSourceGroup->Delete( nDeleteIdx ) ? ERRCODE_NONE : ErrCode(1);
+ }
+ return !nRet;
+}
+
// delete an autotext-file-group
bool SwGlossaryHdl::DelGroup(const OUString &rGrpName)
{