Kaydet (Commit) 7e2450af authored tarafından Caolán McNamara's avatar Caolán McNamara

move these global static to be local statics

üst 3f41fea9
......@@ -67,26 +67,7 @@ namespace toolkitform
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
// used strings
static const ::rtl::OUString FM_PROP_CLASSID(RTL_CONSTASCII_USTRINGPARAM("ClassId"));
static const ::rtl::OUString FM_PROP_NAME(RTL_CONSTASCII_USTRINGPARAM("Name"));
static const ::rtl::OUString FM_PROP_STRINGITEMLIST(RTL_CONSTASCII_USTRINGPARAM("StringItemList"));
static const ::rtl::OUString FM_PROP_HELPTEXT(RTL_CONSTASCII_USTRINGPARAM("HelpText"));
static const ::rtl::OUString FM_PROP_TEXT(RTL_CONSTASCII_USTRINGPARAM("Text"));
static const ::rtl::OUString FM_PROP_LABEL(RTL_CONSTASCII_USTRINGPARAM("Label"));
static const ::rtl::OUString FM_PROP_READONLY(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
static const ::rtl::OUString FM_PROP_BORDER(RTL_CONSTASCII_USTRINGPARAM("Border"));
static const ::rtl::OUString FM_PROP_BACKGROUNDCOLOR(RTL_CONSTASCII_USTRINGPARAM("BackgroundColor"));
static const ::rtl::OUString FM_PROP_TEXTCOLOR(RTL_CONSTASCII_USTRINGPARAM("TextColor"));
static const ::rtl::OUString FM_PROP_MULTILINE(RTL_CONSTASCII_USTRINGPARAM("MultiLine"));
static const ::rtl::OUString FM_PROP_ALIGN(RTL_CONSTASCII_USTRINGPARAM("Align"));
static const ::rtl::OUString FM_PROP_FONT(RTL_CONSTASCII_USTRINGPARAM("FontDescriptor"));
static const ::rtl::OUString FM_PROP_MAXTEXTLEN(RTL_CONSTASCII_USTRINGPARAM("MaxTextLen"));
static const ::rtl::OUString FM_PROP_TARGET_URL(RTL_CONSTASCII_USTRINGPARAM("TargetURL"));
static const ::rtl::OUString FM_PROP_STATE(RTL_CONSTASCII_USTRINGPARAM("State"));
static const ::rtl::OUString FM_PROP_REFVALUE(RTL_CONSTASCII_USTRINGPARAM("RefValue"));
static const ::rtl::OUString FM_PROP_DROPDOWN(RTL_CONSTASCII_USTRINGPARAM("Dropdown"));
static const ::rtl::OUString FM_SUN_COMPONENT_FILECONTROL(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FileControl"));
namespace
{
......@@ -95,6 +76,7 @@ namespace toolkitform
*/
sal_Int16 classifyFormControl( const Reference< XPropertySet >& _rxModel ) SAL_THROW(( Exception ))
{
static const ::rtl::OUString FM_PROP_CLASSID(RTL_CONSTASCII_USTRINGPARAM("ClassId"));
sal_Int16 nControlType = FormComponentType::CONTROL;
Reference< XPropertySetInfo > xPSI;
......@@ -274,6 +256,7 @@ namespace toolkitform
*/
void getStringItemVector( const Reference< XPropertySet >& _rxModel, ::std::vector< ::rtl::OUString >& _rVector )
{
static const ::rtl::OUString FM_PROP_STRINGITEMLIST(RTL_CONSTASCII_USTRINGPARAM("StringItemList"));
Sequence< ::rtl::OUString > aListEntries;
OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_STRINGITEMLIST ) >>= aListEntries );
::std::copy( aListEntries.getConstArray(), aListEntries.getConstArray() + aListEntries.getLength(),
......@@ -312,8 +295,11 @@ namespace toolkitform
// --------------------------------
// Name, Description, Text
OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_NAME ) >>= _rpDescriptor->Name );
static const ::rtl::OUString FM_PROP_HELPTEXT(RTL_CONSTASCII_USTRINGPARAM("HelpText"));
OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_HELPTEXT ) >>= _rpDescriptor->Description );
Any aText;
static const ::rtl::OUString FM_PROP_TEXT(RTL_CONSTASCII_USTRINGPARAM("Text"));
static const ::rtl::OUString FM_PROP_LABEL(RTL_CONSTASCII_USTRINGPARAM("Label"));
if ( xPSI->hasPropertyByName( FM_PROP_TEXT ) )
aText = xModelProps->getPropertyValue( FM_PROP_TEXT );
else if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) )
......@@ -323,12 +309,14 @@ namespace toolkitform
// --------------------------------
// readonly
static const ::rtl::OUString FM_PROP_READONLY(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
if ( xPSI->hasPropertyByName( FM_PROP_READONLY ) )
OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_READONLY ) >>= _rpDescriptor->ReadOnly );
// --------------------------------
// border
{
static const ::rtl::OUString FM_PROP_BORDER(RTL_CONSTASCII_USTRINGPARAM("Border"));
if ( xPSI->hasPropertyByName( FM_PROP_BORDER ) )
{
sal_Int16 nBorderType = 0;
......@@ -349,6 +337,7 @@ namespace toolkitform
// --------------------------------
// background color
static const ::rtl::OUString FM_PROP_BACKGROUNDCOLOR(RTL_CONSTASCII_USTRINGPARAM("BackgroundColor"));
if ( xPSI->hasPropertyByName( FM_PROP_BACKGROUNDCOLOR ) )
{
sal_Int32 nBackColor = COL_TRANSPARENT;
......@@ -359,6 +348,7 @@ namespace toolkitform
// --------------------------------
// text color
static const ::rtl::OUString FM_PROP_TEXTCOLOR(RTL_CONSTASCII_USTRINGPARAM("TextColor"));
if ( xPSI->hasPropertyByName( FM_PROP_TEXTCOLOR ) )
{
sal_Int32 nTextColor = COL_TRANSPARENT;
......@@ -373,6 +363,7 @@ namespace toolkitform
// multi line and word break
// The MultiLine property of the control is mapped to both the "MULTILINE" and
// "WORDBREAK" style flags
static const ::rtl::OUString FM_PROP_MULTILINE(RTL_CONSTASCII_USTRINGPARAM("MultiLine"));
if ( xPSI->hasPropertyByName( FM_PROP_MULTILINE ) )
{
sal_Bool bMultiLine = sal_False;
......@@ -382,6 +373,7 @@ namespace toolkitform
}
// ............................
// horizontal alignment
static const ::rtl::OUString FM_PROP_ALIGN(RTL_CONSTASCII_USTRINGPARAM("Align"));
if ( xPSI->hasPropertyByName( FM_PROP_ALIGN ) )
{
sal_Int16 nAlign = awt::TextAlign::LEFT;
......@@ -417,6 +409,7 @@ namespace toolkitform
}
// font
static const ::rtl::OUString FM_PROP_FONT(RTL_CONSTASCII_USTRINGPARAM("FontDescriptor"));
if ( xPSI->hasPropertyByName( FM_PROP_FONT ) )
{
FontDescriptor aUNOFont;
......@@ -454,10 +447,12 @@ namespace toolkitform
}
// ............................
// file select
static const ::rtl::OUString FM_SUN_COMPONENT_FILECONTROL(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FileControl"));
if ( xSI->supportsService( FM_SUN_COMPONENT_FILECONTROL ) )
pEditWidget->FileSelect = true;
// ............................
// maximum text length
static const ::rtl::OUString FM_PROP_MAXTEXTLEN(RTL_CONSTASCII_USTRINGPARAM("MaxTextLen"));
if ( xPSI->hasPropertyByName( FM_PROP_MAXTEXTLEN ) )
{
sal_Int16 nMaxTextLength = 0;
......@@ -476,6 +471,7 @@ namespace toolkitform
::vcl::PDFWriter::PushButtonWidget* pButtonWidget = static_cast< ::vcl::PDFWriter::PushButtonWidget* >( _rpDescriptor.get() );
FormButtonType eButtonType = FormButtonType_PUSH;
OSL_VERIFY( xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ) ) >>= eButtonType );
static const ::rtl::OUString FM_PROP_TARGET_URL(RTL_CONSTASCII_USTRINGPARAM("TargetURL"));
if ( eButtonType == FormButtonType_SUBMIT )
{
// if a button is a submit button, then it uses the URL at it's parent form
......@@ -517,6 +513,7 @@ namespace toolkitform
// --------------------------------
// check boxes
static const ::rtl::OUString FM_PROP_STATE(RTL_CONSTASCII_USTRINGPARAM("State"));
if ( _rpDescriptor->getType() == ::vcl::PDFWriter::CheckBox )
{
::vcl::PDFWriter::CheckBoxWidget* pCheckBoxWidget = static_cast< ::vcl::PDFWriter::CheckBoxWidget* >( _rpDescriptor.get() );
......@@ -536,6 +533,7 @@ namespace toolkitform
pRadioWidget->RadioGroup = determineRadioGroupId( xModelProps );
try
{
static const ::rtl::OUString FM_PROP_REFVALUE(RTL_CONSTASCII_USTRINGPARAM("RefValue"));
xModelProps->getPropertyValue( FM_PROP_REFVALUE ) >>= pRadioWidget->OnValue;
}
catch(...)
......@@ -551,6 +549,7 @@ namespace toolkitform
::vcl::PDFWriter::ListBoxWidget* pListWidget = static_cast< ::vcl::PDFWriter::ListBoxWidget* >( _rpDescriptor.get() );
// ............................
// drop down
static const ::rtl::OUString FM_PROP_DROPDOWN(RTL_CONSTASCII_USTRINGPARAM("Dropdown"));
OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_DROPDOWN ) >>= pListWidget->DropDown );
// ............................
// multi selection
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment