place the calc default style file in the share folder

Change-Id: I1b8bfee1abf82c5a55cbfc5c1674b115cdfe63b8
This commit is contained in:
Markus Mohrhard 2016-08-23 00:51:47 +02:00
parent 1c54582a04
commit 53ece99285
3 changed files with 21 additions and 33 deletions

View file

@ -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 \
))

View file

@ -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>
@ -593,25 +596,17 @@ bool ScDocShell::Load( SfxMedium& rMedium )
#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);
pOrcus->importODS_Styles(aDocument, aPath);
#endif
bRet = LoadXML( &rMedium, nullptr );

View file

@ -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"
@ -61,25 +63,16 @@ bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
#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);
pOrcus->importODS_Styles(aDocument, aPath);
#endif
// SetDocumentModified is not allowed anymore in Load/InitNew!