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
2aea6d51
Kaydet (Commit)
2aea6d51
authored
Tem 12, 2016
tarafından
Jaskaran Singh
Kaydeden (comit)
Markus Mohrhard
Eyl 17, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add a method to import ODF styles via orcus
Change-Id: Id76593bbb9982ec6745737ade800ae669e8e4471
üst
7911f21c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletion
+47
-1
orcusfilters.hxx
sc/inc/orcusfilters.hxx
+6
-0
orcusfiltersimpl.hxx
sc/source/filter/inc/orcusfiltersimpl.hxx
+2
-0
orcusfiltersimpl.cxx
sc/source/filter/orcus/orcusfiltersimpl.cxx
+39
-1
No files found.
sc/inc/orcusfilters.hxx
Dosyayı görüntüle @
2aea6d51
...
@@ -35,6 +35,12 @@ public:
...
@@ -35,6 +35,12 @@ public:
virtual
bool
importODS
(
ScDocument
&
rDoc
,
SfxMedium
&
rMedium
)
const
=
0
;
virtual
bool
importODS
(
ScDocument
&
rDoc
,
SfxMedium
&
rMedium
)
const
=
0
;
/**
* Used to import just the styles from an xml file.
*/
virtual
bool
importODS_Styles
(
ScDocument
&
rDoc
,
OUString
&
aFileName
)
const
=
0
;
/**
/**
* Create a context for XML file. The context object stores session
* Create a context for XML file. The context object stores session
* information for each unique XML file. You must create a new context
* information for each unique XML file. You must create a new context
...
...
sc/source/filter/inc/orcusfiltersimpl.hxx
Dosyayı görüntüle @
2aea6d51
...
@@ -25,6 +25,8 @@ public:
...
@@ -25,6 +25,8 @@ public:
virtual
bool
importXLSX
(
ScDocument
&
rDoc
,
SfxMedium
&
rMedium
)
const
override
;
virtual
bool
importXLSX
(
ScDocument
&
rDoc
,
SfxMedium
&
rMedium
)
const
override
;
virtual
bool
importODS
(
ScDocument
&
rDoc
,
SfxMedium
&
rMedium
)
const
override
;
virtual
bool
importODS
(
ScDocument
&
rDoc
,
SfxMedium
&
rMedium
)
const
override
;
virtual
bool
importODS_Styles
(
ScDocument
&
rDoc
,
OUString
&
aFileName
)
const
override
;
virtual
ScOrcusXMLContext
*
createXMLContext
(
ScDocument
&
rDoc
,
const
OUString
&
rPath
)
const
override
;
virtual
ScOrcusXMLContext
*
createXMLContext
(
ScDocument
&
rDoc
,
const
OUString
&
rPath
)
const
override
;
};
};
...
...
sc/source/filter/orcus/orcusfiltersimpl.cxx
Dosyayı görüntüle @
2aea6d51
...
@@ -17,14 +17,19 @@
...
@@ -17,14 +17,19 @@
#include <sfx2/frame.hxx>
#include <sfx2/frame.hxx>
#include <sfx2/sfxsids.hrc>
#include <sfx2/sfxsids.hrc>
#include <svl/itemset.hxx>
#include <svl/itemset.hxx>
#include <rtl/bootstrap.hxx>
#include <rtl/ustring.hxx>
#include <comphelper/string.hxx>
#include <orcus/spreadsheet/import_interface.hpp>
#include <orcus/spreadsheet/import_interface.hpp>
#include <orcus/orcus_csv.hpp>
#include <orcus/orcus_csv.hpp>
#include <orcus/orcus_gnumeric.hpp>
#include <orcus/orcus_gnumeric.hpp>
#include <orcus/orcus_xlsx.hpp>
#include <orcus/orcus_xlsx.hpp>
#include <orcus/orcus_ods.hpp>
#include <orcus/orcus_ods.hpp>
#include <orcus/orcus_import_ods.hpp>
#include <orcus/global.hpp>
#include <orcus/global.hpp>
#include <orcus/stream.hpp>
#include <orcus/orcus_import_ods.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#ifdef _WIN32
#ifdef _WIN32
...
@@ -142,6 +147,39 @@ bool ScOrcusFiltersImpl::importODS(ScDocument& rDoc, SfxMedium& rMedium) const
...
@@ -142,6 +147,39 @@ bool ScOrcusFiltersImpl::importODS(ScDocument& rDoc, SfxMedium& rMedium) const
return
true
;
return
true
;
}
}
bool
ScOrcusFiltersImpl
::
importODS_Styles
(
ScDocument
&
rDoc
,
OUString
&
aFileName
)
const
{
OUString
aPath
(
"$BRAND_BASE_DIR/"
);
/* Read the comment below before changing this */
rtl
::
Bootstrap
::
expandMacros
(
aPath
);
OUString
aValidPath
;
/* The Following loop trims 'file://' from start of string and
* '../' from the end of string. If you ever happen to change the above macro
* please consider changing the following range too, otherwise app would
* crash!!
*/
for
(
sal_Int32
i
=
7
;
i
<
aPath
.
getLength
()
-
3
;
++
i
)
aValidPath
+=
OUString
(
aPath
[
i
]);
aValidPath
+=
aFileName
;
OString
aUrl
=
OUStringToOString
(
aValidPath
,
RTL_TEXTENCODING_UTF8
);
const
char
*
path
=
aUrl
.
getStr
();
try
{
std
::
string
content
=
orcus
::
load_file_content
(
path
);
ScOrcusStyles
styles
(
rDoc
);
orcus
::
import_ods
::
read_styles
(
content
.
c_str
(),
content
.
size
(),
&
styles
);
}
catch
(
const
std
::
exception
&
e
)
{
SAL_WARN
(
"sc"
,
"Unable to load styles from xml file! "
<<
e
.
what
());
return
false
;
}
return
true
;
}
ScOrcusXMLContext
*
ScOrcusFiltersImpl
::
createXMLContext
(
ScDocument
&
rDoc
,
const
OUString
&
rPath
)
const
ScOrcusXMLContext
*
ScOrcusFiltersImpl
::
createXMLContext
(
ScDocument
&
rDoc
,
const
OUString
&
rPath
)
const
{
{
return
new
ScOrcusXMLContextImpl
(
rDoc
,
rPath
);
return
new
ScOrcusXMLContextImpl
(
rDoc
,
rPath
);
...
...
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