[Libreoffice-commits] .: 2 commits - sw/CppunitTest_sw_subsequent_rtftok.mk sw/qa writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Sat Apr 14 16:23:03 PDT 2012
sw/CppunitTest_sw_subsequent_rtftok.mk | 1 +
sw/qa/extras/rtftok/data/zoom.rtf | 1 +
sw/qa/extras/rtftok/rtftok.cxx | 15 +++++++++++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 11 +++++++----
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 4 +++-
5 files changed, 27 insertions(+), 5 deletions(-)
New commits:
commit 3fceaca5d6a95371d2c625a569e804a1b2141c0f
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Sun Apr 15 01:22:59 2012 +0200
rtftok: add back explicit OUString ctors where still needed
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2920d1e..e00458d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2052,7 +2052,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_DOBYMARGIN:
{
beans::PropertyValue aPropertyValue;
- aPropertyValue.Name = (nKeyword == RTF_DOBXMARGIN ? "HoriOrientRelation" : "VertOrientRelation");
+ aPropertyValue.Name = (nKeyword == RTF_DOBXMARGIN ? OUString("HoriOrientRelation") : OUString("VertOrientRelation"));
aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA;
m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
}
@@ -2061,7 +2061,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_DOBYPAGE:
{
beans::PropertyValue aPropertyValue;
- aPropertyValue.Name = (nKeyword == RTF_DOBXPAGE ? "HoriOrientRelation" : "VertOrientRelation");
+ aPropertyValue.Name = (nKeyword == RTF_DOBXPAGE ? OUString("HoriOrientRelation") : OUString("VertOrientRelation"));
aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME;
m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
}
commit ecbea5fac49fe63280627ff215c0c7854d7ba953
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Sun Apr 15 00:52:12 2012 +0200
implement RTF import of zoom level
diff --git a/sw/CppunitTest_sw_subsequent_rtftok.mk b/sw/CppunitTest_sw_subsequent_rtftok.mk
index 50ee0d6..f8b2439 100644
--- a/sw/CppunitTest_sw_subsequent_rtftok.mk
+++ b/sw/CppunitTest_sw_subsequent_rtftok.mk
@@ -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_components,sw_subsequent_rtftok,\
+ comphelper/util/comphelp \
configmgr/source/configmgr \
fileaccess/source/fileacc \
filter/source/config/cache/filterconfig1 \
diff --git a/sw/qa/extras/rtftok/data/zoom.rtf b/sw/qa/extras/rtftok/data/zoom.rtf
new file mode 100644
index 0000000..c7fd19b
--- /dev/null
+++ b/sw/qa/extras/rtftok/data/zoom.rtf
@@ -0,0 +1 @@
+{\rtf1\viewscale42 Hello world!\par}
diff --git a/sw/qa/extras/rtftok/rtftok.cxx b/sw/qa/extras/rtftok/rtftok.cxx
index e81fa3a..9fbffca 100644
--- a/sw/qa/extras/rtftok/rtftok.cxx
+++ b/sw/qa/extras/rtftok/rtftok.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextTablesSupplier.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
#include <rtl/oustringostreaminserter.hxx>
#include <test/bootstrapfixture.hxx>
@@ -80,6 +81,7 @@ public:
void testFdo47107();
void testFdo45182();
void testFdo44176();
+ void testZoom();
CPPUNIT_TEST_SUITE(RtfModelTest);
#if !defined(MACOSX) && !defined(WNT)
@@ -102,6 +104,7 @@ public:
CPPUNIT_TEST(testFdo47107);
CPPUNIT_TEST(testFdo45182);
CPPUNIT_TEST(testFdo44176);
+ CPPUNIT_TEST(testZoom);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -533,6 +536,18 @@ void RtfModelTest::testFdo44176()
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_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index cab7df7..2920d1e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -253,6 +253,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_bNeedCr(false),
m_bNeedPar(true),
m_aListTableSprms(),
+ m_aSettingsTableAttributes(),
m_aSettingsTableSprms(),
m_xStorage(),
m_aTableBuffer(),
@@ -374,8 +375,7 @@ void RTFDocumentImpl::checkFirstRun()
if (m_bFirstRun)
{
// output settings table
- RTFSprms aAttributes;
- writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aAttributes, m_aSettingsTableSprms));
+ writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(m_aSettingsTableAttributes, m_aSettingsTableSprms));
RTFReferenceTable::Entries_t aSettingsTableEntries;
aSettingsTableEntries.insert(make_pair(0, pProp));
writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aSettingsTableEntries));
@@ -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);
}
break;
+ case RTF_VIEWSCALE:
+ m_aSettingsTableAttributes->push_back(make_pair(NS_ooxml::LN_CT_Zoom_percent, pIntValue));
+ break;
default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle value '" << lcl_RtfToString(nKeyword) << "'");
aSkip.setParsed(false);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index e66f22e..898fb57 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -425,7 +425,9 @@ namespace writerfilter {
bool m_bNeedPar;
/// The list table and list override table combined.
RTFSprms m_aListTableSprms;
- /// The settings table.
+ /// The settings table attributes.
+ RTFSprms m_aSettingsTableAttributes;
+ /// The settings table sprms.
RTFSprms m_aSettingsTableSprms;
oox::StorageRef m_xStorage;
More information about the Libreoffice-commits
mailing list