Kaydet (Commit) 0b31912b authored tarafından Szymon Kłos's avatar Szymon Kłos

AutoText: .dotx files visible when import

Change-Id: Idd2cdd9696a15ca5a215fc42b46cc470c4c25a28
Reviewed-on: https://gerrit.libreoffice.org/36550Reviewed-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
Tested-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
üst 6f20cb94
......@@ -500,6 +500,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/filter/basflt/fltshell \
sw/source/filter/basflt/iodetect \
sw/source/filter/basflt/shellio \
sw/source/filter/docx/swdocxreader \
sw/source/filter/html/SwAppletImpl \
sw/source/filter/html/css1atr \
sw/source/filter/html/css1kywd \
......
......@@ -17,6 +17,7 @@ comments show that Writer core dates back until at least November
* filter: Writer internal filters
* ascii: plain text filter
* basflt
* docx: wrapper for the UNO DOCX import filter (in writerfilter) for autotext purposes
* html: HTML filter
* inc: include files for filters
* rtf: thin copy&paste helper around the UNO RTF import filter (in writerfilter)
......
......@@ -36,6 +36,7 @@
#define FILTER_XML "CXML" ///< XML filter
#define FILTER_XMLV "CXMLV" ///< XML filter
#define FILTER_XMLVW "CXMLVWEB" ///< XML filter
#define FILTER_DOCX "OXML"
#define sHTML "HTML"
#define sWW5 "WW6"
#define sWW6 "CWW6"
......@@ -69,6 +70,7 @@ enum ReaderWriterEnum {
READER_WRITER_XML,
READER_WRITER_TEXT_DLG,
READER_WRITER_TEXT,
READER_WRITER_DOCX,
MAXFILTER
};
......
......@@ -64,9 +64,10 @@ SwRead ReadAscii = nullptr, ReadHTML = nullptr, ReadXML = nullptr;
Reader* GetRTFReader();
Reader* GetWW8Reader();
Reader* GetDOCXReader();
// Note: if editing, please don't forget to modify also the enum
// ReaderWriterEnum and aFilterDetect in shellio.hxx
// ReaderWriterEnum and aFilterDetect in iodetect.hxx & iodetect.cxx
static SwReaderWriterEntry aReaderWriter[] =
{
SwReaderWriterEntry( &::GetRTFReader, &::GetRTFWriter, true ),
......@@ -78,7 +79,8 @@ static SwReaderWriterEntry aReaderWriter[] =
SwReaderWriterEntry( &::GetWW8Reader, nullptr, true ),
SwReaderWriterEntry( nullptr, &::GetXMLWriter, true ),
SwReaderWriterEntry( nullptr, &::GetASCWriter, false ),
SwReaderWriterEntry( nullptr, &::GetASCWriter, true )
SwReaderWriterEntry( nullptr, &::GetASCWriter, true ),
SwReaderWriterEntry( &::GetDOCXReader, nullptr, true )
};
Reader* SwReaderWriterEntry::GetReader()
......@@ -639,6 +641,7 @@ extern "C" {
void ExportRTF( const OUString&, const OUString& rBaseURL, WriterRef& );
Reader *ImportDOC();
void ExportDOC( const OUString&, const OUString& rBaseURL, WriterRef& );
Reader *ImportDOCX();
sal_uLong SaveOrDelMSVBAStorage_ww8( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
sal_uLong GetSaveWarningOfMSVBAStorage_ww8( SfxObjectShell& );
}
......@@ -703,6 +706,20 @@ void GetWW8Writer( const OUString& rFltName, const OUString& rBaseURL, WriterRef
#endif
}
Reader* GetDOCXReader()
{
#ifndef DISABLE_DYNLOADING
FnGetReader pFunction = reinterpret_cast<FnGetReader>( SwGlobals::getFilters().GetMswordLibSymbol( "ImportDOCX" ) );
if ( pFunction )
return (*pFunction)();
return nullptr;
#else
return ImportDOCX();
#endif
}
typedef sal_uLong ( SAL_CALL *SaveOrDel )( SfxObjectShell&, SotStorage&, sal_Bool, const OUString& );
typedef sal_uLong ( SAL_CALL *GetSaveWarning )( SfxObjectShell& );
......
......@@ -44,7 +44,8 @@ SwIoDetect aFilterDetect[] =
SwIoDetect( sWW5 ),
SwIoDetect( FILTER_XML ),
SwIoDetect( FILTER_TEXT_DLG ),
SwIoDetect( FILTER_TEXT )
SwIoDetect( FILTER_TEXT ),
SwIoDetect( FILTER_DOCX )
};
const OUString SwIoSystem::GetSubStorageName( const SfxFilter& rFltr )
......
/* -*- 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: */
/* -*- 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: */
......@@ -591,6 +591,12 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool )
pFilter->GetWildcard().getGlob() );
xFltMgr->setCurrentFilter( pFilter->GetUIName() ) ;
}
else if( pFilter->GetUserData() == FILTER_DOCX )
{
xFltMgr->appendFilter( pFilter->GetUIName(),
pFilter->GetWildcard().getGlob() );
xFltMgr->setCurrentFilter( pFilter->GetUIName() ) ;
}
pFilter = aIter.Next();
}
......
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