[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source
Michael Stahl
mstahl at redhat.com
Fri Apr 21 10:11:04 UTC 2017
sw/source/filter/xml/xmlimp.cxx | 24 ++++++++++++++++++++++++
sw/source/ui/utlui/poolfmt.src | 1 +
xmloff/source/core/xmlexp.cxx | 2 +-
3 files changed, 26 insertions(+), 1 deletion(-)
New commits:
commit 157013219230f251346a5aa662c39d02f15420ec
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Apr 21 11:41:21 2017 +0200
tdf#107211 sw: ODF import: add a horrible hack to import "Default"
... character style for hyperlinks and index-entry-templates.
The problem is that the "Default" character style doesn't actually
exist, it is just displayed in the UI so you can remove a character
style that is set. So for the most part there is no need to store
"Default" in ODF files, except that for hyperlinks the default isn't
"Default" but "Internet Link"/"Visited Internet Link".
Hence it was not really a good idea to rename "Default" to "Default
Style", because when importing existing documents the
text:style-name="Default" is not found, and for new documents
text:style-name="Default_20_Style" is not found either because
there is no style:style element that sets up the mapping between the
encoded style-name and the unencoded display-style-name.
Add some hack in SwXMLBodyContext_Impl::SwXMLBodyContext_Impl(), when
all style:style elements have been read (so we don't override what's
in the document) to create the mapping for "Default", "Default_20_Style"
and whatever the translation of that is.
(regression from 783d13a9276931e274a90b9b53de2c92dc8c055e)
Change-Id: I8a80847571f194204c5df267cb48e826a82328b2
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 1a6c33753775..225850bb13cb 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -50,6 +50,7 @@
#include <poolfmt.hxx>
#include <ndtxt.hxx>
#include <editsh.hxx>
+#include <poolfmt.hrc>
#include "xmlimp.hxx"
#include "xmltexti.hxx"
#include <xmloff/DocumentSettingsContext.hxx>
@@ -133,6 +134,29 @@ SwXMLBodyContext_Impl::SwXMLBodyContext_Impl( SwXMLImport& rImport,
const Reference< xml::sax::XAttributeList > & /*xAttrList*/ ) :
SvXMLImportContext( rImport, nPrfx, rLName )
{
+ // tdf#107211: if at this point we don't have a defined char style "Default"
+ // or "Default Style", add a mapping for it as it is not written
+ // into the file since it's not really a style but "no style"
+ // (hence referencing it actually makes no sense except for hyperlinks
+ // which default to something other than "Default")
+ OUString const sDefault(SW_RES(STR_POOLCOLL_STANDARD));
+ uno::Reference<container::XNameContainer> const& xStyles(
+ rImport.GetTextImport()->GetTextStyles());
+ if (!xStyles->hasByName("Default"))
+ { // this old name was used before LO 4.0
+ rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, "Default", sDefault);
+ }
+ if (!xStyles->hasByName("Default_20_Style"))
+ { // this new name contains a space which is converted to _20_ on export
+ rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, "Default_20_Style", sDefault);
+ }
+ bool isEncoded(false);
+ OUString const defaultEncoded(
+ rImport.GetMM100UnitConverter().encodeStyleName(sDefault, &isEncoded));
+ if (isEncoded && !xStyles->hasByName(defaultEncoded))
+ { // new name may contain a space which is converted to _20_ on export
+ rImport.AddStyleDisplayName(XML_STYLE_FAMILY_TEXT_TEXT, defaultEncoded, sDefault);
+ }
}
SvXMLImportContext *SwXMLBodyContext_Impl::CreateChildContext(
diff --git a/sw/source/ui/utlui/poolfmt.src b/sw/source/ui/utlui/poolfmt.src
index c6efa70a35d2..c0a876b64797 100644
--- a/sw/source/ui/utlui/poolfmt.src
+++ b/sw/source/ui/utlui/poolfmt.src
@@ -155,6 +155,7 @@ String STR_POOLFRM_LABEL
// Template names
+// tdf#107211 please don't change STANDARD, except back to "Default"
String STR_POOLCOLL_STANDARD
{
Text [ en-US ] = "Default Style" ;
commit 4e3d14deb74c57632db57663d2fc2ead9d8aa0f0
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Apr 20 23:50:14 2017 +0200
xmloff: fix typo
Change-Id: I0f354b37afa2492894c1d3ee6a83633c04e1c87a
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 6ca60f723a5d..fc4f740bc0be 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1191,7 +1191,7 @@ void SvXMLExport::ImplExportContent()
CheckAttrList();
{
- SvXMLElementExport aElemrnt( *this, XML_NAMESPACE_OFFICE, XML_BODY,
+ SvXMLElementExport aElement( *this, XML_NAMESPACE_OFFICE, XML_BODY,
true, true );
{
XMLTokenEnum eClass = meClass;
More information about the Libreoffice-commits
mailing list