sw/sdi/_viewsh.sdi                |    1 +
 sw/source/uibase/uiview/view2.cxx |    1 +
 sw/source/uibase/utlui/uitool.cxx |   20 ++++++++++++++++++++
 3 files changed, 22 insertions(+)

New commits:
commit 1b235ee7d1190b5cb020fd40aae9ec5c8d2b383d
Author:     Pranam Lashkari <lpra...@collabora.com>
AuthorDate: Tue Aug 19 19:56:57 2025 +0530
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Fri Aug 22 06:26:07 2025 +0200

    sw: handle uno:Orientation for writer
    
    Change-Id: I771a6db9cda410912b323918d04f561ab2b3ac7b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189926
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 7a6f5a1ae5ec..5f94cb17c9c3 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -528,6 +528,7 @@ interface BaseTextEditView
     ]
     SID_ATTR_PAGE_ORIENTATION // status()
     [
+        ExecMethod = Execute ;
         StateMethod = GetState ;
     ]
     SID_ATTR_PAGE_SIZE // status(final|play)
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index a6b9493992c2..b2b492e4e982 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1286,6 +1286,7 @@ void SwView::Execute(SfxRequest &rReq)
         case SID_ATTR_PAGE_PAPERBIN:
         case SID_ATTR_PAGE_EXT1:
         case FN_PARAM_FTN_INFO:
+        case SID_ATTR_PAGE_ORIENTATION:
         {
             if(pArgs)
             {
diff --git a/sw/source/uibase/utlui/uitool.cxx 
b/sw/source/uibase/utlui/uitool.cxx
index ae2fa34a7fc5..88c66adb8310 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -328,6 +328,26 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, 
SwPageDesc& rPageDesc )
         rMaster.SetFormatAttr(aSize);
     }
 
+    // Orientation
+    if (rSet.GetItemState(SID_ATTR_PAGE_ORIENTATION) == SfxItemState::SET)
+    {
+        const bool bIsLandscape = 
rSet.GetItem<SfxBoolItem>(SID_ATTR_PAGE_ORIENTATION)->GetValue();
+        SwFormatFrameSize aSize(SwFrameSize::Fixed);
+        Size curSize = rMaster.GetFrameSize().GetSize();
+
+        // If orientation is landscape and width < height, swap them
+        // If orientation is portrait and width > height, swap them
+        if ((bIsLandscape && curSize.Width() < curSize.Height()) ||
+            (!bIsLandscape && curSize.Width() > curSize.Height()))
+        {
+            curSize = Swap(curSize);
+        }
+        aSize.SetSize(curSize);
+        rMaster.SetFormatAttr(aSize);
+
+        rPageDesc.SetLandscape(bIsLandscape);
+    }
+
     // Evaluate header attributes
     if( const SvxSetItem* pHeaderSetItem = rSet.GetItemIfSet( 
SID_ATTR_PAGE_HEADERSET,
             false ) )

Reply via email to