svx/sdi/svx.sdi                   |    9 +++++++--
 sw/sdi/_viewsh.sdi                |    1 +
 sw/source/uibase/uiview/view2.cxx |    1 +
 sw/source/uibase/utlui/uitool.cxx |   29 +++++++++++++++++++++++++++++
 4 files changed, 38 insertions(+), 2 deletions(-)

New commits:
commit e32f6f7e4f4bf192136ec4e7658b36ca644d647e
Author:     Pranam Lashkari <[email protected]>
AuthorDate: Tue Aug 19 19:56:57 2025 +0530
Commit:     Pranam Lashkari <[email protected]>
CommitDate: Tue Sep 2 11:24:52 2025 +0200

    sw: handle uno:Orientation for writer
    
    Change-Id: I771a6db9cda410912b323918d04f561ab2b3ac7b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189926
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>
    (cherry picked from commit 1b235ee7d1190b5cb020fd40aae9ec5c8d2b383d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190504
    Reviewed-by: Pranam Lashkari <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index a5493e781cfd..c4f80693a619 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 3a03899e3597..6e9281d93e56 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1291,6 +1291,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 b87584fc586e..bc247a7cae20 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 ) )
commit 65639e909f87e91d7186529afae035f37c528355
Author:     Pranam Lashkari <[email protected]>
AuthorDate: Tue Aug 19 01:52:13 2025 +0530
Commit:     Pranam Lashkari <[email protected]>
CommitDate: Tue Sep 2 11:24:40 2025 +0200

    svx: added parameter for writer page size  uno command
    
    parameter for SID_ATTR_PAGE_SIZE
    
    Change-Id: I3f44dc8bc9397893f9214ee8915eb592d32c6894
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189890
    Reviewed-by: Szymon Kłos <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit fb4f5e6a68fb74b37356bb9ca11f89df1c106184)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190503
    Reviewed-by: Pranam Lashkari <[email protected]>
    Tested-by: Jenkins

diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 9dbd3591af39..6653e532c2e6 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -6417,9 +6417,14 @@ SvxPaperBinItem PagePaperBin SID_ATTR_PAGE_PAPERBIN
     GroupId = SfxGroupId::Format;
 ]
 
-
+// PaperFormat takes page format number from (paper.hxx) enum Paper
+// If AttributePageSize is also specified PaperFormat is ignored
+// AttributePageSize parameter is added to keep backward compatibility of API
 SvxSizeItem AttributePageSize SID_ATTR_PAGE_SIZE
-
+(
+    SvxSizeItem AttributePageSize SID_ATTR_PAGE_SIZE,
+    SfxUInt16Item PaperFormat FN_PARAM_1
+)
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
diff --git a/sw/source/uibase/utlui/uitool.cxx 
b/sw/source/uibase/utlui/uitool.cxx
index ff061b87c506..b87584fc586e 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -69,6 +69,7 @@
 #include <strings.hrc>
 #include <docmodel/color/ComplexColor.hxx>
 #include <IDocumentSettingAccess.hxx>
+#include <editeng/paperinf.hxx>
 
 // 50 cm 28350
 #define MAXHEIGHT 28350
@@ -319,6 +320,14 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, 
SwPageDesc& rPageDesc )
         aSize.SetSize(rSizeItem.GetSize());
         rMaster.SetFormatAttr(aSize);
     }
+    else if (rSet.GetItemState(FN_PARAM_1) == SfxItemState::SET)
+    {
+        const sal_uInt16 nSizeItem = 
rSet.GetItem<SfxUInt16Item>(FN_PARAM_1)->GetValue();
+        SwFormatFrameSize aSize(SwFrameSize::Fixed);
+        
aSize.SetSize(SvxPaperInfo::GetPaperSize(static_cast<Paper>(nSizeItem)));
+        rMaster.SetFormatAttr(aSize);
+    }
+
     // Evaluate header attributes
     if( const SvxSetItem* pHeaderSetItem = rSet.GetItemIfSet( 
SID_ATTR_PAGE_HEADERSET,
             false ) )

Reply via email to