[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - 8 commits - filter/source sc/source sd/source sw/qa vcl/source writerfilter/source

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Mar 17 10:59:25 UTC 2017


 filter/source/msfilter/svdfppt.cxx           |    4 
 sc/source/core/data/conditio.cxx             |    6 
 sc/source/ui/docshell/docsh5.cxx             |    3 
 sd/source/filter/ppt/pptin.cxx               |   11 
 sd/source/filter/ppt/pptin.hxx               |   10 
 sd/source/ui/view/drviews3.cxx               |  351 +++++++++++++--------------
 sw/qa/extras/ooxmlexport/data/tdf103931.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx    |    8 
 sw/qa/extras/rtfimport/data/tdf105729.rtf    |    9 
 sw/qa/extras/rtfimport/rtfimport.cxx         |    6 
 vcl/source/gdi/CommonSalLayout.cxx           |    2 
 writerfilter/source/dmapper/DomainMapper.cxx |    6 
 writerfilter/source/ooxml/model.xml          |    1 
 13 files changed, 222 insertions(+), 195 deletions(-)

New commits:
commit afe8ca1ee3b5b291645c7845e844138652c53d6c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Mar 16 20:08:30 2017 +0100

    the range should be updated after the references, tdf#104026
    
    Change-Id: I2cb674b8b3bc64df031b473b337d266a2eaab43d
    Reviewed-on: https://gerrit.libreoffice.org/35289
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    (cherry picked from commit 3f0f35c89f3f64fcb110483fd562a59f729dc344)
    Reviewed-on: https://gerrit.libreoffice.org/35297
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit 0ee960fb555deb0a91e8c0e81812ab888ff13c2f)

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 6657dcf37608..f4f0f116ba61 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1926,13 +1926,13 @@ void ScConditionalFormat::CompileXML()
 
 void ScConditionalFormat::UpdateReference( sc::RefUpdateContext& rCxt, bool bCopyAsMove )
 {
+    for(CondFormatContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
+        (*itr)->UpdateReference(rCxt);
+
     if (rCxt.meMode == URM_COPY && bCopyAsMove)
         maRanges.UpdateReference(URM_MOVE, pDoc, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
     else
         maRanges.UpdateReference(rCxt.meMode, pDoc, rCxt.maRange, rCxt.mnColDelta, rCxt.mnRowDelta, rCxt.mnTabDelta);
-
-    for(CondFormatContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
-        (*itr)->UpdateReference(rCxt);
 }
 
 void ScConditionalFormat::InsertRow(SCTAB nTab, SCCOL nColStart, SCCOL nColEnd, SCROW nRowPos, SCSIZE nSize)
commit 6ed2efbb59400df46f14f3729e5e7189aa4a8833
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Mar 14 09:38:44 2017 +0100

    tdf#105729 RTF import: \ltrpar should not override \qc from style
    
    This is similar to commit 92fd894ea18672cba4cf961bdc4c0bc98f168102
    (tdf#94435 RTF import: \ltrpar should not override \qc, 2015-10-05),
    except that here the \qc is inherited from the style, it's not a direct
    formatting. The problematic code was added in commit
    2638faa2e834c2da4c195224fd88d32c29b3d0cc (writerfilter08ooo330: applied
    patch for writerfilter08, 2010-07-28), and it's not really clear to me
    what is its purpose, given that the DOC import equivalent in
    SwWW8ImplReader::Read_ParaBiDi() doesn't set the paragraph alignment.
    
    Fix the situation by not touching the paragraph alignment for the RTF
    case at least.
    
    (cherry picked from commit 2cc5f18d10cf6ef1349d9518e6f67977f7c5d9bf)
    
    Change-Id: I2baa2c8c8012d972740da7cf3f710117812859b3
    Reviewed-on: https://gerrit.libreoffice.org/35190
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit b5c4e120540053d0cb737720503cb7038f12d5bd)

diff --git a/sw/qa/extras/rtfimport/data/tdf105729.rtf b/sw/qa/extras/rtfimport/data/tdf105729.rtf
new file mode 100644
index 000000000000..996dd37b0057
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf105729.rtf
@@ -0,0 +1,9 @@
+{\rtf1
+{\stylesheet
+{\s16\qc
+Titel 1;}
+}
+\pard\plain \ltrpar\s16\qc
+Centered Title
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 1b9a2cc368a1..79f82d72dedb 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2746,6 +2746,12 @@ DECLARE_RTFIMPORT_TEST(testTdf104287, "tdf104287.rtf")
     CPPUNIT_ASSERT(xShape->getAnchor().is());
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf105729, "tdf105729.rtf")
+{
+    // This was style::ParagraphAdjust_LEFT, \ltrpar undone the effect of \qc from style.
+    CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust")));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index fe7b9a97b0b4..79a12523f999 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1445,12 +1445,14 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
             if (nIntValue != 0)
             {
                 rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::RL_TB ));
-                rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_RIGHT ), /*bOverwrite=*/false);
+                if (!IsRTFImport())
+                    rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_RIGHT ), /*bOverwrite=*/false);
             }
             else
             {
                 rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::LR_TB ));
-                rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_LEFT ), /*bOverwrite=*/false);
+                if (!IsRTFImport())
+                    rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_LEFT ), /*bOverwrite=*/false);
             }
         }
 
commit e3632cc981208fbfbd7c56ebf7b49164f881a580
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Mar 6 22:26:32 2017 +0100

    Resolves: tdf#102777 broadcast SC_TAB_INSERTED when inserting scenario
    
    So ScViewData::maTabData gets an entry added which deleting the scenario
    can remove again.
    
    (cherry picked from commit 4c8059a3e140171399ac85ceb882d23bb458599d)
    
    Change-Id: I166baeff5408ef67faef41364515a13b8d4610bb
    Reviewed-on: https://gerrit.libreoffice.org/34942
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit d846a0d7643cf32a43069d9beb3a419a5a4af9f4)

diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index d3437b8c5dcb..368042114ce8 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -824,6 +824,9 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUStrin
             PostPaintExtras();                                          // Tabellenreiter
             aModificator.SetDocumentModified();
 
+            // A scenario tab is like a hidden sheet, broadcasting also
+            // notifies ScTabViewShell to add an ScViewData::maTabData entry.
+            Broadcast( ScTablesHint( SC_TAB_INSERTED, nNewTab ));
             SfxGetpApp()->Broadcast( SfxHint( SC_HINT_TABLES_CHANGED ) );
 
             return nNewTab;
commit 2ff9cff66819fd9ea3aaf7a1caaa00838773f75b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Feb 28 09:16:48 2017 +0100

    tdf#103931 DOCX import: fix lost section break
    
    When there are multiple sections in a document, every <w:p> element
    triggers a handleLastParagraphInSection() call, and that's how the
    previous section is ended and the next one is started if necessary. In
    case the section contains no paragraphs at all, the section was lost on
    import. Fix this by also calling handleLastParagraphInSection() on
    <w:sectPr> as well.
    
    It's not a problem if there are both <w:p> and <w:sectPr> in a section
    (which is the usual situation) as only the first call closes the
    previous section / starts the next one.
    
    (cherry picked from commit 6603947329a7b372a173a3c60e013e532d0bc5cf)
    
    Change-Id: I64f2c403dcb2ceca76d444ab06df3052235d2795
    Reviewed-on: https://gerrit.libreoffice.org/34718
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit 1e88c10327642e6867db5708e3fd0fb7065bc74c)

diff --git a/sw/qa/extras/ooxmlexport/data/tdf103931.docx b/sw/qa/extras/ooxmlexport/data/tdf103931.docx
new file mode 100644
index 000000000000..094fe1ba91cf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf103931.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index ef278f245757..001f5b026251 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -207,6 +207,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106001, "tdf106001.docx")
     CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int16>( 100 ), getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharScaleWidth" ));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf103931, "tdf103931.docx")
+{
+    uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+    // This was 2, the last (empty) section of the document was lost on import.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), xTextSections->getCount());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 24a020b1bc58..19339d3ee040 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -17822,6 +17822,7 @@
     </resource>
     <resource name="CT_SectPrBase" resource="Properties"/>
     <resource name="CT_SectPr" resource="Properties">
+      <action name="start" action="handleLastParagraphInSection"/>
       <element name="sectPrChange" tokenid="ooxml:CT_SectPr_sectPrChange"/>
       <action name="start" action="setLastParagraphInSection"/>
     </resource>
commit 08b7e84a01d836e513a85f542217b9c67eddda7d
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Fri Mar 10 16:53:08 2017 +0200

    tdf#106466: Use graphite2 shaper first
    
    We want to always prefer Graphite shaping when supported by the font,
    which is also what HarfBuzz does by default.
    
    Change-Id: I6670fc03b8e6b3d7e07e1b8e0062880524da1655
    Reviewed-on: https://gerrit.libreoffice.org/35046
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    (cherry picked from commit 3cee50476e422e3ed84169cdcbe6bd9883fc9316)
    Reviewed-on: https://gerrit.libreoffice.org/35058
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit 68b546b17afa0082862f2a20b8f089ae9124a16a)

diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 21be0c99bf01..a6ca683c15f5 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -579,7 +579,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
             // preference. The coretext_aat shaper is available only on macOS,
             // but there is no harm in always including it, HarfBuzz will
             // ignore unavailable shapers.
-            const char* pHbShapers[] = { "coretext_aat", "graphite2", "ot", "fallback", nullptr };
+            const char* pHbShapers[] = { "graphite2", "coretext_aat", "ot", "fallback", nullptr };
             hb_segment_properties_t aHbProps;
             hb_buffer_get_segment_properties(pHbBuffer, &aHbProps);
             hb_shape_plan_t* pHbPlan = hb_shape_plan_create_cached(pHbFace, &aHbProps, maFeatures.data(), maFeatures.size(), pHbShapers);
commit a135e567b8d9735e7a1d7d506730aafc0c43b7f1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 16 11:40:20 2017 +0000

    ofz#877 reference to stack alloced obj outlives obj
    
    (cherry picked from commit ae174b009bcf0f84073b9ebbf01ad31b274b789e)
    
    Change-Id: I8c854e2f651f8bf0018e8249827aae0fe23057e7
    Reviewed-on: https://gerrit.libreoffice.org/35271
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 037069698c6aa78a3509c0527b0bd00c412ba735)

diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 78b5e274c7cd..f2e90fc41cb6 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -100,10 +100,8 @@
 using namespace ::com::sun::star;
 
 SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotStorage& rStorage, SfxMedium& rMedium )
+    : maParam(rDocStream, 0)
 {
-
-    sal_uInt32 nImportFlags = 0;
-
 #ifdef DBG_UTIL
     PropRead* pSummaryInformation = new PropRead( rStorage, OUString( "\005SummaryInformation"  ) );
     if ( pSummaryInformation->IsValid() )
@@ -123,7 +121,7 @@ SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotSt
                 aPropItem.Read( aComment );
                 if ( aComment.indexOf( "Applixware" ) >= 0 )
                 {
-                    nImportFlags |= PPT_IMPORTFLAGS_NO_TEXT_ASSERT;
+                    maParam.nImportFlags |= PPT_IMPORTFLAGS_NO_TEXT_ASSERT;
                 }
             }
         }
@@ -131,11 +129,10 @@ SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotSt
     delete pSummaryInformation;
 #endif
 
-    PowerPointImportParam aParam( rDocStream, nImportFlags );
     SvStream* pCurrentUserStream = rStorage.OpenSotStream( "Current User", StreamMode::STD_READ );
     if( pCurrentUserStream )
     {
-        ReadPptCurrentUserAtom( *pCurrentUserStream, aParam.aCurrentUserAtom );
+        ReadPptCurrentUserAtom(*pCurrentUserStream, maParam.aCurrentUserAtom);
         delete pCurrentUserStream;
     }
 
@@ -155,7 +152,7 @@ SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotSt
         }
     }
 
-    pFilter = new ImplSdPPTImport( pDocument, rStorage, rMedium, aParam );
+    pFilter = new ImplSdPPTImport(pDocument, rStorage, rMedium, maParam);
 }
 
 bool SdPPTImport::Import()
diff --git a/sd/source/filter/ppt/pptin.hxx b/sd/source/filter/ppt/pptin.hxx
index f9435922facf..7fb951fe48fc 100644
--- a/sd/source/filter/ppt/pptin.hxx
+++ b/sd/source/filter/ppt/pptin.hxx
@@ -48,7 +48,6 @@ class ImplSdPPTImport : public SdrPowerPointImport
 {
     SfxMedium&      mrMed;
     SotStorage&      mrStorage;
-//  SvStream*       mpPicStream;
     DffRecordHeader maDocHd;
     std::vector<OUString> maSlideNameList;
     bool            mbDocumentFound;
@@ -82,14 +81,15 @@ public:
 
 class SdPPTImport
 {
+    PowerPointImportParam maParam;
     ImplSdPPTImport* pFilter;
 
-    public:
+public:
 
-        SdPPTImport( SdDrawDocument* pDoc, SvStream& rDocStream, SotStorage& rStorage, SfxMedium& rMed );
-        ~SdPPTImport();
+    SdPPTImport( SdDrawDocument* pDoc, SvStream& rDocStream, SotStorage& rStorage, SfxMedium& rMed );
+    ~SdPPTImport();
 
-        bool Import();
+    bool Import();
 };
 
 #endif // INCLUDED_SD_SOURCE_FILTER_PPT_PPTIN_HXX
commit caa1dd5272dea3fb43a0cc2df3104106bd629756
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 16 10:50:37 2017 +0000

    Resolves: tdf#106557 don't crash on missing line spacing argument
    
    this is all a bit addled, but at least don't crash
    
    Change-Id: I19c35205446cebc83b8299839bcab8e02ff7c07d
    (cherry picked from commit ab10f03ec4dc7d5d7659fb62c59972c80221f733)
    Reviewed-on: https://gerrit.libreoffice.org/35261
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit d0b73f86c667e3637cc439868cb84e7182d98786)

diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index d24e4cbeaefb..e1655ac096e0 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -493,167 +493,166 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
     switch ( rReq.GetSlot() )
     {
         case SID_ATTR_LONG_LRSPACE:
-        {
-            SdUndoGroup* pUndoGroup = new SdUndoGroup(GetDoc());
-            pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
+            if (pArgs)
+            {
+                SdUndoGroup* pUndoGroup = new SdUndoGroup(GetDoc());
+                pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
 
-            const SvxLongLRSpaceItem& rLRSpace = static_cast<const SvxLongLRSpaceItem&>(
-                    pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE)));
+                const SvxLongLRSpaceItem& rLRSpace = static_cast<const SvxLongLRSpaceItem&>(
+                        pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_LRSPACE)));
 
-            if( mpDrawView->IsTextEdit() )
-            {
-                Rectangle aRect = maMarkRect;
-                aRect.SetPos(aRect.TopLeft() + aPagePos);
-                aRect.Left()  = rLRSpace.GetLeft();
-                aRect.Right() = aViewSize.Width() - rLRSpace.GetRight();
-                aRect.SetPos(aRect.TopLeft() - aPagePos);
-                if ( aRect != maMarkRect)
+                if( mpDrawView->IsTextEdit() )
                 {
-                    mpDrawView->SetAllMarkedRect(aRect);
-                    maMarkRect = mpDrawView->GetAllMarkedRect();
-                    Invalidate( SID_RULER_OBJECT );
+                    Rectangle aRect = maMarkRect;
+                    aRect.SetPos(aRect.TopLeft() + aPagePos);
+                    aRect.Left()  = rLRSpace.GetLeft();
+                    aRect.Right() = aViewSize.Width() - rLRSpace.GetRight();
+                    aRect.SetPos(aRect.TopLeft() - aPagePos);
+                    if ( aRect != maMarkRect)
+                    {
+                        mpDrawView->SetAllMarkedRect(aRect);
+                        maMarkRect = mpDrawView->GetAllMarkedRect();
+                        Invalidate( SID_RULER_OBJECT );
+                    }
+                }
+                else
+                {
+                    long nLeft = std::max(0L, rLRSpace.GetLeft() - aPagePos.X());
+                    long nRight = std::max(0L, rLRSpace.GetRight() + aPagePos.X() +
+                                          aPageSize.Width() - aViewSize.Width());
+
+                    sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
+                    sal_uInt16 i;
+                    for ( i = 0; i < nPageCnt; i++)
+                    {
+                        SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
+                        SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
+                                                pPage,
+                                                pPage->GetLftBorder(),
+                                                pPage->GetRgtBorder(),
+                                                nLeft, nRight);
+                        pUndoGroup->AddAction(pUndo);
+                        pPage->SetLftBorder(nLeft);
+                        pPage->SetRgtBorder(nRight);
+                    }
+                    nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
+
+                    for (i = 0; i < nPageCnt; i++)
+                    {
+                        SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
+                        SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
+                                                pPage,
+                                                pPage->GetLftBorder(),
+                                                pPage->GetRgtBorder(),
+                                                nLeft, nRight);
+                        pUndoGroup->AddAction(pUndo);
+                        pPage->SetLftBorder(nLeft);
+                        pPage->SetRgtBorder(nRight);
+                    }
+                    InvalidateWindows();
                 }
+
+                // give the undo group to the undo manager
+                GetViewFrame()->GetObjectShell()->GetUndoManager()->
+                                                    AddUndoAction(pUndoGroup);
             }
-            else
+            break;
+        case SID_ATTR_LONG_ULSPACE:
+            if (pArgs)
             {
-                long nLeft = std::max(0L, rLRSpace.GetLeft() - aPagePos.X());
-                long nRight = std::max(0L, rLRSpace.GetRight() + aPagePos.X() +
-                                      aPageSize.Width() - aViewSize.Width());
+                SdUndoGroup* pUndoGroup = new SdUndoGroup(GetDoc());
+                pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
 
-                sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
-                sal_uInt16 i;
-                for ( i = 0; i < nPageCnt; i++)
-                {
-                    SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
-                    SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
-                                            pPage,
-                                            pPage->GetLftBorder(),
-                                            pPage->GetRgtBorder(),
-                                            nLeft, nRight);
-                    pUndoGroup->AddAction(pUndo);
-                    pPage->SetLftBorder(nLeft);
-                    pPage->SetRgtBorder(nRight);
-                }
-                nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
+                const SvxLongULSpaceItem& rULSpace = static_cast<const SvxLongULSpaceItem&>(
+                        pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE)));
 
-                for (i = 0; i < nPageCnt; i++)
+                if( mpDrawView->IsTextEdit() )
                 {
-                    SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
-                    SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
-                                            pPage,
-                                            pPage->GetLftBorder(),
-                                            pPage->GetRgtBorder(),
-                                            nLeft, nRight);
-                    pUndoGroup->AddAction(pUndo);
-                    pPage->SetLftBorder(nLeft);
-                    pPage->SetRgtBorder(nRight);
+                    Rectangle aRect = maMarkRect;
+                    aRect.SetPos(aRect.TopLeft() + aPagePos);
+                    aRect.Top()  = rULSpace.GetUpper();
+                    aRect.Bottom() = aViewSize.Height() - rULSpace.GetLower();
+                    aRect.SetPos(aRect.TopLeft() - aPagePos);
+
+                    if ( aRect != maMarkRect)
+                    {
+                        mpDrawView->SetAllMarkedRect(aRect);
+                        maMarkRect = mpDrawView->GetAllMarkedRect();
+                        Invalidate( SID_RULER_OBJECT );
+                    }
                 }
-                InvalidateWindows();
-            }
+                else
+                {
+                    long nUpper = std::max(0L, rULSpace.GetUpper() - aPagePos.Y());
+                    long nLower = std::max(0L, rULSpace.GetLower() + aPagePos.Y() +
+                                          aPageSize.Height() - aViewSize.Height());
 
-            // give the undo group to the undo manager
-            GetViewFrame()->GetObjectShell()->GetUndoManager()->
-                                                AddUndoAction(pUndoGroup);
-            break;
-        }
-        case SID_ATTR_LONG_ULSPACE:
-        {
-            SdUndoGroup* pUndoGroup = new SdUndoGroup(GetDoc());
-            pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
+                    sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
+                    sal_uInt16 i;
+                    for ( i = 0; i < nPageCnt; i++)
+                    {
+                        SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
+                        SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
+                                                pPage,
+                                                pPage->GetUppBorder(),
+                                                pPage->GetLwrBorder(),
+                                                nUpper, nLower);
+                        pUndoGroup->AddAction(pUndo);
+                        pPage->SetUppBorder(nUpper);
+                        pPage->SetLwrBorder(nLower);
+                    }
+                    nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
 
-            const SvxLongULSpaceItem& rULSpace = static_cast<const SvxLongULSpaceItem&>(
-                    pArgs->Get(GetPool().GetWhich(SID_ATTR_LONG_ULSPACE)));
+                    for (i = 0; i < nPageCnt; i++)
+                    {
+                        SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
+                        SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
+                                                pPage,
+                                                pPage->GetUppBorder(),
+                                                pPage->GetLwrBorder(),
+                                                nUpper, nLower);
+                        pUndoGroup->AddAction(pUndo);
+                        pPage->SetUppBorder(nUpper);
+                        pPage->SetLwrBorder(nLower);
+                    }
+                    InvalidateWindows();
+                }
 
-            if( mpDrawView->IsTextEdit() )
+                // give the undo group to the undo manager
+                GetViewFrame()->GetObjectShell()->GetUndoManager()->
+                                                    AddUndoAction(pUndoGroup);
+            }
+            break;
+        case SID_RULER_OBJECT:
+            if (pArgs)
             {
                 Rectangle aRect = maMarkRect;
                 aRect.SetPos(aRect.TopLeft() + aPagePos);
-                aRect.Top()  = rULSpace.GetUpper();
-                aRect.Bottom() = aViewSize.Height() - rULSpace.GetLower();
-                aRect.SetPos(aRect.TopLeft() - aPagePos);
 
-                if ( aRect != maMarkRect)
+                const SvxObjectItem& rOI = static_cast<const SvxObjectItem&>(
+                        pArgs->Get(GetPool().GetWhich(SID_RULER_OBJECT)));
+
+                if ( rOI.GetStartX() != rOI.GetEndX() )
                 {
-                    mpDrawView->SetAllMarkedRect(aRect);
-                    maMarkRect = mpDrawView->GetAllMarkedRect();
-                    Invalidate( SID_RULER_OBJECT );
+                    aRect.Left()  = rOI.GetStartX();
+                    aRect.Right() = rOI.GetEndX();
                 }
-            }
-            else
-            {
-                long nUpper = std::max(0L, rULSpace.GetUpper() - aPagePos.Y());
-                long nLower = std::max(0L, rULSpace.GetLower() + aPagePos.Y() +
-                                      aPageSize.Height() - aViewSize.Height());
-
-                sal_uInt16 nPageCnt = GetDoc()->GetSdPageCount(mePageKind);
-                sal_uInt16 i;
-                for ( i = 0; i < nPageCnt; i++)
+                if ( rOI.GetStartY() != rOI.GetEndY() )
                 {
-                    SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
-                    SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
-                                            pPage,
-                                            pPage->GetUppBorder(),
-                                            pPage->GetLwrBorder(),
-                                            nUpper, nLower);
-                    pUndoGroup->AddAction(pUndo);
-                    pPage->SetUppBorder(nUpper);
-                    pPage->SetLwrBorder(nLower);
+                    aRect.Top()    = rOI.GetStartY();
+                    aRect.Bottom() = rOI.GetEndY();
                 }
-                nPageCnt = GetDoc()->GetMasterSdPageCount(mePageKind);
-
-                for (i = 0; i < nPageCnt; i++)
+                aRect.SetPos(aRect.TopLeft() - aPagePos);
+                if ( aRect != maMarkRect)
                 {
-                    SdPage* pPage = GetDoc()->GetMasterSdPage(i, mePageKind);
-                    SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
-                                            pPage,
-                                            pPage->GetUppBorder(),
-                                            pPage->GetLwrBorder(),
-                                            nUpper, nLower);
-                    pUndoGroup->AddAction(pUndo);
-                    pPage->SetUppBorder(nUpper);
-                    pPage->SetLwrBorder(nLower);
+                    mpDrawView->SetAllMarkedRect(aRect);
+                    maMarkRect = mpDrawView->GetAllMarkedRect();
+                    Invalidate( SID_RULER_OBJECT );
                 }
-                InvalidateWindows();
             }
-
-            // give the undo group to the undo manager
-            GetViewFrame()->GetObjectShell()->GetUndoManager()->
-                                                AddUndoAction(pUndoGroup);
-
             break;
-        }
-
-        case SID_RULER_OBJECT:
-        {
-            Rectangle aRect = maMarkRect;
-            aRect.SetPos(aRect.TopLeft() + aPagePos);
-
-            const SvxObjectItem& rOI = static_cast<const SvxObjectItem&>(
-                    pArgs->Get(GetPool().GetWhich(SID_RULER_OBJECT)));
-
-            if ( rOI.GetStartX() != rOI.GetEndX() )
-            {
-                aRect.Left()  = rOI.GetStartX();
-                aRect.Right() = rOI.GetEndX();
-            }
-            if ( rOI.GetStartY() != rOI.GetEndY() )
-            {
-                aRect.Top()    = rOI.GetStartY();
-                aRect.Bottom() = rOI.GetEndY();
-            }
-            aRect.SetPos(aRect.TopLeft() - aPagePos);
-            if ( aRect != maMarkRect)
-            {
-                mpDrawView->SetAllMarkedRect(aRect);
-                maMarkRect = mpDrawView->GetAllMarkedRect();
-                Invalidate( SID_RULER_OBJECT );
-            }
-            break;
-        }
-
         case SID_ATTR_TABSTOP:
-        {
-            if( mpDrawView->IsTextEdit() )
+            if (pArgs && mpDrawView->IsTextEdit())
             {
                 const SvxTabStopItem& rItem = static_cast<const SvxTabStopItem&>(
                             pArgs->Get( EE_PARA_TABS ));
@@ -666,23 +665,22 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                 Invalidate(SID_ATTR_TABSTOP);
             }
             break;
-        }
-
         case SID_ATTR_PARA_LINESPACE:
-        {
-            sal_uInt16 nSlot = SID_ATTR_PARA_LINESPACE;
-            SvxLineSpacingItem aParaLineSP = static_cast<const SvxLineSpacingItem&>(pArgs->Get(
-                GetPool().GetWhich(nSlot)));
+            if (pArgs)
+            {
+                sal_uInt16 nSlot = SID_ATTR_PARA_LINESPACE;
+                SvxLineSpacingItem aParaLineSP = static_cast<const SvxLineSpacingItem&>(pArgs->Get(
+                    GetPool().GetWhich(nSlot)));
 
-            SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL );
-            aParaLineSP.SetWhich( EE_PARA_SBL );
+                SfxItemSet aEditAttr( GetPool(), EE_PARA_SBL, EE_PARA_SBL );
+                aParaLineSP.SetWhich( EE_PARA_SBL );
 
-            aEditAttr.Put( aParaLineSP );
-            mpDrawView->SetAttributes( aEditAttr );
+                aEditAttr.Put( aParaLineSP );
+                mpDrawView->SetAttributes( aEditAttr );
 
-            Invalidate(SID_ATTR_PARA_LINESPACE);
-        }
-        break;
+                Invalidate(SID_ATTR_PARA_LINESPACE);
+            }
+            break;
         case SID_ATTR_PARA_ADJUST_LEFT:
         {
             SvxAdjustItem aItem( SVX_ADJUST_LEFT, EE_PARA_JUST );
@@ -692,8 +690,8 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
             mpDrawView->SetAttributes( aEditAttr );
 
             Invalidate(SID_ATTR_PARA_ADJUST_LEFT);
+            break;
         }
-        break;
         case SID_ATTR_PARA_ADJUST_CENTER:
         {
             SvxAdjustItem aItem( SVX_ADJUST_CENTER, EE_PARA_JUST );
@@ -703,8 +701,8 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
             mpDrawView->SetAttributes( aEditAttr );
 
             Invalidate(SID_ATTR_PARA_ADJUST_CENTER);
+            break;
         }
-        break;
         case SID_ATTR_PARA_ADJUST_RIGHT:
         {
             SvxAdjustItem aItem( SVX_ADJUST_RIGHT, EE_PARA_JUST );
@@ -714,8 +712,8 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
             mpDrawView->SetAttributes( aEditAttr );
 
             Invalidate(SID_ATTR_PARA_ADJUST_RIGHT);
+            break;
         }
-        break;
         case SID_ATTR_PARA_ADJUST_BLOCK:
         {
             SvxAdjustItem aItem( SVX_ADJUST_BLOCK, EE_PARA_JUST );
@@ -725,41 +723,41 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
             mpDrawView->SetAttributes( aEditAttr );
 
             Invalidate(SID_ATTR_PARA_ADJUST_BLOCK);
+            break;
         }
-        break;
         case SID_ATTR_PARA_ULSPACE:
-        {
-            sal_uInt16 nSlot = SID_ATTR_PARA_ULSPACE;
-            SvxULSpaceItem aULSP = static_cast<const SvxULSpaceItem&>(pArgs->Get(
-                GetPool().GetWhich(nSlot)));
-            SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE );
-            aULSP.SetWhich( EE_PARA_ULSPACE );
-
-            aEditAttr.Put( aULSP );
-            mpDrawView->SetAttributes( aEditAttr );
+            if (pArgs)
+            {
+                sal_uInt16 nSlot = SID_ATTR_PARA_ULSPACE;
+                SvxULSpaceItem aULSP = static_cast<const SvxULSpaceItem&>(pArgs->Get(
+                    GetPool().GetWhich(nSlot)));
+                SfxItemSet aEditAttr( GetPool(), EE_PARA_ULSPACE, EE_PARA_ULSPACE );
+                aULSP.SetWhich( EE_PARA_ULSPACE );
 
-            Invalidate(SID_ATTR_PARA_ULSPACE);
-        }
-        break;
+                aEditAttr.Put( aULSP );
+                mpDrawView->SetAttributes( aEditAttr );
 
+                Invalidate(SID_ATTR_PARA_ULSPACE);
+            }
+            break;
         case SID_ATTR_PARA_LRSPACE:
-        {
-            sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE;
-            SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get(
-                GetPool().GetWhich(nSlot)));
+            if (pArgs)
+            {
+                sal_uInt16 nSlot = SID_ATTR_PARA_LRSPACE;
+                SvxLRSpaceItem aLRSpace = static_cast<const SvxLRSpaceItem&>(pArgs->Get(
+                    GetPool().GetWhich(nSlot)));
 
-            SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
-            aLRSpace.SetWhich( EE_PARA_LRSPACE );
+                SfxItemSet aEditAttr( GetPool(), EE_PARA_LRSPACE, EE_PARA_LRSPACE );
+                aLRSpace.SetWhich( EE_PARA_LRSPACE );
 
-            aEditAttr.Put( aLRSpace );
-            mpDrawView->SetAttributes( aEditAttr );
+                aEditAttr.Put( aLRSpace );
+                mpDrawView->SetAttributes( aEditAttr );
 
-            Invalidate(SID_ATTR_PARA_LRSPACE);
+                Invalidate(SID_ATTR_PARA_LRSPACE);
+            }
             break;
-        }
         case SID_ATTR_LRSPACE:
-        {
-            if( mpDrawView->IsTextEdit() )
+            if (pArgs && mpDrawView->IsTextEdit())
             {
                 sal_uInt16 nId = SID_ATTR_PARA_LRSPACE;
                 const SvxLRSpaceItem& rItem = static_cast<const SvxLRSpaceItem&>(
@@ -846,7 +844,6 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                 Invalidate(SID_ATTR_PARA_LRSPACE);
             }
             break;
-        }
     }
 }
 
commit 9e59b88f02d3e730e01d190daa2491a13c91b525
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 16 09:13:13 2017 +0000

    ofz#876 avoid accessing empty rows
    
    (cherry picked from commit b9892037c303e645ee1a987d80734361700d91ac)
    
    Change-Id: Iba539fb03611bbe5627cc7976c1146d08a2ab5fd
    Reviewed-on: https://gerrit.libreoffice.org/35256
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    (cherry picked from commit 8d28a387172ed36c7c06b377bbc7041ec0b825d9)

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 74054409fe97..4195188fe2be 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -7562,6 +7562,10 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab
                     aColumns.insert( aSnapRect.Left() );
                 }
             }
+
+            if (aRows.empty())
+                return pRet;
+
             sdr::table::SdrTableObj* pTable = new sdr::table::SdrTableObj( pSdrModel );
             pTable->uno_lock();
             Reference< XTable > xTable( pTable->getTable() );


More information about the Libreoffice-commits mailing list