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
7e314a83
Kaydet (Commit)
7e314a83
authored
Mar 07, 2013
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Some cleanup, comments, and re-organizing...
Change-Id: I5a614ae032149b755d609ff05b9ef2fdb842dadf
üst
96c82514
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
47 deletions
+32
-47
typedetection.cxx
filter/source/config/cache/typedetection.cxx
+32
-47
No files found.
filter/source/config/cache/typedetection.cxx
Dosyayı görüntüle @
7e314a83
...
...
@@ -399,38 +399,9 @@ void printFlatDetectionList(const char* caption, const FlatDetection& types)
return
stlDescriptor
[
comphelper
::
MediaDescriptor
::
PROP_TYPENAME
()].
get
<
rtl
::
OUString
>
();
}
// preselected type or document service? use it as first "flat" detected
// type later!
FlatDetection
lFlatTypes
;
impl_getPreselection
(
aURL
,
stlDescriptor
,
lFlatTypes
);
{
// Get all types that match the URL alone.
FlatDetection
aFlatByURL
;
m_rCache
->
detectFlatForURL
(
aURL
,
aFlatByURL
);
FlatDetection
::
const_iterator
it
=
aFlatByURL
.
begin
(),
itEnd
=
aFlatByURL
.
end
();
for
(;
it
!=
itEnd
;
++
it
)
{
FlatDetection
::
iterator
itPos
=
std
::
find_if
(
lFlatTypes
.
begin
(),
lFlatTypes
.
end
(),
FindByType
(
it
->
sType
));
if
(
itPos
==
lFlatTypes
.
end
())
// Not in the list yet.
lFlatTypes
.
push_back
(
*
it
);
else
{
// Already in the list. Update the flags.
FlatDetectionInfo
&
rInfo
=
*
itPos
;
const
FlatDetectionInfo
&
rThisInfo
=
*
it
;
if
(
rThisInfo
.
bMatchByExtension
)
rInfo
.
bMatchByExtension
=
true
;
if
(
rThisInfo
.
bMatchByPattern
)
rInfo
.
bMatchByPattern
=
true
;
if
(
rThisInfo
.
bPreselectedByDocumentService
)
rInfo
.
bPreselectedByDocumentService
=
true
;
}
}
}
aLock
.
clear
();
// <- SAFE ----------------------------------
...
...
@@ -839,22 +810,7 @@ void TypeDetection::impl_getPreselection(
{
rFlatTypes
.
clear
();
/* #i55122#
Sometimes we must detect files without or with real unknown extensions.
If it does not work /which can happen of course .-)/, the user tried to preselect
the right format. But some special dialogs (e.g. "Insert->Sheet From File")
add it's own preselection too.
So we have a combination of preselected values ...
The we should preferr the most important one - set by the user.
And the user normaly preselects a filter or type. The preslected
document service cames from the dialog.
Further it doesnt matter if the user preselected a filter or a document service.
A filter selection is always more explicit then a document service selection.
So it must be pereferred. An order between type and filter selection cant be discussed .-)
*/
// Get all filters that we have.
OUStringList
aFilterNames
;
try
{
...
...
@@ -867,6 +823,7 @@ void TypeDetection::impl_getPreselection(
return
;
}
// Retrieve the default type for each of these filters, and store them.
for
(
OUStringList
::
const_iterator
it
=
aFilterNames
.
begin
();
it
!=
aFilterNames
.
end
();
++
it
)
{
OUString
aType
=
impl_getTypeFromFilter
(
*
it
);
...
...
@@ -879,15 +836,43 @@ void TypeDetection::impl_getPreselection(
rFlatTypes
.
push_back
(
aInfo
);
}
{
// Get all types that match the URL alone.
FlatDetection
aFlatByURL
;
m_rCache
->
detectFlatForURL
(
aParsedURL
,
aFlatByURL
);
FlatDetection
::
const_iterator
it
=
aFlatByURL
.
begin
(),
itEnd
=
aFlatByURL
.
end
();
for
(;
it
!=
itEnd
;
++
it
)
{
FlatDetection
::
iterator
itPos
=
std
::
find_if
(
rFlatTypes
.
begin
(),
rFlatTypes
.
end
(),
FindByType
(
it
->
sType
));
if
(
itPos
==
rFlatTypes
.
end
())
// Not in the list yet.
rFlatTypes
.
push_back
(
*
it
);
else
{
// Already in the list. Update the flags.
FlatDetectionInfo
&
rInfo
=
*
itPos
;
const
FlatDetectionInfo
&
rThisInfo
=
*
it
;
if
(
rThisInfo
.
bMatchByExtension
)
rInfo
.
bMatchByExtension
=
true
;
if
(
rThisInfo
.
bMatchByPattern
)
rInfo
.
bMatchByPattern
=
true
;
if
(
rThisInfo
.
bPreselectedByDocumentService
)
rInfo
.
bPreselectedByDocumentService
=
true
;
}
}
}
// Remove duplicates.
rFlatTypes
.
sort
(
SortByType
());
rFlatTypes
.
unique
(
EqualByType
());
::
rtl
::
OUString
sSelectedType
=
rDescriptor
.
getUnpackedValueOrDefault
(
::
comphelper
::
MediaDescriptor
::
PROP_TYPENAME
(),
::
rtl
::
OUString
());
// Mark pre-selected type (if any) to have it prioritized.
OUString
sSelectedType
=
rDescriptor
.
getUnpackedValueOrDefault
(
comphelper
::
MediaDescriptor
::
PROP_TYPENAME
(),
OUString
());
if
(
!
sSelectedType
.
isEmpty
())
impl_getPreselectionForType
(
sSelectedType
,
aParsedURL
,
rFlatTypes
,
false
);
::
rtl
::
OUString
sSelectedDoc
=
rDescriptor
.
getUnpackedValueOrDefault
(
::
comphelper
::
MediaDescriptor
::
PROP_DOCUMENTSERVICE
(),
::
rtl
::
OUString
());
// Mark all types preferred by the current document service, to have it prioritized.
OUString
sSelectedDoc
=
rDescriptor
.
getUnpackedValueOrDefault
(
comphelper
::
MediaDescriptor
::
PROP_DOCUMENTSERVICE
(),
OUString
());
if
(
!
sSelectedDoc
.
isEmpty
())
impl_getPreselectionForDocumentService
(
sSelectedDoc
,
aParsedURL
,
rFlatTypes
);
}
...
...
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