summaryrefslogtreecommitdiffstats
path: root/sc/source/ui/docshell/docsh.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/docshell/docsh.cxx')
-rw-r--r--sc/source/ui/docshell/docsh.cxx20
1 files changed, 19 insertions, 1 deletions
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 );
}