[Libreoffice-commits] core.git: Branch 'feature/calctiledrendering5' - 187 commits - avmedia/source basctl/source basic/source bridges/source canvas/Library_directx9canvas.mk canvas/Library_gdipluscanvas.mk canvas/StaticLibrary_directxcanvas.mk chart2/inc chart2/Library_chartcontroller.mk chart2/qa chart2/source codemaker/source comphelper/source compilerplugins/clang config_host.mk.in configure.ac connectivity/source cppcanvas/CppunitTest_cppcanvas_emfplus.mk cppcanvas/qa cppu/source cui/AllLangResTarget_cui.mk cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/AllLangResTarget_dbu.mk dbaccess/CppunitTest_dbaccess_dialog_save.mk dbaccess/CppunitTest_dbaccess_hsqldb_test.mk dbaccess/CppunitTest_dbaccess_macros_test.mk dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk desktop/inc desktop/source editeng/CppunitTest_editeng_core.mk editeng/qa editeng/source external/coinmp external/glew external/jfreereport external/lcms2 external/python3 extras/source forms/source formula/source framework/inc framework/source helpcontent2 include/avmedia include/basic include/editeng include/formula include/LibreOfficeKit include/oox include/sfx2 include/svl include/svx include/test include/tools include/unotools include/vcl include/xmloff javaunohelper/com jurt/com libreofficekit/CppunitTest_libreofficekit_tiledrendering.mk libreofficekit/Executable_gtktiledviewer.mk libreofficekit/Library_libreofficekitgtk.mk libreofficekit/Module_libreofficekit.mk libreofficekit/qa libreofficekit/README libreofficekit/source libreofficekit/StaticLibrary_libreofficekit.mk oox/inc oox/source package/source RepositoryExternal.mk sal/rtl sc/inc sc/qa sc/source sc/uiconfig sd/source sfx2/inc sfx2/source smoketest/Executable_libtest.mk smoketest/libtest.cxx solenv/gbuild sot/source starmath/source svgio/qa svl/source svx/inc svx/source sw/inc sw/qa sw/source sw/uiconfig test/source tools/source ucb/Library_ucpcmis1.mk ucb/source unotools/source unusedcode.easy vcl/source writer filter/CustomTarget_source.mk writerfilter/qa writerfilter/source xmerge/source xmloff/source

Andrzej Hunt andrzej.hunt at collabora.com
Thu Jul 31 05:46:33 PDT 2014


Rebased ref, commits from common ancestor:
commit 4a95e1a9c212a45408f9a7407ab283eca221378d
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jul 31 14:46:03 2014 +0200

    Implement getPartName for Calc.
    
    Change-Id: I5aa70213f33e0c5d9dc0fe44ddabc68f43cc6b10

diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 932017d..f97a687 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -366,6 +366,7 @@ public:
     virtual void setPart(   int nPart ) SAL_OVERRIDE;
     virtual int  getPart() SAL_OVERRIDE;
     virtual int  getParts() SAL_OVERRIDE;
+    virtual OUString getPartName( int nPart ) SAL_OVERRIDE;
 };
 
 class ScDrawPagesObj : public cppu::WeakImplHelper2<
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 68d4402..bec936a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -479,6 +479,14 @@ int ScModelObj::getPart()
     return pViewData->GetTabNo();
 }
 
+OUString ScModelObj::getPartName( int nPart )
+{
+    ScDocument& rDoc = pDocShell->GetDocument();
+    OUString sTableName;
+    rDoc.GetName( nPart, sTableName );
+    return sTableName;
+}
+
 Size ScModelObj::getDocumentSize()
 {
     // There seems to be no clear way of getting the grid window for this
commit e0e7d7a81f22053e7610732ad7dc7c1191dd95a9
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jul 28 09:02:25 2014 +0200

    DO NOT MERGE: reenable LOK tiled rendering test (BRANCH ONLY).
    
    Change-Id: Ica4e570cafa25f4c642016608d8d510e668ed701

diff --git a/libreofficekit/Module_libreofficekit.mk b/libreofficekit/Module_libreofficekit.mk
index a5b9cb0..7c3ea39 100644
--- a/libreofficekit/Module_libreofficekit.mk
+++ b/libreofficekit/Module_libreofficekit.mk
@@ -11,9 +11,9 @@ $(eval $(call gb_Module_Module,libreofficekit))
 
 ifeq ($(OS),LINUX)
 
-# $(eval $(call gb_Module_add_check_targets,libreofficekit,\
-#     CppunitTest_libreofficekit_tiledrendering \
-# ))
+$(eval $(call gb_Module_add_check_targets,libreofficekit,\
+    CppunitTest_libreofficekit_tiledrendering \
+))
 
 ifneq ($(ENABLE_GTK),)
 $(eval $(call gb_Module_add_targets,libreofficekit,\
commit 97f0daebce014693b8c9a8848e3df938da8bd22a
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jul 21 21:15:39 2014 +0200

    Lets not roll our own twip/mm100 conversions.
    
    Change-Id: Id1d0c2bed0359c35086d963dcfe9b765b6232b09

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 08b8013..60a6f47 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -27,6 +27,7 @@
 #include <editeng/scripttypeitem.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/printer.hxx>
+#include <tools/mapunit.hxx>
 #include <vcl/settings.hxx>
 
 #include <svx/svdpage.hxx>
@@ -424,9 +425,8 @@ Size ScGridWindow::GetDataAreaSize()
     SdrPage* pPage = pPageView->GetPage();
     Rectangle aDrawDataArea = pPage->GetAllObjBoundRect();
     // Draw layer works in 100th mm, whereas we're working with TWIPs.
-    aDrawDataArea.SetPos( aDrawDataArea.TopLeft() * 1440 / 2540 );
-    aDrawDataArea.SetSize( Size( aDrawDataArea.GetSize().Width() * 1440 / 2540,
-                                 aDrawDataArea.GetSize().Height() * 1440 / 2540 ) );
+    aDrawDataArea.SetPos( convertMm100ToTwip(aDrawDataArea.TopLeft() ) );
+    aDrawDataArea.SetSize( convertMm100ToTwip( aDrawDataArea.GetSize() ) );
 
     // We specifically keep iterating until we have covered both the
     // data area AND the drawing layer area. We also make sure that
@@ -641,7 +641,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
     MapMode aDrawMode = pOutDev->GetMapMode();
     Point aOrigin = aDrawMode.GetOrigin();
     aDrawMode.SetMapUnit( MAP_100TH_MM );
-    aDrawMode.SetOrigin( (aOrigin * 2540l) / 1440l );
+    aDrawMode.SetOrigin( convertTwipToMm100( aOrigin ) );
     Rectangle aDrawingRectLogic;
 
     {
commit 46abcb038c779cce39a37c13fbf4ec4179dad346
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jul 21 21:13:15 2014 +0200

    Add Point and Size versions of convertMm100ToTwip/TwipToMm100.
    
    There seem to be quite a few cases where the individual components
    are being converted, this way we can just conver the entire
    object as one.
    
    Change-Id: I0043b6f40520d7497e6edc185187706b255f2354

diff --git a/include/tools/mapunit.hxx b/include/tools/mapunit.hxx
index a68b6b4..af3eaa9 100644
--- a/include/tools/mapunit.hxx
+++ b/include/tools/mapunit.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_TOOLS_MAPUNIT_HXX
 #define INCLUDED_TOOLS_MAPUNIT_HXX
 
+#include "gen.hxx"
+
 enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM,
                MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH,
                MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT,
@@ -33,6 +35,18 @@ inline sal_Int64 convertTwipToMm100(sal_Int64 n)
         return (n*127-36)/72;
 }
 
+inline Point convertTwipToMm100(const Point& rPoint)
+{
+    return Point(convertTwipToMm100(rPoint.getX()),
+                 convertTwipToMm100(rPoint.getY()));
+}
+
+inline Size convertTwipToMm100(const Size& rSize)
+{
+    return Size(convertTwipToMm100(rSize.getWidth()),
+                convertTwipToMm100(rSize.getHeight()));
+}
+
 inline sal_Int64 convertMm100ToTwip(sal_Int64 n)
 {
     if (n >= 0)
@@ -41,6 +55,18 @@ inline sal_Int64 convertMm100ToTwip(sal_Int64 n)
         return (n*72-63)/127;
 }
 
+inline Point convertMm100ToTwip(const Point& rPoint)
+{
+    return Point(convertMm100ToTwip(rPoint.getX()),
+                 convertMm100ToTwip(rPoint.getY()));
+}
+
+inline Size convertMm100ToTwip(const Size& rSize)
+{
+    return Size(convertMm100ToTwip(rSize.getWidth()),
+                convertMm100ToTwip(rSize.getHeight()));
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 6b73ff6a7838f4fd3537573af4ee6f0a62b70b0a
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Fri Jul 11 16:35:58 2014 +0200

    More pixel->document coordinate scaling.
    
    Change-Id: Iea3877c024d66fa6b80d447c749246148f2dc11d

diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 3e77153..2345473 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -145,6 +145,7 @@ void ScHeaderControl::DoPaint( SCCOLROW nStart, SCCOLROW nEnd )
         aRect.Left() = GetScrPos( nStart )-nLayoutSign;     // extra pixel for line left of selection
         aRect.Right() = GetScrPos( nEnd+1 )-nLayoutSign;
     }
+    aRect = PixelToLogic( aRect );
     Invalidate(aRect);
 }
 
commit 93c6a99ff585c3a6c5db7335f54ca970e0c676cc
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jul 3 14:47:15 2014 +0200

    Iterate from origin to tile area to ensure correct positioning.
    
    Change-Id: I29e881f9e67b84e208a198d2aad06db382d14698

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 901fb69..08b8013 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -341,8 +341,16 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
 
     bIsInPaint = true;
 
-    SCCOL nX1 = pViewData->GetPosX(eHWhich);
-    SCROW nY1 = pViewData->GetPosY(eVWhich);
+    // If we're doing tiled rendering we'll have a different output device here,
+    // and we could really be at a completely random position, hence we
+    // iterate from 0.
+    SCCOL nX1 = 0;
+    SCROW nY1 = 0;
+    if ( pOutDev == this )
+    {
+        nX1 = pViewData->GetPosX(eHWhich);
+        nY1 = pViewData->GetPosY(eVWhich);
+    }
 
     SCTAB nTab = pViewData->GetTabNo();
 
@@ -381,6 +389,14 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
         nScrY += pDoc->GetRowHeight( nY2, nTab );
     }
 
+    // Bit hacky -- but Draw starts drawing with nX1/nY1 being at
+    // the output devices origin, so we make sure we start drawing
+    // with cell A1 at the origin etc.
+    if ( pOutDev != this )
+    {
+        nX1 = 0;
+        nY1 = 0;
+    }
     // We specifically need to set the visible range here -- by default it is
     // set in UpdateVisibleRange which however uses the viewdata, which is
     // completely irrelevant for tiled rendering.
commit 749926a27dc6201b992b66a8751501395a92b5d2
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jul 3 14:46:32 2014 +0200

    Use logic units for visible-cells determination.
    
    This eliminates a bunch of LogicToPixel conversions, and also
    means that tiles starting other than the origin are correctly
    processed (as LogicToPixel run on a rectangle will also move that
    rectangle depending on the origin set in the output device).
    
    Change-Id: I42903fe23ad5f6baa1d5276d5dcc7ee038bd27cf

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index eec7d06..901fb69 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -341,46 +341,44 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
 
     bIsInPaint = true;
 
-    Rectangle aPixRect = pOutDev->LogicToPixel( rRect );
-
     SCCOL nX1 = pViewData->GetPosX(eHWhich);
     SCROW nY1 = pViewData->GetPosY(eVWhich);
 
     SCTAB nTab = pViewData->GetTabNo();
 
-    Rectangle aMirroredPixel = aPixRect;
+    Rectangle aMirroredRect = rRect;
     if ( pDoc->IsLayoutRTL( nTab ) )
     {
         //  mirror and swap
-        long nWidth = GetSizePixel().Width();
-        aMirroredPixel.Left()  = nWidth - 1 - aPixRect.Right();
-        aMirroredPixel.Right() = nWidth - 1 - aPixRect.Left();
+        long nWidth = PixelToLogic(GetSizePixel()).Width();
+        aMirroredRect.Left()  = nWidth - 1 - rRect.Right();
+        aMirroredRect.Right() = nWidth - 1 - rRect.Left();
     }
 
-    long nScrX = pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX();/*ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );*/
-    while ( nScrX <= aMirroredPixel.Left() && nX1 < MAXCOL )
+    long nScrX = pDoc->GetColWidth( nX1, nTab );
+    while ( nScrX <= aMirroredRect.Left() && nX1 < MAXCOL )
     {
         ++nX1;
-        nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX();
+        nScrX += pDoc->GetColWidth( nX1, nTab );
     }
     SCCOL nX2 = nX1;
-    while ( nScrX <= aMirroredPixel.Right() && nX2 < MAXCOL )
+    while ( nScrX <= aMirroredRect.Right() && nX2 < MAXCOL )
     {
         ++nX2;
-        nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX2, nTab ), 0 ) ).getX();
+        nScrX += pDoc->GetColWidth( nX2, nTab );
     }
 
     long nScrY = 0;
-    while ( nScrY < aPixRect.Top() && nY1 < MAXROW )
+    while ( nScrY < rRect.Top() && nY1 < MAXROW )
     {
         ++nY1;
-        nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY1, nTab ) ) ).getY();
+        nScrY += pDoc->GetRowHeight( nY1, nTab );
     }
     SCROW nY2 = nY1;
-    while ( nScrY <= aPixRect.Bottom() && nY2 < MAXROW )
+    while ( nScrY <= rRect.Bottom() && nY2 < MAXROW )
     {
         ++nY2;
-        nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY2, nTab ) ) ).getY();
+        nScrY += pDoc->GetRowHeight( nY2, nTab );
     }
 
     // We specifically need to set the visible range here -- by default it is
commit 031490670246929dfc62d08645a3731d81d92f3f
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jul 3 14:43:28 2014 +0200

    Scale the origin for the Draw Layer (Calc Tiled Rendering).
    
    Since we're changing units, we also need to scale the origin
    by the correct amount.
    
    Change-Id: Ie0563376e8fa56f20c30da4fe3cc50546f18e84f

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index ca7195d..eec7d06 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -625,7 +625,9 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
 
     // define drawing layer map mode and paint rectangle
     MapMode aDrawMode = pOutDev->GetMapMode();
+    Point aOrigin = aDrawMode.GetOrigin();
     aDrawMode.SetMapUnit( MAP_100TH_MM );
+    aDrawMode.SetOrigin( (aOrigin * 2540l) / 1440l );
     Rectangle aDrawingRectLogic;
 
     {
commit 5410dc4a34d9b8446680a933c9e0793ab7b29ea5
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jun 25 22:37:54 2014 +0100

    Use OutputDevice scaling for column-/rowbars too.
    
    This means we now match the new gridwindow dimensions. There
    are however some issues around selection/painting now, which
    are presumably related to some parts of the code still assuming
    pixel rather than logical dimensions.
    
    Change-Id: I15c2bc7210f26cededd63bc89dbd782e6e4c03b8

diff --git a/sc/source/ui/inc/hdrcont.hxx b/sc/source/ui/inc/hdrcont.hxx
index 745367e..d2b40b69 100644
--- a/sc/source/ui/inc/hdrcont.hxx
+++ b/sc/source/ui/inc/hdrcont.hxx
@@ -79,7 +79,6 @@ protected:
     virtual void    RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
 
                     // new methods
-
     virtual SCCOLROW    GetPos() const = 0;                         // current position (Scrolling)
     virtual sal_uInt16  GetEntrySize( SCCOLROW nEntryNo ) const = 0;      // width / height (Pixel)
     virtual OUString  GetEntryText( SCCOLROW nEntryNo ) const = 0;
diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx
index 3bc9c47..27ca257 100644
--- a/sc/source/ui/view/colrowba.cxx
+++ b/sc/source/ui/view/colrowba.cxx
@@ -83,7 +83,7 @@ sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) const
     if (pDoc->ColHidden(static_cast<SCCOL>(nEntryNo), nTab))
         return 0;
     else
-        return (sal_uInt16) ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), pViewData->GetPPTX() );
+        return pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab );
 }
 
 OUString ScColBar::GetEntryText( SCCOLROW nEntryNo ) const
@@ -238,8 +238,7 @@ sal_uInt16 ScRowBar::GetEntrySize( SCCOLROW nEntryNo ) const
     if (pDoc->RowHidden(nEntryNo, nTab, NULL, &nLastRow))
         return 0;
     else
-        return (sal_uInt16) ScViewData::ToPixel( pDoc->GetOriginalHeight( nEntryNo,
-                    nTab ), pViewData->GetPPTY() );
+        return pDoc->GetOriginalHeight( nEntryNo, nTab );
 }
 
 OUString ScRowBar::GetEntryText( SCCOLROW nEntryNo ) const
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 40997f2..3e77153 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -111,6 +111,29 @@ void ScHeaderControl::DoPaint( SCCOLROW nStart, SCCOLROW nEnd )
     bool bLayoutRTL = IsLayoutRTL();
     long nLayoutSign = bLayoutRTL ? -1 : 1;
 
+    if ( nStart == nEnd )
+    {
+        // No point in painting 0 items...
+        // This happens e.g. during the construction, and can actually cause
+        // problems at that point as we don't yet have a viewshell, hence
+        // we can't populate the tab info, hence we get segfaults when trying
+        // to access inexistent data in the tabinfo.
+        return;
+    }
+
+    SCROW nY1 = 0, nY2 = 1;
+    SCCOL nX1 = 0, nX2 = 1;
+    if ( bVertical )
+    {
+        nY1 = nStart;
+        nY2 = nEnd + 1; // We request the size of nEnd+1 too below
+    }
+    else
+    {
+        nX1 = nStart;
+        nX2 = nEnd + 1; // We request the size of nEnd+1 too below
+    }
+
     Rectangle aRect( Point(0,0), GetOutputSizePixel() );
     if ( bVertical )
     {
@@ -213,7 +236,7 @@ void ScHeaderControl::DrawShadedRect( long nStart, long nEnd, const Color& rBase
     if ( IsMirrored() )
         std::swap( aInner, aOuter );        // just swap colors instead of positions
 
-    Size aWinSize = GetSizePixel();
+    Size aWinSize = PixelToLogic(GetSizePixel());
     long nBarSize = bVertical ? aWinSize.Width() : aWinSize.Height();
     long nCenterPos = (nBarSize / 2) - 1;
 
@@ -239,6 +262,25 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
 {
     //  fuer VCL ist es wichtig, wenig Aufrufe zu haben, darum werden die aeusseren
     //  Linien zusammengefasst
+    ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+    if (!pViewSh)
+    {
+        assert(false);
+        return;
+    }
+
+    ScViewData& rViewData = pViewSh->GetViewData();
+    MapMode aMapMode( GetMapMode() );
+    aMapMode.SetMapUnit( MAP_TWIP );
+    aMapMode.SetScaleX( rViewData.GetZoomX() * Fraction(0.96) );
+    aMapMode.SetScaleY( rViewData.GetZoomY() * Fraction(0.96) );
+    SetMapMode( aMapMode );
+
+    // We occasionally need to be able to measure 1 pixel
+    // e.g. for column/row subdivision, but we're working
+    // in logic units nowadays, hence we can grab the correct
+    // size from here.
+    const Size aOnePixel = PixelToLogic( Size( 1, 1 ) );
 
     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     bool bHighContrast = rStyleSettings.GetHighContrastMode();
@@ -268,16 +310,16 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
     Size                aTextSize;
 
     if (bVertical)
-        nBarSize = (sal_uInt16) GetSizePixel().Width();
+        nBarSize = (sal_uInt16) PixelToLogic(GetSizePixel()).Width();
     else
-        nBarSize = (sal_uInt16) GetSizePixel().Height();
+        nBarSize = (sal_uInt16) PixelToLogic(GetSizePixel()).Height();
 
     SCCOLROW    nPos = GetPos();
 
     long nPStart = bVertical ? rRect.Top() : rRect.Left();
     long nPEnd = bVertical ? rRect.Bottom() : rRect.Right();
 
-    long nTransStart = nPEnd + 1;
+    long nTransStart = nPEnd + (bVertical ? aOnePixel.Width() : aOnePixel.Height());
     long nTransEnd = 0;
 
     long nInitScrPos = 0;
@@ -290,9 +332,9 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
         nTransStart = nTransEnd;
         nTransEnd = nTemp;
         if ( bVertical )            // start loops from the end
-            nInitScrPos = GetSizePixel().Height() - 1;
+            nInitScrPos = PixelToLogic(GetSizePixel()).Height() - aOnePixel.Height();
         else
-            nInitScrPos = GetSizePixel().Width() - 1;
+            nInitScrPos = PixelToLogic(GetSizePixel()).Width() - aOnePixel.Width();
     }
 
     //  aeussere Linien komplett durchzeichnen
@@ -309,7 +351,7 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
 
             if ( bMarkRange && i >= nMarkStart && i <= nMarkEnd )
             {
-                long nLineStart = nLineEnd - ( nSizePix - 1 ) * nLayoutSign;
+                long nLineStart = nLineEnd - ( nSizePix - ( bVertical ? aOnePixel.Width() : aOnePixel.Height() ) ) * nLayoutSign;
                 if ( nLineStart * nLayoutSign < nTransStart * nLayoutSign )
                     nTransStart = nLineStart;
                 if ( nLineEnd * nLayoutSign > nTransEnd * nLayoutSign )
@@ -342,9 +384,9 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
             // high contrast: single-color background
             SetFillColor( rStyleSettings.GetFaceColor() );
             if ( bVertical )
-                aFillRect = Rectangle( 0, nInitScrPos, nBarSize-1, nLineEnd );
+                aFillRect = Rectangle( 0, nInitScrPos, nBarSize-aOnePixel.Width(), nLineEnd );
             else
-                aFillRect = Rectangle( nInitScrPos, 0, nLineEnd, nBarSize-1 );
+                aFillRect = Rectangle( nInitScrPos, 0, nLineEnd, nBarSize-aOnePixel.Height() );
             DrawRect( aFillRect );
         }
         else
@@ -358,9 +400,9 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
     {
         SetFillColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::APPBACKGROUND).nColor );
         if ( bVertical )
-            aFillRect = Rectangle( 0, nLineEnd+nLayoutSign, nBarSize-1, nPEnd );
+            aFillRect = Rectangle( 0, nLineEnd+nLayoutSign, nBarSize-aOnePixel.Width(), nPEnd );
         else
-            aFillRect = Rectangle( nLineEnd+nLayoutSign, 0, nPEnd, nBarSize-1 );
+            aFillRect = Rectangle( nLineEnd+nLayoutSign, 0, nPEnd, nBarSize-aOnePixel.Height() );
         DrawRect( aFillRect );
     }
 
@@ -377,9 +419,9 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
                     SetLineColor();
                     SetFillColor( COL_LIGHTGRAY );
                     if (bVertical)
-                        DrawRect( Rectangle( 0, nTransStart, nBarSize-1, nTransEnd ) );
+                        DrawRect( Rectangle( 0, nTransStart, nBarSize-aOnePixel.Width(), nTransEnd ) );
                     else
-                        DrawRect( Rectangle( nTransStart, 0, nTransEnd, nBarSize-1 ) );
+                        DrawRect( Rectangle( nTransStart, 0, nTransEnd, nBarSize-aOnePixel.Height() ) );
                 }
             }
             else
@@ -393,11 +435,11 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
         SetLineColor( rStyleSettings.GetDarkShadowColor() );
         if (bVertical)
         {
-            long nDarkPos = bMirrored ? 0 : nBarSize-1;
+            long nDarkPos = bMirrored ? 0 : nBarSize - aOnePixel.Width();
             DrawLine( Point( nDarkPos, nPStart ), Point( nDarkPos, nLineEnd ) );
         }
         else
-            DrawLine( Point( nPStart, nBarSize-1 ), Point( nLineEnd, nBarSize-1 ) );
+            DrawLine( Point( nPStart, nBarSize-aOnePixel.Height() ), Point( nLineEnd, nBarSize-aOnePixel.Height() ) );
 
         // line in different color for selection
         if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && !bHighContrast )
@@ -405,11 +447,11 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
             SetLineColor( aSelLineColor );
             if (bVertical)
             {
-                long nDarkPos = bMirrored ? 0 : nBarSize-1;
+                long nDarkPos = bMirrored ? 0 : nBarSize-aOnePixel.Width();
                 DrawLine( Point( nDarkPos, nTransStart ), Point( nDarkPos, nTransEnd ) );
             }
             else
-                DrawLine( Point( nTransStart, nBarSize-1 ), Point( nTransEnd, nBarSize-1 ) );
+                DrawLine( Point( nTransStart, nBarSize-aOnePixel.Height() ), Point( nTransEnd, nBarSize-aOnePixel.Height() ) );
         }
     }
 
@@ -448,9 +490,9 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
 
                     Rectangle aTransRect;
                     if (bVertical)
-                        aTransRect = Rectangle( 0, nTransStart, nBarSize-1, nTransEnd );
+                        aTransRect = Rectangle( 0, nTransStart, nBarSize-aOnePixel.Width(), nTransEnd );
                     else
-                        aTransRect = Rectangle( nTransStart, 0, nTransEnd, nBarSize-1 );
+                        aTransRect = Rectangle( nTransStart, 0, nTransEnd, nBarSize-aOnePixel.Height() );
                     SetBackground( Color( rStyleSettings.GetFaceColor() ) );
                     DrawSelectionBackground( aTransRect, 0, true, false, false );
                     SetBackground();
@@ -484,9 +526,9 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
                 {
                     Point aEndPos(aScrPos);
                     if (bVertical)
-                        aEndPos = Point( aScrPos.X()+nBarSize-1, aScrPos.Y()+(nSizePix-1)*nLayoutSign );
+                        aEndPos = Point( aScrPos.X()+nBarSize-aOnePixel.Width(), aScrPos.Y()+(nSizePix-aOnePixel.Height())*nLayoutSign );
                     else
-                        aEndPos = Point( aScrPos.X()+(nSizePix-1)*nLayoutSign, aScrPos.Y()+nBarSize-1 );
+                        aEndPos = Point( aScrPos.X()+(nSizePix-aOnePixel.Width())*nLayoutSign, aScrPos.Y()+nBarSize-aOnePixel.Height() );
 
                     bool bMark = bMarkRange && nEntryNo >= nMarkStart && nEntryNo <= nMarkEnd;
                     bool bNextToMark = bMarkRange && nEntryNo + 1 >= nMarkStart && nEntryNo <= nMarkEnd;
@@ -531,6 +573,7 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
                                 aString = GetEntryText( nEntryNo );
                                 aTextSize.Width() = GetTextWidth( aString );
                                 aTextSize.Height() = GetTextHeight();
+                                aTextSize = PixelToLogic( aTextSize );
 
                                 Point aTxtPos(aScrPos);
                                 if (bVertical)
@@ -538,14 +581,20 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
                                     aTxtPos.X() += (nBarSize-aTextSize.Width())/2;
                                     aTxtPos.Y() += (nSizePix*nLayoutSign-aTextSize.Height())/2;
                                     if ( bMirrored )
-                                        aTxtPos.X() += 1;   // dark border is left instead of right
+                                        aTxtPos.X() += aOnePixel.Width();   // dark border is left instead of right
                                 }
                                 else
                                 {
-                                    aTxtPos.X() += (nSizePix*nLayoutSign-aTextSize.Width()+1)/2;
+                                    aTxtPos.X() += (nSizePix*nLayoutSign-aTextSize.Width()+aOnePixel.Width())/2;
                                     aTxtPos.Y() += (nBarSize-aTextSize.Height())/2;
                                 }
+                                aTxtPos = LogicToPixel( aTxtPos );
+                                // Text is in pixels, so easiest just to map that way
+                                // only here.
+                                const MapMode aOriginalMapMode( GetMapMode() );
+                                SetMapMode( MapMode( MAP_PIXEL ) );
                                 DrawText( aTxtPos, aString );
+                                SetMapMode( aOriginalMapMode );
                             }
                             break;
                     }
commit 72458dc3e10ee9172ac76c0005850ab0cc9967db
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jun 26 17:06:58 2014 +0100

    Ensure we actually render all cells in the selected area.
    
    Only cells within maVisibleRange are rendered, even if we request
    a larger area (and maVisibleRange is otherwise not updated for tiled
    rendering). Hence we should explicitly set it here.
    
    Change-Id: I399be9df1f266a2b3d32a95483960b21f561c6b3

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 30b9b6b..ca7195d 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -383,6 +383,10 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
         nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY2, nTab ) ) ).getY();
     }
 
+    // We specifically need to set the visible range here -- by default it is
+    // set in UpdateVisibleRange which however uses the viewdata, which is
+    // completely irrelevant for tiled rendering.
+    maVisibleRange.set( nX1, nY1, nX2, nY2 );
     Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev );           // nicht weiterzeichnen
     bIsInPaint = false;
 }
commit 26cd99f1f9b56c60fe114c521270759ca890cdf3
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Thu Jun 26 14:30:08 2014 +0100

    Take into account drawing layer for data area size.
    
    The drawing layer could potentially have items that are outwith
    the data area, but we probably want to have them included for
    tiled rendering.
    
    Change-Id: I958c4fa29491cdb0fd80392dfcfa033306f2b76c

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index ed80760..30b9b6b 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -29,6 +29,7 @@
 #include <sfx2/printer.hxx>
 #include <vcl/settings.hxx>
 
+#include <svx/svdpage.hxx>
 #include <svx/svdview.hxx>
 #include "tabvwsh.hxx"
 
@@ -394,17 +395,32 @@ Size ScGridWindow::GetDataAreaSize()
 
     SCTAB nTab = pViewData->GetTabNo();
 
+    // Actual data area
     pDoc->ShrinkToDataArea( nTab,
                             nStartCol, nStartRow, nEndCol, nEndRow );
 
+    // Drawing layer area -- is completely independent of the data area.
+    ScTabViewShell* pTabViewShell = pViewData->GetViewShell();
+    SdrView* pDrawView = pTabViewShell->GetSdrView();
+    SdrPageView* pPageView = pDrawView->GetSdrPageView();
+    SdrPage* pPage = pPageView->GetPage();
+    Rectangle aDrawDataArea = pPage->GetAllObjBoundRect();
+    // Draw layer works in 100th mm, whereas we're working with TWIPs.
+    aDrawDataArea.SetPos( aDrawDataArea.TopLeft() * 1440 / 2540 );
+    aDrawDataArea.SetSize( Size( aDrawDataArea.GetSize().Width() * 1440 / 2540,
+                                 aDrawDataArea.GetSize().Height() * 1440 / 2540 ) );
+
+    // We specifically keep iterating until we have covered both the
+    // data area AND the drawing layer area. We also make sure that
+    // we return an area corresponding to a whole number of cells.
     long nX = 0;
-    for ( SCCOL i = 0; i <= nEndCol; i++ )
+    for ( SCCOL i = 0; i <= nEndCol || nX < aDrawDataArea.Right(); i++ )
     {
         nX += pDoc->GetColWidth( i, nTab );
     }
 
     long nY = 0;
-    for ( SCROW i = 0; i <= nEndRow; i++ )
+    for ( SCROW i = 0; i <= nEndRow || nY < aDrawDataArea.Bottom(); i++ )
     {
         nY += pDoc->GetRowHeight( i, nTab );
     }
commit c2704c393d25d9ae66518cc7e5b05e31aba047c4
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jun 24 22:06:59 2014 +0100

    Use output device mapping for draw layer too.
    
    Otherwise draw layer items don't get scaled at all for tiled
    rendering.
    
    Change-Id: If65d460a83fb29b8eda692cb7c1f2bd9f7283e62

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 9f5cbcc..ed80760 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -604,7 +604,8 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
     }
 
     // define drawing layer map mode and paint rectangle
-    const MapMode aDrawMode = GetDrawMapMode();
+    MapMode aDrawMode = pOutDev->GetMapMode();
+    aDrawMode.SetMapUnit( MAP_100TH_MM );
     Rectangle aDrawingRectLogic;
 
     {
commit e5196f5995cdc95dfd4ff5c2f10d96a0df873c5b
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Fri Jun 20 11:07:33 2014 +0100

    Set correct scaling for normal painting.
    
    As we no longer read the scaling from the viewdata, we should
    instead set it on the output device when doing normal rendering.
    
    However the grid still doesn't exactly match the external axes yet,
    there are probably more rounding errors wherever they are painted.
    
    Change-Id: I25b1bd9b344115578fe892aa94fbf753a3c10c81

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 962ac97..9f5cbcc 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -301,6 +301,11 @@ void ScGridWindow::PrePaint()
 
 void ScGridWindow::Paint( const Rectangle& rRect )
 {
+    MapMode aMapMode( GetMapMode() );
+    aMapMode.SetMapUnit( MAP_TWIP );
+    aMapMode.SetScaleX( pViewData->GetZoomX() * Fraction(0.96) );
+    aMapMode.SetScaleY( pViewData->GetZoomY() * Fraction(0.96) );
+    SetMapMode( aMapMode );
     Paint( rRect, this );
 }
 
commit bf605bd71879e040cf0778b0505eb77e9fdf1da7
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Fri Jun 20 10:35:45 2014 +0100

    Use output device scaling to determine cells in draw-area.
    
    Change-Id: Idf4e6ccb72090a55b6a9234cafae21821e3df0b0

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 2e3c2ed..962ac97 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -342,9 +342,6 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
 
     SCTAB nTab = pViewData->GetTabNo();
 
-    double nPPTX = pViewData->GetPPTX();
-    double nPPTY = pViewData->GetPPTY();
-
     Rectangle aMirroredPixel = aPixRect;
     if ( pDoc->IsLayoutRTL( nTab ) )
     {
@@ -354,26 +351,30 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
         aMirroredPixel.Right() = nWidth - 1 - aPixRect.Left();
     }
 
-    long nScrX = ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );
+    long nScrX = pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX();/*ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );*/
     while ( nScrX <= aMirroredPixel.Left() && nX1 < MAXCOL )
     {
         ++nX1;
-        nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );
+        nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX();
     }
     SCCOL nX2 = nX1;
     while ( nScrX <= aMirroredPixel.Right() && nX2 < MAXCOL )
     {
         ++nX2;
-        nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX2, nTab ), nPPTX );
+        nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX2, nTab ), 0 ) ).getX();
     }
 
     long nScrY = 0;
-    ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, MAXROW, nPPTY, pDoc, nTab);
+    while ( nScrY < aPixRect.Top() && nY1 < MAXROW )
+    {
+        ++nY1;
+        nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY1, nTab ) ) ).getY();
+    }
     SCROW nY2 = nY1;
-    if (nScrY <= aPixRect.Bottom() && nY2 < MAXROW)
+    while ( nScrY <= aPixRect.Bottom() && nY2 < MAXROW )
     {
         ++nY2;
-        ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab);
+        nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY2, nTab ) ) ).getY();
     }
 
     Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev );           // nicht weiterzeichnen
commit ce245affabe2afdda777774f450dcda999d2c3e7
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Fri Jun 20 09:38:50 2014 +0100

    Don't scale grid and cell dimensions multiple times.
    
    Previously we had multiple layers of scaling, with rounding
    errors propagating, leading to up to 5% differences in expected
    and rendered sheet widths -- for tiled rendering dimensions have
    to scale accurately as we may paint the same tile at multiple zoom
    levels, by eliminating multiple scaling and letting the output
    device instead deal with the scaling once we can eliminate these
    errors. (However currently rendering of text/images isn't quite right.)
    
    Change-Id: I0a725fd5c030f3c089c2bbd25947088c321eb2d4

diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index a6b7b90..4313856 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -278,7 +278,7 @@ void ScDocument::FillInfo(
             RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
             pThisRowInfo->pCellInfo = NULL;                 // wird unten belegt
 
-            sal_uInt16 nHeight = (sal_uInt16) ( nDocHeight * fRowScale );
+            sal_uInt16 nHeight = nDocHeight;
             if (!nHeight)
                 nHeight = 1;
 
@@ -393,11 +393,7 @@ void ScDocument::FillInfo(
         {
             if (!ColHidden(nX, nTab))
             {
-                sal_uInt16 nThisWidth = (sal_uInt16) (GetColWidth( nX, nTab ) * fColScale);
-                if (!nThisWidth)
-                    nThisWidth = 1;
-
-                pRowInfo[0].pCellInfo[nArrCol].nWidth = nThisWidth;
+                pRowInfo[0].pCellInfo[nArrCol].nWidth = GetColWidth( nX, nTab );
             }
         }
     }
@@ -418,9 +414,7 @@ void ScDocument::FillInfo(
             // TODO: Optimize this loop.
             if (!ColHidden(nX, nTab))
             {
-                sal_uInt16 nThisWidth = (sal_uInt16) (GetColWidth( nX, nTab ) * fColScale);
-                if (!nThisWidth)
-                    nThisWidth = 1;
+                int nThisWidth = GetColWidth( nX, nTab );
 
                 pRowInfo[0].pCellInfo[nArrCol].nWidth = nThisWidth;           //! dies sollte reichen
 
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 6a6d3ef..2e3c2ed 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -713,7 +713,6 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
     else
         aOutputData.SetSolidBackground(true);
 
-    pContentDev->SetMapMode(MAP_PIXEL);
     aOutputData.DrawDocumentBackground();
 
     if ( bGridFirst && ( bGrid || bPage ) )
@@ -920,18 +919,20 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
                               int nTilePosX, int nTilePosY,
                               long nTileWidth, long nTileHeight )
 {
+    // Scaling. Must convert from pixels to TWIPs. We know
+    // that VirtualDevices use a DPI of 96. We might as well do this
+    // calculation now, rather than after another dimension conversion,
+    // to minimise errors.
+    Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) /
+                                Fraction( nTileWidth);
+    Fraction scaleY =  Fraction( nOutputHeight, 96 ) * Fraction(1440L) /
+                                 Fraction( nTileHeight);
+
     rDevice.SetOutputSizePixel( Size( nOutputWidth, nOutputHeight ) );
-    // setup the output device to draw the tile
     MapMode aMapMode( rDevice.GetMapMode() );
     aMapMode.SetMapUnit( MAP_TWIP );
     aMapMode.SetOrigin( Point( -nTilePosX, -nTilePosY ) );
 
-    // Scaling. Must convert from pixels to twips. We know
-    // that VirtualDevises use a DPI of 96.
-    Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) /
-                                Fraction( nTileWidth);
-    Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) /
-                                Fraction( nTileHeight);
     aMapMode.SetScaleX( scaleX );
     aMapMode.SetScaleY( scaleY );
     rDevice.SetMapMode( aMapMode );
commit 099f5232d300b4f63195467cc8244c87c81b9ece
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jun 18 09:33:16 2014 +0100

    Implement data area size retrieval.
    
    Cell dimensions appear to be in TWIPs (but the drawing layer is in 100th mm).

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index f14867c..dfb9b84 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -322,10 +322,19 @@ public:
     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
 
+    // Paint a tile -- all tile dimensions are in TWIPS.
+    // It is possible to request an infinitely large area, i.e. you are not
+    // restricted to the area in GetDataAreaSize.
     void            PaintTile( VirtualDevice& rDevice,
                                int nOutputWidth, int nOutputHeight,
                                int nTilePosX, int nTilePosY,
                                long nTileWidth, long nTileHeight );
+    // Get the area in the document that contains renderable content. This
+    // is primarily a guide as to the area that should be rendered for read
+    // only documents, however for writeable documents you probably want to
+    // dynamically grab more cells in case the user wants to write to them etc.
+    // This returns a size in TWIPS, suitable for use in PaintTile.
+    Size            GetDataAreaSize();
 
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 4e4bff8..68d4402 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -481,10 +481,15 @@ int ScModelObj::getPart()
 
 Size ScModelObj::getDocumentSize()
 {
-    // TODO: not sure what we want to do here, maybe just return the size for a certain
-    // default minimum number of cells, e.g. 100x100 and more if more cells have
-    // content?
-    return Size( 3200, 3200 );
+    // There seems to be no clear way of getting the grid window for this
+    // particular document, hence we need to hope we get the right window.
+    ScViewData* pViewData = ScDocShell::GetViewData();
+    ScGridWindow* pGridWindow = pViewData->GetActiveWin();
+
+    // We simply return the data area -- it is however possible to request
+    // tiles to be rendered outside this area, ie this is the minimum that
+    // the client should allow the user to see.
+    return pGridWindow->GetDataAreaSize();
 }
 
 uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 39c423d..6a6d3ef 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -380,6 +380,36 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
     bIsInPaint = false;
 }
 
+Size ScGridWindow::GetDataAreaSize()
+{
+    ScDocument* pDoc = pViewData->GetDocument();
+    SCCOL nStartCol = 0, nEndCol = MAXCOL;
+    SCROW nStartRow = 0, nEndRow = MAXROW;
+
+    SCTAB nTab = pViewData->GetTabNo();
+
+    pDoc->ShrinkToDataArea( nTab,
+                            nStartCol, nStartRow, nEndCol, nEndRow );
+
+    long nX = 0;
+    for ( SCCOL i = 0; i <= nEndCol; i++ )
+    {
+        nX += pDoc->GetColWidth( i, nTab );
+    }
+
+    long nY = 0;
+    for ( SCROW i = 0; i <= nEndRow; i++ )
+    {
+        nY += pDoc->GetRowHeight( i, nTab );
+    }
+
+    // TODO: this ignores any images / etc., which could be outside
+    // the data area.
+
+    // This doesn't include the final (bottom & right) borders...
+    return Size( nX, nY );
+}
+
 //  Draw  ----------------------------------------------------------------
 void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode,
                          OutputDevice* pOutDev )
@@ -482,6 +512,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
 
     Fraction aZoomX = pViewData->GetZoomX();
     Fraction aZoomY = pViewData->GetZoomY();
+
     ScOutputData aOutputData( pOutDev, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
                                 nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
                                 &aZoomX, &aZoomY );
commit c4316944b010219b4934e6e87f836db83a4c7ca8
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jun 18 08:28:04 2014 +0100

    Allow overriding of device for Paint, and use that for Tiles.
    
    Paint handles figuring out which cells are within the visible area
    for us etc.
    
    Gridwin being a Window which paints to itself is a bit of a pain,
    since we now need to be able to reroute painting calls to alternative
    output devices, however these changes seem to be sufficient to at least
    get the cells in the desired tile rendered.
    
    Change-Id: I7bd1434c97acc6e9ef6e1e63cbcf039b987c88e4

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index e596b0c..f14867c 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -292,6 +292,7 @@ protected:
     virtual void    Resize( const Size& rSize );
     virtual void    PrePaint() SAL_OVERRIDE;
     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
+    virtual void    Paint( const Rectangle& rRect, OutputDevice* pOutDev);
     virtual void    KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
     virtual void    GetFocus() SAL_OVERRIDE;
     virtual void    LoseFocus() SAL_OVERRIDE;
@@ -361,7 +362,7 @@ public:
     using Window::Draw;
     void            Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
                           ScUpdateMode eMode = SC_UPDATE_ALL,
-                          OutputDevice* pOutDev = 0 );
+                          OutputDevice* pOutDev = 0);
 
     void            CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress);
 
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index f882ab0..39c423d 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -301,6 +301,11 @@ void ScGridWindow::PrePaint()
 
 void ScGridWindow::Paint( const Rectangle& rRect )
 {
+    Paint( rRect, this );
+}
+
+void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
+{
     ScDocument* pDoc = pViewData->GetDocument();
     if ( pDoc->IsInInterpreter() )
     {
@@ -330,7 +335,7 @@ void ScGridWindow::Paint( const Rectangle& rRect )
 
     bIsInPaint = true;
 
-    Rectangle aPixRect = LogicToPixel( rRect );
+    Rectangle aPixRect = pOutDev->LogicToPixel( rRect );
 
     SCCOL nX1 = pViewData->GetPosX(eHWhich);
     SCROW nY1 = pViewData->GetPosY(eVWhich);
@@ -371,8 +376,7 @@ void ScGridWindow::Paint( const Rectangle& rRect )
         ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab);
     }
 
-    Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS );           // nicht weiterzeichnen
-
+    Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev );           // nicht weiterzeichnen
     bIsInPaint = false;
 }
 
@@ -590,7 +594,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
         }
 
         // get logic positions
-        aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode);
+        aDrawingRectLogic = pOutDev->PixelToLogic(aDrawingRectPixel, aDrawMode);
     }
 
     // device for document content, used by overlay manager
@@ -848,7 +852,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
         DrawRect( Rectangle( aStart,aEnd ) );
 
         SetMapMode(pViewData->GetLogicMode());
-        pEditView->Paint( PixelToLogic( Rectangle( Point( nScrX, nScrY ),
+        pEditView->Paint( pOutDev->PixelToLogic( Rectangle( Point( nScrX, nScrY ),
                             Size( aOutputData.GetScrW(), aOutputData.GetScrH() ) ) ) );
         SetMapMode(MAP_PIXEL);
     }
@@ -908,7 +912,9 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
         pDrawView->AddWindowToPaintView( &rDevice );
     }
 
-    Draw( 0, 0, 3, 3, SC_UPDATE_ALL, &rDevice );
+    Paint( Rectangle( Point(nTilePosX, nTilePosY),
+                      rDevice.PixelToLogic(Size(nOutputWidth, nOutputHeight))),
+           &rDevice );
 
     if ( pDrawView )
     {
commit faf9c297ef0c040a82517843e8af8af40a2ee74f
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jun 16 16:19:56 2014 +0100

    Calc: Add tiled rendering device to the paint view.
    
    This prevents the previous warnings of
    SdrPageView::DrawLayer: Creating temporary SdrPageWindow (ObjectContact), \
    this should never be needed
    
    Change-Id: I76cb7c9ed4d45bfcbd297f697314309b4e036f80

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 95042d5..f882ab0 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -34,6 +34,7 @@
 
 #include "gridwin.hxx"
 #include "viewdata.hxx"
+#include "drawview.hxx"
 #include "output.hxx"
 #include "document.hxx"
 #include "attrib.hxx"
@@ -900,7 +901,19 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
     aMapMode.SetScaleY( scaleY );
     rDevice.SetMapMode( aMapMode );
 
+    ScTabViewShell* pTabViewSh = pViewData->GetViewShell();
+    SdrView* pDrawView = pTabViewSh->GetScDrawView();
+    if ( pDrawView )
+    {
+        pDrawView->AddWindowToPaintView( &rDevice );
+    }
+
     Draw( 0, 0, 3, 3, SC_UPDATE_ALL, &rDevice );
+
+    if ( pDrawView )
+    {
+        pDrawView->DeleteWindowFromPaintView( &rDevice );
+    }
 }
 
 void ScGridWindow::CheckNeedsRepaint()
commit bbada3548ba4756f2ddc437748d27d555d385b1b
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Mon Jun 16 15:00:02 2014 +0100

    Render tiles from calc.
    
    Currently the document size and number of cells to be rendered
    is hardcoded, this will need some more work to select the correct
    cells for a given tile (i.e. cells from location). Also, there
    isn't really a "size" for a calc sheet, so presumably we'd need
    to instead return the area containing cells that aren't empty,
    whilst still being able to render larger tiles? (And in any case
    the client will need to be aware of this and provide an appropriate
    interface, i.e. the current LO UI simply extends the sheet ad-infinitum.)
    
    We also currently get some warnings most likely related to the way
    we push our OutputDevice into the rendering methods:
    SdrPageView::DrawLayer: Creating temporary SdrPageWindow (ObjectContact), \
    this should never be needed
    
    Change-Id: Ia9d64d7de6c22d5b401350f88497a7ec106f1973

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index ed066b2..e596b0c 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -360,7 +360,8 @@ public:
 
     using Window::Draw;
     void            Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
-                          ScUpdateMode eMode = SC_UPDATE_ALL );
+                          ScUpdateMode eMode = SC_UPDATE_ALL,
+                          OutputDevice* pOutDev = 0 );
 
     void            CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress);
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 2893974..4e4bff8 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -484,7 +484,7 @@ Size ScModelObj::getDocumentSize()
     // TODO: not sure what we want to do here, maybe just return the size for a certain
     // default minimum number of cells, e.g. 100x100 and more if more cells have
     // content?
-    return Size();
+    return Size( 3200, 3200 );
 }
 
 uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index a60fb82..95042d5 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -376,9 +376,14 @@ void ScGridWindow::Paint( const Rectangle& rRect )
 }
 
 //  Draw  ----------------------------------------------------------------
-
-void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode )
+void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode,
+                         OutputDevice* pOutDev )
 {
+    if ( !pOutDev )
+    {
+        pOutDev = this;
+    }
+
     ScModule* pScMod = SC_MOD();
     bool bTextWysiwyg = pScMod->GetInputOptions().GetTextWysiwyg();
 
@@ -472,7 +477,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
 
     Fraction aZoomX = pViewData->GetZoomX();
     Fraction aZoomY = pViewData->GetZoomY();
-    ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
+    ScOutputData aOutputData( pOutDev, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
                                 nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
                                 &aZoomX, &aZoomY );
 
@@ -587,7 +592,9 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
         aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode);
     }
 
-    OutputDevice* pContentDev = this;       // device for document content, used by overlay manager
+    // device for document content, used by overlay manager
+    // We usually paint to ourselves, but allow other devices for tiled rendering.
+    OutputDevice* pContentDev = pOutDev;
     SdrPaintWindow* pTargetPaintWindow = 0; // #i74769# work with SdrPaintWindow directly
 
     {
@@ -604,7 +611,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
             {
                 // #i74769# Use new BeginDrawLayers() interface
                 Region aDrawingRegion(aDrawingRectLogic);
-                pTargetPaintWindow = pDrawView->BeginDrawLayers(this, aDrawingRegion);
+                pTargetPaintWindow = pDrawView->BeginDrawLayers(pOutDev, aDrawingRegion);
                 OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
 
                 // #i74769# get target device from SdrPaintWindow, this may be the prerender
@@ -877,13 +884,23 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
                               int nTilePosX, int nTilePosY,
                               long nTileWidth, long nTileHeight )
 {
-    (void) rDevice;
-    (void) nOutputWidth;
-    (void) nOutputHeight;
-    (void) nTilePosX;
-    (void) nTilePosY;
-    (void) nTileWidth;
-    (void) nTileHeight;
+    rDevice.SetOutputSizePixel( Size( nOutputWidth, nOutputHeight ) );
+    // setup the output device to draw the tile
+    MapMode aMapMode( rDevice.GetMapMode() );
+    aMapMode.SetMapUnit( MAP_TWIP );
+    aMapMode.SetOrigin( Point( -nTilePosX, -nTilePosY ) );
+
+    // Scaling. Must convert from pixels to twips. We know
+    // that VirtualDevises use a DPI of 96.
+    Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) /
+                                Fraction( nTileWidth);
+    Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) /
+                                Fraction( nTileHeight);
+    aMapMode.SetScaleX( scaleX );
+    aMapMode.SetScaleY( scaleY );
+    rDevice.SetMapMode( aMapMode );
+
+    Draw( 0, 0, 3, 3, SC_UPDATE_ALL, &rDevice );
 }
 
 void ScGridWindow::CheckNeedsRepaint()
commit 6e53a179bbaaba2c7ad8ad06890a94f9eaf8943a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 29 19:57:26 2014 +0200

    fix wrong calculation for text size, fdo#81499
    
    Change-Id: Ifd9e09dd9e1d843728e1874c48efdd127bffe11e

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 17b02f8..ed066b2 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -273,7 +273,7 @@ class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHe
     bool            GetEditUrl( const Point& rPos,
                                 OUString* pName=0, OUString* pUrl=0, OUString* pTarget=0 );
 
-    bool IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol2, SCROW nRow );
+    bool IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow );
 
     bool            HitRangeFinder( const Point& rMouse, RfCorner& rCorner, sal_uInt16* pIndex = NULL,
                                     SCsCOL* pAddX = NULL, SCsROW* pAddY = NULL );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 5b7528c..bf777ae 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3010,7 +3010,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
                 if (bSpellError)
                 {
                     // Check and see if a misspelled word is under the mouse pointer.
-                    bSpellError = IsSpellErrorAtPos(aPosPixel, nColSpellError, nCellX, nCellY);
+                    bSpellError = IsSpellErrorAtPos(aPosPixel, nColSpellError, nCellY);
                 }
             }
 
@@ -5334,7 +5334,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
     return false;
 }
 
-bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol2, SCROW nRow )
+bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow )
 {
     if (!mpSpellCheckCxt)
         return false;
@@ -5359,17 +5359,6 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol
     if (rPos.Y() < aEditRect.Top())
         return false;
 
-    Rectangle aEditRect2 = pViewData->GetEditArea(eWhich, nCol2, nRow, this, pPattern, false);
-    long nWidth = aEditRect2.Right() - aEditRect.Left();
-    aEditRect.setWidth(nWidth);
-
-    MapMode aEditMode = pViewData->GetLogicMode(eWhich);
-    Rectangle aLogicEdit = PixelToLogic(aEditRect, aEditMode);
-    Point aLogicClick = PixelToLogic(rPos, aEditMode);
-
-    if (!aLogicEdit.IsInside(aLogicClick))
-        return false;
-
     boost::shared_ptr<ScFieldEditEngine> pEngine = createEditEngine(pDocSh, *pPattern);
 
     Size aPaperSize = Size(1000000, 1000000);
@@ -5380,6 +5369,17 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCCOL nCol
     else
         pEngine->SetText(aCell.mpString->getString());
 
+    long nTextWidth = static_cast<long>(pEngine->CalcTextWidth());
+
+    MapMode aEditMode = pViewData->GetLogicMode(eWhich);
+    Rectangle aLogicEdit = PixelToLogic(aEditRect, aEditMode);
+    Point aLogicClick = PixelToLogic(rPos, aEditMode);
+
+    aLogicEdit.setWidth(nTextWidth + 1);
+
+    if (!aLogicEdit.IsInside(aLogicClick))
+        return false;
+
     pEngine->SetControlWord(pEngine->GetControlWord() | EE_CNTRL_ONLINESPELLING);
     pEngine->SetAllMisspellRanges(*pRanges);
 
commit 7bff8e93eb98be4b621c3902de227a3c313cf5b4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 29 18:52:50 2014 +0200

    the range has to be in the correct order, fdo#81803
    
    Change-Id: Ia3907701857e22c11a2cefa5d35437c8f8219ff6

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 02d1664..0a90209 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1134,6 +1134,7 @@ void ScTable::FillFormulaVertical(
 
     SCCOLROW nRowStart = -1, nRowEnd = -1;
     std::vector<sc::RowSpan> aSpans;
+    PutInOrder(nRow1, nRow2);
     for (rInner = nRow1; rInner <= nRow2; ++rInner)
     {
         if (rInner > nHiddenLast)
commit 896390d79133199910f857cf85004466171ca405
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 29 18:52:14 2014 +0200

    add test case for fdo#81803
    
    Change-Id: I00c52bd1a8d949e3fd874c2dedbd9e2345aca74e

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 02950cf..ee5a0d8 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4576,6 +4576,21 @@ void Test::testAutoFill()
     CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(0,4,0)));
     CPPUNIT_ASSERT_EQUAL(6.0, m_pDoc->GetValue(ScAddress(0,5,0)));
 
+    // test that filling formulas vertically up does the right thing
+    for(SCROW nRow = 0; nRow < 10; ++nRow)
+        m_pDoc->SetValue(100, 100 + nRow, 0, 1);
+
+    m_pDoc->SetString(100, 110, 0, "=A111");
+
+    m_pDoc->Fill(100, 110, 100, 110, NULL, aMarkData, 10, FILL_TO_TOP, FILL_AUTO);
+    for(SCROW nRow = 110; nRow >= 100; --nRow)
+    {
+        OUString aExpected = OUString("=A") + OUString::number(nRow +1);
+        OUString aFormula;
+        m_pDoc->GetFormula(100, nRow, 0, aFormula);
+        CPPUNIT_ASSERT_EQUAL(aExpected, aFormula);
+    }
+
     m_pDoc->DeleteTab(0);
 }
 
commit 56bd29136ceb32250c0acdce798be47c8f7e7b12
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jul 30 13:30:07 2014 +0200

    Wrap "" in OUString: error: conversion from const char* to non-scalar...
    
    Full error:
         error: conversion from const char* to non-scalar type rtl::OUString requested
    
    This seems to be happening only where ITiledRenderable.hxx ends up being
    included in an Objective C file.

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index a57053e..f07ccd5 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -76,7 +76,7 @@ public:
     virtual OUString getPartName(int nPart)
     {
         (void) nPart;
-        return "";
+        return OUString("");
     }
 
     virtual void setPartMode(LibreOfficeKitPartMode ePartMode)
commit 77d083130948fa35f9f404656b8c170060e78043
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jul 30 07:33:54 2014 +0200

    LokDocView: Update part selector when mode changes.
    
    Change-Id: Ice754a46d07ce2714257c30e1aef27193b614cd3

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index c588993..9a40325 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -27,6 +27,7 @@ static int help()
 static GtkWidget* pDocView;
 static GtkWidget* pDocViewQuad;
 static GtkWidget* pVBox;
+static GtkComboBoxText* pPartSelector;
 static LibreOfficeKit* pOffice;
 static char* pFileName;
 
@@ -121,20 +122,29 @@ void changeQuadView( GtkWidget* /*pButton*/, gpointer /* pItem */ )
 
 // GtkComboBox requires gtk 2.24 or later
 #if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
-void populatePartSelector( GtkComboBoxText* pSelector, LOKDocView* pView )
+void populatePartSelector()
 {
+    gtk_list_store_clear( GTK_LIST_STORE(
+                              gtk_combo_box_get_model(
+                                  GTK_COMBO_BOX(pPartSelector) )) );
+
+    if ( !pDocView )
+    {
+        return;
+    }
+
     const int nMaxLength = 50;
     char sText[nMaxLength];
 
-    int nParts = lok_docview_get_parts(pView);
+    int nParts = lok_docview_get_parts( LOK_DOCVIEW(pDocView) );
     for ( int i = 0; i < nParts; i++ )
     {
-        char* pName = lok_docview_get_part_name( pView, i );
+        char* pName = lok_docview_get_part_name( LOK_DOCVIEW(pDocView), i );
         assert( pName );
         snprintf( sText, nMaxLength, "%i (%s)", i+1, pName );
         free( pName );
 
-        gtk_combo_box_text_append_text( pSelector, sText );
+        gtk_combo_box_text_append_text( pPartSelector, sText );
     }
     gtk_combo_box_set_active( GTK_COMBO_BOX(pPartSelector),
                               lok_docview_get_part( LOK_DOCVIEW(pDocView) ) );
@@ -174,6 +184,10 @@ void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
     {
         lok_docview_set_partmode( LOK_DOCVIEW(pDocView), ePartMode );
     }
+
+    // The number of items could change e.g. if we change from slide
+    // to embeddede obj mode -- hence we should update the part list.
+    populatePartSelector();
 }
 #endif
 
@@ -232,6 +246,8 @@ int main( int argc, char* argv[] )
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1 );
     g_signal_connect( G_OBJECT(pComboBox), "changed", G_CALLBACK(changePart), NULL );
 
+    pPartSelector = GTK_COMBO_BOX_TEXT(pComboBox);
+
     GtkToolItem* pSeparator2 = gtk_separator_tool_item_new();
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1);
 
@@ -265,7 +281,7 @@ int main( int argc, char* argv[] )
 
     // GtkComboBox requires gtk 2.24 or later
 #if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
-    populatePartSelector( GTK_COMBO_BOX_TEXT(pComboBox), LOK_DOCVIEW(pDocView) );
+    populatePartSelector();
     populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) );
 #endif
 
commit df438e6ea260c1367fac0c2f195f1aff6311709f
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Wed Jul 30 07:33:35 2014 +0200

    LokDocView: set current item for part selector.
    
    Change-Id: Idbb3d63803bd60a182a9b8e26620d11b2d643cb6

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index a96e1e3..c588993 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -136,7 +136,8 @@ void populatePartSelector( GtkComboBoxText* pSelector, LOKDocView* pView )
 
         gtk_combo_box_text_append_text( pSelector, sText );
     }
-    gtk_combo_box_set_active( GTK_COMBO_BOX(pSelector), 0 );
+    gtk_combo_box_set_active( GTK_COMBO_BOX(pPartSelector),
+                              lok_docview_get_part( LOK_DOCVIEW(pDocView) ) );
 }
 
 void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
commit ba520b9dbb911d32dd770f4548399b98dd80bd2c
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 17:01:48 2014 +0200

    gtktiledviewer: add part mode selector.
    
    Change-Id: Ia1e78df1d833f9b0fbda0b78136590c9c960fa27

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index d74eb96..a96e1e3 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -151,6 +151,29 @@ void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
         lok_docview_set_part( LOK_DOCVIEW(pDocView), nPart );
     }
 }
+
+void populatePartModeSelector( GtkComboBoxText* pSelector )
+{
+    gtk_combo_box_text_append_text( pSelector, "Default" );
+    gtk_combo_box_text_append_text( pSelector, "Slide" );
+    gtk_combo_box_text_append_text( pSelector, "Notes" );
+    gtk_combo_box_text_append_text( pSelector, "Combined (SlideNotes)" );
+    gtk_combo_box_text_append_text( pSelector, "Embedded Objects" );
+    gtk_combo_box_set_active( GTK_COMBO_BOX(pSelector), 0 );
+}
+
+void changePartMode( GtkWidget* pSelector, gpointer /* pItem */ )
+{
+    // Just convert directly back to the LibreOfficeKitPartMode enum.
+    // I.e. the ordering above should match the enum member ordering.
+    LibreOfficeKitPartMode ePartMode =
+        LibreOfficeKitPartMode( gtk_combo_box_get_active( GTK_COMBO_BOX(pSelector) ) );
+
+    if ( pDocView )
+    {
+        lok_docview_set_partmode( LOK_DOCVIEW(pDocView), ePartMode );
+    }
+}
 #endif
 
 int main( int argc, char* argv[] )
@@ -207,11 +230,20 @@ int main( int argc, char* argv[] )
     gtk_container_add( GTK_CONTAINER(pPartSelectorToolItem), pComboBox );
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartSelectorToolItem, -1 );
     g_signal_connect( G_OBJECT(pComboBox), "changed", G_CALLBACK(changePart), NULL );
-#endif
 
     GtkToolItem* pSeparator2 = gtk_separator_tool_item_new();
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator2, -1);
 
+    GtkToolItem* pPartModeSelectorToolItem = gtk_tool_item_new();
+    GtkWidget* pPartModeComboBox = gtk_combo_box_text_new();
+    gtk_container_add( GTK_CONTAINER(pPartModeSelectorToolItem), pPartModeComboBox );
+    gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pPartModeSelectorToolItem, -1 );
+    g_signal_connect( G_OBJECT(pPartModeComboBox), "changed", G_CALLBACK(changePartMode), NULL );
+#endif
+
+    GtkToolItem* pSeparator3 = gtk_separator_tool_item_new();
+    gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pSeparator3, -1);
+
     GtkToolItem* pEnableQuadView = gtk_toggle_tool_button_new();
     gtk_tool_button_set_label( GTK_TOOL_BUTTON(pEnableQuadView), "Use Quad View" );
     gtk_toolbar_insert( GTK_TOOLBAR(pToolbar), pEnableQuadView, -1 );
@@ -233,6 +265,7 @@ int main( int argc, char* argv[] )
     // GtkComboBox requires gtk 2.24 or later
 #if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
     populatePartSelector( GTK_COMBO_BOX_TEXT(pComboBox), LOK_DOCVIEW(pDocView) );
+    populatePartModeSelector( GTK_COMBO_BOX_TEXT(pPartModeComboBox) );
 #endif
 
     gtk_main();
commit af58bb8335416ac6416f7f4b6269337b2127ab08
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 17:01:20 2014 +0200

    Protect setPartMode and ensure we actually show the new mode.
    
    Change-Id: I3642702c5bf268f3c9ab04162166078052804270

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4de42e3..138b8f5 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -504,7 +504,31 @@ static void doc_setPartMode(LibreOfficeKitDocument* pThis,
         return;
     }
 
-    pDoc->setPartMode(ePartMode);
+    Application::AcquireSolarMutex(1);
+    {
+        int nCurrentPart = pDoc->getPart();
+
+        pDoc->setPartMode(ePartMode);
+
+        // We need to make sure the internal state is updated, just changing the mode
+        // might not update the relevant shells (i.e. impress will keep rendering the
+        // previous mode unless we do this).
+        // TODO: we might want to do this within the relevant components rather than
+        // here, but that's also dependent on how we implement embedded object
+        // rendering I guess?
+        // TODO: we could be clever and e.g. set to 0 when we change to/from
+        // embedded object mode, and not when changing between slide/notes/combined
+        // modes?
+        if ( nCurrentPart < pDoc->getParts() )
+        {
+            pDoc->setPart( nCurrentPart );
+        }
+        else
+        {
+            pDoc->setPart( 0 );
+        }
+    }
+    Application::ReleaseSolarMutex();
 }
 
 void doc_paintTile (LibreOfficeKitDocument* pThis,
commit b3375a273e8030fd576e8094fe0890fab23362ea
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 17:00:56 2014 +0200

    Impress/Tiled Rendering: implement setPartMode.
    
    Change-Id: I831953ac3fa1d0a15b64aa008cc3bfb79e72575a

diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 8fa1904..e620ca5 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -234,6 +234,7 @@ public:
     virtual int  getPart() SAL_OVERRIDE;
     virtual int  getParts() SAL_OVERRIDE;
     virtual OUString getPartName( int nPart ) SAL_OVERRIDE;
+    virtual void setPartMode( LibreOfficeKitPartMode ePartMode ) SAL_OVERRIDE;
 
     // XComponent
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 7726de4..6c1661b 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2239,7 +2239,6 @@ void SdXImpressDocument::setPart( int nPart )
         // only possible to select page 0 in this mode, I have no idea how you
         // then actually select what is on the handout page, which defaults to
         // a 4x4 grid of empty pages).
-        pViewSh->SetPageKind( PK_STANDARD );
         pViewSh->SwitchPage( nPart );
     }
 }
@@ -2269,6 +2268,40 @@ OUString SdXImpressDocument::getPartName( int nPart )
     return pPage->GetName();
 }
 
+void SdXImpressDocument::setPartMode( LibreOfficeKitPartMode ePartMode )
+{
+    DrawViewShell* pViewSh = dynamic_cast< DrawViewShell* >( mpDoc->GetDocSh()->GetViewShell() );
+    if (!pViewSh)
+    {
+        return;
+    }
+
+    PageKind aPageKind;
+    switch ( ePartMode )
+    {
+    case LOK_PARTMODE_EMBEDDEDOBJ:
+        // This will probably be handled higher up, i.e.
+        // we probably shouldn't be handling this here.
+        // (However we don't offer embedded object-only
+        //  rendering anywhere yet, so this may be a
+        //  completely incorrect comment.)
+        assert( false );
+        // And let's fall through in a normal build.
+    case LOK_PARTMODE_DEFAULT:
+    case LOK_PARTMODE_SLIDE:
+        aPageKind = PK_STANDARD;
+        break;
+    case LOK_PARTMODE_SLIDENOTES:
+        aPageKind = PK_NOTES;
+        break;
+    case LOK_PARTMODE_NOTES:
+        // TODO: this shows combined slides + notes
+        aPageKind = PK_NOTES;
+        break;
+    }
+    pViewSh->SetPageKind( aPageKind );
+}
+
 Size SdXImpressDocument::getDocumentSize()
 {
     SdrPageView* pCurPageView = mpDoc->GetDocSh()->GetViewShell()->GetView()->GetSdrPageView();
commit 7f8eb6d501f962d2bdac9a581389289f8054daec
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 17:00:33 2014 +0200

    LOKDocView: add set_part_mode.
    
    Change-Id: I0e14a535124e93979ef05431255911245a11aa29

diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index a73f98d..522d74d 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -64,6 +64,8 @@ void            lok_docview_set_part        (LOKDocView* pDocView,
                                              int nPart);
 char*           lok_docview_get_part_name   (LOKDocView* pDocView,
                                              int nPart);
+void            lok_docview_set_partmode    (LOKDocView* pDocView,
+                                             LibreOfficeKitPartMode ePartMode);
 #ifdef __cplusplus
 }
 #endif
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index cb045ce..5884e66 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -208,4 +208,11 @@ SAL_DLLPUBLIC_EXPORT char* lok_docview_get_part_name( LOKDocView* pDocView, int
 {
     return pDocView->pDocument->pClass->getPartName( pDocView->pDocument, nPart );
 }
+
+SAL_DLLPUBLIC_EXPORT void lok_docview_set_partmode( LOKDocView* pDocView,
+                                                    LibreOfficeKitPartMode ePartMode )
+{
+    pDocView->pDocument->pClass->setPartMode( pDocView->pDocument, ePartMode );
+    renderDocument( pDocView );
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 0dc6db6fafd4a4fa9a5ad8d2d09c7ec8ae3ae04e
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 16:59:10 2014 +0200

    Impress/Tiled Rendering: return correct number for getPart.
    
    It looks like page ids begin with 1.
    
    Change-Id: I367285b8cfa1fcc9b8f22a9bb3c679d7e9579099

diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index b6754ec..7726de4 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2256,7 +2256,8 @@ int SdXImpressDocument::getPart()
     DrawViewShell* pViewSh = dynamic_cast< DrawViewShell* >( mpDoc->GetDocSh()->GetViewShell() );
     if (pViewSh)
     {
-        return pViewSh->GetCurPageId();
+        // curPageId seems to start at 1
+        return pViewSh->GetCurPageId() - 1;
     }
     return 0;
 }
commit dd032c3f3b6d6d3142b86860b02efd47c27504cc
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 13:28:49 2014 +0200

    ITiledRenderable: provide default implementations for some methods.
    
    Writer doesn't understand the concept of parts at the moment, it
    makes most sense to keep these dummy implementations central.
    
    Change-Id: Iafbd89864b753ba2bed28a05b0f59df85f364feb

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index a872713..a57053e 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -47,18 +47,27 @@ public:
      * Set the document "part", i.e. slide for a slideshow, and
      * tab for a spreadsheet.
      */
-    virtual void setPart( int nPart ) = 0;
+    virtual void setPart( int nPart )
+    {
+        (void) nPart;
+    }
 
     /**
      * Get the number of parts -- see setPart for further details.
      */
-    virtual int getParts() = 0;
+    virtual int getParts()
+    {
+        return 1;
+    }
 
     /**
      * Get the currently displayed/selected part -- see setPart for further
      * details.
      */
-    virtual int getPart() = 0;
+    virtual int getPart()
+    {
+        return 0;
+    }
 
     /**
      * Get the name of the currently displayed part, i.e. sheet in a spreadsheet
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 1318071..a48a8f3 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -439,9 +439,6 @@ public:
                             long nTileWidth,
                             long nTileHeight ) SAL_OVERRIDE;
     virtual Size getDocumentSize() SAL_OVERRIDE;
-    virtual void setPart(   int nPart ) SAL_OVERRIDE;
-    virtual int  getPart() SAL_OVERRIDE;
-    virtual int  getParts() SAL_OVERRIDE;
 
     void                        Invalidate();
     void                        Reactivate(SwDocShell* pNewDocShell);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 8208814..1dc5f54 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3139,21 +3139,6 @@ Size SwXTextDocument::getDocumentSize()
     return pViewShell->GetDocSize();
 }
 
-void SwXTextDocument::setPart( int /*nPart*/ )
-{
-}
-
-int SwXTextDocument::getPart()
-{
-    return 0;
-}
-
-int SwXTextDocument::getParts()
-{
-    // For now we treat the document as one large piece.
-    return 1;
-}
-
 void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
 {
     return SwXTextDocumentBaseClass::operator new(t);
commit a965dfd7ea87a5aba4e4aefa21049159e56579cf
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 13:19:44 2014 +0200

    Impress: Implement getPartName.
    
    Change-Id: I614838505fef901fc37e8d3906bb59c60b034453

diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 6887663..8fa1904 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -233,6 +233,7 @@ public:
     virtual void setPart(   int nPart ) SAL_OVERRIDE;
     virtual int  getPart() SAL_OVERRIDE;
     virtual int  getParts() SAL_OVERRIDE;
+    virtual OUString getPartName( int nPart ) SAL_OVERRIDE;
 
     // XComponent
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 5a162f2..b6754ec 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2261,6 +2261,13 @@ int SdXImpressDocument::getPart()
     return 0;
 }
 
+OUString SdXImpressDocument::getPartName( int nPart )
+{
+    SdPage* pPage = mpDoc->GetSdPage( nPart, PK_STANDARD );
+    assert( pPage );
+    return pPage->GetName();
+}
+
 Size SdXImpressDocument::getDocumentSize()
 {
     SdrPageView* pCurPageView = mpDoc->GetDocSh()->GetViewShell()->GetView()->GetSdrPageView();
commit 36e5f73637194afdb9ff0e320f6086be35c94a61
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 13:17:45 2014 +0200

    gtktiledviewer: show part names in selector.
    
    Change-Id: I02ae5b729f96e36b3f226218b32495907cb63cf3

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 21cb179..d74eb96 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <assert.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -122,10 +123,17 @@ void changeQuadView( GtkWidget* /*pButton*/, gpointer /* pItem */ )
 #if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
 void populatePartSelector( GtkComboBoxText* pSelector, LOKDocView* pView )
 {
-    char sText[10];
-    for ( int i = 0; i < lok_docview_get_parts(pView); i++ )
+    const int nMaxLength = 50;
+    char sText[nMaxLength];
+
+    int nParts = lok_docview_get_parts(pView);
+    for ( int i = 0; i < nParts; i++ )
     {
-        sprintf( sText, "%i", i+1 );
+        char* pName = lok_docview_get_part_name( pView, i );
+        assert( pName );
+        snprintf( sText, nMaxLength, "%i (%s)", i+1, pName );
+        free( pName );
+
         gtk_combo_box_text_append_text( pSelector, sText );
     }
     gtk_combo_box_set_active( GTK_COMBO_BOX(pSelector), 0 );
@@ -219,8 +227,10 @@ int main( int argc, char* argv[] )
     gtk_widget_show_all( pWindow );
 
     pFileName = argv[2];
-    lok_docview_open_document( LOK_DOCVIEW(pDocView), argv[2] );
-// GtkComboBox requires gtk 2.24 or later
+    assert( lok_docview_open_document( LOK_DOCVIEW(pDocView), argv[2] ) );
+    assert( LOK_DOCVIEW(pDocView)->pDocument );
+
+    // GtkComboBox requires gtk 2.24 or later
 #if ( GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION > 2
     populatePartSelector( GTK_COMBO_BOX_TEXT(pComboBox), LOK_DOCVIEW(pDocView) );
 #endif
commit 366d8fb4dbe829653a4996acc8e9bae512ed0155
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 13:17:30 2014 +0200

    LOKDocView: add part name retrieval.
    
    Change-Id: Iac31de0410d7f6187e5884152c329375047a23f4

diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h
index 37d21f0..a73f98d 100644
--- a/include/LibreOfficeKit/LibreOfficeKitGtk.h
+++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h
@@ -62,7 +62,8 @@ int             lok_docview_get_parts       (LOKDocView* pDocView);
 int             lok_docview_get_part        (LOKDocView* pDocView);
 void            lok_docview_set_part        (LOKDocView* pDocView,
                                              int nPart);
-
+char*           lok_docview_get_part_name   (LOKDocView* pDocView,
+                                             int nPart);
 #ifdef __cplusplus
 }
 #endif
diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c
index 07d07a1..cb045ce 100644
--- a/libreofficekit/source/gtk/lokdocview.c
+++ b/libreofficekit/source/gtk/lokdocview.c
@@ -204,5 +204,8 @@ SAL_DLLPUBLIC_EXPORT void lok_docview_set_part( LOKDocView* pDocView, int nPart)
     renderDocument( pDocView );
 }
 
-
+SAL_DLLPUBLIC_EXPORT char* lok_docview_get_part_name( LOKDocView* pDocView, int nPart )
+{
+    return pDocView->pDocument->pClass->getPartName( pDocView->pDocument, nPart );
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 977ba354b2256da7c871179a75b72c4f568d5fcb
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 09:02:02 2014 +0200

    Remove horrifically outdated comment.
    
    Change-Id: I1362489c9aecf536b31bf6ab57ad8c149f37a876

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index c935ebc..d7b8e41 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -99,11 +99,6 @@ struct _LibreOfficeKitDocumentClass
   void (*setPartMode)     (LibreOfficeKitDocument* pThis,
                            LibreOfficeKitPartMode eMode);
 
-  // Get a pointer to a raw array, of size 3*nCanvasWidth*nCanvasHeight
-  // Basebmp's bitmap device seems to round the width up if needed
-  // for its internal buffer, i.e. the rowstride for the buffer may be larger
-  // than the desired width, hence we need to be able to return the
-  // rowstride too.
   void (*paintTile)       (LibreOfficeKitDocument* pThis,
                            unsigned char* pBuffer,
                            const int nCanvasWidth,
commit 6872ecdbc70befc1f3e9215f5c1cf1530ff8dc40
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 08:59:13 2014 +0200

    LOK: add setPartMode.
    
    This API seems to be simplest in the long run where we'll want to be
    able to select between rendering slides/notes/both/embedded objects,
    and maybe even adding the option of switching between continuous
    and single page mode in writer (although I have no idea how hard
    getting a single page mode out of writer would be).
    
    Change-Id: I5bdfdb61854c37281c6992c8f3ed1c50c8aa0919

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6772694..4de42e3 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -185,6 +185,7 @@ static int doc_getParts(LibreOfficeKitDocument* pThis);
 static int doc_getPart(LibreOfficeKitDocument* pThis);
 static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart);
 static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart);
+static void doc_setPartMode(LibreOfficeKitDocument* pThis, LibreOfficeKitPartMode ePartMode);
 void        doc_paintTile(LibreOfficeKitDocument* pThis,
                           unsigned char* pBuffer,
                           const int nCanvasWidth, const int nCanvasHeight,
@@ -216,6 +217,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
             m_pDocumentClass->getPart = doc_getPart;
             m_pDocumentClass->setPart = doc_setPart;
             m_pDocumentClass->getPartName = doc_getPartName;
+            m_pDocumentClass->setPartMode = doc_setPartMode;
             m_pDocumentClass->paintTile = doc_paintTile;
             m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
 
@@ -490,6 +492,21 @@ static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
 
 }
 
+static void doc_setPartMode(LibreOfficeKitDocument* pThis,
+                            LibreOfficeKitPartMode ePartMode)
+{
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+    ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() );
+    if (!pDoc)
+    {
+        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+        return;
+    }
+
+    pDoc->setPartMode(ePartMode);
+}
+
 void doc_paintTile (LibreOfficeKitDocument* pThis,
                     unsigned char* pBuffer,
                     const int nCanvasWidth, const int nCanvasHeight,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index c90a947..c935ebc 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -40,6 +40,16 @@ typedef enum
   LOK_DOCTYPE_OTHER
 }
 LibreOfficeKitDocumentType;
+
+typedef enum
+{
+    LOK_PARTMODE_DEFAULT,
+    LOK_PARTMODE_SLIDE,
+    LOK_PARTMODE_NOTES,
+    LOK_PARTMODE_SLIDENOTES,
+    LOK_PARTMODE_EMBEDDEDOBJ
+}
+LibreOfficeKitPartMode;
 #endif // LOK_USE_UNSTABLE_API
 
 struct _LibreOfficeKit
@@ -86,6 +96,9 @@ struct _LibreOfficeKitDocumentClass
   char* (*getPartName)    (LibreOfficeKitDocument* pThis,
                            int nPart);
 
+  void (*setPartMode)     (LibreOfficeKitDocument* pThis,
+                           LibreOfficeKitPartMode eMode);
+
   // Get a pointer to a raw array, of size 3*nCanvasWidth*nCanvasHeight
   // Basebmp's bitmap device seems to round the width up if needed
   // for its internal buffer, i.e. the rowstride for the buffer may be larger
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index ca6ee25..a872713 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -11,6 +11,8 @@
 #ifndef INCLUDED_VCL_ITILEDRENDERABLE_HXX
 #define INCLUDED_VCL_ITILEDRENDERABLE_HXX
 
+#define LOK_USE_UNSTABLE_API
+#include <LibreOfficeKit/LibreOfficeKit.h>
 #include <tools/gen.hxx>
 #include <vcl/virdev.hxx>
 
@@ -67,6 +69,11 @@ public:
         (void) nPart;
         return "";
     }
+
+    virtual void setPartMode(LibreOfficeKitPartMode ePartMode)
+    {
+        (void) ePartMode;
+    }
 };
 
 } // namespace vcl
commit 6548361109deeb3be2e2c65b27eca04e59fa1f6f
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 08:50:34 2014 +0200

    LOK: Add getPartName.
    
    By default (i.e. for writer) we can just return an empty string,
    and we only actually need to implement ITiledRenderable's
    getPartName for components that actually support it (i.e. calc/impress).
    
    Change-Id: I8b381e5d7a8000638b02f763b4bea8ef0226f8e0

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6c4d5cc..6772694 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -184,6 +184,7 @@ static LibreOfficeKitDocumentType doc_getDocumentType(LibreOfficeKitDocument* pT
 static int doc_getParts(LibreOfficeKitDocument* pThis);
 static int doc_getPart(LibreOfficeKitDocument* pThis);
 static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart);
+static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart);
 void        doc_paintTile(LibreOfficeKitDocument* pThis,
                           unsigned char* pBuffer,
                           const int nCanvasWidth, const int nCanvasHeight,
@@ -214,6 +215,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
             m_pDocumentClass->getParts = doc_getParts;
             m_pDocumentClass->getPart = doc_getPart;
             m_pDocumentClass->setPart = doc_setPart;
+            m_pDocumentClass->getPartName = doc_getPartName;
             m_pDocumentClass->paintTile = doc_paintTile;
             m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
 
@@ -469,6 +471,25 @@ static void doc_setPart(LibreOfficeKitDocument* pThis, int nPart)
     Application::ReleaseSolarMutex();
 }
 
+static char* doc_getPartName(LibreOfficeKitDocument* pThis, int nPart)
+{
+    LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
+
+    ::vcl::ITiledRenderable* pDoc = dynamic_cast< ::vcl::ITiledRenderable* >( pDocument->mxComponent.get() );
+    if (!pDoc)
+    {
+        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+        return 0;
+    }
+
+    OUString sName = pDoc->getPartName( nPart );
+    OString aString = OUStringToOString(sName, RTL_TEXTENCODING_UTF8);
+    char* pMemory = (char*) malloc(aString.getLength() + 1);
+    strcpy(pMemory, aString.getStr());
+    return pMemory;
+
+}
+
 void doc_paintTile (LibreOfficeKitDocument* pThis,
                     unsigned char* pBuffer,
                     const int nCanvasWidth, const int nCanvasHeight,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 9fb5ace..c90a947 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -83,6 +83,9 @@ struct _LibreOfficeKitDocumentClass
   void (*setPart)         (LibreOfficeKitDocument* pThis,
                            int nPart);
 
+  char* (*getPartName)    (LibreOfficeKitDocument* pThis,
+                           int nPart);
+
   // Get a pointer to a raw array, of size 3*nCanvasWidth*nCanvasHeight
   // Basebmp's bitmap device seems to round the width up if needed
   // for its internal buffer, i.e. the rowstride for the buffer may be larger
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 32faf26..f61a4b8 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -64,6 +64,11 @@ public:
         mpDoc->pClass->setPart(mpDoc, nPart);
     }
 
+    inline char* getPartName(int nPart)
+    {
+        return mpDoc->pClass->getPartName(mpDoc, nPart);
+    }
+
     inline void paintTile(
                           unsigned char* pBuffer,
                           const int nCanvasWidth,
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 55e1b39..ca6ee25 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -57,6 +57,16 @@ public:
      * details.
      */
     virtual int getPart() = 0;
+
+    /**
+     * Get the name of the currently displayed part, i.e. sheet in a spreadsheet
+     * or slide in a presentation.
+     */
+    virtual OUString getPartName(int nPart)
+    {
+        (void) nPart;
+        return "";
+    }
 };
 
 } // namespace vcl
commit 5fe0711dbe8568f6ec5fe7c2edeb122519ac68a7
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Tue Jul 29 08:32:07 2014 +0200

    Fix comment typo.
    
    Change-Id: I8ebe3ad2a6efcf1797a2dc941994c7fc1e36f4bf

diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 9c74634..9fb5ace 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -76,7 +76,7 @@ struct _LibreOfficeKitDocumentClass
   LibreOfficeKitDocumentType (*getDocumentType) (LibreOfficeKitDocument* pThis);
 
   // Part refers to either indivual sheets in a Spreadsheet, or slides
-  // in a Slideshow, and has no relevance for wrtier documents.
+  // in a Slideshow, and has no relevance for writer documents.
   int (*getParts) (LibreOfficeKitDocument* pThis);
 
   int (*getPart)          (LibreOfficeKitDocument* pThis);
commit 4a1efd50e28ed9a38820ff8e21a21475a9096ecc
Author: Joren De Cuyper <jorendc at libreoffice.org>
Date:   Wed Jul 30 00:11:51 2014 +0200

    Remove redundant sal_Char *
    
    Change-Id: I82c80134edaf34f1392d06b0bb68ff092652524b
    Reviewed-on: https://gerrit.libreoffice.org/10634
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4661781..1b08aea 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6584,18 +6584,18 @@ static void impl_WriteTabElement( FSHelperPtr pSerializer,
     switch (rTab.GetAdjustment())
     {
     case SVX_TAB_ADJUST_RIGHT:
-        pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( (sal_Char *)"right") );
+        pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( "right" ) );
         break;
     case SVX_TAB_ADJUST_DECIMAL:
-        pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( (sal_Char *)"decimal") );
+        pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( "decimal" ) );
         break;
     case SVX_TAB_ADJUST_CENTER:
-        pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( (sal_Char *)"center") );
+        pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( "center" ) );
         break;
     case SVX_TAB_ADJUST_DEFAULT:
     case SVX_TAB_ADJUST_LEFT:
     default:
-        pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( (sal_Char *)"left") );
+        pTabElementAttrList->add( FSNS( XML_w, XML_val ), OString( "left" ) );
         break;
     }
 
@@ -6606,15 +6606,15 @@ static void impl_WriteTabElement( FSHelperPtr pSerializer,
     sal_Unicode cFillChar = rTab.GetFill();
 
     if ('.' == cFillChar )
-        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "dot" ) );
+        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( "dot" ) );
     else if ( '-' == cFillChar )
-        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "hyphen" ) );
+        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( "hyphen" ) );
     else if ( sal_Unicode(0xB7) == cFillChar ) // middle dot
-        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "middleDot" ) );
+        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( "middleDot" ) );
     else if ( '_' == cFillChar )
-        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "underscore" ) );
+        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( "underscore" ) );
     else
-        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( (sal_Char *) "none" ) );
+        pTabElementAttrList->add( FSNS( XML_w, XML_leader ), OString( "none" ) );
 
     pSerializer->singleElementNS( XML_w, XML_tab, pTabElementAttrList );
 }
commit 3e9bddfe6879580353b712d61308852e637f2e3d
Author: rbuj <robert.buj at gmail.com>
Date:   Tue Jul 29 21:38:00 2014 +0200

    javaunohelper: The assigned value is never used
    
    Change-Id: Ia190a6784fceaf9607ba39f2ef9d5ea4151cfc16
    Reviewed-on: https://gerrit.libreoffice.org/10624
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
index c598896..f4cda93 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
@@ -75,7 +75,7 @@ public class InputStreamToXInputStreamAdapter implements XInputStream {
     {
         int count = 0;
         try {
-        long bytesRead=0;
+        long bytesRead;
         if (len >iIn.available()) {
             bytesRead = iIn.read(b[0], 0, iIn.available());
         }
@@ -102,7 +102,7 @@ public class InputStreamToXInputStreamAdapter implements XInputStream {
     {
         int count = 0;
         try {
-        long bytesRead=0;
+        long bytesRead;
         if (len >iIn.available()) {
             bytesRead = iIn.read(b[0], 0, iIn.available());
         }
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
index a556bb0..7f4a623 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/XInputStreamToInputStreamAdapter.java
@@ -111,7 +111,7 @@ public class XInputStreamToInputStreamAdapter extends InputStream {
         int count = 0;
         byte [][] tmp = new byte [1][b.length];
         try {
-        long bytesRead=0;
+        long bytesRead;
             int av = xin.available();
         if ( av != 0 && len > av) {
           bytesRead = xin.readBytes(tmp, av);
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
index c2860db..8488e22 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/XOutputStreamToByteArrayAdapter.java
@@ -90,11 +90,10 @@ public class XOutputStreamToByteArrayAdapter
         {
             if ( externalBuffer )
                 throw new BufferSizeExceededException("out of buffer space, cannot grow external buffer");
-            byte[] newBuffer = null;
             while ( values.length > size-position )
                 size *= 2;
             // System.err.println("new buffer size is "+size+" bytes.");
-            newBuffer = new byte[size];
+            byte[] newBuffer = new byte[size];
             System.arraycopy(buffer, 0, newBuffer, 0, position);
             buffer = newBuffer;
         }
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java
index 8163963..c62b005 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java
@@ -494,7 +494,7 @@ XMultiPropertySet
         if ((prop.Attributes & PropertyAttribute.READONLY) == PropertyAttribute.READONLY)
             throw new com.sun.star.beans.PropertyVetoException();
         // The value may be null only if MAYBEVOID attribute is set
-        boolean bVoidValue= false;
+        boolean bVoidValue;
         if (value instanceof Any)
             bVoidValue= ((Any) value).getObject() == null;
         else
@@ -505,7 +505,7 @@ XMultiPropertySet
             throw new DisposedException("Component is already disposed");
 
         //Check if the argument is allowed
-        boolean bValueOk= false;
+        boolean bValueOk;
         if (value instanceof Any)
             bValueOk= checkType(((Any) value).getObject());
         else
@@ -898,7 +898,7 @@ XMultiPropertySet
             for (int i= 0; i < nAffectedProps; i++)
             {
                 // get the listener container for the property name
-                InterfaceContainer lc= null;
+                InterfaceContainer lc;
                 if (bVetoable)
                     lc= aVetoableLC.getContainer(arEvts[i].PropertyName);
                 else
commit 192265720a0f83ceab58fe81a159df5f43a59bb5
Author: rbuj <robert.buj at gmail.com>
Date:   Tue Jul 29 21:34:00 2014 +0200

    javaunohelper: String comparison
    
    Change-Id: I52a7e456bef73824f64213c982052c61e54f7c76
    Reviewed-on: https://gerrit.libreoffice.org/10621
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java b/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java
index 32610a3..e8a4fad 100644
--- a/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java
+++ b/javaunohelper/com/sun/star/comp/helper/SharedLibraryLoader.java
@@ -46,7 +46,7 @@ public class SharedLibraryLoader {
     public static final String DEFAULT_IMPLEMENTATION = "com.sun.star.comp.stoc.DLLComponentLoader";
 
     static {
-        if (System.getProperty("java.vendor") == "The Android Project") {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list