summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-10-12 13:24:04 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-10-12 14:03:00 +0100
commitad067cb0c7a5fc0bb31b87e54effe6e335d129c9 (patch)
tree0d5ad3bc7e75f3bb7289c04d6e9add81f976d5b1 /extensions
parentdca5f8ad026115089620eab3fb361d9ea2f4c507 (diff)
remove StringListResource in favour of ResStringArray...
and turn local resources used as lists of strings into string array resources Change-Id: I9d67a790659963bca87aacba1c052d7b244b4e21
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx26
-rw-r--r--extensions/source/propctrlr/formres.src12
-rw-r--r--extensions/source/propctrlr/handlerhelper.cxx18
-rw-r--r--extensions/source/propctrlr/handlerhelper.hxx28
-rw-r--r--extensions/source/propctrlr/propres.src11
-rw-r--r--extensions/source/propctrlr/stringrepresentation.cxx13
6 files changed, 67 insertions, 41 deletions
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index e6b40c64e8da..362861d1271c 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -95,10 +95,10 @@
#include <svx/svxids.hrc>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
+#include <tools/resary.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/stdtext.hxx>
#include <vcl/wrkwin.hxx>
-#include <tools/StringListResource.hxx>
#include <sal/macros.h>
#include <limits>
@@ -545,10 +545,9 @@ namespace pcr
OUString sControlValue;
OSL_VERIFY( _rControlValue >>= sControlValue );
- ::std::vector< OUString > aListEntries;
- tools::StringListResource aRes( PcrRes( RID_RSC_ENUM_SHOWHIDE ), aListEntries );
- OSL_ENSURE( aListEntries.size() == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!" );
- bool bShow = ( aListEntries.size() < 2 ) || ( sControlValue == aListEntries[1] );
+ ResStringArray aListEntries(PcrRes(RID_RSC_ENUM_SHOWHIDE));
+ OSL_ENSURE( aListEntries.Count() == 2, "FormComponentPropertyHandler::convertToPropertyValue: broken resource for Show/Hide!" );
+ bool bShow = ( aListEntries.Count() < 2 ) || ( sControlValue == aListEntries.GetString(1) );
aPropertyValue <<= bShow;
}
@@ -651,15 +650,14 @@ namespace pcr
case PROPERTY_ID_SHOW_RECORDACTIONS:
case PROPERTY_ID_SHOW_FILTERSORT:
{
- ::std::vector< OUString > aListEntries;
- tools::StringListResource aRes( PcrRes( RID_RSC_ENUM_SHOWHIDE ), aListEntries );
- OSL_ENSURE( aListEntries.size() == 2, "FormComponentPropertyHandler::convertToControlValue: broken resource for Show/Hide!" );
+ ResStringArray aListEntries(PcrRes(RID_RSC_ENUM_SHOWHIDE));
+ OSL_ENSURE( aListEntries.Count() == 2, "FormComponentPropertyHandler::convertToControlValue: broken resource for Show/Hide!" );
- if ( aListEntries.size() == 2 )
+ if (aListEntries.Count() == 2)
{
OUString sControlValue = ::comphelper::getBOOL( _rPropertyValue )
- ? aListEntries[1]
- : aListEntries[0];
+ ? aListEntries.GetString(1)
+ : aListEntries.GetString(0);
aControlValue <<= sControlValue;
}
}
@@ -1252,9 +1250,9 @@ namespace pcr
)
nResId = RID_RSC_ENUM_SHOWHIDE;
- ::std::vector< OUString > aListEntries;
- tools::StringListResource aRes(PcrRes(nResId),aListEntries);
- aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( _rxControlFactory, aListEntries, false, false );
+ PcrRes aRes(nResId);
+ ResStringArray aListEntries(aRes);
+ aDescriptor.Control = PropertyHandlerHelper::createListBoxControl(_rxControlFactory, aListEntries, false, false);
bNeedDefaultStringIfVoidAllowed = true;
}
diff --git a/extensions/source/propctrlr/formres.src b/extensions/source/propctrlr/formres.src
index 728c78466fe2..654515faff37 100644
--- a/extensions/source/propctrlr/formres.src
+++ b/extensions/source/propctrlr/formres.src
@@ -1226,17 +1226,15 @@ String RID_STR_TEXTTYPE
Text [ en-US ] = "Text type";
};
-Resource RID_RSC_ENUM_SHOWHIDE
+StringArray RID_RSC_ENUM_SHOWHIDE
{
- String 1
+ ItemList [ en-US ] =
{
- Text [ en-US ] = "Hide" ;
- };
- String 2
- {
- Text [ en-US ] = "Show" ;
+ < "Hide" ; >;
+ < "Show" ; >;
};
};
+
String RID_STR_XML_DATA_MODEL
{
Text [ en-US ] = "XML data model";
diff --git a/extensions/source/propctrlr/handlerhelper.cxx b/extensions/source/propctrlr/handlerhelper.cxx
index ad612c58ae07..a4feb71ee2bd 100644
--- a/extensions/source/propctrlr/handlerhelper.cxx
+++ b/extensions/source/propctrlr/handlerhelper.cxx
@@ -35,7 +35,7 @@
#include <com/sun/star/inspection/XStringListControl.hpp>
#include <com/sun/star/inspection/XNumericControl.hpp>
#include <tools/diagnose_ex.h>
-#include <tools/StringListResource.hxx>
+#include <tools/resary.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <algorithm>
@@ -72,9 +72,8 @@ namespace pcr
// special handling for booleans (this will become a list)
if ( _rProperty.Type.getTypeClass() == TypeClass_BOOLEAN )
{
- ::std::vector< OUString > aListEntries;
- tools::StringListResource aRes(PcrRes(RID_RSC_ENUM_YESNO),aListEntries);
- _out_rDescriptor.Control = createListBoxControl( _rxControlFactory, aListEntries, bReadOnlyControl, false );
+ ResStringArray aListEntries(PcrRes(RID_RSC_ENUM_YESNO));
+ _out_rDescriptor.Control = createListBoxControl(_rxControlFactory, aListEntries, bReadOnlyControl, false);
return;
}
@@ -141,13 +140,20 @@ namespace pcr
}
}
-
Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory,
const ::std::vector< OUString >& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted )
{
- return lcl_implCreateListLikeControl( _rxControlFactory, _rInitialListEntries, _bReadOnlyControl, _bSorted, true );
+ return lcl_implCreateListLikeControl(_rxControlFactory, _rInitialListEntries, _bReadOnlyControl, _bSorted, true);
}
+ Reference< XPropertyControl > PropertyHandlerHelper::createListBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory,
+ const ResStringArray& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted )
+ {
+ std::vector<OUString> aInitialListEntries;
+ for (sal_uInt32 i = 0; i < _rInitialListEntries.Count(); ++i)
+ aInitialListEntries.push_back(_rInitialListEntries.GetString(i));
+ return lcl_implCreateListLikeControl(_rxControlFactory, aInitialListEntries, _bReadOnlyControl, _bSorted, true);
+ }
Reference< XPropertyControl > PropertyHandlerHelper::createComboBoxControl( const Reference< XPropertyControlFactory >& _rxControlFactory,
const ::std::vector< OUString >& _rInitialListEntries, bool _bReadOnlyControl, bool _bSorted )
diff --git a/extensions/source/propctrlr/handlerhelper.hxx b/extensions/source/propctrlr/handlerhelper.hxx
index ada62ff30687..6e9cac3a51cc 100644
--- a/extensions/source/propctrlr/handlerhelper.hxx
+++ b/extensions/source/propctrlr/handlerhelper.hxx
@@ -37,6 +37,8 @@ namespace com { namespace sun { namespace star {
}
} } }
+class ResStringArray;
+
namespace pcr
{
@@ -97,6 +99,32 @@ namespace pcr
bool _bSorted
);
+ /** creates an <member scope="css::inspection">PropertyControlType::ListBox</member>-type control
+ and fills it with initial values
+
+ @param _rxControlFactory
+ A control factory. Must not be <NULL/>.
+
+ @param _rInitialListEntries
+ the initial values of the control
+
+ @param _bReadOnlyControl
+ determines whether the control should be read-only
+
+ @param _bSorted
+ determines whether the list entries should be sorted
+
+ @return
+ the newly created control
+ */
+ static css::uno::Reference< css::inspection::XPropertyControl >
+ createListBoxControl(
+ const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory,
+ const ResStringArray& _rInitialListEntries,
+ bool _bReadOnlyControl,
+ bool _bSorted
+ );
+
/** creates an <member scope="css::inspection">PropertyControlType::ComboBox</member>-type control
and fills it with initial values
diff --git a/extensions/source/propctrlr/propres.src b/extensions/source/propctrlr/propres.src
index e6bd0aa36159..7881300c4189 100644
--- a/extensions/source/propctrlr/propres.src
+++ b/extensions/source/propctrlr/propres.src
@@ -32,15 +32,12 @@ String RID_STR_PROPPAGE_DATA
{
Text [ en-US ] = "Data" ;
};
-Resource RID_RSC_ENUM_YESNO
+StringArray RID_RSC_ENUM_YESNO
{
- String 1
+ ItemList [ en-US ] =
{
- Text [ en-US ] = "No" ;
- };
- String 2
- {
- Text [ en-US ] = "Yes" ;
+ < "No" ; >;
+ < "Yes" ; >;
};
};
String RID_STR_HELP_SECTION_LABEL
diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx
index 8f3407597676..ba5355dba21b 100644
--- a/extensions/source/propctrlr/stringrepresentation.cxx
+++ b/extensions/source/propctrlr/stringrepresentation.cxx
@@ -35,9 +35,9 @@
#include <com/sun/star/util/Time.hpp>
#include <comphelper/sequence.hxx>
#include <connectivity/dbconversion.hxx>
+#include <tools/resary.hxx>
#include "formresid.hrc"
#include "pcrservices.hxx"
-#include <tools/StringListResource.hxx>
#include <comphelper/types.hxx>
#include "modulepcr.hxx"
@@ -378,11 +378,11 @@ bool StringRepresentation::convertGenericValueToString( const uno::Any& _rValue,
case uno::TypeClass_BOOLEAN:
{
- ::std::vector< OUString > aListEntries;
- tools::StringListResource aRes(PcrRes(RID_RSC_ENUM_YESNO),aListEntries);
+ ResStringArray aListEntries(PcrRes(RID_RSC_ENUM_YESNO));
bool bValue = false;
_rValue >>= bValue;
- _rStringRep = bValue ? aListEntries[1] : aListEntries[0];
+ _rStringRep = bValue ? aListEntries.GetString(1)
+ : aListEntries.GetString(0);
}
break;
@@ -517,9 +517,8 @@ bool StringRepresentation::convertStringToGenericValue( const OUString& _rString
case uno::TypeClass_BOOLEAN:
{
- ::std::vector< OUString > aListEntries;
- tools::StringListResource aRes(PcrRes(RID_RSC_ENUM_YESNO),aListEntries);
- _rValue <<= aListEntries[0] != _rStringRep;
+ ResStringArray aListEntries(PcrRes(RID_RSC_ENUM_YESNO));
+ _rValue <<= aListEntries.GetString(0) != _rStringRep;
}
break;