You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2013/03/18 13:23:25 UTC

svn commit: r1457732 - in /openoffice/branches/sidebar/main/sw/source/ui/sidebar: PageMarginControl.cxx PageMarginControl.hxx PagePropertyPanel.src

Author: orw
Date: Mon Mar 18 12:23:25 2013
New Revision: 1457732

URL: http://svn.apache.org/r1457732
Log:
#121793# - correction: no reaction on user choosing "Last Custom Values", if no custom values are available

Modified:
    openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.cxx
    openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.hxx
    openoffice/branches/sidebar/main/sw/source/ui/sidebar/PagePropertyPanel.src

Modified: openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.cxx?rev=1457732&r1=1457731&r2=1457732&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.cxx (original)
+++ openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.cxx Mon Mar 18 12:23:25 2013
@@ -68,6 +68,7 @@ PageMarginControl::PageMarginControl(
     , mnPageBottomMargin( aPageULMargin.GetLower() )
     , mbMirrored( bMirrored )
     , meUnit( eUnit )
+    , mbUserCustomValuesAvailable(false)
     , mnUserCustomPageLeftMargin(0)
     , mnUserCustomPageRightMargin(0)
     , mnUserCustomPageTopMargin(0)
@@ -79,20 +80,18 @@ PageMarginControl::PageMarginControl(
     maWidthHeightField.Hide();
     SetFieldUnit( maWidthHeightField, eFUnit );
 
-    const bool bCustomValuesAvailable = GetUserCustomValues();
+    mbUserCustomValuesAvailable = GetUserCustomValues();
 
     mpMarginValueSet->SetStyle( mpMarginValueSet->GetStyle() | WB_3DLOOK | WB_NO_DIRECTSELECT );
     mpMarginValueSet->SetColor( GetSettings().GetStyleSettings().GetMenuColor() );
 
-    FillValueSet( bLandscape, bCustomValuesAvailable );
+    FillValueSet( bLandscape, mbUserCustomValuesAvailable );
 
     mpMarginValueSet->SetNoSelection();
     mpMarginValueSet->SetSelectHdl( LINK(this, PageMarginControl,ImplMarginHdl ) );
     mpMarginValueSet->Show();
 
     SelectValueSetItem();
-    mpMarginValueSet->Format();
-    mpMarginValueSet->StartSelection();
 
     SetFieldUnit( maLeftMarginEdit, eFUnit );
     Link aLinkLR = LINK( this, PageMarginControl, ModifyLRMarginHdl );
@@ -304,16 +303,19 @@ void PageMarginControl::SelectValueSetIt
     {
         mpMarginValueSet->SelectItem(0);
     }
+
+    mpMarginValueSet->Format();
+    mpMarginValueSet->StartSelection();
 };
 
 
 IMPL_LINK(PageMarginControl, ImplMarginHdl, void *, pControl)
 {
-    mpMarginValueSet->SetNoSelection();
     if ( pControl == mpMarginValueSet )
     {
         const sal_uInt16 iPos = mpMarginValueSet->GetSelectItemId();
         bool bMirrored = false;
+        bool bApplyNewPageMargins = true;
         switch ( iPos )
         {
         case 1:
@@ -345,26 +347,42 @@ IMPL_LINK(PageMarginControl, ImplMarginH
             bMirrored = true;
             break;
         case 5:
-            mnPageLeftMargin = mnUserCustomPageLeftMargin;
-            mnPageRightMargin = mnUserCustomPageRightMargin;
-            mnPageTopMargin = mnUserCustomPageTopMargin;
-            mnPageBottomMargin = mnUserCustomPageBottomMargin;
-            bMirrored = mbUserCustomMirrored;
+            if ( mbUserCustomValuesAvailable )
+            {
+                mnPageLeftMargin = mnUserCustomPageLeftMargin;
+                mnPageRightMargin = mnUserCustomPageRightMargin;
+                mnPageTopMargin = mnUserCustomPageTopMargin;
+                mnPageBottomMargin = mnUserCustomPageBottomMargin;
+                bMirrored = mbUserCustomMirrored;
+            }
+            else
+            {
+                bApplyNewPageMargins = false;
+            }
             break;
         }
 
-        mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
-        mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
-        if ( mbMirrored != bMirrored )
+        if ( bApplyNewPageMargins )
         {
-            mbMirrored = bMirrored;
-            mrPagePropPanel.ExecutePageLayoutChange( mbMirrored );
-        }
+            mpMarginValueSet->SetNoSelection();
+            mrPagePropPanel.ExecuteMarginLRChange( mnPageLeftMargin, mnPageRightMargin );
+            mrPagePropPanel.ExecuteMarginULChange( mnPageTopMargin, mnPageBottomMargin );
+            if ( mbMirrored != bMirrored )
+            {
+                mbMirrored = bMirrored;
+                mrPagePropPanel.ExecutePageLayoutChange( mbMirrored );
+            }
 
-        mbCustomValuesUsed = false;
+            mbCustomValuesUsed = false;
+            mrPagePropPanel.ClosePageMarginPopup();
+        }
+        else
+        {
+            // back to initial selection
+            SelectValueSetItem();
+        }
     }
 
-    mrPagePropPanel.ClosePageMarginPopup();
     return 0;
 }
 

Modified: openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.hxx?rev=1457732&r1=1457731&r2=1457732&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.hxx (original)
+++ openoffice/branches/sidebar/main/sw/source/ui/sidebar/PageMarginControl.hxx Mon Mar 18 12:23:25 2013
@@ -90,6 +90,7 @@ private:
 
     const SfxMapUnit meUnit;
 
+    bool mbUserCustomValuesAvailable;
     long mnUserCustomPageLeftMargin;
     long mnUserCustomPageRightMargin;
     long mnUserCustomPageTopMargin;

Modified: openoffice/branches/sidebar/main/sw/source/ui/sidebar/PagePropertyPanel.src
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sw/source/ui/sidebar/PagePropertyPanel.src?rev=1457732&r1=1457731&r2=1457732&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sw/source/ui/sidebar/PagePropertyPanel.src (original)
+++ openoffice/branches/sidebar/main/sw/source/ui/sidebar/PagePropertyPanel.src Mon Mar 18 12:23:25 2013
@@ -527,7 +527,7 @@ Control RID_POPUP_SWPAGE_MARGIN
 	};
 	String STR_LCVALUE
 	{
-		Text [ en-US ] = "Last Custom Value";
+		Text [ en-US ] = "Last Custom Values";
 	};
 	String STR_NARROW
 	{