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

implement RTF import of zoom level

üst 69805b85
...@@ -51,6 +51,7 @@ $(eval $(call gb_CppunitTest_use_api,sw_subsequent_rtftok,\ ...@@ -51,6 +51,7 @@ $(eval $(call gb_CppunitTest_use_api,sw_subsequent_rtftok,\
$(eval $(call gb_CppunitTest_use_ure,sw_subsequent_rtftok)) $(eval $(call gb_CppunitTest_use_ure,sw_subsequent_rtftok))
$(eval $(call gb_CppunitTest_use_components,sw_subsequent_rtftok,\ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_rtftok,\
comphelper/util/comphelp \
configmgr/source/configmgr \ configmgr/source/configmgr \
fileaccess/source/fileacc \ fileaccess/source/fileacc \
filter/source/config/cache/filterconfig1 \ filter/source/config/cache/filterconfig1 \
......
{\rtf1\viewscale42 Hello world!\par}
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <com/sun/star/text/XTextFramesSupplier.hpp> #include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
#include <com/sun/star/view/XViewSettingsSupplier.hpp>
#include <rtl/oustringostreaminserter.hxx> #include <rtl/oustringostreaminserter.hxx>
#include <test/bootstrapfixture.hxx> #include <test/bootstrapfixture.hxx>
...@@ -80,6 +81,7 @@ public: ...@@ -80,6 +81,7 @@ public:
void testFdo47107(); void testFdo47107();
void testFdo45182(); void testFdo45182();
void testFdo44176(); void testFdo44176();
void testZoom();
CPPUNIT_TEST_SUITE(RtfModelTest); CPPUNIT_TEST_SUITE(RtfModelTest);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -102,6 +104,7 @@ public: ...@@ -102,6 +104,7 @@ public:
CPPUNIT_TEST(testFdo47107); CPPUNIT_TEST(testFdo47107);
CPPUNIT_TEST(testFdo45182); CPPUNIT_TEST(testFdo45182);
CPPUNIT_TEST(testFdo44176); CPPUNIT_TEST(testFdo44176);
CPPUNIT_TEST(testZoom);
#endif #endif
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -533,6 +536,18 @@ void RtfModelTest::testFdo44176() ...@@ -533,6 +536,18 @@ void RtfModelTest::testFdo44176()
CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader); CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader);
} }
void RtfModelTest::testZoom()
{
load("zoom.rtf");
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings());
sal_Int16 nValue = 0;
xPropertySet->getPropertyValue("ZoomValue") >>= nValue;
CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue);
}
CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest); CPPUNIT_TEST_SUITE_REGISTRATION(RtfModelTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -253,6 +253,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x ...@@ -253,6 +253,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_bNeedCr(false), m_bNeedCr(false),
m_bNeedPar(true), m_bNeedPar(true),
m_aListTableSprms(), m_aListTableSprms(),
m_aSettingsTableAttributes(),
m_aSettingsTableSprms(), m_aSettingsTableSprms(),
m_xStorage(), m_xStorage(),
m_aTableBuffer(), m_aTableBuffer(),
...@@ -374,8 +375,7 @@ void RTFDocumentImpl::checkFirstRun() ...@@ -374,8 +375,7 @@ void RTFDocumentImpl::checkFirstRun()
if (m_bFirstRun) if (m_bFirstRun)
{ {
// output settings table // output settings table
RTFSprms aAttributes; writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(m_aSettingsTableAttributes, m_aSettingsTableSprms));
writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aAttributes, m_aSettingsTableSprms));
RTFReferenceTable::Entries_t aSettingsTableEntries; RTFReferenceTable::Entries_t aSettingsTableEntries;
aSettingsTableEntries.insert(make_pair(0, pProp)); aSettingsTableEntries.insert(make_pair(0, pProp));
writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aSettingsTableEntries)); writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aSettingsTableEntries));
...@@ -2755,6 +2755,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -2755,6 +2755,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
lcl_putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_rPr, NS_sprm::LN_CRgFtc0, pValue); lcl_putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_rPr, NS_sprm::LN_CRgFtc0, pValue);
} }
break; break;
case RTF_VIEWSCALE:
m_aSettingsTableAttributes->push_back(make_pair(NS_ooxml::LN_CT_Zoom_percent, pIntValue));
break;
default: default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle value '" << lcl_RtfToString(nKeyword) << "'"); SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle value '" << lcl_RtfToString(nKeyword) << "'");
aSkip.setParsed(false); aSkip.setParsed(false);
......
...@@ -425,7 +425,9 @@ namespace writerfilter { ...@@ -425,7 +425,9 @@ namespace writerfilter {
bool m_bNeedPar; bool m_bNeedPar;
/// The list table and list override table combined. /// The list table and list override table combined.
RTFSprms m_aListTableSprms; RTFSprms m_aListTableSprms;
/// The settings table. /// The settings table attributes.
RTFSprms m_aSettingsTableAttributes;
/// The settings table sprms.
RTFSprms m_aSettingsTableSprms; RTFSprms m_aSettingsTableSprms;
oox::StorageRef m_xStorage; oox::StorageRef m_xStorage;
......
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