[Libreoffice-commits] core.git: 4 commits - libreofficekit/qa sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Nov 10 05:11:12 PST 2015


 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |    4 ++
 sw/inc/docufld.hxx                                  |    1 
 sw/inc/fldbas.hxx                                   |    1 
 sw/inc/fmtfld.hxx                                   |    1 
 sw/source/core/fields/docufld.cxx                   |   15 ++++++++++
 sw/source/core/fields/fldbas.cxx                    |   29 +++++++-------------
 sw/source/core/txtnode/atrfld.cxx                   |   17 +++++++++++
 sw/source/uibase/docvw/PostItMgr.cxx                |   11 ++++++-
 sw/source/uibase/docvw/SidebarTxtControl.cxx        |   11 +++++++
 9 files changed, 69 insertions(+), 21 deletions(-)

New commits:
commit 6c3dbdbccbcccf914360dac1167599c5b89446a8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 10 14:08:26 2015 +0100

    sw lok: fix width of the notes sidebar
    
    The map mode is in general disabled during tiled rendering, so mouse
    positions can be sent in using twips, but here we have to temporarily
    enable it, otherwise the width will be returned always in pixels.
    
    With this, the gray background of the sidebar has the proper width, not
    e.g. fifteenth of the expected value (using default zoom).
    
    Change-Id: I4380ee0ba6bcda97cf71735161dbdc826e7a2532

diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 08bb106..1abe5c4 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -74,6 +74,7 @@
 
 #include <i18nlangtag/mslangid.hxx>
 #include <i18nlangtag/lang.h>
+#include <comphelper/lok.hxx>
 
 #include "annotsh.hxx"
 #include "swabstdlg.hxx"
@@ -1813,7 +1814,15 @@ unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const
     if (bPx)
         return aWidth;
     else
-        return mpEditWin->PixelToLogic(Size( aWidth ,0)).Width();
+    {
+        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;
+    }
 }
 
 unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const
commit b3b9f2c5b4dde4c5ea9736f8ceda4cdb98036b0b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 10 11:42:36 2015 +0100

    sw: allow doc model xml dump creation while editing comment text
    
    Change-Id: Ie682cfe97b8c48bc66575b89875ca617dbb8ab4e

diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 4ab884b..4b1c274 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -20,6 +20,8 @@
 #include <SidebarTxtControl.hxx>
 
 #include <SidebarTxtControlAcc.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
 
 #include <SidebarWin.hxx>
 #include <PostItMgr.hxx>
@@ -187,6 +189,15 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang
 
 void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt )
 {
+    if (getenv("SW_DEBUG") && rKeyEvt.GetKeyCode().GetCode() == KEY_F12)
+    {
+        if (rKeyEvt.GetKeyCode().IsShift())
+        {
+            mrDocView.GetDocShell()->GetDoc()->dumpAsXml();
+            return;
+        }
+    }
+
     const vcl::KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
     sal_uInt16 nKey = rKeyCode.GetCode();
     if ( ( rKeyCode.IsMod1() && rKeyCode.IsMod2() ) &&
commit 9b504ad3ae9f71ea02df2ab6f2c2fbd59d38ae9a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 10 11:33:03 2015 +0100

    sw doc model xml dump: show comment text
    
    Change-Id: If15ca89f2b7c54441f076eb233c4e1414dac25c0

diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 34b083e..2e8c915 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -487,6 +487,7 @@ public:
     virtual bool        QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const override;
     virtual bool        PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ) override;
     virtual OUString    GetDescription() const override;
+    virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
 };
 
 class SwDocInfoFieldType : public SwValueFieldType
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 603e758..6a49b5e 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -360,6 +360,7 @@ public:
     virtual OUString    GetDescription() const;
     /// Is this field clickable?
     bool IsClickable() const;
+    virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
 };
 
 inline SwFieldType* SwField::GetTyp() const
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 0f83415..4aba5ee 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -112,6 +112,7 @@ public:
             { return m_wXTextField; }
     SAL_DLLPRIVATE void SetXTextField(css::uno::Reference<css::text::XTextField> const& xTextField)
             { m_wXTextField = xTextField; }
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
 };
 
 enum class SwFormatFieldHintWhich
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 8227ccb..29b646c 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1833,6 +1833,21 @@ bool SwPostItField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId )
     return true;
 }
 
+void SwPostItField::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("swPostItField"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr()));
+
+    SwField::dumpAsXml(pWriter);
+
+    xmlTextWriterStartElement(pWriter, BAD_CAST("mpText"));
+    OutlinerParaObject aParaObject(*mpText);
+    aParaObject.dumpAsXml(pWriter);
+    xmlTextWriterEndElement(pWriter);
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 // extended user information field type
 
 SwExtUserFieldType::SwExtUserFieldType()
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 28a3034..f0608d2 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -162,24 +162,8 @@ void SwFieldTypes::dumpAsXml(xmlTextWriterPtr pWriter) const
     {
         const SwFieldType *pCurType = (*this)[nType];
         SwIterator<SwFormatField, SwFieldType> aIter(*pCurType);
-        for (const SwFormatField* pCurFieldFormat = aIter.First(); pCurFieldFormat; pCurFieldFormat = aIter.Next())
-        {
-            xmlTextWriterStartElement(pWriter, BAD_CAST("swFormatField"));
-            xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", pCurFieldFormat);
-            xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("txtField"), "%p", pCurFieldFormat->GetTextField());
-
-            xmlTextWriterStartElement(pWriter, BAD_CAST("swField"));
-            xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(*pCurFieldFormat->GetField()).name()));
-            xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", pCurFieldFormat->GetField());
-            if (pCurFieldFormat->GetField()->GetTyp()->Which() == RES_POSTITFLD)
-            {
-                const SwPostItField* pField = static_cast<const SwPostItField*>(pCurFieldFormat->GetField());
-                xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(pField->GetName().toUtf8().getStr()));
-            }
-            xmlTextWriterEndElement(pWriter);
-
-            xmlTextWriterEndElement(pWriter);
-        }
+        for (const SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next())
+            pFormatField->dumpAsXml(pWriter);
     }
     xmlTextWriterEndElement(pWriter);
 }
@@ -774,4 +758,13 @@ bool SwField::IsClickable() const
     return false;
 }
 
+void SwField::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("swField"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(*this).name()));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 43f1291..89649a0 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -17,8 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "fldbas.hxx"
 #include <fmtfld.hxx>
+
+#include <libxml/xmlwriter.h>
+
+#include "fldbas.hxx"
 #include <txtfld.hxx>
 #include <txtannotationfld.hxx>
 #include <docfld.hxx>
@@ -329,6 +332,18 @@ bool SwFormatField::IsProtect() const
            && mpTextField->GetpTextNode()->IsProtect();
 }
 
+void SwFormatField::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("swFormatField"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("mpTextField"), "%p", mpTextField);
+
+    SfxPoolItem::dumpAsXml(pWriter);
+    GetField()->dumpAsXml(pWriter);
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 // class SwTextField ////////////////////////////////////////////////////
 
 SwTextField::SwTextField(
commit 7a87e9718ce8b455c0780ef7606b1c219bf228b5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Nov 10 09:59:36 2015 +0100

    gtktiledviewer: don't hide cursor after doc size changed
    
    Unconditional call to lok_doc_view_reset_view() resulted in hiding the
    cursor, but then nothing enabled it. As a result, the cursor got hidden
    after the doc size changed.
    
    Change-Id: I06e7c9293e7a4cdbc73421a82430816ab0001f90

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index cface1b..5935b35 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -828,8 +828,10 @@ static void changePart( GtkWidget* pSelector, gpointer /* pItem */ )
     TiledWindow& rWindow = lcl_getTiledWindow(pSelector);
 
     if (rWindow.m_bPartSelectorBroadcast && rWindow.m_pDocView)
+    {
         lok_doc_view_set_part( LOK_DOC_VIEW(rWindow.m_pDocView), nPart );
-    lok_doc_view_reset_view(LOK_DOC_VIEW(rWindow.m_pDocView));
+        lok_doc_view_reset_view(LOK_DOC_VIEW(rWindow.m_pDocView));
+    }
 }
 
 static void removeChildrenFromStatusbar(GtkWidget* children, gpointer pData)


More information about the Libreoffice-commits mailing list