[Libreoffice-commits] core.git: sd/source

Stephan Bergmann sbergman at redhat.com
Mon Oct 24 16:16:51 UTC 2016


 sd/source/ui/unoidl/unomodel.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 59ec27f44630fe129a590ba4caf6998bb671ecb5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Oct 24 17:53:01 2016 +0200

    Calculate size of embedded Impress document properly
    
    The '- 1's had been like that ever since
    cbd8e4d144757f40b75063bb4ab0e13ca2cfaad0 "added VisibleArea and MapUnit
    properties" but caused the following problem, suggesting that they may have been
    an off-by-one error right from the start:
    
    Opening an .odt Writer doc with an embedded (via "Insert - Object - OLE
    Object... - Create new - LibreOffice 5.3 Presentation") Impress doc for which
    the .odt's content.xml records
    
      <draw:frame ... svg:width="5.5508in" svg:height="3.9366in" ...>
    
    causes XMLTextFrameContext_Impl::Create
    (xmloff/source/text/XMLTextFrameContext.cxx) to create a size (in 100th mm?) of
    14099x9999, which is converted to 7993x5669 twips, which are then passed to an
    SwFormatFrameSize ctor (sw/source/core/layout/atrfrm.cxx).
    
    However, double-clicking into the Writer doc's Impress area (to make the Impress
    doc editable) and then clicking back into the outer Writer doc's area (to put
    the Impress doc back into non-editing mode) causes the Writer doc to be
    considered modified (e.g., the "Save" icon gets a small green "plus" overlay)
    due to the call to SfxObjectShell::SetModified at
    
    > SfxObjectShell::SetModified(bool) (this=0x21293a0, bModifiedP=true) at sfx2/source/doc/objmisc.cxx:314
    > SwDocShell::SetModified(bool) (this=0x21293a0, bSet=true) at sw/source/uibase/app/docsh2.cxx:1243
    > SwDocShell::Ole2ModifiedHdl(bool) (this=0x21293a0, bNewStatus=true) at sw/source/uibase/app/docsh.cxx:1093
    > SwDocShell::LinkStubOle2ModifiedHdl(void*, bool) (instance=0x21293a0, data=true) at sw/source/uibase/app/docsh.cxx:1090
    > Link<bool, void>::Call(bool) const (this=0xa32c0c8, data=true) at include/tools/link.hxx:84
    > sw::DocumentStateManager::SetModified() (this=0x82e77f0) at sw/source/core/doc/DocumentStateManager.cxx:48
    > SwDoc::SetAttr(SfxItemSet const&, SwFormat&) (this=0xa32c050, rSet=SfxItemSet of pool 0x21dbd60 with parent 0x0 and Which ranges: [(88, 88)] = {...}, rFormat=...) at sw/source/core/doc/docfmt.cxx:492
    > SwDoc::SetAttr(SfxPoolItem const&, SwFormat&) (this=0xa32c050, rAttr=..., rFormat=...) at sw/source/core/doc/docfmt.cxx:468
    > SwFlyFrame::ChgSize(Size const&) (this=0xa14ae10, aNewSize=Size = {...}) at sw/source/core/layout/fly.cxx:1993
    > SwFEShell::RequestObjectResize(SwRect const&, com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> const&) (this=0x83fc880, rRect=SwRect = {...}, xObj=uno::Reference to (OCommonEmbeddedObject *) 0x7fff745f7530) at sw/source/core/frmedt/fefly1.cxx:1334
    > SwOleClient::ViewChanged() (this=0x4a15a10) at sw/source/uibase/uiview/swcli.cxx:151
    > SfxInPlaceClient::Invalidate() (this=0x4a15a10) at sfx2/source/view/ipclient.cxx:812
    > SfxInPlaceClient::SetObjAreaAndScale(Rectangle const&, Fraction const&, Fraction const&) (this=0x4a15a10, rArea=Rectangle = {...}, rScaleWidth=Fraction containing std::unique_ptr<Fraction::Impl> containing 0x1d47a40, rScaleHeight=Fraction containing std::unique_ptr<Fraction::Impl> containing 0x8c0d910) at sfx2/source/view/ipclient.cxx:785
    > SwWrtShell::CalcAndSetScale(svt::EmbeddedObjectRef&, SwRect const*, SwRect const*, bool) (this=0x83fc880, xObj=..., pFlyPrtRect=0x0, pFlyFrameRect=0x0, bNoTextFramePrtAreaChanged=false) at sw/source/uibase/wrtsh/wrtsh1.cxx:825
    > SwWrtShell::LaunchOLEObj(long) (this=0x83fc880, nVerb=0) at sw/source/uibase/wrtsh/wrtsh1.cxx:591
    > SwEditWin::MouseButtonDown(MouseEvent const&) (this=0x490b2e0, _rMEvt=...) at sw/source/uibase/docvw/edtwin.cxx:3366
    > ImplHandleMouseEvent(VclPtr<vcl::Window> const&, MouseNotifyEvent, bool, long, long, unsigned long, unsigned short, MouseEventModifiers) (xWindow=..., nSVEvent=MouseNotifyEvent::MOUSEBUTTONDOWN, bMouseLeave=false, nX=750, nY=341, nMsgTime=32828148, nCode=1, nMode=(MouseEventModifiers::SIMPLECLICK | MouseEventModifiers::SELECT)) at vcl/source/window/winproc.cxx:698
    > ImplHandleSalMouseButtonDown(vcl::Window*, SalMouseEvent*) (pWindow=0x19d19a0, pEvent=0x7fffffffc928) at vcl/source/window/winproc.cxx:1999
    > ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x19d19a0, nEvent=SalEvent::MouseButtonDown, pEvent=0x7fffffffc928) at vcl/source/window/winproc.cxx:2329
    > SalFrame::CallCallback(SalEvent, void const*) const (this=0x1996820, nEvent=SalEvent::MouseButtonDown, pEvent=0x7fffffffc928) at vcl/inc/salframe.hxx:280
    > GtkSalFrame::CallCallbackExc(SalEvent, void const*) const (this=0x1996820, nEvent=SalEvent::MouseButtonDown, pEvent=0x7fffffffc928) at vcl/unx/gtk3/gtk3gtkframe.cxx:4219
    > GtkSalFrame::signalButton(_GtkWidget*, _GdkEventButton*, void*) (pEvent=0x16403d0, frame=0x1996820) at vcl/unx/gtk3/gtk3gtkframe.cxx:2615
    > <emit signal ??? on instance ???> (instance=instance at entry=0x16f0e20, signal_id=<optimized out>, detail=detail at entry=0) at gsignal.c:3441
    > gtk_widget_event_internal (widget=0x16f0e20, event=0x16403d0) at gtkwidget.c:7731
    > propagate_event (topmost=<optimized out>, event=<optimized out>, widget=0x16f0e20) at gtkmain.c:2545
    > propagate_event (widget=<optimized out>, event=0x16403d0, captured=<optimized out>, topmost=0x0) at gtkmain.c:2647
    > gtk_main_do_event (event=0x16403d0) at gtkmain.c:1878
    > _gdk_event_emit (event=event at entry=0x16403d0) at gdkevents.c:73
    > gdk_event_source_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at gdkeventsource.c:367
    > g_main_context_dispatch (context=0x63a520) at gmain.c:3154
    > g_main_context_dispatch (context=context at entry=0x63a520) at gmain.c:3769
    > g_main_context_iterate (context=context at entry=0x63a520, block=block at entry=0, dispatch=dispatch at entry=1, self=<optimized out>) at gmain.c:3840
    > g_main_context_iteration (context=0x63a520, may_block=0) at gmain.c:3901
    > GtkData::Yield(bool, bool) (this=0x73e260, bWait=false, bHandleAllCurrentEvents=false) at vcl/unx/gtk3/gtk3gtkdata.cxx:479
    > GtkInstance::DoYield(bool, bool, unsigned long) (this=0x73e3c0, bWait=false, bHandleAllCurrentEvents=false, nReleased=0) at vcl/unx/gtk3/../gtk/gtkinst.cxx:423
    > ImplYield(bool, bool, unsigned long) (i_bWait=false, i_bAllEvents=false, nReleased=0) at vcl/source/app/svapp.cxx:504
    > Application::Yield() () at vcl/source/app/svapp.cxx:551
    > Application::Execute() () at vcl/source/app/svapp.cxx:468
    > desktop::Desktop::DoExecute() () at desktop/source/app/app.cxx:1367
    > desktop::Desktop::Main() (this=0x7fffffffe1e8) at desktop/source/app/app.cxx:1694
    > ImplSVMain() () at vcl/source/app/svmain.cxx:185
    > SVMain() () at vcl/source/app/svmain.cxx:223
    > soffice_main() () at desktop/source/app/sofficemain.cxx:165
    > sal_main () at desktop/source/app/main.c:48
    > main (argc=1, argv=0x7fffffffe528) at desktop/source/app/main.c:47
    
    because OCommonEmbeddedObject::getVisualAreaSize
    (embeddedobj/source/commonembedding/visobj.cxx, called from
    SwOleClient::ViewChanged, sw/source/uibase/uiview/swcli.cxx, ultimately
    returning the value 14098x9998 calculated in
    SdXImpressDocument::setPropertyValue, converted to twips) reports a size of
    7993x5668 twips instead.
    
    Change-Id: I8056b99b036970e308a89937b95c57996a8e7c79

diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index ca52ce5..f67ef59 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1262,7 +1262,7 @@ void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyNam
                 if( !(aValue >>= aVisArea) || (aVisArea.Width < 0) || (aVisArea.Height < 0) )
                     throw lang::IllegalArgumentException();
 
-                pEmbeddedObj->SetVisArea( Rectangle( aVisArea.X, aVisArea.Y, aVisArea.X + aVisArea.Width - 1, aVisArea.Y + aVisArea.Height - 1 ) );
+                pEmbeddedObj->SetVisArea( Rectangle( aVisArea.X, aVisArea.Y, aVisArea.X + aVisArea.Width, aVisArea.Y + aVisArea.Height ) );
             }
             break;
         case WID_MODEL_CONTFOCUS:


More information about the Libreoffice-commits mailing list