diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 09:54:38 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 11:59:39 +0100 |
commit | fc1762f96540e18561fbc93c28a36e37ca6e6168 (patch) | |
tree | d0d704bbe9f4895c545a0b21bab95c78ba1c8e8c | |
parent | 27014f48f47b1c90699d51dbf665cc57c3de1705 (diff) |
Merge these source files. Also move a function to where it's used.
Change-Id: Ia0378a58c63364a73c40dd901d93e20a596a4c29
-rw-r--r-- | sw/Library_swd.mk | 1 | ||||
-rw-r--r-- | sw/source/filter/basflt/iodetect.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/uno/swdet2.cxx | 71 | ||||
-rw-r--r-- | sw/source/ui/uno/swdetect.cxx | 36 |
4 files changed, 39 insertions, 75 deletions
diff --git a/sw/Library_swd.mk b/sw/Library_swd.mk index 477bcea915bc..fd53b7b2175f 100644 --- a/sw/Library_swd.mk +++ b/sw/Library_swd.mk @@ -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 \ )) diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx index 2a1ad7252d8b..a71587ed0e9d 100644 --- a/sw/source/filter/basflt/iodetect.cxx +++ b/sw/source/filter/basflt/iodetect.cxx @@ -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[] = { diff --git a/sw/source/ui/uno/swdet2.cxx b/sw/source/ui/uno/swdet2.cxx deleted file mode 100644 index 0eacb62fcec7..000000000000 --- a/sw/source/ui/uno/swdet2.cxx +++ /dev/null @@ -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: */ diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index bdfd3543974c..81a0f11403eb 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -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 ) { |