Kaydet (Commit) 8ba44dd1 authored tarafından Miklos Vajna's avatar Miklos Vajna

n#751020 implement DOCX import of linked styles

This is just initial support: the default template and paragraph
properties are included.
üst 02f1aad7
......@@ -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& )
{
......
......@@ -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 );
......
......@@ -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:
......
......@@ -19063,6 +19063,11 @@
<ref name="CT_Zoom"/>
</element>
</optional>
<optional>
<element name="linkStyles">
<ref name="CT_OnOff"/>
</element>
</optional>
<optional>
<element name="removePersonalInformation">
<ref name="CT_OnOff"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment