summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-10-17 12:10:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-10-17 16:53:59 +0200
commit18d8ba49dcddfc7b01751d278f404a7eaebe5591 (patch)
tree360f001f1c6b2504b9d1eb98307624a4146335b5 /xmloff
parente8475b6343af23bc1ac2d722afd8df4d7615a7a8 (diff)
loplugin:virtualdead dead propertygroup functionality
ever since it was introduced in commit d09dd8986436f17717443823ef18bd8552fdf408 Date: Wed Sep 15 13:55:34 2010 +0200 dba34a: export/import min-/max-/default-/value for date/time as XML-Schema conformant strings looks like classic over-engineering Change-Id: Ia4e4b65cfe92f522dee238a54a37db01f691750e Reviewed-on: https://gerrit.libreoffice.org/80951 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/forms/property_handler.hxx5
-rw-r--r--xmloff/source/forms/elementexport.cxx41
-rw-r--r--xmloff/source/forms/handler/vcl_date_handler.cxx6
-rw-r--r--xmloff/source/forms/handler/vcl_date_handler.hxx1
-rw-r--r--xmloff/source/forms/handler/vcl_time_handler.cxx6
-rw-r--r--xmloff/source/forms/handler/vcl_time_handler.hxx1
-rw-r--r--xmloff/source/forms/property_description.hxx17
-rw-r--r--xmloff/source/forms/property_group.hxx36
-rw-r--r--xmloff/source/forms/property_meta_data.cxx95
-rw-r--r--xmloff/source/forms/property_meta_data.hxx10
10 files changed, 19 insertions, 199 deletions
diff --git a/xmloff/inc/forms/property_handler.hxx b/xmloff/inc/forms/property_handler.hxx
index a217266fc343..de5d42eb5337 100644
--- a/xmloff/inc/forms/property_handler.hxx
+++ b/xmloff/inc/forms/property_handler.hxx
@@ -38,11 +38,6 @@ namespace xmloff
class PropertyHandlerBase : public ::salhelper::SimpleReferenceObject
{
public:
- /** retrieves the XML attribute value for the given property values
- */
- virtual OUString
- getAttributeValue( const PropertyValues& i_propertyValues ) const = 0;
-
/** is a convenience method for XML attributes whose value comprises of only one UNO API property
*/
virtual OUString
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 03c188de5da6..95e6cffadaf6 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -456,42 +456,17 @@ namespace xmloff
continue;
}
- OUString attributeValue;
- if ( propDescription->propertyGroup == NO_GROUP )
+ // that's a property which has a direct mapping to an attribute
+ if ( !shouldExportProperty( prop.Name ) )
+ // TODO: in the future, we surely need a more sophisticated approach to this, involving the property
+ // handler, or the property description
{
- // that's a property which has a direct mapping to an attribute
- if ( !shouldExportProperty( prop.Name ) )
- // TODO: in the future, we surely need a more sophisticated approach to this, involving the property
- // handler, or the property description
- {
- exportedProperty( prop.Name );
- continue;
- }
-
- const Any propValue = m_xProps->getPropertyValue( prop.Name );
- attributeValue = handler->getAttributeValue( propValue );
+ exportedProperty( prop.Name );
+ continue;
}
- else
- {
- // that's a property which is part of a group of properties, whose values, in their entity, comprise
- // a single attribute value
- // retrieve the descriptions of all other properties which add to the attribute value
- PropertyDescriptionList descriptions;
- metadata::getPropertyGroup( propDescription->propertyGroup, descriptions );
-
- // retrieve the values for all those properties
- PropertyValues aValues;
- for ( const auto& desc : descriptions )
- {
- // TODO: XMultiPropertySet?
- const Any propValue = m_xProps->getPropertyValue( desc->propertyName );
- aValues[ desc->propertyId ] = propValue;
- }
-
- // let the handler translate into an XML attribute value
- attributeValue = handler->getAttributeValue( aValues );
- }
+ const Any propValue = m_xProps->getPropertyValue( prop.Name );
+ OUString attributeValue = handler->getAttributeValue( propValue );
AddAttribute(
propDescription->attribute.namespacePrefix,
diff --git a/xmloff/source/forms/handler/vcl_date_handler.cxx b/xmloff/source/forms/handler/vcl_date_handler.cxx
index 1961f332e536..e0a75861be58 100644
--- a/xmloff/source/forms/handler/vcl_date_handler.cxx
+++ b/xmloff/source/forms/handler/vcl_date_handler.cxx
@@ -42,12 +42,6 @@ namespace xmloff
{
}
- OUString VCLDateHandler::getAttributeValue( const PropertyValues& /*i_propertyValues*/ ) const
- {
- OSL_ENSURE( false, "VCLDateHandler::getAttributeValue: unexpected call!" );
- return OUString();
- }
-
OUString VCLDateHandler::getAttributeValue( const Any& i_propertyValue ) const
{
Date aDate;
diff --git a/xmloff/source/forms/handler/vcl_date_handler.hxx b/xmloff/source/forms/handler/vcl_date_handler.hxx
index 40a597540934..b67aa94bad57 100644
--- a/xmloff/source/forms/handler/vcl_date_handler.hxx
+++ b/xmloff/source/forms/handler/vcl_date_handler.hxx
@@ -32,7 +32,6 @@ namespace xmloff
VCLDateHandler();
// IPropertyHandler
- virtual OUString getAttributeValue( const PropertyValues& i_propertyValues ) const override;
virtual OUString getAttributeValue( const css::uno::Any& i_propertyValue ) const override;
virtual bool getPropertyValues( const OUString& i_attributeValue, PropertyValues& o_propertyValues ) const override;
};
diff --git a/xmloff/source/forms/handler/vcl_time_handler.cxx b/xmloff/source/forms/handler/vcl_time_handler.cxx
index 038559a0a80c..d873006479a5 100644
--- a/xmloff/source/forms/handler/vcl_time_handler.cxx
+++ b/xmloff/source/forms/handler/vcl_time_handler.cxx
@@ -42,12 +42,6 @@ namespace xmloff
{
}
- OUString VCLTimeHandler::getAttributeValue( const PropertyValues& /*i_propertyValues*/ ) const
- {
- OSL_ENSURE( false, "VCLTimeHandler::getAttributeValue: unexpected call!" );
- return OUString();
- }
-
OUString VCLTimeHandler::getAttributeValue( const Any& i_propertyValue ) const
{
css::util::Time aTime;
diff --git a/xmloff/source/forms/handler/vcl_time_handler.hxx b/xmloff/source/forms/handler/vcl_time_handler.hxx
index 6373280925fd..d445d3599a87 100644
--- a/xmloff/source/forms/handler/vcl_time_handler.hxx
+++ b/xmloff/source/forms/handler/vcl_time_handler.hxx
@@ -32,7 +32,6 @@ namespace xmloff
VCLTimeHandler();
// IPropertyHandler
- virtual OUString getAttributeValue( const PropertyValues& i_propertyValues ) const override;
virtual OUString getAttributeValue( const css::uno::Any& i_propertyValue ) const override;
virtual bool getPropertyValues( const OUString& i_attributeValue, PropertyValues& o_propertyValues ) const override;
};
diff --git a/xmloff/source/forms/property_description.hxx b/xmloff/source/forms/property_description.hxx
index 2e6e120547b6..df86e4e32528 100644
--- a/xmloff/source/forms/property_description.hxx
+++ b/xmloff/source/forms/property_description.hxx
@@ -21,8 +21,6 @@
#define INCLUDED_XMLOFF_SOURCE_FORMS_PROPERTY_DESCRIPTION_HXX
#include <forms/property_handler.hxx>
-#include "property_group.hxx"
-
#include <xmloff/xmltoken.hxx>
#include <vector>
@@ -71,23 +69,12 @@ namespace xmloff
const PropertyHandlerFactory factory;
/// the unique ID of the property. The property meta data table must not contain two entries with the same property ID
const PropertyId propertyId;
- /** the group which the property belongs to. Multiple properties belonging to the same group will, all together,
- define the attribute value to be written into the ODF file.
-
- Consequently, properties which have the same |propertyGroup| value must also have the same |attribute|
- and the same |factory| value, with the only exception being NO_GROUP properties.
-
- Note that the other direction is not given: It is perfectly legitimate to map the same attribute to different
- (disjunct) property groups.
- */
- const PropertyGroup propertyGroup;
PropertyDescription()
:propertyName()
,attribute()
,factory( nullptr )
,propertyId( PID_INVALID )
- ,propertyGroup( NO_GROUP )
{
}
@@ -96,14 +83,12 @@ namespace xmloff
const sal_uInt16 i_namespacePrefix,
const ::xmloff::token::XMLTokenEnum i_attributeToken,
const PropertyHandlerFactory i_factory,
- const PropertyId i_propertyId,
- const PropertyGroup i_propertyGroup
+ const PropertyId i_propertyId
)
:propertyName( i_propertyName )
,attribute( i_namespacePrefix, i_attributeToken )
,factory( i_factory )
,propertyId( i_propertyId )
- ,propertyGroup( i_propertyGroup )
{
}
};
diff --git a/xmloff/source/forms/property_group.hxx b/xmloff/source/forms/property_group.hxx
deleted file mode 100644
index c763d09f42e7..000000000000
--- a/xmloff/source/forms/property_group.hxx
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_XMLOFF_SOURCE_FORMS_PROPERTY_GROUP_HXX
-#define INCLUDED_XMLOFF_SOURCE_FORMS_PROPERTY_GROUP_HXX
-
-namespace xmloff
-{
-
- //= PropertyGroup
- enum PropertyGroup
- {
- NO_GROUP
- };
-
-} // namespace xmloff
-
-#endif // INCLUDED_XMLOFF_SOURCE_FORMS_PROPERTY_GROUP_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/forms/property_meta_data.cxx b/xmloff/source/forms/property_meta_data.cxx
index edf505faa45d..9f99426091e9 100644
--- a/xmloff/source/forms/property_meta_data.cxx
+++ b/xmloff/source/forms/property_meta_data.cxx
@@ -37,7 +37,7 @@ namespace xmloff { namespace metadata
using namespace ::xmloff::token;
#define FORM_SINGLE_PROPERTY( id, att ) \
- PropertyDescription( PROPERTY_##id, XML_NAMESPACE_FORM, att, &FormHandlerFactory::getFormPropertyHandler, PID_##id, NO_GROUP )
+ PropertyDescription( PROPERTY_##id, XML_NAMESPACE_FORM, att, &FormHandlerFactory::getFormPropertyHandler, PID_##id )
//= property meta data
namespace
@@ -88,25 +88,6 @@ namespace xmloff { namespace metadata
return s_propertyDescriptionsByName;
}
- typedef ::std::map< PropertyGroup, PropertyDescriptionList > IndexedPropertyGroups;
-
- const IndexedPropertyGroups& lcl_getIndexedPropertyGroups()
- {
- DBG_TESTSOLARMUTEX();
- static IndexedPropertyGroups s_indexedPropertyGroups;
- if ( s_indexedPropertyGroups.empty() )
- {
- const PropertyDescription* desc = lcl_getPropertyMetaData();
- while ( !desc->propertyName.isEmpty() )
- {
- if ( desc->propertyGroup != NO_GROUP )
- s_indexedPropertyGroups[ desc->propertyGroup ].push_back( desc );
- ++desc;
- }
- }
- return s_indexedPropertyGroups;
- }
-
typedef std::unordered_map< OUString, XMLTokenEnum > ReverseTokenLookup;
const ReverseTokenLookup& getReverseTokenLookup()
@@ -136,25 +117,6 @@ namespace xmloff { namespace metadata
}
};
- typedef std::unordered_multimap< AttributeDescription, PropertyGroup, AttributeHash > AttributeGroups;
-
- const AttributeGroups& lcl_getAttributeGroups()
- {
- DBG_TESTSOLARMUTEX();
- static AttributeGroups s_attributeGroups;
- if ( s_attributeGroups.empty() )
- {
- const PropertyDescription* desc = lcl_getPropertyMetaData();
- while ( !desc->propertyName.isEmpty() )
- {
- if ( desc->propertyGroup != NO_GROUP )
- s_attributeGroups.emplace( desc->attribute, desc->propertyGroup );
- ++desc;
- }
- }
- return s_attributeGroups;
- }
-
typedef std::unordered_map< AttributeDescription, PropertyGroups, AttributeHash > AttributesWithoutGroup;
const AttributesWithoutGroup& lcl_getAttributesWithoutGroups()
@@ -166,13 +128,10 @@ namespace xmloff { namespace metadata
const PropertyDescription* desc = lcl_getPropertyMetaData();
while ( !desc->propertyName.isEmpty() )
{
- if ( desc->propertyGroup == NO_GROUP )
- {
- PropertyDescriptionList singleElementList;
- singleElementList.push_back( desc );
+ PropertyDescriptionList singleElementList;
+ singleElementList.push_back( desc );
- s_attributesWithoutGroup[ desc->attribute ].push_back( singleElementList );
- }
+ s_attributesWithoutGroup[ desc->attribute ].push_back( singleElementList );
++desc;
}
}
@@ -189,48 +148,14 @@ namespace xmloff { namespace metadata
return nullptr;
}
- void getPropertyGroup( const PropertyGroup i_propertyGroup, PropertyDescriptionList& o_propertyDescriptions )
- {
- OSL_ENSURE( i_propertyGroup != NO_GROUP, "xmloff::metadata::getPropertyGroup: illegal group!" );
-
- const IndexedPropertyGroups& rPropertyGroups( lcl_getIndexedPropertyGroups() );
- const IndexedPropertyGroups::const_iterator pos = rPropertyGroups.find( i_propertyGroup );
- if ( pos != rPropertyGroups.end() )
- o_propertyDescriptions = pos->second;
- }
-
void getPropertyGroupList( const AttributeDescription& i_attribute, PropertyGroups& o_propertyGroups )
{
- const AttributeGroups& rAttributeGroups = lcl_getAttributeGroups();
-
- ::std::pair< AttributeGroups::const_iterator, AttributeGroups::const_iterator >
- range = rAttributeGroups.equal_range( i_attribute );
-
- if ( range.first == range.second )
- {
- // the attribute is not used for any non-trivial group, which means it is mapped directly to
- // a single property
- const AttributesWithoutGroup& attributesWithoutGroups( lcl_getAttributesWithoutGroups() );
- const AttributesWithoutGroup::const_iterator pos = attributesWithoutGroups.find( i_attribute );
- if ( pos != attributesWithoutGroups.end() )
- o_propertyGroups = pos->second;
- }
- else
- {
- const IndexedPropertyGroups& rPropertyGroups = lcl_getIndexedPropertyGroups();
- for ( AttributeGroups::const_iterator group = range.first; group != range.second; ++group )
- {
- const PropertyGroup propGroup = group->second;
- const IndexedPropertyGroups::const_iterator groupPos = rPropertyGroups.find( propGroup );
- if( groupPos == rPropertyGroups.end() )
- {
- SAL_WARN( "xmloff.forms", "getPropertyGroupList: inconsistency!" );
- continue;
- }
-
- o_propertyGroups.push_back( groupPos->second );
- }
- }
+ // the attribute is not used for any non-trivial group, which means it is mapped directly to
+ // a single property
+ const AttributesWithoutGroup& attributesWithoutGroups( lcl_getAttributesWithoutGroups() );
+ const AttributesWithoutGroup::const_iterator pos = attributesWithoutGroups.find( i_attribute );
+ if ( pos != attributesWithoutGroups.end() )
+ o_propertyGroups = pos->second;
}
AttributeDescription getAttributeDescription( const sal_uInt16 i_namespacePrefix, const OUString& i_attributeName )
diff --git a/xmloff/source/forms/property_meta_data.hxx b/xmloff/source/forms/property_meta_data.hxx
index 8d10cad16ac2..5f2b16657e8f 100644
--- a/xmloff/source/forms/property_meta_data.hxx
+++ b/xmloff/source/forms/property_meta_data.hxx
@@ -27,16 +27,6 @@ namespace xmloff { namespace metadata
const PropertyDescription* getPropertyDescription( const OUString& i_propertyName );
- /** retries the descriptions of all properties which add to the given XML attribute
-
- <p>Effectively, the complete property map is search for all entries which have the given
- namespace/attribute values.</p>
- */
- void getPropertyGroup(
- const PropertyGroup i_propertyGroup,
- PropertyDescriptionList& o_propertyDescriptions
- );
-
/** retrieves all known property groups which are mapped to the given attribute
*/
void getPropertyGroupList(