diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-04-23 16:56:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-04-23 22:41:01 +0200 |
commit | 74a58038b2001ddea5673300bd0317d29c100459 (patch) | |
tree | 9c1fca7c8d45e10ea9e5589b2853dec83b664a06 /sw | |
parent | 0a04150b6eefb5feb7ecefaa5cd63dbac8c1574f (diff) |
multiple concatted AcceptChgDat
Change-Id: I4ab78f35cb5a6ea31235662b6fad8d1e6c5d33b5
Reviewed-on: https://gerrit.libreoffice.org/71140
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/inc/redlndlg.hxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/misc/redlndlg.cxx | 69 |
2 files changed, 47 insertions, 34 deletions
diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index 4f551e76ddec..7892fcb48fc6 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -128,7 +128,7 @@ public: void Init(SwRedlineTable::size_type nStart = 0); void CallAcceptReject( bool bSelect, bool bAccept ); - void Initialize(const OUString &rExtraData); + void Initialize(OUString &rExtraData); void FillInfo(OUString &rExtraData) const; void Activate(); @@ -146,16 +146,16 @@ public: virtual void Activate() override; virtual void FillInfo(SfxChildWinInfo&) const override; - void Initialize (SfxChildWinInfo const * pInfo); + void Initialize(SfxChildWinInfo * pInfo); }; class SwRedlineAcceptChild : public SwChildWinWrapper { public: - SwRedlineAcceptChild( vcl::Window* , - sal_uInt16 nId, - SfxBindings*, - SfxChildWinInfo const * ); + SwRedlineAcceptChild(vcl::Window* , + sal_uInt16 nId, + SfxBindings*, + SfxChildWinInfo*); SFX_DECL_CHILDWINDOW_WITHID( SwRedlineAcceptChild ); diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 71bcf99cc62b..6afaaa11712f 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -60,11 +60,11 @@ SFX_IMPL_MODELESSDIALOG_WITHID( SwRedlineAcceptChild, FN_REDLINE_ACCEPT ) static sal_uInt16 nSortMode = 0xffff; static bool bSortDir = true; -SwRedlineAcceptChild::SwRedlineAcceptChild( vcl::Window* _pParent, - sal_uInt16 nId, - SfxBindings* pBindings, - SfxChildWinInfo const * pInfo ) : - SwChildWinWrapper( _pParent, nId ) +SwRedlineAcceptChild::SwRedlineAcceptChild(vcl::Window* _pParent, + sal_uInt16 nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo) + : SwChildWinWrapper(_pParent, nId) { SetWindow( VclPtr<SwModelessRedlineAcceptDlg>::Create( pBindings, this, _pParent) ); @@ -122,7 +122,7 @@ void SwModelessRedlineAcceptDlg::Activate() pImplDlg->Activate(); } -void SwModelessRedlineAcceptDlg::Initialize(SfxChildWinInfo const *pInfo) +void SwModelessRedlineAcceptDlg::Initialize(SfxChildWinInfo* pInfo) { if (pInfo != nullptr) pImplDlg->Initialize(pInfo->aExtraString); @@ -1160,45 +1160,58 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void) } } -void SwRedlineAcceptDlg::Initialize(const OUString& rExtraData) +namespace { - if (!rExtraData.isEmpty()) + OUString lcl_StripAcceptChgDat(OUString &rExtraString) { - sal_Int32 nPos = rExtraData.indexOf("AcceptChgDat:"); - - // try to read the alignment string "ALIGN:(...)"; if none existing, - // it's an old version - if (nPos != -1) + OUString aStr; + while(true) { - sal_Int32 n1 = rExtraData.indexOf('(', nPos); + sal_Int32 nPos = rExtraString.indexOf("AcceptChgDat:"); + if (nPos == -1) + break; + // try to read the alignment string "ALIGN:(...)"; if none existing, + // it's an old version + sal_Int32 n1 = rExtraString.indexOf('(', nPos); if (n1 != -1) { - sal_Int32 n2 = rExtraData.indexOf(')', n1); + sal_Int32 n2 = rExtraString.indexOf(')', n1); if (n2 != -1) { // cut out the alignment string - OUString aStr = rExtraData.copy(nPos, n2 - nPos + 1); + aStr = rExtraString.copy(nPos, n2 - nPos + 1); + rExtraString = rExtraString.replaceAt(nPos, n2 - nPos + 1, ""); aStr = aStr.copy(n1 - nPos + 1); - - if (!aStr.isEmpty()) - { - sal_uInt16 nCount = static_cast< sal_uInt16 >(aStr.toInt32()); - - for (sal_uInt16 i = 0; i < nCount; i++) - { - sal_Int32 n3 = aStr.indexOf(';'); - aStr = aStr.copy(n3 + 1); - m_pTable->SetTab(i, aStr.toInt32(), MapUnit::MapPixel); - } - } } } } + return aStr; + } +} + +void SwRedlineAcceptDlg::Initialize(OUString& rExtraString) +{ + if (!rExtraString.isEmpty()) + { + OUString aStr = lcl_StripAcceptChgDat(rExtraString); + if (!aStr.isEmpty()) + { + sal_uInt16 nCount = static_cast<sal_uInt16>(aStr.toInt32()); + + for (sal_uInt16 i = 0; i < nCount; ++i) + { + sal_Int32 n1 = aStr.indexOf(';'); + aStr = aStr.copy(n1 + 1); + m_pTable->SetTab(i, aStr.toInt32(), MapUnit::MapPixel); + } + } } } void SwRedlineAcceptDlg::FillInfo(OUString &rExtraData) const { + //remove any old one before adding a new one + lcl_StripAcceptChgDat(rExtraData); rExtraData += "AcceptChgDat:("; sal_uInt16 nCount = m_pTable->TabCount(); |