[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 5 commits - desktop/source sfx2/source sw/inc sw/source

Jan Holesovsky kendy at collabora.com
Tue Sep 15 13:08:27 PDT 2015


 desktop/source/lib/init.cxx      |   58 +++++++++++++++++++++++++++++++++++++++
 sfx2/source/control/unoctitm.cxx |   45 +++++++++++++++++++++++++-----
 sw/inc/viewsh.hxx                |    3 +-
 sw/source/core/view/viewsh.cxx   |    7 ++++
 4 files changed, 105 insertions(+), 8 deletions(-)

New commits:
commit 49fb3c613651b6c3b627a7aab8f8095d0b609159
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Sep 15 20:22:08 2015 +0200

    tdf#94237 tiled rendering: Use the entire document as the visual area.
    
    Many places were already adapted for the tiled rendering, and the conditions
    checking for the VisArea() were changed so that the checks are ignored when
    tiled rendering is active.
    
    Unfortunately there are still some places left, and they are causing that
    various areas are invalidated only partially.  Let's sort it out for good, and
    report the entire document as the VisArea() when the tiled rendering is
    active, and if there are performance problems, let's profile that & act
    accordingly.
    
    Change-Id: I53f18915ed0aec898704dd1350a9534cfc3f001b

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 763af50..1ba064f 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -31,6 +31,7 @@
 #include <vcl/mapmod.hxx>
 #include <vcl/print.hxx>
 #include <vcl/vclptr.hxx>
+
 #define LOK_USE_UNSTABLE_API
 #include <LibreOfficeKit/LibreOfficeKitTypes.h>
 
@@ -269,7 +270,7 @@ public:
     bool SmoothScroll( long lXDiff, long lYDiff, const Rectangle* );//Browser
     void EnableSmooth( bool b ) { mbEnableSmooth = b; }
 
-    const SwRect& VisArea() const { return maVisArea; }
+    const SwRect& VisArea() const;
 
     // If necessary scroll until passed Rect is situated in visible sector.
     void MakeVisible( const SwRect & );
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 1b4b80d..2c48e98 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -566,6 +566,13 @@ void SwViewShell::InvalidateWindows( const SwRect &rRect )
     }
 }
 
+const SwRect& SwViewShell::VisArea() const
+{
+    // when using the tiled rendering, consider the entire document as our
+    // visible area
+    return isTiledRendering()? GetLayout()->Frm(): maVisArea;
+}
+
 void SwViewShell::MakeVisible( const SwRect &rRect )
 {
     if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin(*this) )
commit 067aa0133aa49291804c3d0663772475fba79d25
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Sep 15 17:04:58 2015 +0200

    LOK: Avoid crash when the command is not available in the given component.
    
    In that case we get a NULL pSlot.
    
    Change-Id: I38783ed198b1ab9860398f59ef872a295cbae6f8

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4ad1bb8..1439e28 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -555,7 +555,7 @@ static void doc_iniUnoCommands ()
     util::URL aCommandURL;
     const SfxSlot* pSlot = NULL;
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    SfxViewFrame* pViewFrame = (pViewShell ? pViewShell->GetViewFrame() : NULL);
+    SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): NULL;
 
     // check if Frame-Controller were created.
     if (!pViewShell && !pViewFrame)
@@ -564,26 +564,21 @@ static void doc_iniUnoCommands ()
         return;
     }
 
-    SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pViewFrame );
-    uno::Reference<util::XURLTransformer> xParser =
-        util::URLTransformer::create(xContext);
+    SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
+    uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(xContext));
 
-    for (
-        sal_uInt32 nIterator = 0;
-        nIterator < SAL_N_ELEMENTS(sUnoCommands);
-        nIterator++
-        )
+    for (sal_uInt32 nIterator = 0; nIterator < SAL_N_ELEMENTS(sUnoCommands); nIterator++)
     {
         aCommandURL.Complete = sUnoCommands[nIterator];
         xParser->parseStrict(aCommandURL);
         pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
 
-        // Initialize slot to dispatch Uno Command.
-        uno::Reference<frame::XDispatch> xDispatch =
-            pViewFrame->GetBindings().GetDispatch( pSlot, aCommandURL, false );
-        if (!xDispatch.is())
+        // when null, this command is not supported by the given component
+        // (like eg. Calc does not have ".uno:DefaultBullet" etc.)
+        if (pSlot)
         {
-            SAL_WARN("lok", "iniUnoCommands: No XDispatch interface : " + aCommandURL.Complete);
+            // Initialize slot to dispatch .uno: Command.
+            pViewFrame->GetBindings().GetDispatch(pSlot, aCommandURL, false);
         }
     }
 }
commit dcd52e6bcd535da67cf944a5f955b950432abf19
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Sep 15 12:00:25 2015 +0200

    LOK: Sync the list of commands we initialize with those we handle.
    
    A better solution is needed, outlined in tdf#94233.
    
    Change-Id: Ie2a58c9c5f5c46566da105ef84d736d7290f4634

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1f57fc3..4ad1bb8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -539,12 +539,17 @@ static void doc_iniUnoCommands ()
         OUString(".uno:Italic"),
         OUString(".uno:Underline"),
         OUString(".uno:Strikeout"),
+        OUString(".uno:DefaultBullet"),
+        OUString(".uno:DefaultNumbering"),
         OUString(".uno:LeftPara"),
         OUString(".uno:CenterPara"),
         OUString(".uno:RightPara"),
         OUString(".uno:JustifyPara"),
         OUString(".uno:IncrementIndent"),
-        OUString(".uno:DecrementIndent")
+        OUString(".uno:DecrementIndent"),
+        OUString(".uno:CharFontName"),
+        OUString(".uno:FontHeight"),
+        OUString(".uno:StyleApply")
     };
 
     util::URL aCommandURL;
commit 790c9619709fc1f4226c05e398a7a9f0c4d391f0
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Sep 14 20:14:34 2015 -0400

    lok: initialize UNO url command dispatch
    
    In the tiled rendering case, the desktop is headless, so the toolbar
    is not created.  The toolbar usually initializes all UNO url commands
    for each tool item attached.
    
    This causes that SfxControllerItem that monitor a state, it is not
    intercepted by InterceptLOKStateChangeEvent so no callback status changes.
    
    Change-Id: I5937cda66ef24d31dd92a1edd8c1440081c4b1a4

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bf137a5..1f57fc3 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -44,10 +44,15 @@
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/ucb/XContentProvider.hpp>
 #include <com/sun/star/ucb/XUniversalContentBroker.hpp>
+#include <com/sun/star/util/URLTransformer.hpp>
 
 #include <editeng/fontitem.hxx>
 #include <editeng/flstitem.hxx>
 #include <sfx2/objsh.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/msgpool.hxx>
+#include <sfx2/dispatch.hxx>
 #include <svx/svxids.hrc>
 #include <vcl/svapp.hxx>
 #include <vcl/svpforlokit.hxx>
@@ -526,6 +531,58 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
     return false;
 }
 
+static void doc_iniUnoCommands ()
+{
+    OUString sUnoCommands[] =
+    {
+        OUString(".uno:Bold"),
+        OUString(".uno:Italic"),
+        OUString(".uno:Underline"),
+        OUString(".uno:Strikeout"),
+        OUString(".uno:LeftPara"),
+        OUString(".uno:CenterPara"),
+        OUString(".uno:RightPara"),
+        OUString(".uno:JustifyPara"),
+        OUString(".uno:IncrementIndent"),
+        OUString(".uno:DecrementIndent")
+    };
+
+    util::URL aCommandURL;
+    const SfxSlot* pSlot = NULL;
+    SfxViewShell* pViewShell = SfxViewShell::Current();
+    SfxViewFrame* pViewFrame = (pViewShell ? pViewShell->GetViewFrame() : NULL);
+
+    // check if Frame-Controller were created.
+    if (!pViewShell && !pViewFrame)
+    {
+        SAL_WARN("lok", "iniUnoCommands: No Frame-Controller created.");
+        return;
+    }
+
+    SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pViewFrame );
+    uno::Reference<util::XURLTransformer> xParser =
+        util::URLTransformer::create(xContext);
+
+    for (
+        sal_uInt32 nIterator = 0;
+        nIterator < SAL_N_ELEMENTS(sUnoCommands);
+        nIterator++
+        )
+    {
+        aCommandURL.Complete = sUnoCommands[nIterator];
+        xParser->parseStrict(aCommandURL);
+        pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
+
+        // Initialize slot to dispatch Uno Command.
+        uno::Reference<frame::XDispatch> xDispatch =
+            pViewFrame->GetBindings().GetDispatch( pSlot, aCommandURL, false );
+        if (!xDispatch.is())
+        {
+            SAL_WARN("lok", "iniUnoCommands: No XDispatch interface : " + aCommandURL.Complete);
+        }
+    }
+}
+
 static int doc_getDocumentType (LibreOfficeKitDocument* pThis)
 {
     LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
@@ -739,6 +796,7 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis)
     ITiledRenderable* pDoc = getTiledRenderable(pThis);
     if (pDoc)
     {
+        doc_iniUnoCommands();
         pDoc->initializeForTiledRendering();
     }
 }
commit 538f10f6fccb0ad92abb1f92324f9989f0b9f558
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Mon Sep 14 20:06:07 2015 +0300

    get feedback for style / font / font size in tiledrendering
    
    Change-Id: I92fd5022a4a5736a6323732141e9ea7bafec2a44

diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index bba52c6..bb5d672 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -28,6 +28,7 @@
 #include <svtools/javacontext.hxx>
 #include <svl/itempool.hxx>
 #include <tools/urlobj.hxx>
+#include <com/sun/star/awt/FontDescriptor.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
@@ -37,8 +38,10 @@
 #include <com/sun/star/frame/XFrame.hpp>
 #include <com/sun/star/frame/FrameActionEvent.hpp>
 #include <com/sun/star/frame/FrameAction.hpp>
+#include <com/sun/star/frame/status/FontHeight.hpp>
 #include <com/sun/star/frame/status/ItemStatus.hpp>
 #include <com/sun/star/frame/status/ItemState.hpp>
+#include <com/sun/star/frame/status/Template.hpp>
 #include <com/sun/star/frame/DispatchResultState.hpp>
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/frame/status/Visibility.hpp>
@@ -1059,22 +1062,50 @@ void SfxDispatchController_Impl::InterceptLOKStateChangeEvent(const SfxObjectShe
     if (!objSh || !objSh->isTiledRendering())
         return;
 
+    OUStringBuffer aBuffer;
+    aBuffer.append(aEvent.FeatureURL.Complete);
+    aBuffer.append("=");
+
     if (aEvent.FeatureURL.Path == "Bold" ||
         aEvent.FeatureURL.Path == "Italic" ||
         aEvent.FeatureURL.Path == "Underline" ||
-        aEvent.FeatureURL.Path == "Strikeout")
+        aEvent.FeatureURL.Path == "Strikeout" ||
+        aEvent.FeatureURL.Path == "DefaultBullet" ||
+        aEvent.FeatureURL.Path == "DefaultNumbering" ||
+        aEvent.FeatureURL.Path == "LeftPara" ||
+        aEvent.FeatureURL.Path == "CenterPara" ||
+        aEvent.FeatureURL.Path == "RightPara" ||
+        aEvent.FeatureURL.Path == "JustifyPara")
     {
-
-        OUStringBuffer aBuffer;
-        aBuffer.append(aEvent.FeatureURL.Complete);
-        aBuffer.append("=");
         bool bTemp = false;
         aEvent.State >>= bTemp;
         aBuffer.append(bTemp);
 
-        OUString payload = aBuffer.makeStringAndClear();
-        objSh->libreOfficeKitCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr());
     }
+    else if (aEvent.FeatureURL.Path == "CharFontName")
+    {
+        ::com::sun::star::awt::FontDescriptor aFontDesc;
+        aEvent.State >>= aFontDesc;
+        aBuffer.append(aFontDesc.Name);
+    }
+    else if (aEvent.FeatureURL.Path == "FontHeight")
+    {
+        ::com::sun::star::frame::status::FontHeight aFontHeight;
+        aEvent.State >>= aFontHeight;
+        aBuffer.append(aFontHeight.Height);
+    }
+    else if (aEvent.FeatureURL.Path == "StyleApply")
+    {
+        ::com::sun::star::frame::status::Template aTemplate;
+        aEvent.State >>= aTemplate;
+        aBuffer.append(aTemplate.StyleName);
+    }
+    else
+    {
+        return;
+    }
+    OUString payload = aBuffer.makeStringAndClear();
+    objSh->libreOfficeKitCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list