[Libreoffice-commits] .: 2 commits - writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed Mar 14 10:01:43 PDT 2012
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 12 ++++++++++++
writerfilter/source/dmapper/SettingsTable.cxx | 10 ++++++++++
writerfilter/source/dmapper/SettingsTable.hxx | 3 +++
writerfilter/source/ooxml/model.xml | 5 +++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 6 ++++++
5 files changed, 36 insertions(+)
New commits:
commit ae62f61a5cd345466b528a1a0334d742721e7b05
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Mar 14 17:54:26 2012 +0100
implement RTF import of linked styles
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index bde6da9..3e0c9b9 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2025,6 +2025,12 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aParagraphSprms->push_back(make_pair(NS_sprm::LN_PContextualSpacing, pValue));
}
break;
+ case RTF_LINKSTYLES:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(1));
+ m_aSettingsTableSprms->push_back(make_pair(NS_ooxml::LN_CT_Settings_linkStyles, pValue));
+ }
+ break;
default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle flag '" << lcl_RtfToString(nKeyword) << "'");
aSkip.setParsed(false);
commit 8ba44dd1abbe31c1235f3b840bf27a61c3401236
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Mar 14 17:12:35 2012 +0100
n#751020 implement DOCX import of linked styles
This is just initial support: the default template and paragraph
properties are included.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 066416e..2f0dd2b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -41,6 +41,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/style/LineNumberPosition.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
#include <com/sun/star/style/NumberingType.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
@@ -3504,6 +3506,16 @@ void DomainMapper_Impl::ApplySettingsTable()
m_xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Defaults"))), uno::UNO_QUERY_THROW );
sal_Int32 nDefTab = m_pSettingsTable->GetDefaultTabStop();
xTextDefaults->setPropertyValue( PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_TAB_STOP_DISTANCE ), uno::makeAny(nDefTab) );
+ if (m_pSettingsTable->GetLinkStyles())
+ {
+ PropertyNameSupplier& rSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
+ // If linked styles are enabled, set paragraph defaults from Word's default template
+ xTextDefaults->setPropertyValue(rSupplier.GetName(PROP_PARA_BOTTOM_MARGIN), uno::makeAny(ConversionHelper::convertTwipToMM100(200)));
+ style::LineSpacing aSpacing;
+ aSpacing.Mode = style::LineSpacingMode::PROP;
+ aSpacing.Height = sal_Int16(115);
+ xTextDefaults->setPropertyValue(rSupplier.GetName(PROP_PARA_LINE_SPACING), uno::makeAny(aSpacing));
+ }
}
catch(const uno::Exception& )
{
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index 87b6f9e..6e33617 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -75,6 +75,7 @@ struct SettingsTable_Impl
::rtl::OUString m_sCryptProviderTypeExtSource;
::rtl::OUString m_sHash;
::rtl::OUString m_sSalt;
+ bool m_bLinkStyles;
SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) :
m_rDMapper( rDMapper )
@@ -91,6 +92,7 @@ struct SettingsTable_Impl
, m_nCryptAlgorithmClass(NS_ooxml::LN_Value_wordprocessingml_ST_AlgClass_hash)
, m_nCryptAlgorithmType(NS_ooxml::LN_Value_wordprocessingml_ST_AlgType_typeAny)
, m_nCryptSpinCount(0)
+ , m_bLinkStyles(false)
{}
};
@@ -162,6 +164,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_CT_Settings_defaultTabStop: // 92505;
m_pImpl->m_nDefaultTabStop = nIntValue;
break;
+ case NS_ooxml::LN_CT_Settings_linkStyles: // 92663;
+ m_pImpl->m_bLinkStyles = nIntValue;
+ break;
case NS_ooxml::LN_CT_Settings_noPunctuationKerning: // 92526;
m_pImpl->m_bNoPunctuationKerning = nIntValue ? true : false;
break;
@@ -217,6 +222,11 @@ int SettingsTable::GetDefaultTabStop() const
return ConversionHelper::convertTwipToMM100( m_pImpl->m_nDefaultTabStop );
}
+bool SettingsTable::GetLinkStyles() const
+{
+ return m_pImpl->m_bLinkStyles;
+}
+
void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
{
uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx
index 2b50d51..79e095a 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -64,6 +64,9 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo
//returns default TabStop in 1/100th mm
int GetDefaultTabStop() const;
+ /// Automatically update styles from document template?
+ bool GetLinkStyles() const;
+
void ApplyProperties( uno::Reference< text::XTextDocument > xDoc );
private:
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 4dc8c49..98f35a1 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -19064,6 +19064,11 @@
</element>
</optional>
<optional>
+ <element name="linkStyles">
+ <ref name="CT_OnOff"/>
+ </element>
+ </optional>
+ <optional>
<element name="removePersonalInformation">
<ref name="CT_OnOff"/>
</element>
More information about the Libreoffice-commits
mailing list