Commits

Anonymous committed cae5523

chartshapes: #i12587# line styles are not saved

Comments (0)

Files changed (4)

chart2/source/model/main/ChartModel.cxx

         switch( (*aIt).second )
         {
             case SERVICE_DASH_TABLE:
-                return m_pImplChartModel->GetDashTable();
             case SERVICE_GARDIENT_TABLE:
-                return m_pImplChartModel->GetGradientTable();
             case SERVICE_HATCH_TABLE:
-                return m_pImplChartModel->GetHatchTable();
             case SERVICE_BITMAP_TABLE:
-                return m_pImplChartModel->GetBitmapTable();
             case SERVICE_TRANSP_GRADIENT_TABLE:
-                return m_pImplChartModel->GetTransparencyGradientTable();
             case SERVICE_MARKER_TABLE:
-                // not supported
-                return 0;
+                {
+                    uno::Reference< lang::XMultiServiceFactory > xFact(
+                        this->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+                    if ( xFact.is() )
+                    {
+                        return xFact->createInstance( rServiceSpecifier );
+                    }
+                }
+                break;
             case SERVICE_NAMESPACE_MAP:
                 // not yet supported, @todo
 //                 return 0;

chart2/source/model/main/ImplChartModel.hxx

     void CreateDefaultChart();
 
     ::com::sun::star::uno::Reference<
-            ::com::sun::star::uno::XInterface > GetDashTable() const;
-    ::com::sun::star::uno::Reference<
-            ::com::sun::star::uno::XInterface > GetGradientTable() const;
-    ::com::sun::star::uno::Reference<
-            ::com::sun::star::uno::XInterface > GetHatchTable() const;
-    ::com::sun::star::uno::Reference<
-            ::com::sun::star::uno::XInterface > GetBitmapTable() const;
-    ::com::sun::star::uno::Reference<
-            ::com::sun::star::uno::XInterface > GetTransparencyGradientTable() const;
-
-    ::com::sun::star::uno::Reference<
             ::com::sun::star::uno::XInterface > GetXMLNameSpaceMap() const;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >
     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
                                           m_xPageBackground;
 
-    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xDashTable;
-    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xGradientTable;
-    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xHatchTable;
-    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xBitmapTable;
-    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xTransparencyGradientTable;
-
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>     m_xXMLNamespaceMap;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >     m_xModifyListener;

chart2/source/view/main/ChartView.cxx

 // header for class Application
 #include <vcl/svapp.hxx>
 #include <vos/mutex.hxx>
+#include <svx/unofill.hxx>
 
 #include <time.h>
 
     OSL_ENSURE(false,"not implemented");
 }
 
+// ____ XMultiServiceFactory ____
+
+Reference< uno::XInterface > ChartView::createInstance( const ::rtl::OUString& aServiceSpecifier )
+    throw (uno::Exception, uno::RuntimeException)
+{
+    SdrModel* pModel = ( m_pDrawModelWrapper ? &m_pDrawModelWrapper->getSdrModel() : NULL );
+    if ( pModel )
+    {
+        if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.DashTable" ) ) == 0 )
+        {
+            if ( !m_xDashTable.is() )
+            {
+                m_xDashTable = SvxUnoDashTable_createInstance( pModel );
+            }
+            return m_xDashTable;
+        }
+        else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.GradientTable" ) ) == 0 )
+        {
+            if ( !m_xGradientTable.is() )
+            {
+                m_xGradientTable = SvxUnoGradientTable_createInstance( pModel );
+            }
+            return m_xGradientTable;
+        }
+        else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.HatchTable" ) ) == 0 )
+        {
+            if ( !m_xHatchTable.is() )
+            {
+                m_xHatchTable = SvxUnoHatchTable_createInstance( pModel );
+            }
+            return m_xHatchTable;
+        }
+        else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.BitmapTable" ) ) == 0 )
+        {
+            if ( !m_xBitmapTable.is() )
+            {
+                m_xBitmapTable = SvxUnoBitmapTable_createInstance( pModel );
+            }
+            return m_xBitmapTable;
+        }
+        else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.TransparencyGradientTable" ) ) == 0 )
+        {
+            if ( !m_xTransGradientTable.is() )
+            {
+                m_xTransGradientTable = SvxUnoTransGradientTable_createInstance( pModel );
+            }
+            return m_xTransGradientTable;
+        }
+        else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.MarkerTable" ) ) == 0 )
+        {
+            if ( !m_xMarkerTable.is() )
+            {
+                m_xMarkerTable = SvxUnoMarkerTable_createInstance( pModel );
+            }
+            return m_xMarkerTable;
+        }
+    }
+
+    return 0;
+}
+
+Reference< uno::XInterface > ChartView::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments )
+    throw (uno::Exception, uno::RuntimeException)
+{
+    OSL_ENSURE( Arguments.getLength(), "ChartView::createInstanceWithArguments: arguments are ignored" );
+    (void) Arguments; // avoid warning
+    return createInstance( ServiceSpecifier );
+}
+
+uno::Sequence< ::rtl::OUString > ChartView::getAvailableServiceNames() throw (uno::RuntimeException)
+{
+    uno::Sequence< ::rtl::OUString > aServiceNames( 6 );
+
+    aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DashTable" ) );
+    aServiceNames[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GradientTable" ) );
+    aServiceNames[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.HatchTable" ) );
+    aServiceNames[3] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.BitmapTable" ) );
+    aServiceNames[4] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.TransparencyGradientTable" ) );
+    aServiceNames[5] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MarkerTable" ) );
+
+	return aServiceNames;
+}
 
 //.............................................................................
 } //namespace chart

chart2/source/view/main/ChartView.hxx

 
 #include "chartview/ExplicitValueProvider.hxx"
 #include "ServiceMacros.hxx"
-#include <cppuhelper/implbase8.hxx>
+#include <cppuhelper/implbase9.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
 
 // header for class SfxListener
 The View is not responsible to handle single user events (that is instead done by the ChartWindow).
 */
 
-class ChartView : public ::cppu::WeakImplHelper8<
+class ChartView : public ::cppu::WeakImplHelper9<
 	::com::sun::star::lang::XInitialization
 		, ::com::sun::star::lang::XServiceInfo
         , ::com::sun::star::datatransfer::XTransferable
         ,::com::sun::star::util::XModeChangeBroadcaster
         ,::com::sun::star::util::XUpdatable
         ,::com::sun::star::beans::XPropertySet
+        ,::com::sun::star::lang::XMultiServiceFactory
 		>
         , public ExplicitValueProvider
         , private SfxListener
     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
     
+    //-----------------------------------------------------------------
+    // ::com::sun::star::lang::XMultiServiceFactory
+    //-----------------------------------------------------------------
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier )
+        throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments(
+        const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments )
+        throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException);
 
     // for ExplicitValueProvider
     // ____ XUnoTunnel ___
 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage>
 			m_xDrawPage;
 
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xDashTable;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xGradientTable;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xHatchTable;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xBitmapTable;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xTransGradientTable;
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xMarkerTable;
+
     ::boost::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
 
     std::vector< VCoordinateSystem* > m_aVCooSysList;