From a30f969432a451ade87b93e3077836a849b8f11b Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 3 Nov 2016 12:32:03 +0100 Subject: [PATCH] svx: add missing ~CONVERT_TWIPS mask in SvxPageItem::PutValue() With this, it's possible to use AttributePage.* keys in macros. Change-Id: I3f0b1ea8fb6274e7c18511c2e80774205206a2ba --- svx/source/items/pageitem.cxx | 2 +- sw/qa/extras/uiwriter/uiwriter.cxx | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index 7371ef1de7cb..53c01c10d595 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -180,7 +180,7 @@ bool SvxPageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxPageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { - switch( nMemberId ) + switch( nMemberId & ~CONVERT_TWIPS ) { case MID_PAGE_NUMTYPE: { diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index b37a6c4d0e42..e58093f4c870 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -94,6 +94,7 @@ #include #include #include +#include #include static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/"; @@ -211,6 +212,7 @@ public: void testTdf78727(); void testRedlineTimestamp(); void testCursorWindows(); + void testLandscape(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -320,6 +322,7 @@ public: CPPUNIT_TEST(testTdf78727); CPPUNIT_TEST(testRedlineTimestamp); CPPUNIT_TEST(testCursorWindows); + CPPUNIT_TEST(testLandscape); CPPUNIT_TEST_SUITE_END(); private: @@ -4027,6 +4030,25 @@ void SwUiWriterTest::testCursorWindows() CPPUNIT_ASSERT_EQUAL(aText.getLength(), pShellCursor2->Start()->nContent.GetIndex()); } +void SwUiWriterTest::testLandscape() +{ + // Set page orientation to landscape. + SwDoc* pDoc = createDoc(); + uno::Sequence aPropertyValues = + { + comphelper::makePropertyValue("AttributePage.Landscape", true), + }; + lcl_dispatchCommand(mxComponent, ".uno:AttributePage", aPropertyValues); + Scheduler::ProcessEventsToIdle(); + + // Assert that the document model was modified. + SwDocShell* pDocShell = pDoc->GetDocShell(); + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + size_t nPageDesc = pWrtShell->GetCurPageDesc(); + // This failed, page was still portrait. + CPPUNIT_ASSERT(pWrtShell->GetPageDesc(nPageDesc).GetLandscape()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT();