When the user selects "Pages" radio button in the Range section, it is very
reasonable to expect that she would now want to specify the range. Thus moving
the focus automatically to the page range edit box would save the user a mouse
click.

Code is contributed under the LGPLv3+ / MPL.

Signed-off-by: Maxim Iorsh <io...@users.sourceforge.net>
---
 vcl/source/window/printdlg.cxx |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 969030c..5a59281 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -2300,6 +2300,27 @@ IMPL_LINK( PrintDialog, UIOption_RadioHdl, RadioButton*, i_pBtn )
             sal_Int32 nVal = it->second;
             pVal->Value <<= nVal;
 
+            // when page range option is selected, focus on range input.
+            if (pVal->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PrintContent" ) ) &&
+                nVal == 1)
+            {
+                std::map< rtl::OUString, std::vector< Window* > >::const_iterator pit = maPropertyToWindowMap.find( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ) );
+                if( pit != maPropertyToWindowMap.end() )
+                {
+                    const std::vector< Window* >& rWindows( pit->second );
+                    if( ! rWindows.empty() )
+                    {
+                        // we should have an Edit for this one
+                        Edit* pRange = dynamic_cast< Edit* >( rWindows.front() );
+                        if( pRange )
+                        {
+                            pRange->SetSelection( Selection( 0, 0xFFFF ) ); // select all
+                            pRange->GrabFocus();
+                        }
+                    }
+                }
+            }
+
             checkOptionalControlDependencies();
 
             // update preview and page settings
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to