summaryrefslogtreecommitdiff
path: root/oox/source/helper/propertymap.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/helper/propertymap.cxx')
-rw-r--r--oox/source/helper/propertymap.cxx120
1 files changed, 17 insertions, 103 deletions
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index 31072fe449e5..0c4e2cb07549 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -26,62 +26,37 @@
************************************************************************/
#include "oox/helper/propertymap.hxx"
-#include <osl/mutex.hxx>
-#include <cppuhelper/implbase2.hxx>
+
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include "properties.hxx"
-#include "oox/token/propertylist.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::IllegalArgumentException;
-using ::com::sun::star::lang::WrappedTargetException;
-using ::com::sun::star::beans::Property;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::beans::PropertyVetoException;
-using ::com::sun::star::beans::UnknownPropertyException;
-using ::com::sun::star::beans::XPropertyChangeListener;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::beans::XPropertySetInfo;
-using ::com::sun::star::beans::XVetoableChangeListener;
-
-#if OSL_DEBUG_LEVEL > 0
-#include <cstdio>
-#include <com/sun/star/style/LineSpacing.hpp>
-#include <com/sun/star/style/LineSpacingMode.hpp>
-#include <com/sun/star/text/WritingMode.hpp>
-#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr()
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using ::rtl::OString;
-using ::com::sun::star::style::LineSpacing;
-using ::com::sun::star::text::WritingMode;
-#endif
+#include <cppuhelper/implbase2.hxx>
+#include <osl/mutex.hxx>
+#include "oox/token/propertynames.hxx"
namespace oox {
// ============================================================================
-namespace {
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
-/** Thread-save singleton of a vector of all supported property names. */
-struct StaticPropertyList : public ::rtl::Static< PropertyList, StaticPropertyList > {};
+using ::rtl::OString;
+using ::rtl::OUString;
-// ----------------------------------------------------------------------------
+// ============================================================================
+
+namespace {
-typedef ::cppu::WeakImplHelper2< XPropertySet, XPropertySetInfo > GenericPropertySetImplBase;
+typedef ::cppu::WeakImplHelper2< XPropertySet, XPropertySetInfo > GenericPropertySetBase;
/** This class implements a generic XPropertySet.
Properties of all names and types can be set and later retrieved.
TODO: move this to comphelper or better find an existing implementation
*/
-class GenericPropertySet : public GenericPropertySetImplBase, private ::osl::Mutex
+class GenericPropertySet : public GenericPropertySetBase, private ::osl::Mutex
{
public:
explicit GenericPropertySet();
@@ -114,7 +89,7 @@ GenericPropertySet::GenericPropertySet()
GenericPropertySet::GenericPropertySet( const PropertyMap& rPropMap )
{
- const PropertyList& rPropNames = StaticPropertyList::get();
+ const PropertyNameVector& rPropNames = StaticPropertyNameVector::get();
for( PropertyMap::const_iterator aIt = rPropMap.begin(), aEnd = rPropMap.end(); aIt != aEnd; ++aIt )
maPropMap[ rPropNames[ aIt->first ] ] = aIt->second;
}
@@ -182,7 +157,7 @@ sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( const OUString& rProper
// ============================================================================
PropertyMap::PropertyMap() :
- mpPropNames( &StaticPropertyList::get() )
+ mpPropNames( &StaticPropertyNameVector::get() ) // pointer instead reference to get compiler generated copy c'tor and operator=
{
}
@@ -193,7 +168,7 @@ PropertyMap::~PropertyMap()
/*static*/ const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
{
OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" );
- return StaticPropertyList::get()[ nPropId ];
+ return StaticPropertyNameVector::get()[ nPropId ];
}
const Any* PropertyMap::getProperty( sal_Int32 nPropId ) const
@@ -241,67 +216,6 @@ Reference< XPropertySet > PropertyMap::makePropertySet() const
return new GenericPropertySet( *this );
}
-#if OSL_DEBUG_LEVEL > 0
-void PropertyMap::dump( Reference< XPropertySet > rXPropSet )
-{
- Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
- Sequence< beans::Property > props = info->getProperties ();
-
- OSL_TRACE("dump props, len: %d", props.getLength ());
-
- for (int i=0; i < props.getLength (); i++) {
- OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
- fprintf (stderr,"%30s = ", name.getStr() );
-
- try {
- Any value = rXPropSet->getPropertyValue( props [i].Name );
-
- OUString strValue;
- sal_Int32 intValue = 0;
- sal_uInt32 uintValue = 0;
- sal_Int16 int16Value = 0;
- sal_uInt16 uint16Value = 0;
- bool boolValue = false;
- LineSpacing spacing;
-// RectanglePoint pointValue;
- WritingMode aWritingMode;
-
- if( value >>= strValue )
- fprintf (stderr,"\"%s\"\n", USS( strValue ) );
- else if( value >>= intValue )
- fprintf (stderr,"%"SAL_PRIdINT32" (hex: %"SAL_PRIxUINT32")\n", intValue, intValue);
- else if( value >>= uintValue )
- fprintf (stderr,"%"SAL_PRIdINT32" (hex: %"SAL_PRIxUINT32")\n", uintValue, uintValue);
- else if( value >>= int16Value )
- fprintf (stderr,"%d (hex: %x)\n", int16Value, int16Value);
- else if( value >>= uint16Value )
- fprintf (stderr,"%d (hex: %x)\n", uint16Value, uint16Value);
- else if( value >>= boolValue )
- fprintf (stderr,"%d (bool)\n", boolValue);
- else if( value >>= aWritingMode )
- fprintf (stderr, "%d writing mode\n", aWritingMode);
- else if( value >>= spacing ) {
- fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height);
- } else if( value.isExtractableTo(::getCppuType((const sal_Int32*)0))) {
- fprintf (stderr,"is extractable to int32\n");
- }
-// else if( value >>= pointValue )
-// fprintf (stderr,"%d (RectanglePoint)\n", pointValue);
- else
- fprintf (stderr,"??? <unhandled type %s>\n", USS(value.getValueTypeName()));
- } catch(Exception e) {
- fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
- }
- }
-}
-
-void PropertyMap::dump()
-{
- dump( Reference< XPropertySet >( makePropertySet(), UNO_QUERY ) );
-}
-#endif
-
// ============================================================================
} // namespace oox
-