diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-08-23 00:51:47 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-09-18 00:15:22 +0200 |
commit | 53ece9928587fedc93231a8f730455d638663296 (patch) | |
tree | 80f3147f66e3bb663033d982f7c5e2ff0c611b0a | |
parent | 1c54582a045ccd434e7c4e0cadb7275468c6a53c (diff) |
place the calc default style file in the share folder
Change-Id: I1b8bfee1abf82c5a55cbfc5c1674b115cdfe63b8
-rw-r--r-- | sc/Package_res_xml.mk | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh2.cxx | 25 |
3 files changed, 21 insertions, 33 deletions
diff --git a/sc/Package_res_xml.mk b/sc/Package_res_xml.mk index 1a25a66f451b..383e8d598781 100644 --- a/sc/Package_res_xml.mk +++ b/sc/Package_res_xml.mk @@ -9,7 +9,7 @@ $(eval $(call gb_Package_Package,sc_res_xml,$(SRCDIR)/sc/res/xml)) -$(eval $(call gb_Package_add_files,sc_res_xml,$(LIBO_BIN_FOLDER),\ +$(eval $(call gb_Package_add_files,sc_res_xml,$(LIBO_SHARE_FOLDER)/calc,\ styles.xml \ )) diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 62e2a8d49d0c..099278631387 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -39,6 +39,7 @@ #include <svl/documentlockfile.hxx> #include <svl/sharecontrolfile.hxx> #include <svl/urihelper.hxx> +#include <osl/file.hxx> #include "chgtrack.hxx" #include "chgviset.hxx" #include <com/sun/star/awt/Key.hpp> @@ -62,6 +63,8 @@ #include <com/sun/star/frame/XStorable2.hpp> #include <com/sun/star/frame/Desktop.hpp> +#include <config_folders.h> + #include "scabstdlg.hxx" #include <sot/formats.hxx> @@ -590,29 +593,21 @@ bool ScDocShell::Load( SfxMedium& rMedium ) aDocument.GetStyleSheetPool()->CreateStandardStyles(); aDocument.UpdStlShtPtrsFrmNms(); - #if ENABLE_ORCUS +#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 aURL("$BRAND_BASE_DIR" LIBO_SHARE_FOLDER "/calc/styles.xml"); + rtl::Bootstrap::expandMacros(aURL); - OUString aFileName = "styles.xml"; - aValidPath += aFileName; + OUString aPath; + osl::FileBase::getSystemPathFromFileURL(aURL, aPath); ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters(); if (!pOrcus) return false; - pOrcus->importODS_Styles(aDocument, aValidPath); - #endif + + pOrcus->importODS_Styles(aDocument, aPath); +#endif bRet = LoadXML( &rMedium, nullptr ); } diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 46adfa8c187e..358732ae229d 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -19,6 +19,7 @@ #include "scitems.hxx" #include <rtl/bootstrap.hxx> +#include <osl/file.hxx> #include <svx/drawitem.hxx> #include <svl/asiancfg.hxx> #include <editeng/forbiddencharacterstable.hxx> @@ -26,6 +27,7 @@ #include <orcus/orcus_import_ods.hpp> #include <orcusfiltersimpl.hxx> #include <config_orcus.h> +#include <config_folders.h> #include "drwlayer.hxx" #include "stlpool.hxx" @@ -58,29 +60,20 @@ bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) aDocument.GetStyleSheetPool()->CreateStandardStyles(); aDocument.UpdStlShtPtrsFrmNms(); - #if ENABLE_ORCUS +#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; + OUString aURL("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/calc/styles.xml"); + rtl::Bootstrap::expandMacros(aURL); - /* 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; + OUString aPath; + osl::FileBase::getSystemPathFromFileURL(aURL, aPath); ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters(); if (!pOrcus) return false; - pOrcus->importODS_Styles(aDocument, aValidPath); - #endif + pOrcus->importODS_Styles(aDocument, aPath); +#endif // SetDocumentModified is not allowed anymore in Load/InitNew! InitItems(); |