Commits

Anonymous committed 08b33ea

fs34b: #i117454# don't ask for the value of the possibly non-existent 'Sorting' HiddenControl

Comments (0)

Files changed (2)

wizards/com/sun/star/wizards/document/FormHandler.java

         return xFormsSupplier.getForms();
     }
 
-    public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName, String sMsg) throws com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException
+    public String getValueofHiddenControl(XNameAccess xNamedForm, String ControlName)
     {
+        String value = "";
         try
         {
             if (xNamedForm.hasByName(ControlName))
             {
-                return AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
-            }
-            else
-            {
-                throw new UnknownHiddenControlException(xNamedForm, ControlName, sMsg);
+                value = AnyConverter.toString(com.sun.star.wizards.common.Helper.getUnoPropertyValue(xNamedForm.getByName(ControlName), "HiddenValue"));
             }
         }
-        catch (Exception exception)
+        catch (Exception ex)
         {
-            throw new UnknownHiddenControlException(xNamedForm, ControlName, sMsg);
+            Logger.getLogger( FormHandler.class.getName() ).log( Level.SEVERE, null, ex );
         }
+        return value;
     }
 
     public void insertHiddenControl(XNameAccess xNameAccess, XNameContainer xNamedForm, String ControlName, String ControlValue)
         }
     }
 
-    public class UnknownHiddenControlException extends java.lang.Throwable
-    {
-
-        public UnknownHiddenControlException(XNameAccess xNamedForm, String ControlName, String sMsgHiddenControlisMissing)
-        {
-            XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xNamedForm);
-            String FormName = xNamed.getName();
-            sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, FormName, "<REPORTFORM>");
-            sMsgHiddenControlisMissing = JavaTools.replaceSubString(sMsgHiddenControlisMissing, ControlName, "<CONTROLNAME>");
-            SystemDialog.showMessageBox(xMSFDoc, "ErrorBox", VclWindowPeerAttribute.OK, sMsgHiddenControlisMissing);
-        }
-    }
-
     public boolean hasFormByName(String _FormName)
     {
         xNamedFormContainer = getDocumentForms();

wizards/com/sun/star/wizards/report/ReportTextImplementation.java

             XNameContainer xNamedForms = getDoc().oFormHandler.getDocumentForms();
             Object oDBForm = Helper.getUnoObjectbyName(xNamedForms, ReportWizard.SOREPORTFORMNAME);
             boolean bgetConnection;
-            String sQueryName = PropertyNames.EMPTY_STRING;
             if (oDBForm != null)
             {
                 String sMsg = sMsgHiddenControlMissing + (char) 13 + sMsgEndAutopilot;
                 XNameAccess xNamedForm = UnoRuntime.queryInterface( XNameAccess.class, oDBForm );
-                getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND, sMsg);
-                String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE, sMsg);
-                String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames", sMsg);
-                String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames", sMsg);
-                final String sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting", sMsg);
-                String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames", sMsg);
-                if (xNamedForm.hasByName("QueryName"))
-                {
-                    sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName", sMsg);
-                }
+                getRecordParser().Command = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND);
+                String sCommandType = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, PropertyNames.COMMAND_TYPE);
+                String sGroupFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "GroupFieldNames");
+                String sFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "FieldNames");
+                String sRecordFieldNames = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "RecordFieldNames");
+
+                String sorting = PropertyNames.EMPTY_STRING;
+                if ( xNamedForm.hasByName( "Sorting" ) )
+                    sorting = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "Sorting");
+
+                String sQueryName = PropertyNames.EMPTY_STRING;
+                if ( xNamedForm.hasByName( "QueryName" ) )
+                    sQueryName = getDoc().oFormHandler.getValueofHiddenControl(xNamedForm, "QueryName");
+
                 String[] sFieldNameList = JavaTools.ArrayoutofString(sFieldNames, PropertyNames.SEMI_COLON);
                 String[] sNewList = JavaTools.ArrayoutofString(sRecordFieldNames, PropertyNames.SEMI_COLON);
-                if ( !PropertyNames.EMPTY_STRING.equals(sorting))
+                if ( sorting.length() > 0)
                 {
                     String[] sortList = JavaTools.ArrayoutofString(sorting, PropertyNames.SEMI_COLON);
                     ArrayList<String[]> aSortFields = new ArrayList<String[]>();
             Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
             return false;
         }
-        catch (com.sun.star.wizards.document.FormHandler.UnknownHiddenControlException ex)
-        {
-            Logger.getLogger( ReportTextImplementation.class.getName() ).log( Level.SEVERE, null, ex );
-            return false;
-        }
     }
     private boolean m_bStopProcess;