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
69c03000
Kaydet (Commit)
69c03000
authored
Ock 17, 2017
tarafından
David Tardon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
eliminate some code duplicity
Change-Id: I7792ddd691f81744971d45e1155e3192b24155dc
üst
05ce36d2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
44 deletions
+49
-44
DirectoryStream.hxx
writerperfect/inc/DirectoryStream.hxx
+3
-0
DirectoryStreamTest.cxx
writerperfect/qa/unit/DirectoryStreamTest.cxx
+4
-34
DirectoryStream.cxx
writerperfect/source/common/DirectoryStream.cxx
+38
-0
KeynoteImportFilter.cxx
writerperfect/source/impress/KeynoteImportFilter.cxx
+4
-10
No files found.
writerperfect/inc/DirectoryStream.hxx
Dosyayı görüntüle @
69c03000
...
@@ -41,6 +41,9 @@ public:
...
@@ -41,6 +41,9 @@ public:
virtual
~
DirectoryStream
()
override
;
virtual
~
DirectoryStream
()
override
;
static
bool
isDirectory
(
const
css
::
uno
::
Reference
<
css
::
ucb
::
XContent
>
&
xContent
);
static
bool
isDirectory
(
const
css
::
uno
::
Reference
<
css
::
ucb
::
XContent
>
&
xContent
);
static
std
::
unique_ptr
<
DirectoryStream
>
createForParent
(
const
css
::
uno
::
Reference
<
css
::
ucb
::
XContent
>
&
xContent
);
const
css
::
uno
::
Reference
<
css
::
ucb
::
XContent
>
getContent
()
const
;
virtual
bool
isStructured
()
override
;
virtual
bool
isStructured
()
override
;
virtual
unsigned
subStreamCount
()
override
;
virtual
unsigned
subStreamCount
()
override
;
...
...
writerperfect/qa/unit/DirectoryStreamTest.cxx
Dosyayı görüntüle @
69c03000
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include <test/bootstrapfixture.hxx>
#include <test/bootstrapfixture.hxx>
#include <DirectoryStream.hxx>
#include <DirectoryStream.hxx>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/ucb/XContent.hpp>
namespace
ucb
=
com
::
sun
::
star
::
ucb
;
namespace
ucb
=
com
::
sun
::
star
::
ucb
;
...
@@ -64,35 +63,6 @@ static const char g_aDirPath[] = "/writerperfect/qa/unit/data/stream/test.dir";
...
@@ -64,35 +63,6 @@ static const char g_aDirPath[] = "/writerperfect/qa/unit/data/stream/test.dir";
static
const
char
g_aNondirPath
[]
=
"/writerperfect/qa/unit/data/stream/test.dir/mimetype"
;
static
const
char
g_aNondirPath
[]
=
"/writerperfect/qa/unit/data/stream/test.dir/mimetype"
;
static
const
char
g_aNonexistentPath
[]
=
"/writerperfect/qa/unit/data/stream/foo/bar"
;
static
const
char
g_aNonexistentPath
[]
=
"/writerperfect/qa/unit/data/stream/foo/bar"
;
std
::
unique_ptr
<
DirectoryStream
>
createForParent
(
const
css
::
uno
::
Reference
<
css
::
ucb
::
XContent
>
&
xContent
)
{
try
{
if
(
!
xContent
.
is
())
return
nullptr
;
unique_ptr
<
DirectoryStream
>
pDir
;
const
uno
::
Reference
<
css
::
container
::
XChild
>
xChild
(
xContent
,
uno
::
UNO_QUERY
);
if
(
xChild
.
is
())
{
const
uno
::
Reference
<
ucb
::
XContent
>
xDirContent
(
xChild
->
getParent
(),
uno
::
UNO_QUERY
);
if
(
xDirContent
.
is
())
{
pDir
=
o3tl
::
make_unique
<
DirectoryStream
>
(
xDirContent
);
if
(
!
pDir
->
isStructured
())
pDir
.
reset
();
}
}
return
pDir
;
}
catch
(...)
{
return
nullptr
;
}
}
DirectoryStreamTest
::
DirectoryStreamTest
()
DirectoryStreamTest
::
DirectoryStreamTest
()
{
{
const
uno
::
Reference
<
ucb
::
XCommandEnvironment
>
xCmdEnv
;
const
uno
::
Reference
<
ucb
::
XCommandEnvironment
>
xCmdEnv
;
...
@@ -107,17 +77,17 @@ DirectoryStreamTest::DirectoryStreamTest()
...
@@ -107,17 +77,17 @@ DirectoryStreamTest::DirectoryStreamTest()
void
DirectoryStreamTest
::
testConstruction
()
void
DirectoryStreamTest
::
testConstruction
()
{
{
const
unique_ptr
<
DirectoryStream
>
pDir
(
createForParent
(
m_xFile
));
const
unique_ptr
<
DirectoryStream
>
pDir
(
DirectoryStream
::
createForParent
(
m_xFile
));
CPPUNIT_ASSERT
(
bool
(
pDir
));
CPPUNIT_ASSERT
(
bool
(
pDir
));
CPPUNIT_ASSERT
(
pDir
->
isStructured
());
CPPUNIT_ASSERT
(
pDir
->
isStructured
());
// this should work for dirs too
// this should work for dirs too
const
unique_ptr
<
DirectoryStream
>
pDir2
(
createForParent
(
m_xDir
));
const
unique_ptr
<
DirectoryStream
>
pDir2
(
DirectoryStream
::
createForParent
(
m_xDir
));
CPPUNIT_ASSERT
(
bool
(
pDir2
));
CPPUNIT_ASSERT
(
bool
(
pDir2
));
CPPUNIT_ASSERT
(
pDir2
->
isStructured
());
CPPUNIT_ASSERT
(
pDir2
->
isStructured
());
// for nonexistent dirs nothing is created
// for nonexistent dirs nothing is created
const
unique_ptr
<
DirectoryStream
>
pNondir
(
createForParent
(
m_xNonexistent
));
const
unique_ptr
<
DirectoryStream
>
pNondir
(
DirectoryStream
::
createForParent
(
m_xNonexistent
));
CPPUNIT_ASSERT
(
!
pNondir
);
CPPUNIT_ASSERT
(
!
pNondir
);
// even if we try harder, just an empty shell is created
// even if we try harder, just an empty shell is created
...
@@ -169,7 +139,7 @@ void DirectoryStreamTest::testStructuredOperations()
...
@@ -169,7 +139,7 @@ void DirectoryStreamTest::testStructuredOperations()
DirectoryStream
aDir
(
m_xDir
);
DirectoryStream
aDir
(
m_xDir
);
lcl_testStructuredOperations
(
aDir
);
lcl_testStructuredOperations
(
aDir
);
unique_ptr
<
DirectoryStream
>
pDir
(
createForParent
(
m_xFile
));
unique_ptr
<
DirectoryStream
>
pDir
(
DirectoryStream
::
createForParent
(
m_xFile
));
CPPUNIT_ASSERT
(
bool
(
pDir
));
CPPUNIT_ASSERT
(
bool
(
pDir
));
lcl_testStructuredOperations
(
*
pDir
.
get
());
lcl_testStructuredOperations
(
*
pDir
.
get
());
}
}
...
...
writerperfect/source/common/DirectoryStream.cxx
Dosyayı görüntüle @
69c03000
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/processfactory.hxx>
#include <o3tl/make_unique.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustring.hxx>
#include <ucbhelper/content.hxx>
#include <ucbhelper/content.hxx>
...
@@ -128,6 +130,42 @@ bool DirectoryStream::isDirectory(const css::uno::Reference<css::ucb::XContent>
...
@@ -128,6 +130,42 @@ bool DirectoryStream::isDirectory(const css::uno::Reference<css::ucb::XContent>
}
}
}
}
std
::
unique_ptr
<
DirectoryStream
>
DirectoryStream
::
createForParent
(
const
css
::
uno
::
Reference
<
css
::
ucb
::
XContent
>
&
xContent
)
{
try
{
if
(
!
xContent
.
is
())
return
nullptr
;
std
::
unique_ptr
<
DirectoryStream
>
pDir
;
const
uno
::
Reference
<
css
::
container
::
XChild
>
xChild
(
xContent
,
uno
::
UNO_QUERY
);
if
(
xChild
.
is
())
{
const
uno
::
Reference
<
ucb
::
XContent
>
xDirContent
(
xChild
->
getParent
(),
uno
::
UNO_QUERY
);
if
(
xDirContent
.
is
())
{
pDir
=
o3tl
::
make_unique
<
DirectoryStream
>
(
xDirContent
);
if
(
!
pDir
->
isStructured
())
pDir
.
reset
();
}
}
return
pDir
;
}
catch
(...)
{
return
nullptr
;
}
}
const
css
::
uno
::
Reference
<
css
::
ucb
::
XContent
>
DirectoryStream
::
getContent
()
const
{
if
(
!
m_pImpl
)
return
css
::
uno
::
Reference
<
css
::
ucb
::
XContent
>
();
return
m_pImpl
->
xContent
;
}
bool
DirectoryStream
::
isStructured
()
bool
DirectoryStream
::
isStructured
()
{
{
if
(
!
m_pImpl
)
if
(
!
m_pImpl
)
...
...
writerperfect/source/impress/KeynoteImportFilter.cxx
Dosyayı görüntüle @
69c03000
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
#include <memory>
#include <memory>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/ucb/XContent.hpp>
...
@@ -48,7 +47,6 @@ using writerperfect::DocumentHandler;
...
@@ -48,7 +47,6 @@ using writerperfect::DocumentHandler;
using
writerperfect
::
WPXSvInputStream
;
using
writerperfect
::
WPXSvInputStream
;
namespace
beans
=
com
::
sun
::
star
::
beans
;
namespace
beans
=
com
::
sun
::
star
::
beans
;
namespace
container
=
com
::
sun
::
star
::
container
;
namespace
ucb
=
com
::
sun
::
star
::
ucb
;
namespace
ucb
=
com
::
sun
::
star
::
ucb
;
bool
KeynoteImportFilter
::
doImportDocument
(
librevenge
::
RVNGInputStream
&
rInput
,
OdpGenerator
&
rGenerator
,
utl
::
MediaDescriptor
&
)
bool
KeynoteImportFilter
::
doImportDocument
(
librevenge
::
RVNGInputStream
&
rInput
,
OdpGenerator
&
rGenerator
,
utl
::
MediaDescriptor
&
)
...
@@ -159,16 +157,13 @@ OUString SAL_CALL KeynoteImportFilter::detect(css::uno::Sequence< css::beans::Pr
...
@@ -159,16 +157,13 @@ OUString SAL_CALL KeynoteImportFilter::detect(css::uno::Sequence< css::beans::Pr
if
(
bIsPackage
)
// we passed a directory stream, but the filter claims it's APXL file?
if
(
bIsPackage
)
// we passed a directory stream, but the filter claims it's APXL file?
return
OUString
();
return
OUString
();
const
Reference
<
container
::
XChild
>
xChild
(
xContent
,
UNO_QUERY
);
const
std
::
shared_ptr
<
writerperfect
::
DirectoryStream
>
pDir
=
writerperfect
::
DirectoryStream
::
createForParent
(
xContent
);
if
(
xChild
.
is
())
input
=
pDir
;
if
(
bool
(
input
))
{
{
const
Reference
<
ucb
::
XContent
>
xPackageContent
(
xChild
->
getParent
(),
UNO_QUERY
);
if
(
xPackageContent
.
is
())
{
input
.
reset
(
new
writerperfect
::
DirectoryStream
(
xPackageContent
));
if
(
libetonyek
::
EtonyekDocument
::
CONFIDENCE_EXCELLENT
==
libetonyek
::
EtonyekDocument
::
isSupported
(
input
.
get
()))
if
(
libetonyek
::
EtonyekDocument
::
CONFIDENCE_EXCELLENT
==
libetonyek
::
EtonyekDocument
::
isSupported
(
input
.
get
()))
{
{
xContent
=
xPackageContent
;
xContent
=
pDir
->
getContent
()
;
bUCBContentChanged
=
true
;
bUCBContentChanged
=
true
;
bIsPackage
=
true
;
bIsPackage
=
true
;
}
}
...
@@ -180,7 +175,6 @@ OUString SAL_CALL KeynoteImportFilter::detect(css::uno::Sequence< css::beans::Pr
...
@@ -180,7 +175,6 @@ OUString SAL_CALL KeynoteImportFilter::detect(css::uno::Sequence< css::beans::Pr
}
}
}
}
}
}
}
// we do not need to insert ComponentData if this is not a package
// we do not need to insert ComponentData if this is not a package
if
(
!
bIsPackage
&&
(
nComponentDataLocation
==
-
1
))
if
(
!
bIsPackage
&&
(
nComponentDataLocation
==
-
1
))
...
...
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