[Libreoffice-commits] core.git: 2 commits - sc/source sd/source

David Tardon dtardon at redhat.com
Mon Aug 1 15:31:35 UTC 2016


 sc/source/ui/inc/csvgrid.hxx    |    2 -
 sd/source/ui/inc/unopage.hxx    |    5 ++-
 sd/source/ui/unoidl/unopage.cxx |   57 +++++++++++++++++++++++-----------------
 3 files changed, 38 insertions(+), 26 deletions(-)

New commits:
commit b7b951a90b210bdec5215f2ad09f8a10757a1b2a
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Aug 1 16:04:36 2016 +0200

    tdf#100969 ensure proper update after model change
    
    Change-Id: I62836056aeda7497552d60d33fedd9490a6fe545

diff --git a/sd/source/ui/inc/unopage.hxx b/sd/source/ui/inc/unopage.hxx
index b2f5b67..ae5e2b6 100644
--- a/sd/source/ui/inc/unopage.hxx
+++ b/sd/source/ui/inc/unopage.hxx
@@ -60,8 +60,11 @@ class SdGenericDrawPage : public SvxFmDrawPage,
 private:
     SdXImpressDocument* mpModel;
     SdrModel* mpSdrModel;
+    bool      mbIsImpressDocument;
     sal_Int16 mnTempPageNumber; // for printing handouts
 
+    void UpdateModel();
+
 protected:
     friend class SdXImpressDocument;
 
@@ -81,7 +84,7 @@ protected:
     void SetWidth( sal_Int32 nWidth );
     void SetHeight( sal_Int32 nHeight );
 
-    bool     mbIsImpressDocument;
+    bool IsImpressDocument() const;
 
     virtual void disposing() throw() override;
 
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 4ca21d0..7ca15d9 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -347,9 +347,9 @@ SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument* _pModel, SdPage* pInPa
         SdUnoSearchReplaceShape(this),
         mpModel     ( _pModel ),
         mpSdrModel(nullptr),
+        mbIsImpressDocument(false),
         mnTempPageNumber(0),
-        mpPropSet   ( _pSet ),
-        mbIsImpressDocument(false)
+        mpPropSet   ( _pSet )
 {
     mpSdrModel = SvxFmDrawPage::mpModel;
     if( mpModel )
@@ -370,22 +370,31 @@ void SdGenericDrawPage::throwIfDisposed() const throw (css::uno::RuntimeExceptio
 SdXImpressDocument* SdGenericDrawPage::GetModel() const
 {
     if( mpSdrModel != SvxFmDrawPage::mpModel )
+        const_cast<SdGenericDrawPage*>(this)->UpdateModel();
+    return mpModel;
+}
+
+bool SdGenericDrawPage::IsImpressDocument() const
+{
+    if( mpSdrModel != SvxFmDrawPage::mpModel )
+        const_cast<SdGenericDrawPage*>(this)->UpdateModel();
+    return mbIsImpressDocument;
+}
+
+
+void SdGenericDrawPage::UpdateModel()
+{
+    mpSdrModel = SvxFmDrawPage::mpModel;
+    if( mpSdrModel )
     {
-        const_cast< SdGenericDrawPage* >(this)->mpSdrModel = SvxFmDrawPage::mpModel;
-        if( mpSdrModel )
-        {
-            uno::Reference< uno::XInterface > xModel( SvxFmDrawPage::mpModel->getUnoModel() );
-            const_cast< SdGenericDrawPage*>(this)->mpModel = SdXImpressDocument::getImplementation( xModel );
-            if( mpModel )
-                const_cast< SdGenericDrawPage*>(this)->mbIsImpressDocument = mpModel->IsImpressDocument();
-        }
-        else
-        {
-            const_cast< SdGenericDrawPage* >(this)->mpModel = nullptr;
-        }
+        uno::Reference< uno::XInterface > xModel( SvxFmDrawPage::mpModel->getUnoModel() );
+        mpModel = SdXImpressDocument::getImplementation( xModel );
     }
-
-    return mpModel;
+    else
+    {
+        mpModel = nullptr;
+    }
+    mbIsImpressDocument = mpModel ? mpModel->IsImpressDocument() : false;
 }
 
 // this is called whenever a SdrObject must be created for a empty api shape wrapper
@@ -573,7 +582,7 @@ Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType )
     {
         aAny <<= Reference<office::XAnnotationAccess>(this);
     }
-    else if (mbIsImpressDocument && rType == cppu::UnoType<XAnimationNodeSupplier>::get())
+    else if (IsImpressDocument() && rType == cppu::UnoType<XAnimationNodeSupplier>::get())
     {
         const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
 
@@ -2071,7 +2080,7 @@ Any SAL_CALL SdDrawPage::queryInterface( const uno::Type & rType )
     {
         return makeAny( Reference< drawing::XMasterPageTarget >( this ) );
     }
-    else if( mbIsImpressDocument
+    else if( IsImpressDocument()
              && rType == cppu::UnoType<presentation::XPresentationPage>::get() )
     {
         SdPage * p = dynamic_cast<SdPage *>(SvxDrawPage::mpPage);
@@ -2106,7 +2115,7 @@ Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeExceptio
     if( maTypeSequence.getLength() == 0 )
     {
         const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
-        bool bPresPage = mbIsImpressDocument && ePageKind != PK_HANDOUT;
+        bool bPresPage = IsImpressDocument() && ePageKind != PK_HANDOUT;
 
         // Collect the types of this class.
         ::std::vector<uno::Type> aTypes;
@@ -2258,7 +2267,7 @@ Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames() throw(uno::
     Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
     comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.DrawPage"} );
 
-    if( mbIsImpressDocument )
+    if( IsImpressDocument() )
         comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.presentation.DrawPage"} );
 
     return aSeq;
@@ -2719,7 +2728,7 @@ Any SAL_CALL SdMasterPage::queryInterface( const uno::Type & rType )
     else if( rType == cppu::UnoType<container::XNamed>::get() )
         aAny <<=  Reference< container::XNamed >(this);
     else if( rType == cppu::UnoType<presentation::XPresentationPage>::get() &&
-             ( mbIsImpressDocument &&
+             ( IsImpressDocument() &&
                GetPage()  && GetPage()->GetPageKind() != PK_HANDOUT) )
         aAny <<= Reference< presentation::XPresentationPage >( this );
     else
@@ -2750,7 +2759,7 @@ Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeExcept
     if( maTypeSequence.getLength() == 0 )
     {
         const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
-        bool bPresPage = mbIsImpressDocument && SvxFmDrawPage::mpPage && ePageKind != PK_HANDOUT;
+        bool bPresPage = IsImpressDocument() && SvxFmDrawPage::mpPage && ePageKind != PK_HANDOUT;
 
         // Collect the types of this class.
         ::std::vector<uno::Type> aTypes;
@@ -2871,7 +2880,7 @@ void SdMasterPage::setBackground( const Any& rValue )
 
     try
     {
-        if( GetModel() && mbIsImpressDocument )
+        if( GetModel() && IsImpressDocument() )
         {
             Reference< container::XNameAccess >  xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
             Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW ) ;
@@ -2971,7 +2980,7 @@ void SdMasterPage::getBackground( Any& rValue ) throw (std::exception)
 {
     if( GetModel() ) try
     {
-        if( mbIsImpressDocument )
+        if( IsImpressDocument() )
         {
             Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
             Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW );
commit f977b4c87ebb7ef213d71eb6afc9f757c25edc7b
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Jul 25 17:24:53 2016 +0200

    fix copypasta
    
    Change-Id: I069b3bb80fbe095335fb350f984116bfc8a0f01d

diff --git a/sc/source/ui/inc/csvgrid.hxx b/sc/source/ui/inc/csvgrid.hxx
index 63e2013..9f60114 100644
--- a/sc/source/ui/inc/csvgrid.hxx
+++ b/sc/source/ui/inc/csvgrid.hxx
@@ -189,7 +189,7 @@ public:
 private:
     /** Returns the data type of the specified column. */
     SAL_DLLPRIVATE sal_Int32                   GetColumnType( sal_uInt32 nColIndex ) const;
-    /** Returns the data type of the specified column. */
+    /** Sets the data type of the specified column. */
     SAL_DLLPRIVATE void                        SetColumnType( sal_uInt32 nColIndex, sal_Int32 nColType );
 
     /** Scrolls data grid vertically. */


More information about the Libreoffice-commits mailing list