[Libreoffice-commits] core.git: 2 commits - cui/source desktop/source sc/uiconfig svx/source

Kiyotaka Nishibori (via logerrit) logerrit at kemper.freedesktop.org
Mon May 20 08:32:08 UTC 2019


 cui/source/tabpages/transfrm.cxx                    |   47 --------------
 desktop/source/lib/init.cxx                         |   32 +++++++++
 sc/uiconfig/scalc/ui/condformatmanager.ui           |    4 -
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx |   65 +-------------------
 svx/source/svdraw/svdedtv1.cxx                      |   38 +----------
 5 files changed, 45 insertions(+), 141 deletions(-)

New commits:
commit 2141f6d44a4f72396d9ab8effe8d1619a25dca8b
Author:     Kiyotaka Nishibori <ml.nishibori.kiyotaka at gmail.com>
AuthorDate: Sun May 19 11:05:07 2019 +0900
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Mon May 20 10:31:09 2019 +0200

    swapped column titles in condformatmanager.ui to fit the contents.
    
    Change-Id: Ia4c9a32e91b5bc65d223f7d1b2aa6d8b2c64454e
    Reviewed-on: https://gerrit.libreoffice.org/72543
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    Tested-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/sc/uiconfig/scalc/ui/condformatmanager.ui b/sc/uiconfig/scalc/ui/condformatmanager.ui
index c5e06da45e58..6423fa41829f 100644
--- a/sc/uiconfig/scalc/ui/condformatmanager.ui
+++ b/sc/uiconfig/scalc/ui/condformatmanager.ui
@@ -133,7 +133,7 @@
                               <object class="GtkTreeViewColumn" id="treeviewcolumn1">
                                 <property name="resizable">True</property>
                                 <property name="spacing">6</property>
-                                <property name="title" translatable="yes" context="condformatmanager|STR_HEADER_RANGE">First Condition</property>
+                                <property name="title" translatable="yes" context="condformatmanager|STR_HEADER_RANGE">Range</property>
                                 <child>
                                   <object class="GtkCellRendererText" id="cellrenderer1"/>
                                   <attributes>
@@ -146,7 +146,7 @@
                               <object class="GtkTreeViewColumn" id="treeviewcolumn2">
                                 <property name="resizable">True</property>
                                 <property name="spacing">6</property>
-                                <property name="title" translatable="yes" context="condformatmanager|STR_HEADER_RANGE">Range</property>
+                                <property name="title" translatable="yes" context="condformatmanager|STR_HEADER_FIRST_CONDITION">First Condition</property>
                                 <child>
                                   <object class="GtkCellRendererText" id="cellrenderer2"/>
                                   <attributes>
commit 89189743b9795cae13c69f69cdf6901b9ed354a7
Author:     Marco Cecchetti <mrcekets at gmail.com>
AuthorDate: Fri Nov 30 17:20:37 2018 +0100
Commit:     Marco Cecchetti <mrcekets at gmail.com>
CommitDate: Mon May 20 10:31:05 2019 +0200

    lok: shape selection: perform the needed unit conversion in a clever way
    
    Change-Id: I505bd41801b5fd1898a9eddc81b102f2f7ae20b5
    Reviewed-on: https://gerrit.libreoffice.org/70563
    Tested-by: Jenkins
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 9adcea111d85..397803c96e5c 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -88,28 +88,6 @@ const sal_uInt16 SvxSlantTabPage::pSlantRanges[] =
     0
 };
 
-namespace {
-
-bool lcl_twipsNeeded(const SdrView* pView)
-{
-    const bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
-    if (bTiledRendering)
-    {
-        // We gets the position in twips
-        if (OutputDevice* pOutputDevice = pView->GetFirstOutputDevice())
-        {
-            if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
-            {
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-} // anonymous ns
-
-
 /*************************************************************************
 |*
 |* constructor of the tab dialog: adds the pages to the dialog
@@ -279,18 +257,9 @@ bool SvxAngleTabPage::FillItemSet(SfxItemSet* rSet)
         const double fTmpX((GetCoreValue(*m_xMtrPosX, ePoolUnit) + maAnchor.getX()) * fUIScale);
         const double fTmpY((GetCoreValue(*m_xMtrPosY, ePoolUnit) + maAnchor.getY()) * fUIScale);
 
-        long nRotateX = basegfx::fround(fTmpX);
-        long nRotateY = basegfx::fround(fTmpY);
-
-        if (lcl_twipsNeeded(pView))
-        {
-            nRotateX = OutputDevice::LogicToLogic(nRotateX, MapUnit::Map100thMM, MapUnit::MapTwip);
-            nRotateY = OutputDevice::LogicToLogic(nRotateY, MapUnit::Map100thMM, MapUnit::MapTwip);
-        }
-
         rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ANGLE), m_aCtlAngle.GetRotation()));
-        rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), nRotateX));
-        rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), nRotateY));
+        rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_X), basegfx::fround(fTmpX)));
+        rSet->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_ROT_Y), basegfx::fround(fTmpY)));
 
         bModified = true;
     }
@@ -965,12 +934,6 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
             // #101581# GetTopLeftPosition(...) needs coordinates after UI scaling, in real PagePositions
             GetTopLeftPosition(fX, fY, maRange);
 
-            if (lcl_twipsNeeded(mpView))
-            {
-                fX = OutputDevice::LogicToLogic(fX, MapUnit::Map100thMM, MapUnit::MapTwip);
-                fY = OutputDevice::LogicToLogic(fY, MapUnit::Map100thMM, MapUnit::MapTwip);
-            }
-
             rOutAttrs->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_X), basegfx::fround(fX)));
             rOutAttrs->Put(SfxInt32Item(GetWhich(SID_ATTR_TRANSFORM_POS_Y), basegfx::fround(fY)));
 
@@ -1010,12 +973,6 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* rOutAttrs )
         lHeight = OutputDevice::LogicToLogic( lHeight, MapUnit::Map100thMM, mePoolUnit );
         lHeight = static_cast<long>(m_xMtrHeight->denormalize( lHeight ));
 
-        if (lcl_twipsNeeded(mpView))
-        {
-            lWidth = OutputDevice::LogicToLogic(lWidth, MapUnit::Map100thMM, MapUnit::MapTwip);
-            lHeight = OutputDevice::LogicToLogic(lHeight, MapUnit::Map100thMM, MapUnit::MapTwip);
-        }
-
         // put Width & Height to itemset
         rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_WIDTH ), static_cast<sal_uInt32>(lWidth) ) );
         rOutAttrs->Put( SfxUInt32Item( GetWhich( SID_ATTR_TRANSFORM_HEIGHT ), static_cast<sal_uInt32>(lHeight) ) );
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index ac82e295546f..f747a5391a77 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -107,6 +107,7 @@
 #include <svx/dialogs.hrc>
 #include <svx/strings.hrc>
 #include <svx/ruler.hxx>
+#include <svx/svdview.hxx>
 #include <svx/svxids.hrc>
 #include <svx/ucsubset.hxx>
 #include <vcl/vclevent.hxx>
@@ -3033,6 +3034,37 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
             return;
         }
     }
+    else if (gImpl && aCommand == ".uno:TransformDialog")
+    {
+        bool bNeedConversion = false;
+        SfxViewShell* pViewShell = SfxViewShell::Current();
+        if (const SdrView* pView = pViewShell->GetDrawView())
+        {
+            if (OutputDevice* pOutputDevice = pView->GetFirstOutputDevice())
+            {
+                bNeedConversion = (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM);
+            }
+        }
+        if (bNeedConversion)
+        {
+            sal_Int32 value;
+            for (beans::PropertyValue& rPropValue: aPropertyValuesVector)
+            {
+                if (rPropValue.Name == "TransformPosX"
+                        || rPropValue.Name == "TransformPosY"
+                        || rPropValue.Name == "TransformWidth"
+                        || rPropValue.Name == "TransformHeight"
+                        || rPropValue.Name == "TransformRotationX"
+                        || rPropValue.Name == "TransformRotationY")
+                {
+                    rPropValue.Value >>= value;
+                    value = OutputDevice::LogicToLogic(value, MapUnit::MapTwip, MapUnit::Map100thMM);
+                    rPropValue.Value <<= value;
+                }
+
+            }
+        }
+    }
 
     bool bResult = false;
     if (bNotifyWhenFinished && pDocument->mpCallbackFlushHandlers[nView])
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 2f4d63fb2079..fd45c8cfaa41 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -45,7 +45,7 @@
 #include <svl/intitem.hxx>
 #include <svx/svdview.hxx>
 #include <svx/transfrmhelper.hxx>
-#include <comphelper/lok.hxx>
+
 #include <svtools/unitconv.hxx>
 
 using namespace css;
@@ -53,27 +53,6 @@ using namespace css::uno;
 
 const char USERITEM_NAME[]      = "FitItem";
 
-namespace {
-
-bool lcl_twipsNeeded(const SdrView* pView)
-{
-    const bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
-    if (bTiledRendering)
-    {
-        // We gets the position in twips
-        if (OutputDevice* pOutputDevice = pView->GetFirstOutputDevice())
-        {
-            if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
-            {
-                return true;
-            }
-        }
-    }
-    return false;
-}
-
-} // anonymouus ns
-
 namespace svx { namespace sidebar {
 
 PosSizePropertyPanel::PosSizePropertyPanel(
@@ -401,11 +380,6 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, Edit&, void )
         Fraction aUIScale = mpView->GetModel()->GetUIScale();
         lX = long( lX * aUIScale );
 
-        if (lcl_twipsNeeded(mpView))
-        {
-            lX = OutputDevice::LogicToLogic(lX, MapUnit::Map100thMM, MapUnit::MapTwip);
-        }
-
         SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,static_cast<sal_uInt32>(lX));
 
         GetBindings()->GetDispatcher()->ExecuteList(
@@ -423,11 +397,6 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, Edit&, void )
         Fraction aUIScale = mpView->GetModel()->GetUIScale();
         lY = long( lY * aUIScale );
 
-        if (lcl_twipsNeeded(mpView))
-        {
-            lY = OutputDevice::LogicToLogic(lY, MapUnit::Map100thMM, MapUnit::MapTwip);
-        }
-
         SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,static_cast<sal_uInt32>(lY));
 
         GetBindings()->GetDispatcher()->ExecuteList(
@@ -485,18 +454,9 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, AngleModifiedHdl, Edit&, void )
 
     // #i123993# Need to take UIScale into account when executing rotations
     const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0);
-    long nRotateX = basegfx::fround(mlRotX * fUIScale);
-    long nRotateY = basegfx::fround(mlRotY * fUIScale);
-
-    if (lcl_twipsNeeded(mpView))
-    {
-        nRotateX = OutputDevice::LogicToLogic(nRotateX, MapUnit::Map100thMM, MapUnit::MapTwip);
-        nRotateY = OutputDevice::LogicToLogic(nRotateY, MapUnit::Map100thMM, MapUnit::MapTwip);
-    }
-
     SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,static_cast<sal_uInt32>(nTmp));
-    SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, nRotateX);
-    SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, nRotateY);
+    SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale));
+    SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale));
 
     GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
             SfxCallMode::RECORD, { &aAngleItem, &aRotXItem, &aRotYItem });
@@ -509,18 +469,9 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, RotationHdl, DialControl*, void )
 
     // #i123993# Need to take UIScale into account when executing rotations
     const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0);
-    long nRotateX = basegfx::fround(mlRotX * fUIScale);
-    long nRotateY = basegfx::fround(mlRotY * fUIScale);
-
-    if (lcl_twipsNeeded(mpView))
-    {
-        nRotateX = OutputDevice::LogicToLogic(nRotateX, MapUnit::Map100thMM, MapUnit::MapTwip);
-        nRotateY = OutputDevice::LogicToLogic(nRotateY, MapUnit::Map100thMM, MapUnit::MapTwip);
-    }
-
     SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,static_cast<sal_uInt32>(nTmp));
-    SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, nRotateX);
-    SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, nRotateY);
+    SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale));
+    SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale));
 
     GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
             SfxCallMode::RECORD, { &aAngleItem, &aRotXItem, &aRotYItem });
@@ -888,12 +839,6 @@ void PosSizePropertyPanel::executeSize()
     lHeight = OutputDevice::LogicToLogic( lHeight, MapUnit::Map100thMM, mePoolUnit );
     lHeight = static_cast<long>(mpMtrWidth->Denormalize( lHeight ));
 
-    if (lcl_twipsNeeded(mpView))
-    {
-        lWidth = OutputDevice::LogicToLogic(lWidth, MapUnit::Map100thMM, MapUnit::MapTwip);
-        lHeight = OutputDevice::LogicToLogic(lHeight, MapUnit::Map100thMM, MapUnit::MapTwip);
-    }
-
     // put Width & Height to itemset
     SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, static_cast<sal_uInt32>(lWidth));
     SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, static_cast<sal_uInt32>(lHeight));
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index b623579f8e3c..f781b64b36f7 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -1427,19 +1427,7 @@ static Point ImpGetPoint(const tools::Rectangle& rRect, RectPoint eRP)
 
 void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
 {
-    bool bDealingWithTwips = false;
     const bool bTiledRendering = comphelper::LibreOfficeKit::isActive();
-    if (bTiledRendering)
-    {
-        // We gets the position in twips
-        if (OutputDevice* pOutputDevice = mpMarkedPV->GetView().GetFirstOutputDevice())
-        {
-            if (pOutputDevice->GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
-            {
-                bDealingWithTwips = true;
-            }
-        }
-    }
 
     tools::Rectangle aRect(GetMarkedObjRect());
 
@@ -1455,14 +1443,8 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
     SdrObject* pObj=nullptr;
 
     RectPoint eSizePoint=RectPoint::MM;
-    long nPosX=aRect.Left();
-    long nPosY=aRect.Top();
-    if (bDealingWithTwips)
-    {
-        nPosX = OutputDevice::LogicToLogic(nPosX, MapUnit::Map100thMM, MapUnit::MapTwip);
-        nPosY = OutputDevice::LogicToLogic(nPosY, MapUnit::Map100thMM, MapUnit::MapTwip);
-    }
-
+    long nPosDX=0;
+    long nPosDY=0;
     long nSizX=0;
     long nSizY=0;
     long nRotateAngle=0;
@@ -1504,11 +1486,11 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
 
     // position
     if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_X,true,&pPoolItem)) {
-        nPosX=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+        nPosDX=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue() - aRect.Left();
         bChgPos=true;
     }
     if (SfxItemState::SET==rAttr.GetItemState(SID_ATTR_TRANSFORM_POS_Y,true,&pPoolItem)){
-        nPosY=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+        nPosDY=static_cast<const SfxInt32Item*>(pPoolItem)->GetValue() - aRect.Top();
         bChgPos=true;
     }
     // size
@@ -1598,18 +1580,6 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr)
         bSetAttr=true;
     }
 
-    if(bDealingWithTwips) {
-        nPosX = OutputDevice::LogicToLogic(nPosX, MapUnit::MapTwip, MapUnit::Map100thMM);
-        nPosY = OutputDevice::LogicToLogic(nPosY, MapUnit::MapTwip, MapUnit::Map100thMM);
-        nSizX = OutputDevice::LogicToLogic(nSizX, MapUnit::MapTwip, MapUnit::Map100thMM);
-        nSizY = OutputDevice::LogicToLogic(nSizY, MapUnit::MapTwip, MapUnit::Map100thMM);
-        nRotateX = OutputDevice::LogicToLogic(nRotateX, MapUnit::MapTwip, MapUnit::Map100thMM);
-        nRotateY = OutputDevice::LogicToLogic(nRotateY, MapUnit::MapTwip, MapUnit::Map100thMM);
-    }
-
-    long nPosDX = nPosX - aRect.Left();
-    long nPosDY = nPosY - aRect.Top();
-
     ForcePossibilities();
 
     BegUndo(SvxResId(STR_EditTransform),GetDescriptionOfMarkedObjects());


More information about the Libreoffice-commits mailing list