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

Miklos Vajna vmiklos at collabora.co.uk
Tue Nov 17 12:20:06 PST 2015


 sw/source/uibase/docvw/PostItMgr.cxx  |   23 ++++++++++++++++-------
 sw/source/uibase/docvw/SidebarWin.cxx |   12 +++++++-----
 sw/source/uibase/uno/unotxdoc.cxx     |   12 ++++++++++++
 3 files changed, 35 insertions(+), 12 deletions(-)

New commits:
commit f04f2f5708414691de622cfd6a1d891841c66b5e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 17 18:28:57 2015 +0100

    sw lok comments: implement clipboard copy
    
    Change-Id: I0f45b1a6ab198a8403073eea05497e76f758250c
    (cherry picked from commit 4890ae51288c2c571e85a1536cb6c8f44681bd25)

diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index db61ce3..e6c1040 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -134,6 +134,8 @@
 #include <srcview.hxx>
 #include <edtwin.hxx>
 #include <swdtflvr.hxx>
+#include <SidebarWin.hxx>
+#include <PostItMgr.hxx>
 
 #include <svtools/langtab.hxx>
 #include <svtools/miscopt.hxx>
@@ -3373,6 +3375,16 @@ OString SwXTextDocument::getTextSelection(const char* pMimeType, OString& rUsedM
         }
     }
 
+    if (SwPostItMgr* pPostItMgr = pDocShell->GetView()->GetPostItMgr())
+    {
+        if (sw::sidebarwindows::SwSidebarWin* pWin = pPostItMgr->GetActiveSidebarWin())
+        {
+            // Editing postit text.
+            EditView& rEditView = pWin->GetOutlinerView()->GetEditView();
+            xTransferable = rEditView.GetEditEngine()->CreateTransferable(rEditView.GetSelection());
+        }
+    }
+
     if (!xTransferable.is())
         xTransferable = new SwTransferable(*pWrtShell);
 
commit 688082708d9bb1d5938bf21acf324ee3069600e0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 17 17:14:58 2015 +0100

    sw lok comments: fix meta author/data size with custom zoom
    
    Change-Id: I3310813c971aa7abffccc0b7f462e05caa83482e
    (cherry picked from commit 50bdd588d39a23d44d2d2111256f5e505c7165af)

diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index c459c88..1281bf8 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -668,11 +668,12 @@ void SwSidebarWin::Rescale()
     mpOutliner->SetRefMapMode( aMode );
     SetMapMode( aMode );
     mpSidebarTextControl->SetMapMode( aMode );
+    const Fraction& rFraction = mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY();
     if ( mpMetadataAuthor )
     {
         vcl::Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() );
         sal_Int32 nHeight = aFont.GetHeight();
-        nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+        nHeight = nHeight * rFraction.GetNumerator() / rFraction.GetDenominator();
         aFont.SetHeight( nHeight );
         mpMetadataAuthor->SetControlFont( aFont );
     }
@@ -680,7 +681,7 @@ void SwSidebarWin::Rescale()
     {
         vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
         sal_Int32 nHeight = aFont.GetHeight();
-        nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+        nHeight = nHeight * rFraction.GetNumerator() / rFraction.GetDenominator();
         aFont.SetHeight( nHeight );
         mpMetadataDate->SetControlFont( aFont );
     }
commit 5abc86ab189e2e8654c608d093c7d8ba7ca5c999
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 17 17:07:47 2015 +0100

    sw lok comments: fix comment widget width with custom zoom
    
    When tiled rendering, then only the render context (or failing that,
    SwViewShell::GetOut()) has the correct zoom level, so use that when
    doing pixel-to-logic conversion or scaling pixel values.
    
    Change-Id: I265a642b8253c6eced42da2a0e06a2de25c36ca8
    (cherry picked from commit 8a249d38e94098b300fb4f49cb4a44960027fa20)

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 40e2bda..e0ea88f 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -870,7 +870,7 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe
         MapMode aMapMode(rRenderContext.GetMapMode());
         aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
         rRenderContext.SetMapMode(aMapMode);
-        Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel()));
+        Size aSize(rRenderContext.PixelToLogic(pPostIt->GetSizePixel()));
         Rectangle aRectangle(Point(0, 0), aSize);
 
         pPostIt->PaintTile(rRenderContext, aRectangle);
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index 47b335a..c459c88 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -285,7 +285,8 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
             continue;
 
         rRenderContext.Push(PushFlags::MAPMODE);
-        Point aOffset(PixelToLogic(pChild->GetPosPixel()));
+        const Fraction& rFraction(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
+        Point aOffset(PixelToLogic(pChild->GetPosPixel() * rFraction.GetDenominator() / rFraction.GetNumerator()));
         MapMode aMapMode(rRenderContext.GetMapMode());
         aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
         rRenderContext.SetMapMode(aMapMode);
@@ -1410,7 +1411,7 @@ sal_Int32 SwSidebarWin::GetMetaButtonAreaWidth()
 
 sal_Int32 SwSidebarWin::GetMetaHeight()
 {
-    const Fraction& f( GetMapMode().GetScaleY() );
+    const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
     return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
 }
 
@@ -1421,7 +1422,7 @@ sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta()
 
 sal_Int32 SwSidebarWin::GetMinimumSizeWithoutMeta()
 {
-    const Fraction& f( GetMapMode().GetScaleY() );
+    const Fraction& f(mrView.GetWrtShellPtr()->GetOut()->GetMapMode().GetScaleY());
     return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
 }
 
commit ade5aa14139517c54182d46ae2fd268d86556e45
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 17 12:02:06 2015 +0100

    sw lok comments: fix text selection with custom zoom
    
    SwPostItMgr::GetSidebarWidth() can be called in two scenarios:
    
    - inside PaintTile() the output device contains the zoom level and has
      the map mode enabled (and its scale factor is the zoom level)
    - outisde PaintTile() the output device is SwEditWin and has the map
      mode disabled (and the zoom level is to be taken from the view
      options)
    
    Change-Id: I6cf19f3241a2e972ae711e0efa7b0205aae1a3f2
    (cherry picked from commit acec324b0c753877cf913e8064c02603307b5ebb)

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index fa82556..40e2bda 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1865,10 +1865,11 @@ bool SwPostItMgr::HasNotes() const
 
 unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const
 {
+    bool bEnableMapMode = !mpWrtShell->GetOut()->IsMapModeEnabled();
     sal_uInt16 nZoom = mpWrtShell->GetViewOptions()->GetZoom();
-    if (comphelper::LibreOfficeKit::isActive())
+    if (comphelper::LibreOfficeKit::isActive() && !bEnableMapMode)
     {
-        // The output device contains the real wanted scale factor.
+        // The output device is the tile and contains the real wanted scale factor.
         double fScaleX = mpWrtShell->GetOut()->GetMapMode().GetScaleX();
         nZoom = fScaleX * 100;
     }
@@ -1877,7 +1878,15 @@ unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const
     if (bPx)
         return aWidth;
     else
-        return mpWrtShell->GetOut()->PixelToLogic(Size(aWidth, 0)).Width();
+    {
+        if (bEnableMapMode)
+            // The output device is the window.
+            mpWrtShell->GetOut()->EnableMapMode();
+        long nRet = mpWrtShell->GetOut()->PixelToLogic(Size(aWidth, 0)).Width();
+        if (bEnableMapMode)
+            mpWrtShell->GetOut()->EnableMapMode(false);
+        return nRet;
+    }
 }
 
 unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const
commit f326e5b132500392edb3e10bf7a2fd191e317808
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Nov 16 16:30:21 2015 +0100

    sw lok comments: fix sidebar width with custom zoom
    
    Change-Id: I6772cce10d157421d983d6b93efb52bf8b95f5b8
    (cherry picked from commit dc65f048fd1b08d17e71e4d3a3a3c114aae871e6)

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 871a642..fa82556 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -1865,19 +1865,19 @@ bool SwPostItMgr::HasNotes() const
 
 unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const
 {
-    unsigned long aWidth = (unsigned long)(mpWrtShell->GetViewOptions()->GetZoom() * 1.8);
+    sal_uInt16 nZoom = mpWrtShell->GetViewOptions()->GetZoom();
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // The output device contains the real wanted scale factor.
+        double fScaleX = mpWrtShell->GetOut()->GetMapMode().GetScaleX();
+        nZoom = fScaleX * 100;
+    }
+    unsigned long aWidth = (unsigned long)(nZoom * 1.8);
+
     if (bPx)
         return aWidth;
     else
-    {
-        bool bEnableMapMode = comphelper::LibreOfficeKit::isActive() && !mpEditWin->IsMapModeEnabled();
-        if (bEnableMapMode)
-            mpEditWin->EnableMapMode();
-        long nRet = mpEditWin->PixelToLogic(Size(aWidth, 0)).Width();
-        if (bEnableMapMode)
-            mpEditWin->EnableMapMode(false);
-        return nRet;
-    }
+        return mpWrtShell->GetOut()->PixelToLogic(Size(aWidth, 0)).Width();
 }
 
 unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const
@@ -1885,7 +1885,7 @@ unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const
     if (bPx)
         return 2;
     else
-        return mpEditWin->PixelToLogic(Size(2,0)).Width();
+        return mpWrtShell->GetOut()->PixelToLogic(Size(2,0)).Width();
 }
 
 unsigned long SwPostItMgr::GetNoteWidth()


More information about the Libreoffice-commits mailing list