[Libreoffice-commits] core.git: 6 commits - chart2/inc chart2/source drawinglayer/source include/drawinglayer include/svx Makefile.in svx/source

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Apr 25 11:11:05 PDT 2014


 Makefile.in                                                       |    4 
 chart2/inc/ChartModel.hxx                                         |    3 
 chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx |   33 +++++-
 chart2/source/model/main/ChartModel.cxx                           |    5 
 chart2/source/view/main/ChartView.cxx                             |   34 ++++--
 chart2/source/view/main/ShapeFactory.cxx                          |   13 +-
 drawinglayer/source/dumper/XShapeDumper.cxx                       |   25 ++++
 include/drawinglayer/XShapeDumper.hxx                             |    2 
 include/svx/unopage.hxx                                           |   12 +-
 svx/source/unodraw/unopage.cxx                                    |   53 +++++++++-
 10 files changed, 155 insertions(+), 29 deletions(-)

New commits:
commit 96c66da23a327ec68d0ad5966fc1e79b7af41e56
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Apr 25 20:07:31 2014 +0200

    fix comment about ChartView::dump

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index ec9dcb5..77db5f9 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3056,7 +3056,7 @@ uno::Sequence< OUString > ChartView::getAvailableServiceNames() throw (uno::Runt
 OUString ChartView::dump() throw (uno::RuntimeException, std::exception)
 {
 #if HAVE_FEATURE_DESKTOP
-    // Used for unit tests only, no need to drag in this when cross-compiling
+    // Used for unit tests and in chartcontroller only, no need to drag in this when cross-compiling
     // for non-desktop
     impl_updateView();
     uno::Reference< drawing::XShapes > xShapes( m_xDrawPage, uno::UNO_QUERY_THROW );
commit 3b2ec44912ca2e0548d8078d2edf17fa10856553
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Apr 25 19:56:36 2014 +0200

    the chart root shape has to be at the bottom, fdo#74333, cp#1000057
    
    Change-Id: Ic99fec987f290e94e4b45f4d193406daa2de4740

diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index b51f197..892c4b3 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -66,10 +66,15 @@ uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape(
     uno::Reference< drawing::XShapes > xRet( ShapeFactory::getChartRootShape( xDrawPage ) );
     if( !xRet.is()  )
     {
-        //create the root shape
-        xRet = this->createGroup2D(
-            uno::Reference<drawing::XShapes>( xDrawPage, uno::UNO_QUERY )
-            , "com.sun.star.chart2.shapes" );
+        uno::Reference< drawing::XShape > xShape( m_xShapeFactory->createInstance(
+                    "com.sun.star.drawing.GroupShape" ), uno::UNO_QUERY );
+        uno::Reference< drawing::XShapes2 > xShapes2(xDrawPage, uno::UNO_QUERY_THROW);
+        xShapes2->addBottom(xShape);
+
+        setShapeName( xShape, "com.sun.star.chart2.shapes" );
+        xShape->setSize(awt::Size(0,0));
+
+        xRet = uno::Reference<drawing::XShapes>( xShape, uno::UNO_QUERY );
     }
     return xRet;
 }
diff --git a/include/svx/unopage.hxx b/include/svx/unopage.hxx
index a5a37d5..515074c 100644
--- a/include/svx/unopage.hxx
+++ b/include/svx/unopage.hxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XShapes2.hpp>
 #include <com/sun/star/drawing/XShapeGrouper.hpp>
 #include <com/sun/star/drawing/XShapeCombiner.hpp>
 #include <com/sun/star/drawing/XShapeBinder.hpp>
@@ -35,7 +36,7 @@
 #include <editeng/mutxhelp.hxx>
 #include <svx/svxdllapi.h>
 
-#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase6.hxx>
 #include <comphelper/servicehelper.hxx>
 
 #include <svx/unoprov.hxx>
@@ -55,8 +56,9 @@ class SvxShapeConnector;
 #define TWIPS_TO_MM(val) ((val * 127 + 36) / 72)
 #define MM_TO_TWIPS(val) ((val * 72 + 63) / 127)
 
-class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun::star::drawing::XDrawPage,
+class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper6< ::com::sun::star::drawing::XDrawPage,
                                                ::com::sun::star::drawing::XShapeGrouper,
+                                               ::com::sun::star::drawing::XShapes2,
                                                ::com::sun::star::lang::XServiceInfo,
                                                ::com::sun::star::lang::XUnoTunnel,
                                                ::com::sun::star::lang::XComponent>,
@@ -84,7 +86,7 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun:
     void ChangeModel( SdrModel* pNewModel );
 
     // Creation of a SdrObject and insertion into the SdrPage
-    SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw();
+    SdrObject *CreateSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, bool bBeginning = false ) throw();
 
     // Determine Type and Inventor
     void GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const OUString& aName ) const throw();
@@ -115,6 +117,10 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper5< ::com::sun:
         throw (::com::sun::star::uno::RuntimeException,
                std::exception) SAL_OVERRIDE;
 
+    // XShapes2
+    virtual void SAL_CALL addTop( const ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual void SAL_CALL addBottom( const ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
     // XElementAccess
     virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index cf8b824..d8466ab 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -231,6 +231,50 @@ void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape
     mpModel->SetChanged();
 }
 
+void SAL_CALL SvxDrawPage::addTop( const uno::Reference< drawing::XShape >& xShape )
+    throw( uno::RuntimeException, std::exception )
+{
+    add(xShape);
+}
+
+void SAL_CALL SvxDrawPage::addBottom( const uno::Reference< drawing::XShape >& xShape )
+    throw( uno::RuntimeException, std::exception )
+{
+    SolarMutexGuard aGuard;
+
+    if ( ( mpModel == NULL ) || ( mpPage == NULL ) )
+        throw lang::DisposedException();
+
+    SvxShape* pShape = SvxShape::getImplementation( xShape );
+
+    if( NULL == pShape )
+        return;
+
+    SdrObject *pObj = pShape->GetSdrObject();
+
+    if(!pObj)
+    {
+        pObj = CreateSdrObject( xShape, true );
+        ENSURE_OR_RETURN_VOID( pObj != NULL, "SvxDrawPage::add: no SdrObject was created!" );
+    }
+    else if ( !pObj->IsInserted() )
+    {
+        pObj->SetModel(mpModel);
+        mpPage->InsertObject( pObj, 0 );
+    }
+
+    pShape->Create( pObj, this );
+    OSL_ENSURE( pShape->GetSdrObject() == pObj, "SvxDrawPage::add: shape does not know about its newly created SdrObject!" );
+
+    if ( !pObj->IsInserted() )
+    {
+        pObj->SetModel(mpModel);
+        mpPage->InsertObject( pObj, 0 );
+    }
+
+    mpModel->SetChanged();
+}
+
 void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
     throw (uno::RuntimeException, std::exception)
 {
@@ -802,14 +846,19 @@ Reference< drawing::XShape >  SvxDrawPage::_CreateShape( SdrObject *pObj ) const
     return xShape;
 }
 
-SdrObject *SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xShape ) throw()
+SdrObject *SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xShape, bool bBeginning ) throw()
 {
     SdrObject* pObj = _CreateSdrObject( xShape );
     if( pObj)
     {
         pObj->SetModel(mpModel);
         if ( !pObj->IsInserted() && !pObj->IsDoNotInsertIntoPageAutomatically() )
-            mpPage->InsertObject( pObj );
+        {
+            if(bBeginning)
+                mpPage->InsertObject( pObj, 0 );
+            else
+                mpPage->InsertObject( pObj );
+        }
     }
 
     return pObj;
commit 12ace5060dbef6add5521fb932d78e7807c793be
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Apr 25 19:55:59 2014 +0200

    dump also drawinglayer shapes that are externally added
    
    Change-Id: I0a5ba2db0fa09193803442b5771a1d6b0475c2c8

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index fe5d38c..ec9dcb5 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3059,17 +3059,31 @@ OUString ChartView::dump() throw (uno::RuntimeException, std::exception)
     // Used for unit tests only, no need to drag in this when cross-compiling
     // for non-desktop
     impl_updateView();
-    if(!mxRootShape.is())
-        mxRootShape = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory)
-            ->getOrCreateChartRootShape( m_xDrawPage );
-
-    if (!mxRootShape.is())
-        return OUString();
-    else
+    uno::Reference< drawing::XShapes > xShapes( m_xDrawPage, uno::UNO_QUERY_THROW );
+    sal_Int32 n = xShapes->getCount();
+    OUStringBuffer aBuffer;
+    for(sal_Int32 i = 0; i < n; ++i)
     {
-        XShapeDumper dumper;
-        return dumper.dump(mxRootShape);
+        uno::Reference< drawing::XShapes > xShape(xShapes->getByIndex(i), uno::UNO_QUERY);
+        if(xShape.is())
+        {
+            XShapeDumper dumper;
+            OUString aString = dumper.dump(mxRootShape);
+            aBuffer.append(aString);
+        }
+        else
+        {
+            uno::Reference< drawing::XShape > xSingleShape(xShapes->getByIndex(i), uno::UNO_QUERY);
+            if(!xSingleShape.is())
+                continue;
+            XShapeDumper dumper;
+            OUString aString = dumper.dump(xSingleShape);
+            aBuffer.append(aString);
+        }
+        aBuffer.append("\n\n");
     }
+
+    return aBuffer.makeStringAndClear();
 #else
     return OUString();
 #endif
commit a371f5de634195785c9e4b90118049b3c8260ac6
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Apr 25 19:49:09 2014 +0200

    fix missing service factory during import, related fdo#74333, cp#1000057
    
    Change-Id: I2cce561587d82b0434ef2d3e65e5d35b7ff99260

diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index d62628f..38735d9 100644
--- a/chart2/inc/ChartModel.hxx
+++ b/chart2/inc/ChartModel.hxx
@@ -581,12 +581,15 @@ public:
     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >
         getNumberFormatsSupplier();
 
+    com::sun::star::uno::Reference< com::sun::star::uno::XInterface > getChartView();
+
     bool isTimeBased() const;
     void setTimeBased(bool bTimeBased);
 
     void getNextTimePoint();
     void setTimeBasedRange(sal_Int32 nStart, sal_Int32 nEnd);
 
+private:
     sal_Int32 mnStart;
     sal_Int32 mnEnd;
     bool bSet;
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index f68cd67..5e27717 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -1147,6 +1147,24 @@ uno::Reference< drawing::XDrawPage > ChartDocumentWrapper::impl_getDrawPage() co
     return m_spChart2ModelContact->getDrawPage();
 }
 
+namespace {
+
+uno::Reference< lang::XMultiServiceFactory > getShapeFactory(uno::Reference<uno::XInterface> xChartView)
+{
+    Reference< lang::XUnoTunnel> xUnoTunnel(xChartView,uno::UNO_QUERY);
+    if(xUnoTunnel.is())
+    {
+        ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
+                    ExplicitValueProvider::getUnoTunnelId() ));
+        if( pProvider )
+            return pProvider->getDrawModelWrapper()->getShapeFactory();
+
+    }
+    return uno::Reference< lang::XMultiServiceFactory >();
+}
+
+}
+
 // ____ XMultiServiceFactory ____
 uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
     const OUString& aServiceSpecifier )
@@ -1385,15 +1403,18 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
         {
             if( !m_xShapeFactory.is() && m_xChartView.is() )
             {
-                Reference< lang::XUnoTunnel> xUnoTunnel(m_xChartView,uno::UNO_QUERY);
-                if(xUnoTunnel.is())
+                m_xShapeFactory = getShapeFactory( m_xChartView );
+            }
+            else
+            {
+                ChartModel* pModel = m_spChart2ModelContact->getModel();
+                if(pModel)
                 {
-                    ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
-                        ExplicitValueProvider::getUnoTunnelId() ));
-                    if( pProvider )
-                        m_xShapeFactory.set( pProvider->getDrawModelWrapper()->getShapeFactory() );
+                    m_xChartView = pModel->getChartView();
+                    m_xShapeFactory = getShapeFactory( m_xChartView );
                 }
             }
+
             if( m_xShapeFactory.is() )
             {
                 xResult = m_xShapeFactory->createInstance( aServiceSpecifier );
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 1b725ac..e386d7f 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1402,6 +1402,11 @@ void ChartModel::setTimeBasedRange(sal_Int32 nStart, sal_Int32 nEnd)
     mbTimeBased = true;
 }
 
+uno::Reference< uno::XInterface > ChartModel::getChartView()
+{
+    return xChartView;
+}
+
 }  // namespace chart
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 08299e911131c2850907d9c612950497a8348d2f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Apr 25 19:47:36 2014 +0200

    add way for shape dumper to dump single shape
    
    Change-Id: I031921d6869d3bbdef4ed11e4316b6cd977992ca

diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 93712ad..639ec73 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -1938,7 +1938,6 @@ void dumpXShapes( uno::Reference< drawing::XShapes > xShapes, xmlTextWriterPtr x
 
 OUString XShapeDumper::dump(uno::Reference<drawing::XShapes> xPageShapes, bool bDumpInteropProperties)
 {
-
     OStringBuffer aString;
     xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, NULL );
     xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
@@ -1961,4 +1960,28 @@ OUString XShapeDumper::dump(uno::Reference<drawing::XShapes> xPageShapes, bool b
     return OStringToOUString(aString.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
 }
 
+OUString XShapeDumper::dump(uno::Reference<drawing::XShape> xPageShapes, bool bDumpInteropProperties)
+{
+    OStringBuffer aString;
+    xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO( writeCallback, closeCallback, &aString, NULL );
+    xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer );
+    xmlTextWriterSetIndent( xmlWriter, 1 );
+
+    xmlTextWriterStartDocument( xmlWriter, NULL, NULL, NULL );
+
+    try
+    {
+        dumpXShape( xPageShapes, xmlWriter, bDumpInteropProperties );
+    }
+    catch (const beans::UnknownPropertyException& e)
+    {
+        std::cout << "Exception caught in XShapeDumper: " << e.Message << std::endl;
+    }
+
+    xmlTextWriterEndDocument( xmlWriter );
+    xmlFreeTextWriter( xmlWriter );
+
+    return OStringToOUString(aString.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/XShapeDumper.hxx b/include/drawinglayer/XShapeDumper.hxx
index efce777..e8c50bc 100644
--- a/include/drawinglayer/XShapeDumper.hxx
+++ b/include/drawinglayer/XShapeDumper.hxx
@@ -47,7 +47,7 @@ class DRAWINGLAYER_DLLPUBLIC XShapeDumper
 public:
     XShapeDumper();
     OUString dump(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> xPageShapes, bool bDumpInteropProperties=false);
-
+    OUString dump(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xPageShapes, bool bDumpInteropProperties=false);
 };
 
 #endif
commit 9f13bb51a852f29ce3c26845859a547c6be4e423
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Apr 25 19:11:57 2014 +0200

    support sc.slowcheck
    
    Change-Id: I91dcdba455660dee25accdd2185a876bf7012ff8

diff --git a/Makefile.in b/Makefile.in
index 0be30f7..f63dbe0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -61,12 +61,12 @@ PARALLELISM_OPTION := $(if $(filter-out 0,$(PARALLELISM)),-j $(PARALLELISM),)
 # Partial Build
 #
 define gb_Top_GbuildModuleRules
-.PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).showdeliverables $(1).subsequentcheck
+.PHONY: $(1) $(1).all $(1).build $(1).check $(1).clean $(1).showdeliverables $(1).subsequentcheck $(1).slowcheck
 
 $(1): bootstrap fetch
 	cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS)
 
-$(1).build $(1).check $(1).clean $(1).showdeliverables $(1).subsequentcheck:
+$(1).build $(1).check $(1).clean $(1).showdeliverables $(1).subsequentcheck $(1).slowcheck:
 	cd $(SRCDIR)/$(2) && $$(MAKE) $(PARALLELISM_OPTION) $(GMAKE_OPTIONS) $$(patsubst $(1).%,%,$$@)
 
 $(1).all: bootstrap fetch


More information about the Libreoffice-commits mailing list