svx/source/items/pageitem.cxx      |    2 +-
 sw/qa/extras/uiwriter/uiwriter.cxx |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 219b16cffdd1661886fa1e00d3503c42b270a825
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Thu Nov 3 12:32:03 2016 +0100

    svx: add missing ~CONVERT_TWIPS mask in SvxPageItem::PutValue()
    
    With this, it's possible to use AttributePage.* keys in macros.
    
    (cherry picked from commit a30f969432a451ade87b93e3077836a849b8f11b)
    
    Change-Id: I3f0b1ea8fb6274e7c18511c2e80774205206a2ba

diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx
index c6de545..d553c25 100644
--- a/svx/source/items/pageitem.cxx
+++ b/svx/source/items/pageitem.cxx
@@ -177,7 +177,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 f2c4263..531d15e 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -91,6 +91,7 @@
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/dispatch.hxx>
+#include <comphelper/propertyvalue.hxx>
 
 static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/";
 
@@ -196,6 +197,7 @@ public:
     void testRedlineViewAuthor();
     void testRedlineTimestamp();
     void testCursorWindows();
+    void testLandscape();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -294,6 +296,7 @@ public:
     CPPUNIT_TEST(testRedlineViewAuthor);
     CPPUNIT_TEST(testRedlineTimestamp);
     CPPUNIT_TEST(testCursorWindows);
+    CPPUNIT_TEST(testLandscape);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -3442,6 +3445,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();
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to