[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - svgio/source sw/source

Armin Le Grand alg at apache.org
Tue Jul 2 05:07:27 PDT 2013


 svgio/source/svgreader/svgsvgnode.cxx |   60 ++++++++++++++++++++++++++++++++--
 sw/source/ui/shells/textfld.cxx       |   15 +++-----
 2 files changed, 64 insertions(+), 11 deletions(-)

New commits:
commit 5fa6275694d0990018b13266b37c359b37251c1c
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Jul 2 12:00:29 2013 +0000

    i122594 correctly handle iner svg node when no width/height or percent is given

diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx
index 155a179..b77b124 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -182,8 +182,64 @@ namespace svgio
                             // create target range homing x,y, width and height as given
                             const double fX(getX().isSet() ? getX().solve(*this, xcoordinate) : 0.0);
                             const double fY(getY().isSet() ? getY().solve(*this, ycoordinate) : 0.0);
-                            const double fW(getWidth().isSet() ? getWidth().solve(*this, xcoordinate) : getViewBox()->getWidth());
-                            const double fH(getHeight().isSet() ? getHeight().solve(*this, ycoordinate) : getViewBox()->getHeight());
+                            const bool bWidthIsRelative(!getWidth().isSet() || Unit_percent == getWidth().getUnit());
+                            const bool bHeightIsRelative(!getWidth().isSet() || Unit_percent == getWidth().getUnit());
+                            const SvgSvgNode* pParentSvgSvgNode = 0;
+                            double fW(0.0);
+                            double fH(0.0);
+
+                            // #122594# if width/height is not given, it's 100% (see 5.1.2 The ‘svg’ element in SVG1.1 spec).
+                            // If it is relative, the question is to what. The previous implementatin assumed relative to the
+                            // local ViewBox which is implied by (4.2 Basic data types):
+                            //
+                            // "Note that the non-property <length> definition also allows a percentage unit identifier.
+                            // The meaning of a percentage length value depends on the attribute for which the percentage
+                            // length value has been specified. Two common cases are: (a) when a percentage length value
+                            // represents a percentage of the viewport width or height (refer to the section that discusses
+                            // units in general), and (b) when a percentage length value represents a percentage of the
+                            // bounding box width or height on a given object (refer to the section that describes object
+                            // bounding box units)."
+                            //
+                            // This is not closer specified for the SVG element itself as non-outmost element, but comparisons
+                            // with common browsers shows that it's mostly interpreted relative to the viewBox of the parent.
+                            // Adding code to search the parent SVG element and calculating width/height relative to it's
+                            // viewBox width/height (and no longer to the local viewBox).
+                            if(bWidthIsRelative || bHeightIsRelative)
+                            {
+                                for(const SvgNode* pParent = getParent(); pParent && !pParentSvgSvgNode; pParent = pParent->getParent())
+                                {
+                                    pParentSvgSvgNode = dynamic_cast< const SvgSvgNode* >(pParent);
+                                }
+                            }
+
+                            if(bWidthIsRelative)
+                            {
+                                fW = getWidth().isSet() ? getWidth().getNumber() * 0.01 : 1.0;
+
+                                if(pParentSvgSvgNode)
+                                {
+                                    fW *= pParentSvgSvgNode->getViewBox()->getWidth();
+                                }
+                            }
+                            else
+                            {
+                                fW = getWidth().solve(*this, xcoordinate);
+                            }
+
+                            if(bHeightIsRelative)
+                            {
+                                fH = getHeight().isSet() ? getHeight().getNumber() * 0.01 : 1.0;
+
+                                if(pParentSvgSvgNode)
+                                {
+                                    fH *= pParentSvgSvgNode->getViewBox()->getHeight();
+                                }
+                            }
+                            else
+                            {
+                                fH = getHeight().solve(*this, ycoordinate);
+                            }
+
                             const basegfx::B2DRange aTarget(fX, fY, fX + fW, fY + fH);
 
                             if(aTarget.equal(*getViewBox()))
commit bfeefdb5affc187c4ae04d82915ac65ea3fc73e4
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Jul 2 11:30:06 2013 +0000

    i120513 Remove autocompletion suggestion when inserting comment via menu/shortcut
    
    Author: orw, alg

diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
index 915695d..2cbaee4 100644
--- a/sw/source/ui/shells/textfld.cxx
+++ b/sw/source/ui/shells/textfld.cxx
@@ -19,14 +19,11 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
 #include <crsskip.hxx>
 #include <hintids.hxx>  //_immer_ vor den solar-Items
-
 #include <sfx2/lnkbase.hxx>
 #include <fmtfld.hxx>
 #include <tools/urlobj.hxx>
@@ -40,7 +37,6 @@
 #include <sfx2/request.hxx>
 #include <svx/postattr.hxx>
 #include <svx/hlnkitem.hxx>
-
 #include <svx/svxdlg.hxx>
 #include <sfx2/linkmgr.hxx>
 #include <unotools/localedatawrapper.hxx>
@@ -62,10 +58,8 @@
 #include <expfld.hxx>
 #include <fldmgr.hxx>
 #include <uitool.hxx>
-
 #include <cmdid.h>
 #include <shells.hrc>
-
 #include <sfx2/app.hxx>
 #include <svx/svxdlg.hxx>
 #include <svx/dialogs.hrc>
@@ -73,15 +67,13 @@
 #include "dialog.hrc"
 #include <fldui.hrc>
 #include <doc.hxx>
-
 #include <app.hrc>
-
+#include <edtwin.hxx>
 #include <PostItMgr.hxx>
 #include <switerator.hxx>
 
 using namespace nsSwDocInfoSubType;
 
-
 extern sal_Bool bNoInterrupt;       // in mainwn.cxx
 
 String& lcl_AppendRedlineStr( String& rStr, sal_uInt16 nRedlId )
@@ -363,6 +355,11 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                         rSh.KillPams();
                         rSh.ClearMark();
                     }
+
+                    // #120513# Inserting a comment into an autocompletion crashes
+                    // --> suggestion has to be removed before
+                    GetView().GetEditWin().StopQuickHelp();
+
                     SwInsertFld_Data aData(TYP_POSTITFLD, 0, sAuthor, aEmptyStr, 0);
                     aFldMgr.InsertFld(aData);
                     rSh.Push();


More information about the Libreoffice-commits mailing list