Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
40e043ca
Kaydet (Commit)
40e043ca
authored
Eki 15, 2014
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sw: remove more dead code from SwIoSystem::GetFileFilter()
Change-Id: I53cadf01246faf3c4b54ee360db19bde2dcb98cc
üst
3ec25899
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
55 deletions
+14
-55
iodetect.hxx
sw/inc/iodetect.hxx
+0
-2
iodetect.cxx
sw/source/filter/basflt/iodetect.cxx
+14
-53
No files found.
sw/inc/iodetect.hxx
Dosyayı görüntüle @
40e043ca
...
...
@@ -102,8 +102,6 @@ public:
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
);
static
const
OUString
GetSubStorageName
(
const
SfxFilter
&
rFltr
);
};
...
...
sw/source/filter/basflt/iodetect.cxx
Dosyayı görüntüle @
40e043ca
...
...
@@ -25,6 +25,9 @@
#include <tools/urlobj.hxx>
#include <unotools/moduleoptions.hxx>
using
namespace
::
com
::
sun
::
star
;
static
bool
IsDocShellRegistered
()
{
return
SvtModuleOptions
().
IsWriter
();
...
...
@@ -210,7 +213,6 @@ const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
if
(
!
pFilter
)
return
0
;
::
boost
::
scoped_ptr
<
SfxMedium
>
pMedium
;
if
(
SotStorage
::
IsStorageFile
(
rFileName
))
{
// package storage or OLEStorage based format
...
...
@@ -218,25 +220,24 @@ const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
INetURLObject
aObj
;
aObj
.
SetSmartProtocol
(
INET_PROT_FILE
);
aObj
.
SetSmartURL
(
rFileName
);
pMedium
.
reset
(
new
SfxMedium
(
aObj
.
GetMainURL
(
INetURLObject
::
NO_DECODE
),
STREAM_STD_READ
)
);
SfxMedium
aMedium
(
aObj
.
GetMainURL
(
INetURLObject
::
NO_DECODE
),
STREAM_STD_READ
);
// templates should not get precedence over "normal" filters (#i35508, #i33168)
const
SfxFilter
*
pTemplateFilter
=
0
;
const
SfxFilter
*
pOldFilter
=
pFCntnr
->
GetFilter4FilterName
(
""
);
assert
(
!
pOldFilter
);
bool
bLookForTemplate
=
pOldFilter
&&
pOldFilter
->
IsOwnTemplateFormat
();
if
(
pMedium
->
IsStorage
()
)
if
(
aMedium
.
IsStorage
())
{
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
embed
::
XStorage
>
xStor
=
pMedium
->
GetStorage
();
uno
::
Reference
<
embed
::
XStorage
>
const
xStor
=
aMedium
.
GetStorage
();
if
(
xStor
.
is
()
)
{
while
(
pFilter
)
{
if
(
'C'
==
pFilter
->
GetUserData
()[
0
]
&&
IsValidStgFilter
(
xStor
,
*
pFilter
)
)
{
if
(
pFilter
->
IsOwnTemplateFormat
()
&&
!
bLookForTemplate
)
if
(
pFilter
->
IsOwnTemplateFormat
())
{
// found template filter; maybe there's a "normal" one also
pTemplateFilter
=
pFilter
;
}
else
return
pFilter
;
}
...
...
@@ -253,7 +254,7 @@ const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
{
try
{
SvStream
*
pStream
=
pMedium
->
GetInStream
();
SvStream
*
const
pStream
=
aMedium
.
GetInStream
();
if
(
pStream
&&
SotStorage
::
IsStorageFile
(
pStream
)
)
xStg
=
new
SotStorage
(
pStream
,
false
);
}
...
...
@@ -267,9 +268,11 @@ const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
{
if
(
'C'
==
pFilter
->
GetUserData
()[
0
]
&&
IsValidStgFilter
(
*
xStg
,
*
pFilter
)
)
{
if
(
pFilter
->
IsOwnTemplateFormat
()
&&
!
bLookForTemplate
)
if
(
pFilter
->
IsOwnTemplateFormat
())
{
// found template filter; maybe there's a "normal" one also
pTemplateFilter
=
pFilter
;
}
else
return
pFilter
;
}
...
...
@@ -287,42 +290,7 @@ const SfxFilter* SwIoSystem::GetFileFilter(const OUString& rFileName)
return
pFilter
;
}
sal_Char
aBuffer
[
4098
];
const
sal_uLong
nMaxRead
=
sizeof
(
aBuffer
)
-
2
;
sal_uLong
nBytesRead
=
0
;
if
(
pMedium
)
{
SvStream
*
pIStrm
=
pMedium
->
GetInStream
();
if
(
!
pIStrm
||
SVSTREAM_OK
!=
pIStrm
->
GetError
()
)
return
0
;
sal_uLong
nCurrPos
=
pIStrm
->
Tell
();
nBytesRead
=
pIStrm
->
Read
(
aBuffer
,
nMaxRead
);
pIStrm
->
Seek
(
nCurrPos
);
}
TerminateBuffer
(
aBuffer
,
nBytesRead
,
sizeof
(
aBuffer
));
{
for
(
sal_uInt16
n
=
0
;
n
<
MAXFILTER
;
++
n
)
{
OUString
sNm
(
aFilterDetect
[
n
].
IsReader
(
aBuffer
,
nBytesRead
));
const
SfxFilter
*
pFilterTmp
=
sNm
.
isEmpty
()
?
0
:
SwIoSystem
::
GetFilterOfFormat
(
sNm
,
pFCntnr
);
if
(
pFilterTmp
)
{
return
pFilterTmp
;
}
}
}
// no filter recognized so far; thus check "WORD 4 WORD" Filter
if
(
!
rFileName
.
isEmpty
()
)
{
if
(
pMedium
)
pMedium
->
CloseInStream
();
}
return
SwIoSystem
::
GetTextFilter
(
aBuffer
,
nBytesRead
);
return
SwIoSystem
::
GetFilterOfFormat
(
OUString
::
createFromAscii
(
FILTER_TEXT
),
0
);
}
bool
SwIoSystem
::
IsDetectableText
(
const
sal_Char
*
pBuf
,
sal_uLong
&
rLen
,
...
...
@@ -464,11 +432,4 @@ bool SwIoSystem::IsDetectableText(const sal_Char* pBuf, sal_uLong &rLen,
return
bEncodedFilter
||
(
!
bIsBareUnicode
&&
eSysLE
==
eLineEnd
);
}
const
SfxFilter
*
SwIoSystem
::
GetTextFilter
(
const
sal_Char
*
pBuf
,
sal_uLong
nLen
)
{
bool
bAuto
=
IsDetectableText
(
pBuf
,
nLen
);
const
sal_Char
*
pNm
=
bAuto
?
FILTER_TEXT
:
FILTER_TEXT_DLG
;
return
SwIoSystem
::
GetFilterOfFormat
(
OUString
::
createFromAscii
(
pNm
),
0
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment