2001-01-12 04:35:45 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 04:49:26 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2008-04-11 04:49:26 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2008-04-11 04:49:26 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2008-04-11 04:49:26 -05:00
|
|
|
* $RCSfile: formbrowsertools.cxx,v $
|
|
|
|
* $Revision: 1.7 $
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2008-04-11 04:49:26 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2008-04-11 04:49:26 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2008-04-11 04:49:26 -05:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
2008-04-11 04:49:26 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2001-01-12 04:35:45 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 07:17:03 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_extensions.hxx"
|
2001-01-12 04:35:45 -06:00
|
|
|
#include "formbrowsertools.hxx"
|
|
|
|
#include <com/sun/star/form/FormComponentType.hpp>
|
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#ifndef _EXTENSIONS_FORMCTRLR_PROPRESID_HRC_
|
|
|
|
#include "formresid.hrc"
|
|
|
|
#endif
|
|
|
|
#ifndef _EXTENSIONS_PROPCTRLR_MODULEPRC_HXX_
|
|
|
|
#include "modulepcr.hxx"
|
|
|
|
#endif
|
|
|
|
#include <tools/string.hxx>
|
|
|
|
#include "formstrings.hxx"
|
|
|
|
|
|
|
|
//............................................................................
|
|
|
|
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
|
|
|
|
//............................................................................
|
|
|
|
|