svx: add missing ~CONVERT_TWIPS mask in SvxPageItem::PutValue()

With this, it's possible to use AttributePage.* keys in macros.

Change-Id: I3f0b1ea8fb6274e7c18511c2e80774205206a2ba
This commit is contained in:
Miklos Vajna 2016-11-03 12:32:03 +01:00
parent b75468d743
commit a30f969432
2 changed files with 23 additions and 1 deletions

View File

@ -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:
{

View File

@ -94,6 +94,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
#include <comphelper/propertyvalue.hxx>
#include <config_features.h>
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<beans::PropertyValue> 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();