sw/source/uibase/sidebar/PageSizeControl.cxx |  106 ++++++++++++---------------
 1 file changed, 51 insertions(+), 55 deletions(-)

New commits:
commit 8273a549f0e0506f69ac158239e92f8e7dfecc2b
Author:     Michael Weghorn <[email protected]>
AuthorDate: Tue Nov 25 00:10:29 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Nov 25 13:43:21 2025 +0100

    sw: Drop extra scope/indentation in PageSizeControl ctor
    
    There's no reason to have an extra scope here, so drop it.
    
    (`git show --ignore-space-change` can help to see the
    "actual" change more easily.)
    
    Change-Id: Ia32f75339ee7106e3e774cd5edcf34a1633eaf3c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194493
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>
    Code-Style: Michael Weghorn <[email protected]>

diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx 
b/sw/source/uibase/sidebar/PageSizeControl.cxx
index aca3b437b938..3d4eb36283b4 100644
--- a/sw/source/uibase/sidebar/PageSizeControl.cxx
+++ b/sw/source/uibase/sidebar/PageSizeControl.cxx
@@ -93,75 +93,74 @@ PageSizeControl::PageSizeControl(PageSizePopup* pControl, 
weld::Widget* pParent)
     mxSizeValueSet->SetStyle( mxSizeValueSet->GetStyle() | WB_3DLOOK | 
WB_NO_DIRECTSELECT | WB_FLATVALUESET );
 
     sal_uInt16 nSelectedItem = 0;
+    OUString aMetricStr;
     {
-        OUString aMetricStr;
+        const OUString aText = mxWidthHeightField->get_text();
+        for (short i = aText.getLength() - 1; i >= 0; i--)
         {
-            const OUString aText = mxWidthHeightField->get_text();
-            for (short i = aText.getLength() - 1; i >= 0; i--)
+            sal_Unicode c = aText[i];
+            if ( rtl::isAsciiAlpha(c) || (c == '\'') || (c == '\"') || (c == 
'%') )
             {
-                sal_Unicode c = aText[i];
-                if ( rtl::isAsciiAlpha(c) || (c == '\'') || (c == '\"') || (c 
== '%') )
-                {
-                    aMetricStr = OUStringChar(c) + aMetricStr;
-                }
-                else
+                aMetricStr = OUStringChar(c) + aMetricStr;
+            }
+            else
+            {
+                if (!aMetricStr.isEmpty())
                 {
-                    if (!aMetricStr.isEmpty())
-                    {
-                        break;
-                    }
+                    break;
                 }
             }
         }
+    }
 
-        bool bLandscape = false;
-        const SvxSizeItem* pSize(nullptr);
-        if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
-        {
-            SfxPoolItemHolder aResult;
-            pViewFrm->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE, 
aResult );
-            bLandscape = static_cast<const 
SvxPageItem*>(aResult.getItem())->IsLandscape();
-            
pViewFrm->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_SIZE, 
aResult);
-            pSize = static_cast<const SvxSizeItem*>(aResult.getItem());
-        }
+    bool bLandscape = false;
+    const SvxSizeItem* pSize(nullptr);
+    if (SfxViewFrame* pViewFrm = SfxViewFrame::Current())
+    {
+        SfxPoolItemHolder aResult;
+        pViewFrm->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE, 
aResult );
+        bLandscape = static_cast<const 
SvxPageItem*>(aResult.getItem())->IsLandscape();
+        
pViewFrm->GetBindings().GetDispatcher()->QueryState(SID_ATTR_PAGE_SIZE, 
aResult);
+        pSize = static_cast<const SvxSizeItem*>(aResult.getItem());
+    }
 
-        const LocaleDataWrapper& localeDataWrapper = 
Application::GetSettings().GetLocaleDataWrapper();
-        for ( std::vector< Paper >::size_type nPaperIdx = 0;
-              nPaperIdx < maPaperList.size();
-              ++nPaperIdx )
+    const LocaleDataWrapper& localeDataWrapper = 
Application::GetSettings().GetLocaleDataWrapper();
+    for ( std::vector< Paper >::size_type nPaperIdx = 0;
+          nPaperIdx < maPaperList.size();
+          ++nPaperIdx )
+    {
+        Size aPaperSize = SvxPaperInfo::GetPaperSize( maPaperList[ nPaperIdx ] 
);
+        if ( bLandscape )
         {
-            Size aPaperSize = SvxPaperInfo::GetPaperSize( maPaperList[ 
nPaperIdx ] );
-            if ( bLandscape )
-            {
-                Swap( aPaperSize );
-            }
+            Swap( aPaperSize );
+        }
 
-            mxWidthHeightField->set_value( mxWidthHeightField->normalize( 
aPaperSize.Width() ), FieldUnit::TWIP );
-            const OUString aWidthStr = localeDataWrapper.getNum(
-                mxWidthHeightField->get_value(FieldUnit::NONE),
-                mxWidthHeightField->get_digits(),
-                true,
-                true );
+        mxWidthHeightField->set_value( mxWidthHeightField->normalize( 
aPaperSize.Width() ), FieldUnit::TWIP );
+        const OUString aWidthStr = localeDataWrapper.getNum(
+            mxWidthHeightField->get_value(FieldUnit::NONE),
+            mxWidthHeightField->get_digits(),
+            true,
+            true );
 
-            mxWidthHeightField->set_value( mxWidthHeightField->normalize( 
aPaperSize.Height() ), FieldUnit::TWIP);
-            const OUString aHeightStr = localeDataWrapper.getNum(
-                mxWidthHeightField->get_value(FieldUnit::NONE),
-                mxWidthHeightField->get_digits(),
-                true,
-                true );
+        mxWidthHeightField->set_value( mxWidthHeightField->normalize( 
aPaperSize.Height() ), FieldUnit::TWIP);
+        const OUString aHeightStr = localeDataWrapper.getNum(
+            mxWidthHeightField->get_value(FieldUnit::NONE),
+            mxWidthHeightField->get_digits(),
+            true,
+            true );
 
-            const OUString aItemText2 = aWidthStr + " x " + aHeightStr + " " + 
aMetricStr;
+        const OUString aItemText2 = aWidthStr + " x " + aHeightStr + " " + 
aMetricStr;
 
-            mxSizeValueSet->AddItem(
-                SvxPaperInfo::GetName( maPaperList[ nPaperIdx ] ),
-                aItemText2 );
+        mxSizeValueSet->AddItem(
+            SvxPaperInfo::GetName( maPaperList[ nPaperIdx ] ),
+            aItemText2 );
 
-            if ( pSize && aPaperSize == pSize->GetSize() )
-            {
-                nSelectedItem = nPaperIdx + 1;
-            }
+        if ( pSize && aPaperSize == pSize->GetSize() )
+        {
+            nSelectedItem = nPaperIdx + 1;
         }
     }
+
     mxSizeValueSet->SetNoSelection();
     mxSizeValueSet->SetSelectHdl( LINK(this, PageSizeControl, ImplSizeHdl ) );
     mxSizeValueSet->Show();
commit 7e7dd388c613d3be939a299b7506c65459d900d2
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Nov 24 12:40:51 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Nov 25 13:43:07 2025 +0100

    sw: Reduce local variable scope
    
    Change-Id: Id9c37a94fa0fb10fe52c6179f9f5934e68d2c7d3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194488
    Code-Style: Michael Weghorn <[email protected]>
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx 
b/sw/source/uibase/sidebar/PageSizeControl.cxx
index e124446288df..aca3b437b938 100644
--- a/sw/source/uibase/sidebar/PageSizeControl.cxx
+++ b/sw/source/uibase/sidebar/PageSizeControl.cxx
@@ -126,9 +126,6 @@ PageSizeControl::PageSizeControl(PageSizePopup* pControl, 
weld::Widget* pParent)
         }
 
         const LocaleDataWrapper& localeDataWrapper = 
Application::GetSettings().GetLocaleDataWrapper();
-        OUString aWidthStr;
-        OUString aHeightStr;
-        OUString aItemText2;
         for ( std::vector< Paper >::size_type nPaperIdx = 0;
               nPaperIdx < maPaperList.size();
               ++nPaperIdx )
@@ -140,20 +137,20 @@ PageSizeControl::PageSizeControl(PageSizePopup* pControl, 
weld::Widget* pParent)
             }
 
             mxWidthHeightField->set_value( mxWidthHeightField->normalize( 
aPaperSize.Width() ), FieldUnit::TWIP );
-            aWidthStr = localeDataWrapper.getNum(
+            const OUString aWidthStr = localeDataWrapper.getNum(
                 mxWidthHeightField->get_value(FieldUnit::NONE),
                 mxWidthHeightField->get_digits(),
                 true,
                 true );
 
             mxWidthHeightField->set_value( mxWidthHeightField->normalize( 
aPaperSize.Height() ), FieldUnit::TWIP);
-            aHeightStr = localeDataWrapper.getNum(
+            const OUString aHeightStr = localeDataWrapper.getNum(
                 mxWidthHeightField->get_value(FieldUnit::NONE),
                 mxWidthHeightField->get_digits(),
                 true,
                 true );
 
-            aItemText2 = aWidthStr + " x " + aHeightStr + " " + aMetricStr;
+            const OUString aItemText2 = aWidthStr + " x " + aHeightStr + " " + 
aMetricStr;
 
             mxSizeValueSet->AddItem(
                 SvxPaperInfo::GetName( maPaperList[ nPaperIdx ] ),

Reply via email to