summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2014-04-28 18:31:24 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2014-05-01 17:03:48 +0000
commit4b7bdef4b1d1e4ff45a8816c038df38ce7995b3d (patch)
treecb6d82194ec4727cda762406281075a9dcb2caf5
parentdddd9b41f59fa9857159cef70add9e2343dd1ab1 (diff)
sw: iodetect is not a part of the type detector anymore
and remove now unused IsFileFilter method. Change-Id: I6b4559fdf6442b6baa869b2949142f8fc8c52f30 Reviewed-on: https://gerrit.libreoffice.org/9223 Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com> Tested-by: Maxim Monastirsky <momonasmon@gmail.com>
-rw-r--r--sw/Library_sw.mk2
-rw-r--r--sw/Library_swd.mk9
-rw-r--r--sw/Library_swui.mk1
-rw-r--r--sw/inc/iodetect.hxx21
-rw-r--r--sw/inc/swddllapi.h33
-rw-r--r--sw/source/filter/basflt/iodetect.cxx71
6 files changed, 7 insertions, 130 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index af465ca4d92c..839197bf9cd8 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -65,7 +65,6 @@ $(eval $(call gb_Library_use_libraries,sw,\
svt \
svx \
svxcore \
- swd \
tk \
tl \
ucbhelper \
@@ -479,6 +478,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/filter/ascii/wrtasc \
sw/source/filter/basflt/docfact \
sw/source/filter/basflt/fltini \
+ sw/source/filter/basflt/iodetect \
sw/source/filter/basflt/shellio \
sw/source/filter/html/SwAppletImpl \
sw/source/filter/html/css1atr \
diff --git a/sw/Library_swd.mk b/sw/Library_swd.mk
index cb92fe3a8c31..8657cf17704f 100644
--- a/sw/Library_swd.mk
+++ b/sw/Library_swd.mk
@@ -23,19 +23,12 @@ $(eval $(call gb_Library_set_componentfile,swd,sw/util/swd))
$(eval $(call gb_Library_set_include,swd,\
$$(INCLUDE) \
- -I$(SRCDIR)/sw/inc \
- -I$(SRCDIR)/sw/source/core/inc \
- -I$(SRCDIR)/sw/source/filter/inc \
))
$(eval $(call gb_Library_use_external,swd,boost_headers))
$(eval $(call gb_Library_use_sdk_api,swd))
-$(eval $(call gb_Library_add_defs,swd,\
- -DSWD_DLLIMPLEMENTATION \
-))
-
$(eval $(call gb_Library_use_libraries,swd,\
comphelper \
cppu \
@@ -43,14 +36,12 @@ $(eval $(call gb_Library_use_libraries,swd,\
sal \
sfx \
sot \
- svt \
tl \
utl \
$(gb_UWINAPI) \
))
$(eval $(call gb_Library_add_exception_objects,swd,\
- sw/source/filter/basflt/iodetect \
sw/source/ui/uno/detreg \
sw/source/ui/uno/swdetect \
))
diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index 13ba3a52b51a..009089a64bd5 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -62,7 +62,6 @@ $(eval $(call gb_Library_use_libraries,swui,\
svx \
svxcore \
sw \
- swd \
tk \
tl \
ucbhelper \
diff --git a/sw/inc/iodetect.hxx b/sw/inc/iodetect.hxx
index e3e33cdf1d39..c3ed1e2d63b9 100644
--- a/sw/inc/iodetect.hxx
+++ b/sw/inc/iodetect.hxx
@@ -25,7 +25,7 @@
#include <sfx2/docfilt.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/fcontnr.hxx>
-#include <swddllapi.h>
+#include <swdllapi.h>
#define FILTER_RTF "RTF" ///< RTF filter
#define sRtfWH "WH_RTF"
@@ -76,7 +76,7 @@ enum ReaderWriterEnum {
MAXFILTER
};
-extern SWD_DLLPUBLIC SwIoDetect aFilterDetect[];
+extern SwIoDetect aFilterDetect[];
/** The following class is a wrapper for basic i/o functions of Writer 3.0.
Everything is static. All filter names mentioned are Writer-internal
@@ -87,33 +87,24 @@ class SwIoSystem
{
public:
/// find for an internal format name the corresponding filter entry
- SWD_DLLPUBLIC static const SfxFilter*
+ SW_DLLPUBLIC static const SfxFilter*
GetFilterOfFormat( const OUString& rFormat,
const SfxFilterContainer* pCnt = 0 );
/** Detect for the given file which filter should be used. The filter name
is returned. If no filter could be found, the name of the ASCII filter
is returned! */
- SWD_DLLPUBLIC static const SfxFilter*
- GetFileFilter( const OUString& rFileName,
- const OUString& rPrefFltName,
- SfxMedium* pMedium = 0 );
-
- /** Detect whether the given file is in the given format.
- For now, only our own filters are supported! */
- static bool IsFileFilter(SfxMedium& rMedium, const OUString& rFmtName);
+ static const SfxFilter* GetFileFilter( const OUString& rFileName, const OUString& rPrefFltName, SfxMedium* pMedium = 0 );
static bool IsValidStgFilter( SotStorage& , const SfxFilter& );
static bool IsValidStgFilter( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const SfxFilter& rFilter);
- SWD_DLLPUBLIC static bool
- IsDetectableText( const sal_Char* pBuf, sal_uLong &rLen,
+ static bool IsDetectableText( const sal_Char* pBuf, sal_uLong &rLen,
rtl_TextEncoding *pCharSet=0, bool *pSwap=0, LineEnd *pLineEnd=0, bool bEncodedFilter = false );
static const SfxFilter* GetTextFilter( const sal_Char* pBuf, sal_uLong nLen );
- SWD_DLLPUBLIC static const OUString
- GetSubStorageName( const SfxFilter& rFltr );
+ static const OUString GetSubStorageName( const SfxFilter& rFltr );
};
#endif
diff --git a/sw/inc/swddllapi.h b/sw/inc/swddllapi.h
deleted file mode 100644
index c920285275e3..000000000000
--- a/sw/inc/swddllapi.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- 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_INC_SWDDLLAPI_H
-#define INCLUDED_SW_INC_SWDDLLAPI_H
-
-#include <sal/types.h>
-
-#if defined(SWD_DLLIMPLEMENTATION)
-#define SWD_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
-#else
-#define SWD_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
-#endif
-
-#endif // INCLUDED_SW_INC_SWDDLLAPI_H
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx
index 809b0f1559c9..8cb7e0d9fce9 100644
--- a/sw/source/filter/basflt/iodetect.cxx
+++ b/sw/source/filter/basflt/iodetect.cxx
@@ -195,77 +195,6 @@ void TerminateBuffer(sal_Char *pBuffer, sal_uLong nBytesRead, sal_uLong nBufferL
}
}
-// Check if the file fits the corresponding format
-// Currently we only support our own filters
-bool SwIoSystem::IsFileFilter(SfxMedium& rMedium, const OUString& rFmtName)
-{
- bool bRet = false;
-
- SfxFilterContainer aCntSw( OUString(sSWRITER) );
- SfxFilterContainer aCntSwWeb( OUString(sSWRITERWEB) );
- const SfxFilterContainer& rFltContainer = IsDocShellRegistered() ? aCntSw : aCntSwWeb;
-
- com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStor;
- SotStorageRef xStg;
- if (rMedium.IsStorage())
- xStor = rMedium.GetStorage();
- else
- {
- SvStream* pStream = rMedium.GetInStream();
- if ( pStream && SotStorage::IsStorageFile(pStream) )
- xStg = new SotStorage( pStream, false );
- }
-
- SfxFilterMatcher aMatcher( rFltContainer.GetName() );
- SfxFilterMatcherIter aIter( aMatcher );
- const SfxFilter* pFltr = aIter.First();
- while ( pFltr )
- {
- const OUString& rUserData = pFltr->GetUserData();
- if (rUserData.equals(rFmtName))
- {
- if( 'C' == rUserData[0] )
- {
- if ( xStor.is() )
- bRet = IsValidStgFilter( xStor, *pFltr );
- else if ( xStg.Is() )
- bRet = IsValidStgFilter( *xStg, *pFltr );
- }
- else if( !xStg.Is() && !xStor.is() )
- {
- SvStream* pStrm = rMedium.GetInStream();
- if( pStrm && !pStrm->GetError() )
- {
- sal_Char aBuffer[4098];
- const sal_uLong nMaxRead = sizeof(aBuffer) - 2;
- sal_uLong nBytesRead = pStrm->Read(aBuffer, nMaxRead);
- pStrm->Seek(STREAM_SEEK_TO_BEGIN);
- TerminateBuffer(aBuffer, nBytesRead, sizeof(aBuffer));
- for (sal_uInt16 i = 0; i < MAXFILTER; ++i)
- {
- if (aFilterDetect[i].IsFilter(rFmtName))
- {
- OUString sFilter(aFilterDetect[i].IsReader(aBuffer, nBytesRead));
- bRet = !sFilter.isEmpty();
- break;
- }
- }
- }
- }
- //The same underlying filter can appear multiple times in the
- //filter list, e.g. CWW8 filter twice, once for .doc and once for
- //.dot. We just care here if its either, not enforce that it's
- //both which would be a bit of an odd requirement
- if (bRet)
- break;
- }
-
- pFltr = aIter.Next();
- }
-
- return bRet;
-}
-
// Check the type of the stream (file) by searching for corresponding set of bytes.
// If no known type is found, return ASCII for now!
// Returns the internal FilterName.