Merge these source files. Also move a function to where it's used.
Change-Id: Ia0378a58c63364a73c40dd901d93e20a596a4c29
This commit is contained in:
@@ -56,7 +56,6 @@ $(eval $(call gb_Library_use_libraries,swd,\
|
||||
$(eval $(call gb_Library_add_exception_objects,swd,\
|
||||
sw/source/filter/basflt/iodetect \
|
||||
sw/source/ui/uno/detreg \
|
||||
sw/source/ui/uno/swdet2 \
|
||||
sw/source/ui/uno/swdetect \
|
||||
))
|
||||
|
||||
|
@@ -24,8 +24,12 @@
|
||||
#include <sot/storage.hxx>
|
||||
#include <svtools/parhtml.hxx>
|
||||
#include <tools/urlobj.hxx>
|
||||
#include <unotools/moduleoptions.hxx>
|
||||
|
||||
bool IsDocShellRegistered();
|
||||
static bool IsDocShellRegistered()
|
||||
{
|
||||
return SvtModuleOptions().IsWriter();
|
||||
}
|
||||
|
||||
SwIoDetect aFilterDetect[] =
|
||||
{
|
||||
|
@@ -1,71 +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 .
|
||||
*/
|
||||
|
||||
#include "rtl/ustring.hxx" // for OUString, operator==
|
||||
#include "sal/types.h" // for sal_Bool
|
||||
#include "tools/errcode.hxx" // for ERRCODE_ABORT, ERRCODE_NONE
|
||||
#include "tools/solar.h" // for sal_uLong
|
||||
|
||||
#include <sfx2/docfilt.hxx>
|
||||
#include <sfx2/fcontnr.hxx>
|
||||
#include <sfx2/docfile.hxx>
|
||||
#include <iodetect.hxx>
|
||||
#include <swdetect.hxx>
|
||||
|
||||
#include <unotools/moduleoptions.hxx>
|
||||
|
||||
bool IsDocShellRegistered()
|
||||
{
|
||||
return SvtModuleOptions().IsWriter();
|
||||
}
|
||||
|
||||
sal_uLong SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter )
|
||||
{
|
||||
sal_uLong nRet = ERRCODE_NONE;
|
||||
if( *ppFilter )
|
||||
{
|
||||
// verify the given filter
|
||||
OUString aPrefFlt = (*ppFilter)->GetUserData();
|
||||
|
||||
// detection for TextFilter needs an additional checking
|
||||
sal_Bool bDetected = SwIoSystem::IsFileFilter(rMedium, aPrefFlt);
|
||||
return bDetected ? nRet : ERRCODE_ABORT;
|
||||
}
|
||||
|
||||
// mba: without preselection there is no PrefFlt
|
||||
OUString aPrefFlt;
|
||||
const SfxFilter* pTmp = SwIoSystem::GetFileFilter( rMedium.GetPhysicalName(), aPrefFlt, &rMedium );
|
||||
if( !pTmp )
|
||||
return ERRCODE_ABORT;
|
||||
|
||||
else
|
||||
{
|
||||
//Bug 41417: JP 09.07.97: HTML documents should be loaded by WebWriter
|
||||
SfxFilterContainer aFilterContainer( OUString("swriter/web") );
|
||||
if( !pTmp->GetUserData().equals(sHTML) ||
|
||||
pTmp->GetServiceName() == "com.sun.star.text.WebDocument" ||
|
||||
0 == ( (*ppFilter) = SwIoSystem::GetFilterOfFormat( OUString(sHTML),
|
||||
&aFilterContainer ) ) )
|
||||
*ppFilter = pTmp;
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -56,8 +56,7 @@
|
||||
#include <vcl/FilterConfigItem.hxx>
|
||||
#include <unotools/moduleoptions.hxx>
|
||||
#include <comphelper/ihwrapnofilter.hxx>
|
||||
|
||||
#include <swdll.hxx>
|
||||
#include <iodetect.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
@@ -418,6 +417,39 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
|
||||
return aTypeName;
|
||||
}
|
||||
|
||||
sal_uLong SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter )
|
||||
{
|
||||
sal_uLong nRet = ERRCODE_NONE;
|
||||
if( *ppFilter )
|
||||
{
|
||||
// verify the given filter
|
||||
OUString aPrefFlt = (*ppFilter)->GetUserData();
|
||||
|
||||
// detection for TextFilter needs an additional checking
|
||||
sal_Bool bDetected = SwIoSystem::IsFileFilter(rMedium, aPrefFlt);
|
||||
return bDetected ? nRet : ERRCODE_ABORT;
|
||||
}
|
||||
|
||||
// mba: without preselection there is no PrefFlt
|
||||
OUString aPrefFlt;
|
||||
const SfxFilter* pTmp = SwIoSystem::GetFileFilter( rMedium.GetPhysicalName(), aPrefFlt, &rMedium );
|
||||
if( !pTmp )
|
||||
return ERRCODE_ABORT;
|
||||
|
||||
else
|
||||
{
|
||||
//Bug 41417: JP 09.07.97: HTML documents should be loaded by WebWriter
|
||||
SfxFilterContainer aFilterContainer( OUString("swriter/web") );
|
||||
if( !pTmp->GetUserData().equals(sHTML) ||
|
||||
pTmp->GetServiceName() == "com.sun.star.text.WebDocument" ||
|
||||
0 == ( (*ppFilter) = SwIoSystem::GetFilterOfFormat( OUString(sHTML),
|
||||
&aFilterContainer ) ) )
|
||||
*ppFilter = pTmp;
|
||||
}
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
/* XServiceInfo */
|
||||
OUString SAL_CALL SwFilterDetect::getImplementationName() throw( RuntimeException )
|
||||
{
|
||||
|
Reference in New Issue
Block a user