[Libreoffice-commits] core.git: 3 commits - sw/qa sw/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Dec 11 10:19:05 PST 2014
sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 5 +++
sw/source/filter/ww8/docxexport.cxx | 13 +++++++++
writerfilter/source/dmapper/SettingsTable.cxx | 24 +++++++++++++++++
writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx | 6 ----
4 files changed, 42 insertions(+), 6 deletions(-)
New commits:
commit 5a410df4ff5edd9ea2fbe5469084bb0e8b57bd1c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Dec 11 19:18:06 2014 +0100
DOCX export: handle <w:autoHyphenation/>
Change-Id: Ie4bb2b3bf7d2df58c30a54ded68f7b932c2111ed
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 923a82f..d2a4c7f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -462,6 +462,11 @@ DECLARE_OOXMLEXPORT_TEST(testfdo78599,"fdo78599.docx")
return;
//docx file after RT is getting corrupted.
assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink/w:r[6]/w:fldChar", "fldCharType", "end" );
+
+ // Check for automatic hyphenation
+ if (xmlDocPtr pSettingsXml = parseExport("word/settings.xml"))
+ // This failed as w:settings had no w:autoHyphenation child.
+ assertXPath(pSettingsXml, "/w:settings/w:autoHyphenation");
}
DECLARE_OOXMLEXPORT_TEST(testfdo78886, "fdo78886.docx")
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 6cb7d80..48ebe66 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -43,6 +43,7 @@
#include <IMark.hxx>
#include <IDocumentSettingAccess.hxx>
#include <IDocumentLayoutAccess.hxx>
+#include <IDocumentStylePoolAccess.hxx>
#include <docsh.hxx>
#include <ndtxt.hxx>
#include <wrtww8.hxx>
@@ -58,6 +59,7 @@
#include <editeng/editobj.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/brushitem.hxx>
+#include <editeng/hyphenzoneitem.hxx>
#include <docary.hxx>
#include <numrule.hxx>
@@ -849,6 +851,17 @@ void DocxExport::WriteSettings()
pFS->singleElementNS( XML_w, XML_defaultTabStop, FSNS( XML_w, XML_val ),
OString::number( m_aSettings.defaultTabStop).getStr(), FSEND );
+ // Automatic hyphenation: it's a global setting in Word, it's a paragraph setting in Writer.
+ // Use the setting from the default style.
+ SwTxtFmtColl* pColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, /*bRegardLanguage=*/false);
+ const SfxPoolItem* pItem;
+ if (pColl && SfxItemState::SET == pColl->GetItemState(RES_PARATR_HYPHENZONE, false, &pItem))
+ {
+ pFS->singleElementNS(XML_w, XML_autoHyphenation,
+ FSNS(XML_w, XML_val), OString::boolean(static_cast<const SvxHyphenZoneItem*>(pItem)->IsHyphen()),
+ FSEND);
+ }
+
// Even and Odd Headers
if( m_aSettings.evenAndOddHeaders )
pFS->singleElementNS( XML_w, XML_evenAndOddHeaders, FSEND );
commit d93d09c5065cf4342402b6f4e1216406d3cf9b24
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Dec 11 18:10:28 2014 +0100
DOCX import: handle <w:autoHyphenation/>
It's the OOXML equivalent of the fAutoHyphen DOP flag from [MS-DOC].
Change-Id: Iae66dcd0d350ce4ebee3c3493ee07eff0d9a5e1d
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index dd2cef5..76dff4c 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -21,6 +21,10 @@
#include <rtl/ustring.hxx>
#include <resourcemodel/ResourceModelHelper.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <SettingsTable.hxx>
#include <ooxml/resourceids.hxx>
#include <ConversionHelper.hxx>
@@ -75,6 +79,7 @@ struct SettingsTable_Impl
bool embedSystemFonts;
bool m_bDoNotUseHTMLParagraphAutoSpacing;
bool m_bNoColumnBalance;
+ bool m_bAutoHyphenation;
bool m_bSplitPgBreakAndParaMark;
bool m_bMirrorMargin;
uno::Sequence<beans::PropertyValue> m_pThemeFontLangProps;
@@ -106,6 +111,7 @@ struct SettingsTable_Impl
, embedSystemFonts(false)
, m_bDoNotUseHTMLParagraphAutoSpacing(false)
, m_bNoColumnBalance(false)
+ , m_bAutoHyphenation(false)
, m_bSplitPgBreakAndParaMark(false)
, m_bMirrorMargin(false)
, m_pThemeFontLangProps(3)
@@ -281,6 +287,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_CT_Compat_noColumnBalance:
m_pImpl->m_bNoColumnBalance = nIntValue;
break;
+ case NS_ooxml::LN_CT_Settings_autoHyphenation:
+ m_pImpl->m_bAutoHyphenation = nIntValue;
+ break;
default:
{
#ifdef DEBUG_WRITERFILTER
@@ -375,6 +384,21 @@ void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& x
// Record changes value
if (xDocProps.is())
xDocProps->setPropertyValue("RecordChanges", uno::makeAny( m_pImpl->m_bRecordChanges ) );
+
+ // Auto hyphenation: turns on hyphenation by default, <w:suppressAutoHyphens/> may still disable it at a paragraph level.
+ if (m_pImpl->m_bAutoHyphenation)
+ {
+ uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xDoc, uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
+ uno::Reference<container::XNameContainer> xParagraphStyles = xStyleFamilies->getByName("ParagraphStyles").get< uno::Reference<container::XNameContainer> >();
+ uno::Reference<style::XStyle> xDefault = xParagraphStyles->getByName("Standard").get< uno::Reference<style::XStyle> >();
+ uno::Reference<beans::XPropertyState> xPropertyState(xDefault, uno::UNO_QUERY);
+ if (xPropertyState->getPropertyState("ParaIsHyphenation") == beans::PropertyState_DEFAULT_VALUE)
+ {
+ uno::Reference<beans::XPropertySet> xPropertySet(xDefault, uno::UNO_QUERY);
+ xPropertySet->setPropertyValue("ParaIsHyphenation", uno::makeAny(true));
+ }
+ }
}
commit b249197f262c7f768a8fad74b3f5b20adc8d5aad
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Dec 11 17:48:54 2014 +0100
writerfilter: clean up useless debug output in ooxmltok
OOXMLFastDocumentHandler::createFastChildContext() is called for the
streams we expect, no need to unconditionally produce output there.
Change-Id: I164b3c4dc6f2294487e1b1283266957d8f24cbbb
diff --git a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
index 740bc33..a8d4180 100644
--- a/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
@@ -142,12 +142,6 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
{
-#ifdef DEBUG_WRITERFILTER
- clog << this << ":createFastChildContext:"
- << fastTokenToId(Element)
- << endl;
-#endif
-
if ( mpStream == nullptr && mpDocument == nullptr )
{
// document handler has been created as unknown child - see <OOXMLFastDocumentHandler::createUnknownChildContext(..)>
More information about the Libreoffice-commits
mailing list