diff options
author | Jaskaran Singh <jvsg1303@gmail.com> | 2016-08-01 00:35:48 +0530 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-09-17 18:59:49 +0200 |
commit | e4b848d7767b14b8f7176d26399cd67f253ca9bf (patch) | |
tree | 5fb20efe01e0200315ee0b20ce8f0182a4561225 | |
parent | Link orcus headers and libs to subsequent filters test (diff) | |
download | core-e4b848d7767b14b8f7176d26399cd67f253ca9bf.tar.gz core-e4b848d7767b14b8f7176d26399cd67f253ca9bf.zip |
Change the way url is handled for orcus style import
Change-Id: I6d5f9059f8a83ae5b148ff0498d8af0777acfac8
-rw-r--r-- | sc/source/filter/orcus/orcusfiltersimpl.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh2.cxx | 20 |
3 files changed, 40 insertions, 17 deletions
diff --git a/sc/source/filter/orcus/orcusfiltersimpl.cxx b/sc/source/filter/orcus/orcusfiltersimpl.cxx index e16cc7f1e077..66a9ca29efab 100644 --- a/sc/source/filter/orcus/orcusfiltersimpl.cxx +++ b/sc/source/filter/orcus/orcusfiltersimpl.cxx @@ -147,22 +147,9 @@ bool ScOrcusFiltersImpl::importODS(ScDocument& rDoc, SfxMedium& rMedium) const return true; } -bool ScOrcusFiltersImpl::importODS_Styles(ScDocument& rDoc, OUString& aFileName) const +bool ScOrcusFiltersImpl::importODS_Styles(ScDocument& rDoc, OUString& aPath) 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); + OString aUrl = OUStringToOString(aPath, RTL_TEXTENCODING_UTF8); const char* path = aUrl.getStr(); try diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c36489663afb..62e2a8d49d0c 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -27,6 +27,7 @@ #include <vcl/msgbox.hxx> #include <vcl/virdev.hxx> #include <vcl/waitobj.hxx> +#include <rtl/bootstrap.hxx> #include <svl/PasswordHelper.hxx> #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> @@ -111,6 +112,7 @@ #include "refreshtimerprotector.hxx" #include <orcus/orcus_import_ods.hpp> #include <orcusfiltersimpl.hxx> +#include <config_orcus.h> #include <officecfg/Office/Calc.hxx> #include <comphelper/processfactory.hxx> @@ -588,13 +590,29 @@ bool ScDocShell::Load( SfxMedium& rMedium ) aDocument.GetStyleSheetPool()->CreateStandardStyles(); aDocument.UpdStlShtPtrsFrmNms(); + #if ENABLE_ORCUS /* Create styles that are imported through Orcus */ + 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]); + OUString aFileName = "styles.xml"; + aValidPath += aFileName; + ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters(); if (!pOrcus) return false; - pOrcus->importODS_Styles(aDocument, aFileName); + pOrcus->importODS_Styles(aDocument, aValidPath); + #endif bRet = LoadXML( &rMedium, nullptr ); } diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 04989b092810..46adfa8c187e 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -18,12 +18,14 @@ */ #include "scitems.hxx" +#include <rtl/bootstrap.hxx> #include <svx/drawitem.hxx> #include <svl/asiancfg.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <editeng/unolingu.hxx> #include <orcus/orcus_import_ods.hpp> #include <orcusfiltersimpl.hxx> +#include <config_orcus.h> #include "drwlayer.hxx" #include "stlpool.hxx" @@ -56,13 +58,29 @@ bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) aDocument.GetStyleSheetPool()->CreateStandardStyles(); aDocument.UpdStlShtPtrsFrmNms(); + #if ENABLE_ORCUS /* Create styles that are imported through Orcus */ + 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]); + OUString aFileName = "styles.xml"; + aValidPath += aFileName; + ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters(); if (!pOrcus) return false; - pOrcus->importODS_Styles(aDocument, aFileName); + pOrcus->importODS_Styles(aDocument, aValidPath); + #endif // SetDocumentModified is not allowed anymore in Load/InitNew! InitItems(); |