[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 3 commits - desktop/qa desktop/source include/LibreOfficeKit include/vcl libreofficekit/source sc/inc sc/source sd/qa sd/source sw/inc sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Nov 18 07:58:16 PST 2015
desktop/qa/desktop_lib/test_desktop_lib.cxx | 4 -
desktop/source/lib/init.cxx | 78 +++++++++++++------------
desktop/source/lib/lokandroid.cxx | 2
include/LibreOfficeKit/LibreOfficeKit.h | 3
include/LibreOfficeKit/LibreOfficeKit.hxx | 16 ++++-
include/vcl/ITiledRenderable.hxx | 2
libreofficekit/source/gtk/lokdocview.cxx | 2
sc/inc/docuno.hxx | 2
sc/source/ui/unoobj/docuno.cxx | 2
sd/qa/unit/tiledrendering/tiledrendering.cxx | 2
sd/source/ui/inc/unomodel.hxx | 2
sd/source/ui/unoidl/unomodel.cxx | 2
sw/inc/unotxdoc.hxx | 2
sw/qa/extras/tiledrendering/tiledrendering.cxx | 3
sw/source/uibase/uno/unotxdoc.cxx | 8 ++
15 files changed, 76 insertions(+), 54 deletions(-)
New commits:
commit 2c134214c3276faa60a8e49055e52ad304557600
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Nov 18 16:07:17 2015 +0100
sw: handle arguments in SwXTextDocument::initializeForTiledRendering()
Change-Id: I19efc6050c78162e0889437d4c8285d1a6714e82
(cherry picked from commit be28ab9aa535e36ea226bc5aeaedea95fd2ba3db)
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 3d2cff7..0604279 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3251,7 +3251,7 @@ OUString SwXTextDocument::getPartName(int nPart)
return OUString(SW_RES(STR_PAGE)) + OUString::number(nPart + 1);
}
-void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& /*rArguments*/)
+void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments)
{
SolarMutexGuard aGuard;
@@ -3273,6 +3273,12 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::
// Tiled rendering defaults.
SwViewOption aViewOption(*pViewShell->GetViewOptions());
aViewOption.SetHardBlank(false);
+ for (sal_Int32 i = 0; i < rArguments.getLength(); ++i)
+ {
+ const beans::PropertyValue& rValue = rArguments[i];
+ if (rValue.Name == ".uno:HideWhitespace" && rValue.Value.has<bool>())
+ aViewOption.SetHideWhitespaceMode(rValue.Value.get<bool>());
+ }
pViewShell->ApplyViewOptions(aViewOption);
// Disable map mode, so that it's possible to send mouse event coordinates
commit 511429242bea4fafd28c169d02b5e2851007a1db
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Nov 18 15:20:30 2015 +0100
vcl::ITiledRenderable::initializeForTiledRendering: support init. arguments
(cherry picked from commit 479325dec83ea2747f3ce27ca7e817695b15e1bb)
Conflicts:
sc/inc/docuno.hxx
sd/source/ui/inc/unomodel.hxx
sw/inc/unotxdoc.hxx
Change-Id: I9a6a75457078dc6383673f4c1a2012b69b5cefdd
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index dce9644..26a64d9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -991,7 +991,7 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
doc_iniUnoCommands();
uno::Sequence<beans::PropertyValue> aPropertyValues;
jsonToPropertyValues(pArguments, aPropertyValues);
- pDoc->initializeForTiledRendering();
+ pDoc->initializeForTiledRendering(aPropertyValues);
}
}
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 108e089..e31fd70 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -93,7 +93,7 @@ public:
* Setup various document properties that are needed for the document to
* be renderable via tiled rendering.
*/
- virtual void initializeForTiledRendering() = 0;
+ virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) = 0;
/**
* Registers a callback that will be invoked whenever the tiled renderer
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 32209b8..09fd69c 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -393,7 +393,7 @@ public:
virtual OUString getPartName(int nPart) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::initializeForTiledRendering().
- virtual void initializeForTiledRendering() SAL_OVERRIDE;
+ virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::registerCallback().
virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 2fc376c..1a41391 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -914,7 +914,7 @@ Pointer ScModelObj::getPointer()
return pGridWindow->GetPointer();
}
-void ScModelObj::initializeForTiledRendering()
+void ScModelObj::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& /*rArguments*/)
{
SolarMutexGuard aGuard;
pDocShell->GetDocument().GetDrawLayer()->setTiledRendering(true);
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 8a82295..8a8f926 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -126,7 +126,7 @@ SdXImpressDocument* SdTiledRenderingTest::createDoc(const char* pName)
mxComponent = loadFromDesktop(getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName), "com.sun.star.presentation.PresentationDocument");
SdXImpressDocument* pImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pImpressDocument);
- pImpressDocument->initializeForTiledRendering();
+ pImpressDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
return pImpressDocument;
}
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index e56549b..1fd9756 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -243,7 +243,7 @@ public:
virtual void setPartMode( int nPartMode ) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::initializeForTiledRendering().
- virtual void initializeForTiledRendering() SAL_OVERRIDE;
+ virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::registerCallback().
virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::postKeyEvent().
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 28ca118..d5e9490 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2370,7 +2370,7 @@ Size SdXImpressDocument::getDocumentSize()
return Size(convertMm100ToTwip(aSize.getWidth()), convertMm100ToTwip(aSize.getHeight()));
}
-void SdXImpressDocument::initializeForTiledRendering()
+void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& /*rArguments*/)
{
SolarMutexGuard aGuard;
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 63695f0..37cadfd 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -417,7 +417,7 @@ public:
/// @see vcl::ITiledRenderable::getPartName().
virtual OUString getPartName(int nPart) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::initializeForTiledRendering().
- virtual void initializeForTiledRendering() SAL_OVERRIDE;
+ virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::registerCallback().
virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE;
/// @see vcl::ITiledRenderable::postKeyEvent().
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index fe441fd..4901653 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -93,7 +93,7 @@ SwXTextDocument* SwTiledRenderingTest::createDoc(const char* pName)
SwXTextDocument* pTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pTextDocument);
- pTextDocument->initializeForTiledRendering();
+ pTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
return pTextDocument;
}
@@ -429,7 +429,6 @@ void SwTiledRenderingTest::testDocumentSizeChanged()
SwXTextDocument* pXTextDocument = createDoc("2-pages.odt");
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
- pXTextDocument->initializeForTiledRendering();
Size aSize = pXTextDocument->getDocumentSize();
// Delete the second page and see how the size changes.
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 750fd20..3d2cff7 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3251,7 +3251,7 @@ OUString SwXTextDocument::getPartName(int nPart)
return OUString(SW_RES(STR_PAGE)) + OUString::number(nPart + 1);
}
-void SwXTextDocument::initializeForTiledRendering()
+void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& /*rArguments*/)
{
SolarMutexGuard aGuard;
commit b95434954822dfa8a42cf96a647985c3f491896f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Nov 18 14:59:51 2015 +0100
lok::Document::initializeForRendering: support init. arguments
(cherry picked from commit 4bddfc00d25a42917db79ceaf0547c2e792132c4)
Conflicts:
libreofficekit/source/gtk/lokdocview.cxx
Change-Id: I8aaf19a50f25f495cb87fba7ff6a4b0f56ed7d80
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index e289be8..fa432de 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -287,7 +287,7 @@ void DesktopLOKTest::testSearchCalc()
LibLibreOffice_Impl aOffice;
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("search.ods");
- pDocument->pClass->initializeForRendering(pDocument);
+ pDocument->pClass->initializeForRendering(pDocument, nullptr);
pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
@@ -410,7 +410,7 @@ void DesktopLOKTest::testRowColumnHeaders()
*/
LibLODocument_Impl* pDocument = loadDoc("search.ods");
- pDocument->pClass->initializeForRendering(pDocument);
+ pDocument->pClass->initializeForRendering(pDocument, nullptr);
boost::property_tree::ptree aTree;
char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders");
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f62fcde..dce9644 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -270,6 +270,40 @@ static OUString getAbsoluteURL(const char* pURL)
return OUString();
}
+static void jsonToPropertyValues(const char* pJSON, uno::Sequence<beans::PropertyValue>& rPropertyValues)
+{
+ std::vector<beans::PropertyValue> aArguments;
+ if (pJSON)
+ {
+ boost::property_tree::ptree aTree;
+ std::stringstream aStream(pJSON);
+ boost::property_tree::read_json(aStream, aTree);
+
+ for (const std::pair<std::string, boost::property_tree::ptree>& rPair : aTree)
+ {
+ const std::string& rType = rPair.second.get<std::string>("type");
+ const std::string& rValue = rPair.second.get<std::string>("value");
+
+ beans::PropertyValue aValue;
+ aValue.Name = OUString::fromUtf8(rPair.first.c_str());
+ if (rType == "string")
+ aValue.Value <<= OUString::fromUtf8(rValue.c_str());
+ else if (rType == "boolean")
+ aValue.Value <<= OString(rValue.c_str()).toBoolean();
+ else if (rType == "float")
+ aValue.Value <<= OString(rValue.c_str()).toFloat();
+ else if (rType == "long")
+ aValue.Value <<= OString(rValue.c_str()).toInt32();
+ else if (rType == "unsigned short")
+ aValue.Value <<= static_cast<sal_uInt16>(OString(rValue.c_str()).toUInt32());
+ else
+ SAL_WARN("desktop.lib", "jsonToPropertyValues: unhandled type '"<<rType<<"'");
+ aArguments.push_back(aValue);
+ }
+ }
+ rPropertyValues = comphelper::containerToSequence(aArguments);
+}
+
extern "C"
{
@@ -290,7 +324,8 @@ void doc_paintTile(LibreOfficeKitDocument* pThis,
static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
long* pWidth,
long* pHeight);
-static void doc_initializeForRendering(LibreOfficeKitDocument* pThis);
+static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
+ const char* pArguments);
static void doc_registerCallback(LibreOfficeKitDocument* pThis,
LibreOfficeKitCallback pCallback,
@@ -947,12 +982,15 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
}
}
-static void doc_initializeForRendering(LibreOfficeKitDocument* pThis)
+static void doc_initializeForRendering(LibreOfficeKitDocument* pThis,
+ const char* pArguments)
{
ITiledRenderable* pDoc = getTiledRenderable(pThis);
if (pDoc)
{
doc_iniUnoCommands();
+ uno::Sequence<beans::PropertyValue> aPropertyValues;
+ jsonToPropertyValues(pArguments, aPropertyValues);
pDoc->initializeForTiledRendering();
}
}
@@ -996,40 +1034,6 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar
pDoc->postKeyEvent(nType, nCharCode, nKeyCode);
}
-static void jsonToPropertyValues(const char* pJSON, uno::Sequence<beans::PropertyValue>& rPropertyValues)
-{
- std::vector<beans::PropertyValue> aArguments;
- if (pJSON)
- {
- boost::property_tree::ptree aTree;
- std::stringstream aStream(pJSON);
- boost::property_tree::read_json(aStream, aTree);
-
- for (const std::pair<std::string, boost::property_tree::ptree>& rPair : aTree)
- {
- const std::string& rType = rPair.second.get<std::string>("type");
- const std::string& rValue = rPair.second.get<std::string>("value");
-
- beans::PropertyValue aValue;
- aValue.Name = OUString::fromUtf8(rPair.first.c_str());
- if (rType == "string")
- aValue.Value <<= OUString::fromUtf8(rValue.c_str());
- else if (rType == "boolean")
- aValue.Value <<= OString(rValue.c_str()).toBoolean();
- else if (rType == "float")
- aValue.Value <<= OString(rValue.c_str()).toFloat();
- else if (rType == "long")
- aValue.Value <<= OString(rValue.c_str()).toInt32();
- else if (rType == "unsigned short")
- aValue.Value <<= static_cast<sal_uInt16>(OString(rValue.c_str()).toUInt32());
- else
- SAL_WARN("desktop.lib", "jsonToPropertyValues: unhandled type '"<<rType<<"'");
- aArguments.push_back(aValue);
- }
- }
- rPropertyValues = comphelper::containerToSequence(aArguments);
-}
-
/** Class to react on finishing of a dispatched command.
This will call a LOK_COMMAND_FINISHED callback when postUnoCommand was
diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx
index 0c360d3..9f15796 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -256,7 +256,7 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_initial
(JNIEnv* pEnv, jobject aObject)
{
LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
- pDocument->pClass->initializeForRendering(pDocument);
+ pDocument->pClass->initializeForRendering(pDocument, NULL);
}
extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 0321037..93f7dca 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -124,7 +124,8 @@ struct _LibreOfficeKitDocumentClass
long* pHeight);
/// @see lok::Document::initializeForRendering().
- void (*initializeForRendering) (LibreOfficeKitDocument* pThis);
+ void (*initializeForRendering) (LibreOfficeKitDocument* pThis,
+ const char* pArguments);
/// @see lok::Document::registerCallback().
void (*registerCallback) (LibreOfficeKitDocument* pThis,
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 93e8772..0eeb5be 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -153,10 +153,22 @@ public:
* needed to render the document correctly using tiled rendering. This
* method has to be called right after documentLoad() in case any of the
* tiled rendering methods are to be used later.
+ *
+ * Example argument string for text documents:
+ *
+ * {
+ * ".uno:HideWhitespace":
+ * {
+ * "type": "boolean",
+ * "value": "true"
+ * }
+ * }
+ *
+ * @param pArguments arguments of the rendering
*/
- inline void initializeForRendering()
+ inline void initializeForRendering(const char* pArguments = NULL)
{
- mpDoc->pClass->initializeForRendering(mpDoc);
+ mpDoc->pClass->initializeForRendering(mpDoc, pArguments);
}
/**
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 0489d75..bdf3a19 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -1240,7 +1240,7 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c
}
else
{
- pDocView->m_pImpl->m_pDocument->pClass->initializeForRendering(pDocView->m_pImpl->m_pDocument);
+ pDocView->m_pImpl->m_pDocument->pClass->initializeForRendering(pDocView->m_pImpl->m_pDocument, 0);
pDocView->m_pImpl->m_pDocument->pClass->registerCallback(pDocView->m_pImpl->m_pDocument, &LOKDocView_Impl::callbackWorker, pDocView);
pDocView->m_pImpl->m_pDocument->pClass->getDocumentSize(pDocView->m_pImpl->m_pDocument, &pDocView->m_pImpl->m_nDocumentWidthTwips, &pDocView->m_pImpl->m_nDocumentHeightTwips);
g_timeout_add(600, &LOKDocView_Impl::handleTimeout, pDocView);
More information about the Libreoffice-commits
mailing list