[Libreoffice-commits] core.git: desktop/qa desktop/source sfx2/source

2019-07-30 Thread Ashod Nakashian (via logerrit)
 desktop/qa/desktop_lib/test_desktop_lib.cxx |4 
 desktop/source/lib/init.cxx |   16 
 sfx2/source/sidebar/SidebarChildWindow.cxx  |   10 +++---
 3 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit 70d3bbe11e56f12a339a5b8759b53a96b4fe84ab
Author: Ashod Nakashian 
AuthorDate: Thu May 2 23:16:30 2019 -0400
Commit: Noel Grandin 
CommitDate: Tue Jul 30 18:52:48 2019 +0200

sfx2: Enable sidebar on calc and writer, but not in impress

Added by Noel to this commit:
And add a special deregister mode to doc_registerCallback
so we can unregister stack-based callback objects in the
presence of multiple views.

Reviewed-on: https://gerrit.libreoffice.org/71715
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 
(cherry picked from commit fba6d4267b3f827269d6550dcb003cc56b31e493)

Change-Id: I8d846bc1f794cf16fd45486fd83ef87f43fd52c7
Reviewed-on: https://gerrit.libreoffice.org/76555
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index e0647da2f6af..112f29f4c59e 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1939,6 +1939,7 @@ void DesktopLOKTest::testWriterCommentInsertCursor()
 CPPUNIT_ASSERT(aView1.m_aOwnCursor.IsEmpty());
 
 Scheduler::ProcessEventsToIdle();
+pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, 
reinterpret_cast(1));
 }
 
 #if HAVE_MORE_FONTS
@@ -2210,6 +2211,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter()
 CPPUNIT_ASSERT(!aStream.str().empty());
 boost::property_tree::read_json(aStream, aTree);
 CPPUNIT_ASSERT_EQUAL(static_cast(5), 
aTree.get_child("comments").size());
+
+pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, 
reinterpret_cast(1));
 }
 
 void DesktopLOKTest::testRunMacro()
@@ -2629,6 +2632,7 @@ void DesktopLOKTest::testShowHideDialog()
 Scheduler::ProcessEventsToIdle();
 
 CPPUNIT_ASSERT_EQUAL(std::string("invalidate"), 
aView.m_aCallbackWindowResult.get("action"));
+pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, 
reinterpret_cast(1));
 }
 
 namespace {
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f8d93534f44a..89078209ef43 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2828,6 +2828,22 @@ static void doc_registerCallback(LibreOfficeKitDocument* 
pThis,
 
 LibLODocument_Impl* pDocument = static_cast(pThis);
 
+// This is used by unit-tests to unregister stack-local callback objects 
where we have multiple views
+// so we cannot rely on SfxLokHelper::getView
+if (pCallback == nullptr && pData != nullptr)
+{
+for (auto& pair1 : pDocument->mpCallbackFlushHandlers)
+{
+int nView = pair1.first;
+for (auto& pair2 : pDocument->mpCallbackFlushHandlers)
+{
+pair2.second->removeViewStates(nView);
+}
+pDocument->mpCallbackFlushHandlers[nView].reset(new 
CallbackFlushHandler(pThis, nullptr, nullptr));
+}
+return;
+}
+
 int nView = SfxLokHelper::getView();
 if (nView < 0)
 return;
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx 
b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 678c5538aa0b..b958d840dd3b 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -33,7 +33,7 @@ SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, 
SID_SIDEBAR);
 SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 
nId,
SfxBindings* pBindings, 
SfxChildWinInfo* pInfo)
 : SfxChildWindow(pParentWindow, nId)
-, mbSidebarVisibleInLOK(pInfo && pInfo->aModule == "simpress")
+, mbSidebarVisibleInLOK(pInfo && (pInfo->aModule == "scalc" || 
pInfo->aModule == "swriter"))
 {
 auto pDockWin = VclPtr::Create(
 pBindings, *this, pParentWindow, WB_STDDOCKWIN | 
WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN
@@ -53,8 +53,12 @@ SidebarChildWindow::SidebarChildWindow(vcl::Window* 
pParentWindow, sal_uInt16 nI
 // HACK: unfortunately I haven't found a clean solution to do
 // this, so do it this way:
 //
-pDockWin->SetSizePixel(Size(TabBar::GetDefaultWidth() * 
GetWindow()->GetDPIScaleFactor(),
-pDockWin->GetSizePixel().Height()));
+if (!comphelper::LibreOfficeKit::isActive())
+{
+pDockWin->SetSizePixel(
+Size(TabBar::GetDefaultWidth() * 
GetWindow()->GetDPIScaleFactor(),
+ pDockWin->GetSizePixel().Height()));
+}
 }
 
 pDockWin->Initialize(pInfo);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.fr

[Libreoffice-commits] core.git: desktop/qa desktop/source sfx2/source sw/qa sw/source

2018-01-18 Thread Henry Castro
 desktop/qa/desktop_lib/test_desktop_lib.cxx|1 
 desktop/source/lib/init.cxx|   29 +++
 sfx2/source/control/unoctitm.cxx   |   25 ++--
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   27 +-
 sw/source/uibase/shells/textsh1.cxx|   37 +++--
 5 files changed, 101 insertions(+), 18 deletions(-)

New commits:
commit 252ce90e39648c47bcfdb39547d0ac82bacdbae6
Author: Henry Castro 
Date:   Tue Jan 9 22:17:23 2018 -0400

sw lokit: add page syles to header & footer

Change-Id: I3c0b0603d1e03f1cc19af4324dd2b909320d9d4a
Reviewed-on: https://gerrit.libreoffice.org/47687
Tested-by: Jenkins 
Reviewed-by: Henry Castro 

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index d5d7cb26f18b..4488aa8c155c 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -309,6 +309,7 @@ void DesktopLOKTest::testGetStyles()
 rPair.first != "CellStyles" &&
 rPair.first != "ShapeStyles" &&
 rPair.first != "TableStyles" &&
+rPair.first != "HeaderFooter" &&
 rPair.first != "Commands")
 {
 CPPUNIT_FAIL("Unknown style family: " + rPair.first);
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4c0b96b85951..126861d7877a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2769,6 +2769,35 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren);
 }
 
+// Header & Footer Styles
+{
+OUString sName;
+bool bIsPhysical;
+boost::property_tree::ptree aChild;
+uno::Reference xProperty;
+boost::property_tree::ptree aChildren;
+uno::Reference xContainer;
+
+if (xStyleFamilies->getByName("PageStyles") >>= xContainer)
+{
+uno::Sequence aSeqNames = xContainer->getElementNames();
+for (sal_Int32 itName = 0; itName < aSeqNames.getLength(); 
itName++)
+{
+sName = aSeqNames[itName];
+xProperty.set(xContainer->getByName(sName), uno::UNO_QUERY);
+if (xProperty.is() && 
(xProperty->getPropertyValue("IsPhysical") >>= bIsPhysical) && bIsPhysical)
+{
+xProperty->getPropertyValue("DisplayName") >>= sName;
+aChild.put("", sName.toUtf8());
+aChildren.push_back(std::make_pair("", aChild));
+}
+else
+bIsPhysical = false;
+}
+aValues.add_child("HeaderFooter", aChildren);
+}
+}
+
 {
 boost::property_tree::ptree aCommandList;
 
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 63df319437a5..2193914465f2 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -1019,9 +1019,7 @@ static void InterceptLOKStateChangeEvent(const 
SfxViewFrame* pViewFrame, const c
 aEvent.FeatureURL.Path == "AlignLeft" ||
 aEvent.FeatureURL.Path == "AlignHorizontalCenter" ||
 aEvent.FeatureURL.Path == "AlignRight" ||
-aEvent.FeatureURL.Path == "DocumentRepair" ||
-aEvent.FeatureURL.Path == "InsertPageHeader" ||
-aEvent.FeatureURL.Path == "InsertPageFooter")
+aEvent.FeatureURL.Path == "DocumentRepair")
 {
 bool bTemp = false;
 aEvent.State >>= bTemp;
@@ -1197,6 +1195,27 @@ static void InterceptLOKStateChangeEvent(const 
SfxViewFrame* pViewFrame, const c
 }
 }
 }
+else if (aEvent.FeatureURL.Path == "InsertPageHeader" ||
+ aEvent.FeatureURL.Path == "InsertPageFooter")
+{
+if (aEvent.IsEnabled)
+{
+css::uno::Sequence< OUString > aSeq;
+if (aEvent.State >>= aSeq)
+{
+aBuffer.append(u'{');
+for (sal_Int32 itSeq = 0; itSeq < aSeq.getLength(); itSeq++)
+{
+aBuffer.append("\"" + aSeq[itSeq]);
+if (itSeq != aSeq.getLength() - 1)
+aBuffer.append("\":true,");
+else
+aBuffer.append("\":true");
+}
+aBuffer.append(u'}');
+}
+}
+}
 else
 {
 return;
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 3dd1335e50f9..3a9c1c6f9985 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1944,11 +1945,19 @@ namespace {
 
 void checkPageHeaderOrFooter(c