summaryrefslogtreecommitdiff
path: root/sw/source/filter/docx
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-04-14 10:22:37 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2017-04-14 12:24:38 +0200
commit0b31912b1df719c5507b22a2f63086cb8921f597 (patch)
treece039fa56ebe9774c0f7d2b78d82f3886c3f89b1 /sw/source/filter/docx
parent6f20cb94640224c47efa0a9de8ee757260ba3771 (diff)
AutoText: .dotx files visible when import
Change-Id: Idd2cdd9696a15ca5a215fc42b46cc470c4c25a28 Reviewed-on: https://gerrit.libreoffice.org/36550 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sw/source/filter/docx')
-rw-r--r--sw/source/filter/docx/swdocxreader.cxx51
-rw-r--r--sw/source/filter/docx/swdocxreader.hxx40
2 files changed, 91 insertions, 0 deletions
diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx
new file mode 100644
index 000000000000..5975f1b862bd
--- /dev/null
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "swdocxreader.hxx"
+
+#include <swerror.h>
+
+extern "C" SAL_DLLPUBLIC_EXPORT Reader* SAL_CALL ImportDOCX()
+{
+ return new SwDOCXReader;
+}
+
+sal_uLong SwDOCXReader::Read( SwDoc& /* rDoc */, const OUString& /* rBaseURL */, SwPaM& /* rPaM */, const OUString& /* FileName */ )
+{
+ return ERR_SWG_READ_ERROR;
+}
+
+int SwDOCXReader::GetReaderType()
+{
+ return SW_STORAGE_READER | SW_STREAM_READER;
+}
+
+bool SwDOCXReader::HasGlossaries() const
+{
+ // TODO
+ return true;
+}
+
+bool SwDOCXReader::ReadGlossaries( SwTextBlocks& /* rBlocks */, bool /* bSaveRelFiles */ ) const
+{
+ // TODO
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/docx/swdocxreader.hxx b/sw/source/filter/docx/swdocxreader.hxx
new file mode 100644
index 000000000000..35fdee86a643
--- /dev/null
+++ b/sw/source/filter/docx/swdocxreader.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SW_SOURCE_FILTER_DOCX_SWDOCXREADER_HXX
+#define INCLUDED_SW_SOURCE_FILTER_DOCX_SWDOCXREADER_HXX
+
+#include <shellio.hxx>
+
+/// Wrapper for the UNO DOCX import filter (in writerfilter) for autotext purposes.
+class SwDOCXReader : public StgReader
+{
+public:
+ virtual int GetReaderType() override;
+
+ virtual bool HasGlossaries() const override;
+ virtual bool ReadGlossaries( SwTextBlocks& rBlocks, bool bSaveRelFiles ) const override;
+
+private:
+ virtual sal_uLong Read( SwDoc&, const OUString&, SwPaM&, const OUString& ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */