summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-09 11:12:06 +0200
committerNoel Grandin <noel@peralex.com>2013-05-13 09:38:03 +0200
commit5d1ad167294878789e644452f23ef883af93fe87 (patch)
tree8f8e14de156eb20e5843e7458502b58828c258a9 /sc
parent39ab9c4e4f4fb26326d8b1f08e4ef45cbe268cfb (diff)
fdo#46808 Convert chart2::FormattedString service to new style
API CHANGE: dropped the following services from the new unified interface because the current service does not implement them. service ::com::sun::star::style::CharacterProperties; [optional] service ::com::sun::star::style::CharacterPropertiesAsian; [optional] service ::com::sun::star::style::CharacterPropertiesComplex; Change-Id: I7cb6a5d4e998975b1272f4f4da03feea30cd30b6
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xichart.cxx33
-rw-r--r--sc/source/filter/ftools/fapihelper.cxx10
-rw-r--r--sc/source/filter/inc/fapihelper.hxx70
-rw-r--r--sc/source/filter/inc/xlchart.hxx1
4 files changed, 45 insertions, 69 deletions
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index f783eed1524f..50d36d26c7fa 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/chart/TimeUnit.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart/XDiagramPositioning.hpp>
+#include <com/sun/star/chart2/FormattedString.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
@@ -875,25 +876,21 @@ Sequence< Reference< XFormattedString > > XclImpChSourceLink::CreateStringSequen
{
for( XclImpStringIterator aIt( *mxString ); aIt.Is(); ++aIt )
{
- Reference< XFormattedString > xFmtStr(
- ScfApiHelper::CreateInstance( SERVICE_CHART2_FORMATTEDSTRING ), UNO_QUERY );
- if( xFmtStr.is() )
- {
- // set text data
- xFmtStr->setString( aIt.GetPortionText() );
-
- // set font formatting and font color
- ScfPropertySet aStringProp( xFmtStr );
- sal_uInt16 nFontIdx = aIt.GetPortionFont();
- if( (nFontIdx == EXC_FONT_NOTFOUND) && (aIt.GetPortionIndex() == 0) )
- // leading unformatted portion - use passed font settings
- rRoot.ConvertFont( aStringProp, nLeadFontIdx, &rLeadFontColor );
- else
- rRoot.ConvertFont( aStringProp, nFontIdx );
+ Reference< css::chart2::XFormattedString2 > xFmtStr = css::chart2::FormattedString::create( comphelper::getProcessComponentContext() );
+ // set text data
+ xFmtStr->setString( aIt.GetPortionText() );
+
+ // set font formatting and font color
+ ScfPropertySet aStringProp( xFmtStr );
+ sal_uInt16 nFontIdx = aIt.GetPortionFont();
+ if( (nFontIdx == EXC_FONT_NOTFOUND) && (aIt.GetPortionIndex() == 0) )
+ // leading unformatted portion - use passed font settings
+ rRoot.ConvertFont( aStringProp, nLeadFontIdx, &rLeadFontColor );
+ else
+ rRoot.ConvertFont( aStringProp, nFontIdx );
- // add string to vector of strings
- aStringVec.push_back( xFmtStr );
- }
+ // add string to vector of strings
+ aStringVec.push_back( xFmtStr );
}
}
return ScfApiHelper::VectorToSequence( aStringVec );
diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx
index 47f35c0d2cf1..3bf0f3e17319 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -56,7 +56,7 @@ using namespace ::com::sun::star;
// Static helper functions ====================================================
-OUString ScfApiHelper::GetServiceName( Reference< XInterface > xInt )
+OUString ScfApiHelper::GetServiceName( const Reference< XInterface >& xInt )
{
OUString aService;
Reference< XServiceName > xServiceName( xInt, UNO_QUERY );
@@ -74,7 +74,7 @@ Reference< XMultiServiceFactory > ScfApiHelper::GetServiceFactory( SfxObjectShel
}
Reference< XInterface > ScfApiHelper::CreateInstance(
- Reference< XMultiServiceFactory > xFactory, const OUString& rServiceName )
+ const Reference< XMultiServiceFactory >& xFactory, const OUString& rServiceName )
{
Reference< XInterface > xInt;
if( xFactory.is() )
@@ -323,9 +323,9 @@ void ScfPropSetHelper::ReadFromPropertySet( const ScfPropertySet& rPropSet )
mnNextIdx = 0;
}
-bool ScfPropSetHelper::ReadValue( UnoAny& rAny )
+bool ScfPropSetHelper::ReadValue( Any& rAny )
{
- UnoAny* pAny = GetNextAny();
+ Any* pAny = GetNextAny();
if( pAny )
rAny = *pAny;
return pAny != 0;
@@ -367,7 +367,7 @@ void ScfPropSetHelper::InitializeWrite( bool bClearAllAnys )
void ScfPropSetHelper::WriteValue( const Any& rAny )
{
- if( UnoAny* pAny = GetNextAny() )
+ if( Any* pAny = GetNextAny() )
*pAny = rAny;
}
diff --git a/sc/source/filter/inc/fapihelper.hxx b/sc/source/filter/inc/fapihelper.hxx
index b4b696af1c7f..1238220d70ec 100644
--- a/sc/source/filter/inc/fapihelper.hxx
+++ b/sc/source/filter/inc/fapihelper.hxx
@@ -46,11 +46,6 @@ class SfxObjectShell;
class ScfApiHelper
{
public:
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > XInterfaceRef;
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > XServiceFactoryRef;
- typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > UnoAnySequence;
-
-public:
/** Converts a tools color to a UNO color value. */
inline static sal_Int32 ConvertToApiColor( const Color& rColor )
{ return static_cast< sal_Int32 >( rColor.GetColor() ); }
@@ -64,23 +59,23 @@ public:
VectorToSequence( const ::std::vector< Type >& rVector );
/** Returns the service name provided via the XServiceName interface, or an empty string on error. */
- static OUString GetServiceName( XInterfaceRef xInt );
+ static OUString GetServiceName( const css::uno::Reference< css::uno::XInterface >& xInt );
/** Returns the multi service factory from a document shell. */
- static XServiceFactoryRef GetServiceFactory( SfxObjectShell* pShell );
+ static css::uno::Reference< css::lang::XMultiServiceFactory > GetServiceFactory( SfxObjectShell* pShell );
/** Creates an instance from the passed service name, using the passed service factory. */
- static XInterfaceRef CreateInstance(
- XServiceFactoryRef xFactory,
+ static css::uno::Reference< css::uno::XInterface > CreateInstance(
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory,
const OUString& rServiceName );
/** Creates an instance from the passed service name, using the service factory of the passed object. */
- static XInterfaceRef CreateInstance(
+ static css::uno::Reference< css::uno::XInterface > CreateInstance(
SfxObjectShell* pShell,
const OUString& rServiceName );
/** Creates an instance from the passed service name, using the process service factory. */
- static XInterfaceRef CreateInstance( const OUString& rServiceName );
+ static css::uno::Reference< css::uno::XInterface > CreateInstance( const OUString& rServiceName );
/** Opens a password dialog and returns the encryption data.
@return The encryption data or an empty sequence on 'Cancel' or any error. */
@@ -116,36 +111,27 @@ template< typename Type >
class ScfPropertySet
{
public:
- typedef ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertySet > XPropertySetRef;
- typedef ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XMultiPropertySet > XMultiPropSetRef;
- typedef ::com::sun::star::uno::Any UnoAny;
- typedef ::com::sun::star::uno::Sequence< UnoAny > UnoAnySequence;
- typedef ::com::sun::star::uno::Sequence< OUString > OUStringSequence;
-
-public:
inline explicit ScfPropertySet() {}
/** Constructs a property set wrapper with the passed UNO property set. */
- inline explicit ScfPropertySet( XPropertySetRef xPropSet ) { Set( xPropSet ); }
+ inline explicit ScfPropertySet( const css::uno::Reference< css::beans::XPropertySet > & xPropSet ) { Set( xPropSet ); }
/** Constructs a property set wrapper after querying the XPropertySet interface. */
template< typename InterfaceType >
- inline explicit ScfPropertySet( ::com::sun::star::uno::Reference< InterfaceType > xInterface ) { Set( xInterface ); }
+ inline explicit ScfPropertySet( const css::uno::Reference< InterfaceType >& xInterface ) { Set( xInterface ); }
~ScfPropertySet();
/** Sets the passed UNO property set and releases the old UNO property set. */
- void Set( XPropertySetRef xPropSet );
+ void Set( css::uno::Reference< css::beans::XPropertySet > xPropSet );
/** Queries the passed interface for an XPropertySet and releases the old UNO property set. */
template< typename InterfaceType >
inline void Set( ::com::sun::star::uno::Reference< InterfaceType > xInterface )
- { Set( XPropertySetRef( xInterface, ::com::sun::star::uno::UNO_QUERY ) ); }
+ { Set( css::uno::Reference< css::beans::XPropertySet >( xInterface, ::com::sun::star::uno::UNO_QUERY ) ); }
/** Returns true, if the contained XPropertySet interface is valid. */
inline bool Is() const { return mxPropSet.is(); }
/** Returns the contained XPropertySet interface. */
- inline XPropertySetRef GetApiPropertySet() const { return mxPropSet; }
+ inline css::uno::Reference< css::beans::XPropertySet > GetApiPropertySet() const { return mxPropSet; }
/** Returns the service name provided via the XServiceName interface, or an empty string on error. */
OUString GetServiceName() const;
@@ -157,13 +143,13 @@ public:
/** Gets the specified property from the property set.
@return true, if the Any could be filled with the property value. */
- bool GetAnyProperty( UnoAny& rValue, const OUString& rPropName ) const;
+ bool GetAnyProperty( css::uno::Any& rValue, const OUString& rPropName ) const;
/** Gets the specified property from the property set.
@return true, if the passed variable could be filled with the property value. */
template< typename Type >
inline bool GetProperty( Type& rValue, const OUString& rPropName ) const
- { UnoAny aAny; return GetAnyProperty( aAny, rPropName ) && (aAny >>= rValue); }
+ { css::uno::Any aAny; return GetAnyProperty( aAny, rPropName ) && (aAny >>= rValue); }
/** Gets the specified Boolean property from the property set.
@return true = property contains true; false = property contains false or error occurred. */
@@ -179,12 +165,12 @@ public:
/** Gets the specified properties from the property set. Tries to use the XMultiPropertySet interface.
@param rPropNames The property names. MUST be ordered alphabetically.
@param rValues The related property values. */
- void GetProperties( UnoAnySequence& rValues, const OUStringSequence& rPropNames ) const;
+ void GetProperties( css::uno::Sequence< css::uno::Any >& rValues, const css::uno::Sequence< OUString >& rPropNames ) const;
// Set properties ---------------------------------------------------------
/** Puts the passed Any into the property set. */
- void SetAnyProperty( const OUString& rPropName, const UnoAny& rValue );
+ void SetAnyProperty( const OUString& rPropName, const css::uno::Any& rValue );
/** Puts the passed value into the property set. */
template< typename Type >
@@ -206,12 +192,12 @@ public:
/** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface.
@param rPropNames The property names. MUST be ordered alphabetically.
@param rValues The related property values. */
- void SetProperties( const OUStringSequence& rPropNames, const UnoAnySequence& rValues );
+ void SetProperties( const css::uno::Sequence< OUString > & rPropNames, const css::uno::Sequence< css::uno::Any >& rValues );
// ------------------------------------------------------------------------
private:
- XPropertySetRef mxPropSet; /// The mandatory property set interface.
- XMultiPropSetRef mxMultiPropSet; /// The optional multi property set interface.
+ css::uno::Reference< css::beans::XPropertySet > mxPropSet; /// The mandatory property set interface.
+ css::uno::Reference< css::beans::XMultiPropertySet > mxMultiPropSet; /// The optional multi property set interface.
};
// ----------------------------------------------------------------------------
@@ -233,9 +219,6 @@ private:
class ScfPropSetHelper
{
public:
- typedef ::com::sun::star::uno::Any UnoAny;
-
-public:
/** @param ppPropNames A null-terminated array of ASCII property names. */
explicit ScfPropSetHelper( const sal_Char* const* ppcPropNames );
@@ -248,7 +231,7 @@ public:
template< typename Type >
bool ReadValue( Type& rValue );
/** Reads an Any from the value sequence. */
- bool ReadValue( UnoAny& rAny );
+ bool ReadValue( css::uno::Any& rAny );
/** Reads a tools string from the value sequence. */
bool ReadValue( String& rString );
/** Reads a color value from the value sequence. */
@@ -265,7 +248,7 @@ public:
template< typename Type >
void WriteValue( const Type& rValue );
/** Writes an Any to the value sequence. */
- void WriteValue( const UnoAny& rAny );
+ void WriteValue( const css::uno::Any& rAny );
/** Writes a tools string to the value sequence. */
inline void WriteValue( const String& rString )
{ WriteValue( OUString( rString ) ); }
@@ -281,14 +264,11 @@ public:
// ------------------------------------------------------------------------
private:
/** Returns a pointer to the next Any to be written to. */
- UnoAny* GetNextAny();
+ css::uno::Any* GetNextAny();
private:
- typedef ::com::sun::star::uno::Sequence< OUString > OUStringSequence;
- typedef ::com::sun::star::uno::Sequence< UnoAny > UnoAnySequence;
-
- OUStringSequence maNameSeq; /// Sequence of property names.
- UnoAnySequence maValueSeq; /// Sequence of property values.
+ css::uno::Sequence< OUString > maNameSeq; /// Sequence of property names.
+ css::uno::Sequence< css::uno::Any > maValueSeq; /// Sequence of property values.
ScfInt32Vec maNameOrder; /// Maps initial order to alphabetical order.
size_t mnNextIdx; /// Counter for next Any to be processed.
};
@@ -298,14 +278,14 @@ private:
template< typename Type >
bool ScfPropSetHelper::ReadValue( Type& rValue )
{
- UnoAny* pAny = GetNextAny();
+ css::uno::Any* pAny = GetNextAny();
return pAny && (*pAny >>= rValue);
}
template< typename Type >
void ScfPropSetHelper::WriteValue( const Type& rValue )
{
- UnoAny* pAny = GetNextAny();
+ css::uno::Any* pAny = GetNextAny();
if( pAny )
*pAny <<= rValue;
}
diff --git a/sc/source/filter/inc/xlchart.hxx b/sc/source/filter/inc/xlchart.hxx
index 0df3408de43f..9743bee767ce 100644
--- a/sc/source/filter/inc/xlchart.hxx
+++ b/sc/source/filter/inc/xlchart.hxx
@@ -56,7 +56,6 @@ class XclRoot;
#define SERVICE_CHART2_DIAGRAM "com.sun.star.chart2.Diagram"
#define SERVICE_CHART2_ERRORBAR "com.sun.star.chart2.ErrorBar"
#define SERVICE_CHART2_EXPREGCURVE "com.sun.star.chart2.ExponentialRegressionCurve"
-#define SERVICE_CHART2_FORMATTEDSTRING "com.sun.star.chart2.FormattedString"
#define SERVICE_CHART2_LEGEND "com.sun.star.chart2.Legend"
#define SERVICE_CHART2_LINEARREGCURVE "com.sun.star.chart2.LinearRegressionCurve"
#define SERVICE_CHART2_LINEARSCALING "com.sun.star.chart2.LinearScaling"