summaryrefslogtreecommitdiff
path: root/sw/source/filter/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-11 15:20:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-12 15:24:31 +0100
commit810b5f6491850d70bfe2da1f58927a3404d37d49 (patch)
treea96beeed524f2c04c9e6d335dc6d6521441ecb4c /sw/source/filter/inc
parentad35cc9ed0faa6555bc09e5e065abb5cdc6c4ee6 (diff)
reuse ImportProgress class for exception safety
cause if no EndProgress is called then the shell leaks so the document leaks, etc Change-Id: I8e22644e58ac440dbee60c2ceacda4abb002c81c Reviewed-on: https://gerrit.libreoffice.org/46246 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/filter/inc')
-rw-r--r--sw/source/filter/inc/fltshell.hxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index bc8fb87bf806..e1a8503d657d 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -25,8 +25,10 @@
#include <editeng/formatbreakitem.hxx>
#include <poolfmt.hxx>
#include <fmtornt.hxx>
+#include <mdiexp.hxx>
#include <ndindex.hxx>
#include <pam.hxx>
+#include <strings.hrc>
#include <IDocumentRedlineAccess.hxx>
#include <cstddef>
@@ -319,6 +321,28 @@ public:
SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, size_t nInPageDescOffset);
+class ImportProgress
+{
+private:
+ SwDocShell *m_pDocShell;
+public:
+ ImportProgress(SwDocShell *pDocShell, long nStartVal, long nEndVal)
+ : m_pDocShell(pDocShell)
+ {
+ ::StartProgress(STR_STATSTR_W4WREAD, nStartVal, nEndVal, m_pDocShell);
+ }
+
+ void Update(sal_uInt16 nProgress)
+ {
+ ::SetProgressState(nProgress, m_pDocShell); // Update
+ }
+
+ ~ImportProgress()
+ {
+ ::EndProgress(m_pDocShell);
+ }
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */