Kaydet (Commit) 93cdd851 authored tarafından Miklos Vajna's avatar Miklos Vajna

n#775899 docx import of w:usePrinterMetrics compat option

This was set unconditionally, but it turns out it's not the default for
docx, it's triggered by a compat flag there as well.

Change-Id: I84dccfe7ffd49fbc6878b19ff4276f8a36b827a3
üst c4ab4d3b
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/container/XIndexReplace.hpp> #include <com/sun/star/container/XIndexReplace.hpp>
#include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
...@@ -3663,6 +3664,12 @@ void DomainMapper_Impl::ApplySettingsTable() ...@@ -3663,6 +3664,12 @@ void DomainMapper_Impl::ApplySettingsTable()
uno::Reference<document::XViewDataSupplier> xViewDataSupplier(m_xTextDocument, uno::UNO_QUERY); uno::Reference<document::XViewDataSupplier> xViewDataSupplier(m_xTextDocument, uno::UNO_QUERY);
xViewDataSupplier->setViewData(xIndexAccess); xViewDataSupplier->setViewData(xIndexAccess);
} }
if (m_pSettingsTable->GetUsePrinterMetrics())
{
uno::Reference< beans::XPropertySet > xSettings(m_xTextFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
xSettings->setPropertyValue("PrinterIndependentLayout", uno::makeAny(document::PrinterIndependentLayout::DISABLED));
}
} }
catch(const uno::Exception&) catch(const uno::Exception&)
{ {
......
...@@ -68,6 +68,7 @@ struct SettingsTable_Impl ...@@ -68,6 +68,7 @@ struct SettingsTable_Impl
bool m_bLinkStyles; bool m_bLinkStyles;
sal_Int16 m_nZoomFactor; sal_Int16 m_nZoomFactor;
bool m_bEvenAndOddHeaders; bool m_bEvenAndOddHeaders;
bool m_bUsePrinterMetrics;
SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) : SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) :
m_rDMapper( rDMapper ) m_rDMapper( rDMapper )
...@@ -87,6 +88,7 @@ struct SettingsTable_Impl ...@@ -87,6 +88,7 @@ struct SettingsTable_Impl
, m_bLinkStyles(false) , m_bLinkStyles(false)
, m_nZoomFactor(0) , m_nZoomFactor(0)
, m_bEvenAndOddHeaders(false) , m_bEvenAndOddHeaders(false)
, m_bUsePrinterMetrics(false)
{} {}
}; };
...@@ -194,6 +196,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm) ...@@ -194,6 +196,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
resolveSprmProps(*this, rSprm); resolveSprmProps(*this, rSprm);
} }
break; break;
case NS_ooxml::LN_CT_Compat_usePrinterMetrics:
m_pImpl->m_bUsePrinterMetrics = nIntValue;
break;
default: default:
{ {
#ifdef DEBUG_DMAPPER_SETTINGS_TABLE #ifdef DEBUG_DMAPPER_SETTINGS_TABLE
...@@ -226,6 +231,11 @@ sal_Int16 SettingsTable::GetZoomFactor() const ...@@ -226,6 +231,11 @@ sal_Int16 SettingsTable::GetZoomFactor() const
return m_pImpl->m_nZoomFactor; return m_pImpl->m_nZoomFactor;
} }
bool SettingsTable::GetUsePrinterMetrics() const
{
return m_pImpl->m_bUsePrinterMetrics;
}
bool SettingsTable::GetEvenAndOddHeaders() const bool SettingsTable::GetEvenAndOddHeaders() const
{ {
return m_pImpl->m_bEvenAndOddHeaders; return m_pImpl->m_bEvenAndOddHeaders;
......
...@@ -63,6 +63,8 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo ...@@ -63,6 +63,8 @@ class WRITERFILTER_DLLPRIVATE SettingsTable : public LoggedProperties, public Lo
bool GetEvenAndOddHeaders() const; bool GetEvenAndOddHeaders() const;
bool GetUsePrinterMetrics() const;
void ApplyProperties( uno::Reference< text::XTextDocument > xDoc ); void ApplyProperties( uno::Reference< text::XTextDocument > xDoc );
private: private:
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
#include <comphelper/mediadescriptor.hxx> #include <comphelper/mediadescriptor.hxx>
#include <oox/core/filterdetect.hxx> #include <oox/core/filterdetect.hxx>
#include <dmapper/DomainMapper.hxx> #include <dmapper/DomainMapper.hxx>
...@@ -179,7 +178,6 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >& ...@@ -179,7 +178,6 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >&
xSettings->setPropertyValue( "StylesNoDefault", uno::makeAny( sal_True ) ); xSettings->setPropertyValue( "StylesNoDefault", uno::makeAny( sal_True ) );
xSettings->setPropertyValue("FloattableNomargins", uno::makeAny( sal_True )); xSettings->setPropertyValue("FloattableNomargins", uno::makeAny( sal_True ));
xSettings->setPropertyValue("PrinterIndependentLayout", uno::makeAny(document::PrinterIndependentLayout::DISABLED));
} }
void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) void WriterFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )
......
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