2001-01-12 04:35:45 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 14:11:31 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2005-09-08 14:11:31 -05:00
|
|
|
* $RCSfile: formbrowsertools.cxx,v $
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2006-03-14 04:22:45 -06:00
|
|
|
* $Revision: 1.5 $
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2006-03-14 04:22:45 -06:00
|
|
|
* last change: $Author: vg $ $Date: 2006-03-14 11:22:45 $
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2005-09-08 14:11:31 -05:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 14:11:31 -05:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2005-09-08 14:11:31 -05:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2005-09-08 14:11:31 -05:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2005-09-08 14:11:31 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _EXTENSIONS_FORMSCTRLR_FORMBROWSERTOOLS_HXX_
|
|
|
|
#include "formbrowsertools.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_
|
|
|
|
#include <com/sun/star/form/FormComponentType.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
|
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_
|
|
|
|
#include "formresid.hrc"
|
|
|
|
#endif
|
|
|
|
#ifndef _EXTENSIONS_PROPCTRLR_MODULEPRC_HXX_
|
|
|
|
#include "modulepcr.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _STRING_HXX
|
|
|
|
#include <tools/string.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _EXTENSIONS_FORMSCTRLR_FORMSTRINGS_HXX_
|
|
|
|
#include "formstrings.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//............................................................................
|
|
|
|
namespace pcr
|
|
|
|
{
|
|
|
|
//............................................................................
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::form;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
|
|
|
|
::rtl::OUString GetUIHeadlineName(sal_Int16 nClassId, const Any& aUnoObj)
|
|
|
|
{
|
2006-03-14 04:22:45 -06:00
|
|
|
PcrClient aResourceAccess;
|
2001-01-12 04:35:45 -06:00
|
|
|
// this ensures that we have our resource file loaded
|
|
|
|
|
|
|
|
::rtl::OUString sClassName;
|
|
|
|
switch (nClassId)
|
|
|
|
{
|
|
|
|
case FormComponentType::TEXTFIELD:
|
|
|
|
{
|
|
|
|
Reference< XInterface > xIFace;
|
|
|
|
aUnoObj >>= xIFace;
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_EDIT));
|
2001-01-12 04:35:45 -06:00
|
|
|
if (xIFace.is())
|
|
|
|
{ // we have a chance to check if it's a formatted field model
|
|
|
|
Reference< XServiceInfo > xInfo(xIFace, UNO_QUERY);
|
|
|
|
if (xInfo.is() && (xInfo->supportsService(SERVICE_COMPONENT_FORMATTEDFIELD)))
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_FORMATTED));
|
2001-01-12 04:35:45 -06:00
|
|
|
else if (!xInfo.is())
|
|
|
|
{
|
|
|
|
// couldn't distinguish between formatted and edit with the service name, so try with the properties
|
|
|
|
Reference< XPropertySet > xProps(xIFace, UNO_QUERY);
|
|
|
|
if (xProps.is())
|
|
|
|
{
|
|
|
|
Reference< XPropertySetInfo > xPropsInfo = xProps->getPropertySetInfo();
|
|
|
|
if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(PROPERTY_FORMATSSUPPLIER))
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_FORMATTED));
|
2001-01-12 04:35:45 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FormComponentType::COMMANDBUTTON:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_PUSHBUTTON)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::RADIOBUTTON:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_RADIOBUTTON)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::CHECKBOX:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_CHECKBOX)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::LISTBOX:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_LISTBOX)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::COMBOBOX:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_COMBOBOX)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::GROUPBOX:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_GROUPBOX)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::IMAGEBUTTON:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_IMAGEBUTTON)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::FIXEDTEXT:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_FIXEDTEXT)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::GRIDCONTROL:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_DBGRID)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::FILECONTROL:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_FILECONTROL)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
|
|
|
|
case FormComponentType::DATEFIELD:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_DATEFIELD)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::TIMEFIELD:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_TIMEFIELD)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::NUMERICFIELD:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_NUMERICFIELD)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::CURRENCYFIELD:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_CURRENCYFIELD)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::PATTERNFIELD:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_PATTERNFIELD)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::IMAGECONTROL:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_IMAGECONTROL)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
case FormComponentType::HIDDENCONTROL:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_HIDDENCONTROL)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
|
|
|
|
case FormComponentType::CONTROL:
|
|
|
|
default:
|
2006-03-14 04:22:45 -06:00
|
|
|
sClassName = String(PcrRes(RID_STR_PROPTITLE_UNKNOWNCONTROL)); break;
|
2001-01-12 04:35:45 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return sClassName;
|
|
|
|
}
|
|
|
|
|
|
|
|
//............................................................................
|
|
|
|
} // namespace pcr
|
|
|
|
//............................................................................
|
|
|
|
|