[Libreoffice-commits] core.git: sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Sep 6 00:19:13 UTC 2018
sc/source/filter/inc/orcusinterface.hxx | 5 +++--
sc/source/filter/orcus/interface.cxx | 21 +++++++++++++--------
sc/source/filter/orcus/orcusfiltersimpl.cxx | 2 +-
3 files changed, 17 insertions(+), 11 deletions(-)
New commits:
commit 7f43f0b50135e147fb2bb1f942da3bf60153fd2c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
AuthorDate: Wed Sep 5 19:04:42 2018 -0400
Commit: Kohei Yoshida <libreoffice at kohei.us>
CommitDate: Thu Sep 6 02:18:48 2018 +0200
tdf#116453: One less argument to pass to ScOrcusStyles.
You can access ScDocument via ScOrcusFactory. There should be no
functionality change.
Change-Id: Ia679b6b006cc60bf24ca11432909682fa527b034
Reviewed-on: https://gerrit.libreoffice.org/60063
Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
Tested-by: Kohei Yoshida <libreoffice at kohei.us>
diff --git a/sc/source/filter/inc/orcusinterface.hxx b/sc/source/filter/inc/orcusinterface.hxx
index cca677f9435c..4db5e1c9cd4c 100644
--- a/sc/source/filter/inc/orcusinterface.hxx
+++ b/sc/source/filter/inc/orcusinterface.hxx
@@ -347,7 +347,6 @@ class ScOrcusStyles : public orcus::spreadsheet::iface::import_styles
{
private:
ScOrcusFactory& mrFactory;
- ScDocument& mrDoc;
struct font
{
@@ -478,7 +477,7 @@ private:
void applyXfToItemSet(SfxItemSet& rSet, const xf& rXf);
public:
- ScOrcusStyles( ScOrcusFactory& rFactory, ScDocument& rDoc, bool bSkipDefaultStyles=false );
+ ScOrcusStyles( ScOrcusFactory& rFactory, bool bSkipDefaultStyles=false );
void applyXfToItemSet(SfxItemSet& rSet, size_t xfId);
@@ -642,6 +641,8 @@ public:
virtual orcus::spreadsheet::iface::import_styles* get_styles() override;
virtual void finalize() override;
+ ScDocumentImport& getDoc();
+
size_t appendString(const OUString& rStr);
size_t addString(const OUString& rStr);
const OUString* getString(size_t nIndex) const;
diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx
index 44dc12201531..cbabe68da023 100644
--- a/sc/source/filter/orcus/interface.cxx
+++ b/sc/source/filter/orcus/interface.cxx
@@ -283,7 +283,7 @@ ScOrcusFactory::ScOrcusFactory(ScDocument& rDoc, bool bSkipDefaultStyles) :
maGlobalSettings(maDoc),
maSharedStrings(*this),
maNamedExpressions(maDoc, maGlobalSettings),
- maStyles(*this, rDoc, bSkipDefaultStyles),
+ maStyles(*this, bSkipDefaultStyles),
mnProgress(0) {}
orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet(
@@ -497,6 +497,11 @@ void ScOrcusFactory::finalize()
maDoc.finalize();
}
+ScDocumentImport& ScOrcusFactory::getDoc()
+{
+ return maDoc;
+}
+
size_t ScOrcusFactory::appendString(const OUString& rStr)
{
size_t nPos = maStrings.size();
@@ -1261,12 +1266,12 @@ size_t ScOrcusSharedStrings::commit_segments()
OStringToOUString(aStr, mrFactory.getGlobalSettings().getTextEncoding()));
}
-ScOrcusStyles::ScOrcusStyles( ScOrcusFactory& rFactory, ScDocument& rDoc, bool bSkipDefaultStyles ) :
- mrFactory(rFactory),
- mrDoc(rDoc)
+ScOrcusStyles::ScOrcusStyles( ScOrcusFactory& rFactory, bool bSkipDefaultStyles ) :
+ mrFactory(rFactory)
{
- if (!bSkipDefaultStyles && !mrDoc.GetStyleSheetPool()->HasStandardStyles())
- mrDoc.GetStyleSheetPool()->CreateStandardStyles();
+ ScDocument& rDoc = rFactory.getDoc().getDoc();
+ if (!bSkipDefaultStyles && !rDoc.GetStyleSheetPool()->HasStandardStyles())
+ rDoc.GetStyleSheetPool()->CreateStandardStyles();
}
ScOrcusStyles::font::font():
@@ -1526,7 +1531,7 @@ void ScOrcusStyles::applyXfToItemSet(SfxItemSet& rSet, const xf& rXf)
}
const number_format& rFormat = maNumberFormats[nNumberFormatId];
if (rFormat.mbHasNumberFormatAttr)
- rFormat.applyToItemSet(rSet, mrDoc);
+ rFormat.applyToItemSet(rSet, mrFactory.getDoc().getDoc());
if(rXf.mbAlignment)
{
@@ -2134,7 +2139,7 @@ size_t ScOrcusStyles::commit_cell_style()
return 0;
}
- ScStyleSheetPool* pPool = mrDoc.GetStyleSheetPool();
+ ScStyleSheetPool* pPool = mrFactory.getDoc().getDoc().GetStyleSheetPool();
SfxStyleSheetBase& rBase = pPool->Make(maCurrentCellStyle.maName, SfxStyleFamily::Para);
rBase.SetParent(maCurrentCellStyle.maParentName);
SfxItemSet& rSet = rBase.GetItemSet();
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx
index 808a99033fde..c55fd7535d3d 100644
--- a/sc/source/filter/orcus/orcusfiltersimpl.cxx
+++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx
@@ -145,7 +145,7 @@ bool ScOrcusFiltersImpl::importODS_Styles(ScDocument& rDoc, OUString& aPath) con
{
std::string content = orcus::load_file_content(path);
ScOrcusFactory aFactory(rDoc);
- ScOrcusStyles aStyles(aFactory, rDoc);
+ ScOrcusStyles aStyles(aFactory);
orcus::import_ods::read_styles(content.c_str(), content.size(), &aStyles);
}
catch (const std::exception& e)
More information about the Libreoffice-commits
mailing list