Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index



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 <iorsh@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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.