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

2023-06-19 Thread Tomaž Vajngerl (via logerrit)
 sd/qa/unit/uiimpress.cxx |5 -
 sd/source/ui/func/fuconstr.cxx   |   36 

 sw/qa/extras/ooxmlexport/data/Test_ThemeTextParaBackgroundColor.docx |binary
 sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx   |   43 
++
 4 files changed, 46 insertions(+), 38 deletions(-)

New commits:
commit 2afff27c5327bcb30f894d9a507131f2ad8f1dc6
Author: Tomaž Vajngerl 
AuthorDate: Mon Jun 19 15:28:40 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Jun 19 13:36:37 2023 +0200

tdf#155086 remove code that sets theme color to shapes as DF

Remove this functionallity for now until we support theme colors
in shape styles. Then we can do it for the default style, and not
as a direct format for each inserted shape.

Change-Id: Ib042072954a79cadc750372333c40269fbe4ca40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153244
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index e3a9c86e91d1..c4cdc0a5e338 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -1144,7 +1144,8 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127696)
 CPPUNIT_ASSERT(bContoured);
 }
 
-CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testThemeShapeInsert)
+// TODO - Readd when we implement style level fill color and set that for 
default style
+/*CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testThemeShapeInsert)
 {
 // Given a document with a theme, accent1 color is set to 0x04:
 createSdImpressDoc();
@@ -1188,7 +1189,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, 
testThemeShapeInsert)
 // - Expected: 0 / 0x04 (~black)
 // - Actual  : 7512015 / 0x729fcf (~blue)
 CPPUNIT_ASSERT_EQUAL(static_cast(0x4), nFillColor);
-}
+}*/
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sd/source/ui/func/fuconstr.cxx b/sd/source/ui/func/fuconstr.cxx
index 4db1f4042dc9..fd93a3ce7c94 100644
--- a/sd/source/ui/func/fuconstr.cxx
+++ b/sd/source/ui/func/fuconstr.cxx
@@ -371,42 +371,6 @@ void FuConstruct::SetStyleSheet( SfxItemSet& rAttr, 
SdrObject* pObj,
 pObj->SetMergedItemSet(aAttr);
 }
 }
-else
-{
-// Creating an object with fill.
-SdrPage* pThemePage = pPage;
-if (pThemePage->TRG_HasMasterPage())
-{
-pThemePage = >TRG_GetMasterPage();
-}
-
-auto const& pTheme = pThemePage->getSdrPageProperties().GetTheme();
-if (pTheme)
-{
-// We construct an object on a page where the master page has 
a theme. Take the
-// accent1 color from that theme, make sure it has priority 
over the shape's
-// document-global style.
-SfxItemSet aAttr(mpView->GetDefaultAttr());
-
-aAttr.Put(XFillStyleItem(css::drawing::FillStyle_SOLID));
-
-model::ThemeColorType eColorType = 
model::ThemeColorType::Accent1;
-Color aColor = pTheme->GetColor(eColorType);
-XFillColorItem aFillColorItem("", aColor);
-aFillColorItem.getComplexColor().setSchemeColor(eColorType);
-aAttr.Put(aFillColorItem);
-
-aAttr.Put(XLineStyleItem(css::drawing::LineStyle_SOLID));
-
-// Line color is 50% darker than the fill color.
-aColor.ApplyTintOrShade(-5000);
-XLineColorItem aLineColorItem("", aColor);
-// TODO no theme or theme effect for line colors yet.
-aAttr.Put(aLineColorItem);
-
-pObj->SetMergedItemSet(aAttr);
-}
-}
 }
 }
 
commit 703c28d76924bcbda3f492de8a14cc9c30ee1dfb
Author: Tomaž Vajngerl 
AuthorDate: Mon Jun 19 15:48:56 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Jun 19 13:36:28 2023 +0200

sw: Test paragraph level text background

Change-Id: Icea365ae036cae49749dd24bb8412775fafbd6c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153247
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git 
a/sw/qa/extras/ooxmlexport/data/Test_ThemeTextParaBackgroundColor.docx 
b/sw/qa/extras/ooxmlexport/data/Test_ThemeTextParaBackgroundColor.docx
new file mode 100644
index ..5b012f01333b
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/Test_ThemeTextParaBackgroundColor.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx 
b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx
index f9e7155859ea..45bd8014f1d3 100644
--- a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx
@@ -97,6 +97,49 @@ DECLARE_SW_ROUNDTRIP_TEST(testCharUnderlineTheme_DOCX, 
"Test_CharUnderlineThemeC
 CPPUNIT_ASSERT_EQUAL(sal_Int16(2509), rTransforms[0].mnValue);
 }
 

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

2020-06-03 Thread Tomaž Vajngerl (via logerrit)
 sd/qa/unit/tiledrendering/LOKitSearchTest.cxx |   12 +++---
 sd/source/ui/view/Outliner.cxx|   45 +-
 2 files changed, 29 insertions(+), 28 deletions(-)

New commits:
commit f36fec9bd296e2aa0a5463f849808bb85e746d2e
Author: Tomaž Vajngerl 
AuthorDate: Sun May 31 10:05:17 2020 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 4 00:42:55 2020 +0200

sd: rename testSearchInMixedObject(2) to more descriptive name

testSearchInMixedObject -> testSearchIn2MixedObjects
testSearchInMixedObject2 -> testSearchIn6MixedObjects

Change-Id: Ifba20df38fd33bb86b072ba79085d123c914f916
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95457
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx 
b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index 7786bc1f1dae..ec9f7d95c5da 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -55,8 +55,8 @@ public:
 void testDontSearchInMasterPages();
 void testSearchInPDFNonExisting();
 void testSearchInPDF();
-void testSearchInMixedObject();
-void testSearchInMixedObject2();
+void testSearchIn2MixedObjects();
+void testSearchIn6MixedObjects();
 
 CPPUNIT_TEST_SUITE(LOKitSearchTest);
 CPPUNIT_TEST(testSearch);
@@ -67,8 +67,8 @@ public:
 CPPUNIT_TEST(testDontSearchInMasterPages);
 CPPUNIT_TEST(testSearchInPDFNonExisting);
 CPPUNIT_TEST(testSearchInPDF);
-CPPUNIT_TEST(testSearchInMixedObject);
-CPPUNIT_TEST(testSearchInMixedObject2);
+CPPUNIT_TEST(testSearchIn2MixedObjects);
+CPPUNIT_TEST(testSearchIn6MixedObjects);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -332,7 +332,7 @@ void LOKitSearchTest::testSearchInPDF()
 
 // Test searching in document with mixed objects.
 // We have 2 objects: 1. Text Object, 2. Graphic Object with PDF
-void LOKitSearchTest::testSearchInMixedObject()
+void LOKitSearchTest::testSearchIn2MixedObjects()
 {
 SdXImpressDocument* pXImpressDocument = createDoc("MixedTest1.odg");
 sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
@@ -417,7 +417,7 @@ void LOKitSearchTest::testSearchInMixedObject()
 }
 
 // Test searching in document with mixed objects. We have 6 objects.
-void LOKitSearchTest::testSearchInMixedObject2()
+void LOKitSearchTest::testSearchIn6MixedObjects()
 {
 SdXImpressDocument* pXImpressDocument = createDoc("MixedTest2.odg");
 sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
commit f60caab2c867a578b6e6b963ebd5a72b5a12463e
Author: Tomaž Vajngerl 
AuthorDate: Sun May 31 09:58:26 2020 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 4 00:42:39 2020 +0200

sd: PDF search - reset mpVectorGraphicSearch at more places

and simplify the case when the search doesn't find a match in
the vector graphic.

Change-Id: I3e086e8e36f8a578711eed6d4dcca65c0c4c6268
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95456
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 52326f0dfbf8..44ecd9182e6b 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1159,6 +1159,7 @@ void SdOutliner::ProvideNextTextObject()
 mbFoundObject = false;
 
 // reset the vector search
+mpImpl->mbCurrentIsVectorGraphic = false;
 mpImpl->mpVectorGraphicSearch.reset();
 
 mpView->UnmarkAllObj (mpView->GetSdrPageView());
@@ -1194,6 +1195,7 @@ void SdOutliner::ProvideNextTextObject()
 bool bForbiddenPage = comphelper::LibreOfficeKit::isActive() && 
(maCurrentPosition.mePageKind != PageKind::Standard || 
maCurrentPosition.meEditMode != EditMode::Page);
 
 mpImpl->mbCurrentIsVectorGraphic = false;
+mpImpl->mpVectorGraphicSearch.reset();
 
 if (!bForbiddenPage)
 {
@@ -1227,34 +1229,30 @@ void SdOutliner::ProvideNextTextObject()
 OUString const & rString = mpSearchItem->GetSearchString();
 
 mpImpl->mpVectorGraphicSearch = 
std::make_unique(pGraphicObject->GetGraphic());
-if (mpImpl->mpVectorGraphicSearch->search(rString))
+
+bool bResult = 
mpImpl->mpVectorGraphicSearch->search(rString);
+if (bResult)
+bResult = mpImpl->mpVectorGraphicSearch->next();
+
+if (bResult)
 {
-bool bResult = mpImpl->mpVectorGraphicSearch->next();
-if (bResult)
-{
-mpObj = SetObject(maCurrentPosition);
+mpObj = SetObject(maCurrentPosition);
 
-mbStringFound = true;
-mbMatchMayExist = true;
-

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

2018-05-23 Thread Tomaž Vajngerl
 sd/qa/unit/data/odp/BulletsAsImage.odp |binary
 sd/qa/unit/export-tests.cxx|   54 +++--
 sd/source/filter/eppt/pptx-text.cxx|6 +++
 3 files changed, 57 insertions(+), 3 deletions(-)

New commits:
commit 82975bbc1a6acee97e3a90756909e424af03bc37
Author: Tomaž Vajngerl 
Date:   Wed May 23 18:24:19 2018 +0900

sd: extend bitmap bullet tests

Change-Id: I169f7306f3af2c283b1c928230eaf6566b1a6660
Reviewed-on: https://gerrit.libreoffice.org/54696
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sd/qa/unit/data/odp/BulletsAsImage.odp 
b/sd/qa/unit/data/odp/BulletsAsImage.odp
index 21d10e494829..7094d34af949 100644
Binary files a/sd/qa/unit/data/odp/BulletsAsImage.odp and 
b/sd/qa/unit/data/odp/BulletsAsImage.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index c6dd4a70741f..165d212fd956 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -944,14 +944,64 @@ void SdExportTest::testBulletsAsImage()
 uno::Reference 
xLevels(xPropSet->getPropertyValue("NumberingRules"), uno::UNO_QUERY_THROW);
 uno::Sequence aProperties;
 xLevels->getByIndex(0) >>= aProperties; // 1st level
+
 uno::Reference xBitmap;
-for (const beans::PropertyValue& rProperty : aProperties)
+awt::Size aSize;
+sal_Int16 nNumberingType = -1;
+
+for (beans::PropertyValue const & rProperty : aProperties)
 {
-if (rProperty.Name == "GraphicBitmap")
+if (rProperty.Name == "NumberingType")
+{
+nNumberingType = rProperty.Value.get();
+}
+else if (rProperty.Name == "GraphicBitmap")
+{
 xBitmap = rProperty.Value.get();
+}
+else if (rProperty.Name == "GraphicSize")
+{
+aSize = rProperty.Value.get();
+}
 }
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 
style::NumberingType::BITMAP, nNumberingType);
+
+// Graphic Bitmap
 const OString sFailed = sFailedMessageBase + "No bitmap for the 
bullets";
 CPPUNIT_ASSERT_MESSAGE(sFailed.getStr(), xBitmap.is());
+Graphic aGraphic(uno::Reference(xBitmap, 
uno::UNO_QUERY));
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 
GraphicType::Bitmap, aGraphic.GetType());
+CPPUNIT_ASSERT_MESSAGE(sFailedMessageBase.getStr(), 
aGraphic.GetSizeBytes() > sal_uLong(0));
+
+if (nExportFormat == ODP || nExportFormat == PPT)
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 16L, 
aGraphic.GetSizePixel().Width());
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 16L, 
aGraphic.GetSizePixel().Height());
+}
+else // FIXME: what happened here
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 64L, 
aGraphic.GetSizePixel().Width());
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 64L, 
aGraphic.GetSizePixel().Height());
+}
+
+// Graphic Size
+if (nExportFormat == ODP)
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 
sal_Int32(500), aSize.Width);
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 
sal_Int32(500), aSize.Height);
+
+}
+else if (nExportFormat == PPT) // seems like a conversion error
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 
sal_Int32(504), aSize.Width);
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 
sal_Int32(504), aSize.Height);
+}
+else // FIXME: totally wrong
+{
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 
sal_Int32(790), aSize.Width);
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessageBase.getStr(), 
sal_Int32(790), aSize.Height);
+}
 
 xDocShRef->DoClose();
 }
commit 15938ebbfa3a52595371a718f251137612184d21
Author: Tomaž Vajngerl 
Date:   Wed May 23 18:23:31 2018 +0900

sd: convert XGraphic to XBitmap for the "GraphicBitmap" property

Change-Id: Idec08d4823775b11976f8650fe942f296d6dd4ce
Reviewed-on: https://gerrit.libreoffice.org/54695
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/sd/source/filter/eppt/pptx-text.cxx 
b/sd/source/filter/eppt/pptx-text.cxx
index 615cb15aad09..285c5e14a5fd 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -846,7 +847,10 @@ void ParagraphObj::ImplGetNumberingLevel( 
PPTExBulletProvider* pBuProv, sal_Int1
 
 }
 

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

2017-09-07 Thread Jan Holesovsky
 sd/qa/unit/data/pptx/tdf112280.pptx  |binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   15 +
 sd/source/filter/eppt/pptx-epptooxml.cxx |   84 +++
 3 files changed, 89 insertions(+), 10 deletions(-)

New commits:
commit d921d4fd24b6416e00069678886f9692ffb4a008
Author: Jan Holesovsky 
Date:   Thu Sep 7 19:42:45 2017 +0200

tdf#112280: Unit test.

Change-Id: I70d7f388c1573ed34bb3d93b480fe1ccaa97076f
Reviewed-on: https://gerrit.libreoffice.org/42075
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/sd/qa/unit/data/pptx/tdf112280.pptx 
b/sd/qa/unit/data/pptx/tdf112280.pptx
new file mode 100644
index ..39c2aa4cb1b8
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf112280.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index ce7c117e27c0..999d0744b562 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -105,6 +105,7 @@ public:
 void testTdf100387();
 void testRotateFlip();
 void testTdf106867();
+void testTdf112280();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -137,6 +138,7 @@ public:
 CPPUNIT_TEST(testTdf100387);
 CPPUNIT_TEST(testRotateFlip);
 CPPUNIT_TEST(testTdf106867);
+CPPUNIT_TEST(testTdf112280);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -1024,6 +1026,19 @@ void SdOOXMLExportTest2::testTdf106867()
 "spid", "42");
 }
 
+void SdOOXMLExportTest2::testTdf112280()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf112280.pptx"), 
PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+// check the animRot value
+xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent, 
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:animRot",
+"by", "2160");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit f5fa86303f25dd271d9bbfa9fc25c1e21430910f
Author: Jan Holesovsky 
Date:   Thu Sep 7 19:26:07 2017 +0200

tdf#112280: Export spin animation in PPTX.

Change-Id: I9f13bbc2bd3a3de582491ea5b2ad16535589420a
Reviewed-on: https://gerrit.libreoffice.org/42074
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index b00aa125b129..2129b7f6bcaa 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -51,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -928,6 +930,16 @@ void PowerPointExport::WriteAnimationAttributeName(const 
FSHelperPtr& pFS, const
 pFS->writeEscaped("ppt_y");
 pFS->endElementNS(XML_p, XML_attrName);
 }
+else if (rAttributeName == "Rotate")
+{
+pFS->startElementNS(XML_p, XML_attrName, FSEND);
+pFS->writeEscaped("r");
+pFS->endElementNS(XML_p, XML_attrName);
+}
+else
+{
+SAL_INFO("sd.eppt", "unhandled animation attribute name: " << 
rAttributeName);
+}
 
 pFS->endElementNS(XML_p, XML_attrNameLst);
 }
@@ -1012,27 +1024,62 @@ void PowerPointExport::WriteAnimationNodeAnimate(const 
FSHelperPtr& pFS, const R
 }
 }
 
-OUString aPath;
 if (nXmlNodeType == XML_animMotion)
 {
-Reference rMotion(rXNode, UNO_QUERY);
-if (rMotion.is())
-rMotion->getPath() >>= aPath;
-}
+OUString aPath;
+Reference xMotion(rXNode, UNO_QUERY);
+if (xMotion.is())
+xMotion->getPath() >>= aPath;
 
-if (aPath.isEmpty())
+pFS->startElementNS(XML_p, nXmlNodeType,
+XML_path, OUStringToOString(aPath, 
RTL_TEXTENCODING_UTF8),
+FSEND);
+}
+else if (nXmlNodeType == XML_animRot)
 {
+// when const char* is nullptr, the attribute is completely omitted in 
the output
+const char* pBy = nullptr;
+const char* pFrom = nullptr;
+const char* pTo = nullptr;
+OString aBy, aFrom, aTo;
+
+Reference xTransform(rXNode, UNO_QUERY);
+if (xTransform.is())
+{
+double value;
+if (xTransform->getBy() >>= value)
+{
+aBy = OString::number(static_cast(value * PER_DEGREE));
+pBy = aBy.getStr();
+}
+
+if (xTransform->getFrom() >>= value)
+{
+aFrom = 

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

2016-03-31 Thread Jan Holesovsky
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   37 ---
 sd/source/ui/table/tablefunction.cxx |   20 ++
 2 files changed, 49 insertions(+), 8 deletions(-)

New commits:
commit 8c32ffd59aef2c7b319d64c310e7d0a46dbb9e2c
Author: Jan Holesovsky 
Date:   Thu Mar 31 15:48:52 2016 +0200

sd lok bccu#1525: Unit test for the fix.

Change-Id: I55107bd36a9b716ecbef4d01dd670617b141cc48

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 1d6775f..f62fa5e 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -46,7 +46,6 @@ public:
 virtual void tearDown() override;
 
 #if !defined(_WIN32) && !defined(MACOSX)
-void testInsertDeletePage();
 void testRegisterCallback();
 void testPostKeyEvent();
 void testPostMouseEvent();
@@ -59,11 +58,12 @@ public:
 void testSearchAllSelections();
 void testSearchAllNotifications();
 void testSearchAllFollowedBySearch();
+void testInsertDeletePage();
+void testInsertTable();
 #endif
 
 CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
 #if !defined(_WIN32) && !defined(MACOSX)
-CPPUNIT_TEST(testInsertDeletePage);
 CPPUNIT_TEST(testRegisterCallback);
 CPPUNIT_TEST(testPostKeyEvent);
 CPPUNIT_TEST(testPostMouseEvent);
@@ -75,7 +75,8 @@ public:
 CPPUNIT_TEST(testSearchAll);
 CPPUNIT_TEST(testSearchAllSelections);
 CPPUNIT_TEST(testSearchAllNotifications);
-CPPUNIT_TEST(testSearchAllFollowedBySearch);
+CPPUNIT_TEST(testInsertDeletePage);
+CPPUNIT_TEST(testInsertTable);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -628,6 +629,36 @@ void SdTiledRenderingTest::testInsertDeletePage()
 comphelper::LibreOfficeKit::setActive(false);
 }
 
+void SdTiledRenderingTest::testInsertTable()
+{
+comphelper::LibreOfficeKit::setActive();
+SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+
+uno::Sequence aArgs(comphelper::InitPropertySequence(
+{
+{"Rows", uno::makeAny(3)},
+{"Columns", uno::makeAny(5)}
+}
+));
+
+comphelper::dispatchCommand(".uno:InsertTable", aArgs);
+Scheduler::ProcessEventsToIdle();
+
+// get the table
+sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
+SdPage* pActualPage = pViewShell->GetActualPage();
+SdrObject* pObject = pActualPage->GetObj(1);
+CPPUNIT_ASSERT(pObject);
+
+// check that the table is not in the top left corner
+Point aPos(pObject->GetRelativePos());
+
+CPPUNIT_ASSERT(aPos.X() != 0);
+CPPUNIT_ASSERT(aPos.Y() != 0);
+
+comphelper::LibreOfficeKit::setActive(false);
+}
+
 #endif
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
commit ee246512cb0103f22f8afc0de245ea7f82143776
Author: Jan Holesovsky 
Date:   Thu Mar 31 12:26:54 2016 +0200

sd lok bccu#1525: Don't rely on the window size in the LOK case.

Otherwise the table is inserted in the top left corner.

Change-Id: Ia5d7099d4bace6f18cd7e8d3409427119240b756

diff --git a/sd/source/ui/table/tablefunction.cxx 
b/sd/source/ui/table/tablefunction.cxx
index 4d20312..fd58cd4 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -149,16 +150,25 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
 Size aSize( 14100, 2000 );
 
 Point aPos;
-Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
+Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel());
 aWinRect = GetActiveWindow()->PixelToLogic(aWinRect);
 
 // make sure that the default size of the table fits on the paper 
and is inside the viewing area.
 // if zoomed in close, don't make the table bigger than the 
viewing window.
 Size aMaxSize = getCurrentPage()->GetSize();
-if( aMaxSize.Height() > aWinRect.getHeight() )
-aMaxSize.setHeight( aWinRect.getHeight() );
-if( aMaxSize.Width() > aWinRect.getWidth() )
-aMaxSize.setWidth( aWinRect.getWidth() );
+
+if (comphelper::LibreOfficeKit::isActive())
+{
+// aWinRect is nonsensical in the LOK case
+aWinRect = Rectangle(aPos, aMaxSize);
+}
+else
+{
+if( aMaxSize.Height() > aWinRect.getHeight() )
+aMaxSize.setHeight( aWinRect.getHeight() );
+if( aMaxSize.Width() > aWinRect.getWidth() )
+aMaxSize.setWidth( aWinRect.getWidth() );
+}
 
 if( aSize.Width() > aMaxSize.getWidth() )
 aSize.setWidth( aMaxSize.getWidth() );
___
Libreoffice-commits 

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

2015-10-15 Thread Miklos Vajna
 sd/qa/unit/tiledrendering/data/search-all.odp |binary
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |   26 --
 sd/source/ui/view/Outliner.cxx|   21 -
 3 files changed, 44 insertions(+), 3 deletions(-)

New commits:
commit 6a35a75a6bb2753f40edf59f360130e452b3c7f0
Author: Miklos Vajna 
Date:   Thu Oct 15 16:56:14 2015 +0200

sd tiled rendering: implement CALLBACK_SET_PART for find-all

Change-Id: I607b3719e0f508f9ae24db7482323847aa8e2491

diff --git a/sd/qa/unit/tiledrendering/data/search-all.odp 
b/sd/qa/unit/tiledrendering/data/search-all.odp
index cb3cb31..0fd069c 100644
Binary files a/sd/qa/unit/tiledrendering/data/search-all.odp and 
b/sd/qa/unit/tiledrendering/data/search-all.odp differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 89a2bf1..1073d14 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -421,12 +421,19 @@ void SdTiledRenderingTest::testSearch()
 void SdTiledRenderingTest::testSearchAll()
 {
 SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
+pXImpressDocument->registerCallback(::callback, this);
 
 lcl_search("match", /*bFindAll=*/true);
 
 OString aUsedFormat;
 // This was empty: find-all did not highlight the first match.
 CPPUNIT_ASSERT_EQUAL(OString("match"), 
pXImpressDocument->getTextSelection("text/plain;charset=utf-8", aUsedFormat));
+
+// We're on the first slide, search for something on the second slide and 
make sure we get a SET_PART.
+m_nPart = 0;
+lcl_search("second", /*bFindAll=*/true);
+// This was 0: no SET_PART was emitted.
+CPPUNIT_ASSERT_EQUAL(static_cast(1), m_nPart);
 }
 
 #endif
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 8c79ac4..4ccd33c 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -667,6 +667,14 @@ bool Outliner::SearchAndReplaceAll()
 }
 
 RestoreStartPosition ();
+
+if (mpSearchItem->GetCommand() == SvxSearchCmd::FIND_ALL && 
pViewShell->GetDoc()->isTiledRendering() && !bRet)
+{
+// Find-all, tiled rendering and we have at least one match.
+OString aPayload = OString::number(mnStartPageIndex);
+pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, 
aPayload.getStr());
+}
+
 mnStartPageIndex = (sal_uInt16)-1;
 
 return bRet;
commit cd4976988cf3acb4f1a23f1df7fcc2bfec0f3da0
Author: Miklos Vajna 
Date:   Thu Oct 15 15:20:23 2015 +0200

sd tiled rendering: let find-all at least select the first match physically

The LOK API can describe a multi-selection, so find-all can signal all
matches, editeng can have a single selection only. Instead of having no
selections after a find-all, select the first match, so e.g. copy works.

Change-Id: I0eab2565916f0c3cce5d77279c0d927ad4b7054c

diff --git a/sd/qa/unit/tiledrendering/data/search-all.odp 
b/sd/qa/unit/tiledrendering/data/search-all.odp
new file mode 100644
index 000..cb3cb31
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/search-all.odp 
differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 4a5c81b..89a2bf1 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -51,6 +52,7 @@ public:
 void testSetGraphicSelection();
 void testResetSelection();
 void testSearch();
+void testSearchAll();
 #endif
 
 CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
@@ -63,6 +65,7 @@ public:
 CPPUNIT_TEST(testSetGraphicSelection);
 CPPUNIT_TEST(testResetSelection);
 CPPUNIT_TEST(testSearch);
+CPPUNIT_TEST(testSearchAll);
 #endif
 CPPUNIT_TEST_SUITE_END();
 
@@ -371,12 +374,13 @@ void SdTiledRenderingTest::testResetSelection()
 CPPUNIT_ASSERT(!pView->GetTextEditObject());
 }
 
-static void lcl_search(const OUString& rKey)
+static void lcl_search(const OUString& rKey, bool bFindAll = false)
 {
 uno::Sequence 
aPropertyValues(comphelper::InitPropertySequence(
 {
 {"SearchItem.SearchString", uno::makeAny(rKey)},
-{"SearchItem.Backward", uno::makeAny(false)}
+{"SearchItem.Backward", uno::makeAny(false)},
+{"SearchItem.Command", uno::makeAny(static_cast(bFindAll ? 
SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND))},
 }));
 comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
 }
@@ -414,6 +418,17 @@ void SdTiledRenderingTest::testSearch()
 CPPUNIT_ASSERT_EQUAL(false, m_bFound);
 }
 
+void SdTiledRenderingTest::testSearchAll()
+{
+SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
+
+lcl_search("match", /*bFindAll=*/true);
+
+

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

2015-10-12 Thread Miklos Vajna
 sd/qa/unit/tiledrendering/tiledrendering.cxx |1 -
 sd/source/ui/view/Outliner.cxx   |   13 -
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit aa5f4bb22e6f6b38b60ee45d1079f2bc934c0611
Author: Miklos Vajna 
Date:   Mon Oct 12 11:53:02 2015 +0200

sd: avoid unnecessary invalidations during search

Search works by using sd::outliner::OutlinerContainer to iterate over
all text objects of the document. We used to switch to each and every
object, and only then search in it. In large presentations this means
the number of invalidations during search was dependent on the number of
slides between the current slide and the first match.

Fix this by not calling sd::Outliner::SetObject() (which would call
sd::Outliner::SetPage()) right after finding a text object, only later
when we know it has matching content.

The result is that the number of invalidations is not O(n) but O(1) till
we find the first match.

Change-Id: I29a11c8737a7e1db6a247eb98617d12495c8bb41

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 9cde9d7..f080488 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -951,7 +951,11 @@ void Outliner::ProvideNextTextObject()
 // Switch to the current object only if it is a valid text object.
 if (IsValidTextObject (maCurrentPosition))
 {
-mpObj = SetObject (maCurrentPosition);
+// Don't set yet in case of searching: the text object may not 
match.
+if (meMode != SEARCH)
+mpObj = SetObject(maCurrentPosition);
+else
+mpObj = maCurrentPosition.mxObject.get();
 }
 ++maObjectIterator;
 
@@ -977,6 +981,10 @@ void Outliner::ProvideNextTextObject()
 }
 else
 {
+if (meMode == SEARCH)
+// Instead of doing a full-blown SetObject(), which would do 
the same -- but would also possibly switch pages.
+mbStringFound = false;
+
 mbEndOfSearch = true;
 EndOfSearch ();
 }
@@ -1169,6 +1177,9 @@ void Outliner::PrepareSearchAndReplace()
 {
 if (HasText( *mpSearchItem ))
 {
+// Set the object now that we know it matches.
+mpObj = SetObject(maCurrentPosition);
+
 mbStringFound = true;
 mbMatchMayExist = true;
 
commit 8d1d280741f62d60fe56cd86da995b08228a1594
Author: Miklos Vajna 
Date:   Mon Oct 12 11:34:31 2015 +0200

Related: tdf#74132 CppunitTest_sd_export_tests: clean up testSearch()

Not needed anymore since the dialog is gone.

Change-Id: Icd3747683d2656a9404b405fc29aae6183dcfe15

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index a36cfba..da6d4be 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -389,7 +389,6 @@ void SdTiledRenderingTest::testSearch()
 CPPUNIT_ASSERT_EQUAL(true, m_bFound);
 
 // This should trigger the not-found callback.
-Application::EnableHeadlessMode(false);
 lcl_search("ccc");
 CPPUNIT_ASSERT_EQUAL(false, m_bFound);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-19 Thread Miklos Vajna
 sd/qa/unit/tiledrendering/tiledrendering.cxx   |3 +++
 sd/source/ui/view/viewshel.cxx |6 ++
 sw/qa/extras/tiledrendering/tiledrendering.cxx |3 +++
 sw/source/uibase/uno/unotxdoc.cxx  |6 ++
 4 files changed, 18 insertions(+)

New commits:
commit abd92f37ee5840cc46bf26c4bfabc22ef5457ebe
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jun 19 16:14:59 2015 +0200

sd::ViewShell::GetTextSelection: fix text/richtext handling

Change-Id: If7d75d48667cd48d9426b02a38d2cf539b248d26

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 6ec2219..55c4426 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -303,6 +303,9 @@ void SdTiledRenderingTest::testGetTextSelection()
 rEditView.SetSelection(aWordSelection);
 // Did we indeed manage to copy the selected text?
 CPPUNIT_ASSERT_EQUAL(OString(Shape), 
pXImpressDocument-getTextSelection(text/plain;charset=utf-8));
+
+// Make sure returned RTF is not empty.
+
CPPUNIT_ASSERT(!OString(pXImpressDocument-getTextSelection(text/richtext)).isEmpty());
 }
 
 void SdTiledRenderingTest::testSetGraphicSelection()
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index e3b8314..f8c45b5 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -597,6 +597,12 @@ OString ViewShell::GetTextSelection(const OString 
_aMimeType)
 else
 aRet = OString(reinterpret_castconst sal_Char 
*(aString.getStr()), aString.getLength() * sizeof(sal_Unicode));
 }
+else
+{
+uno::Sequencesal_Int8 aSequence;
+aAny = aSequence;
+aRet = OString(reinterpret_castsal_Char*(aSequence.getArray()), 
aSequence.getLength());
+}
 
 return aRet;
 }
commit e72e79dfa3342482214b37435550e534cfdfc08e
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jun 19 15:12:54 2015 +0200

SwXTextDocument::getTextSelection: fix missing non-string content handling

text/html works with this.

Change-Id: I749e0c987a87dbc6700956f564f6846617c393e8

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 1006ef9..8d9d6ae 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -233,6 +233,9 @@ void SwTiledRenderingTest::testGetTextSelection()
 // Make sure that we selected text from the body text.
 CPPUNIT_ASSERT_EQUAL(OString(Hello), 
pXTextDocument-getTextSelection(text/plain;charset=utf-8));
 
+// Make sure we produce something for HTML.
+
CPPUNIT_ASSERT(!OString(pXTextDocument-getTextSelection(text/html)).isEmpty());
+
 // Now select some shape text and check again.
 SdrPage* pPage = 
pWrtShell-GetDoc()-getIDocumentDrawModelAccess().GetDrawModel()-GetPage(0);
 SdrObject* pObject = pPage-GetObj(0);
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 9c9f15f..e2008ac 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3310,6 +3310,12 @@ OString SwXTextDocument::getTextSelection(const char* 
pMimeType)
 else
 aRet = OString(reinterpret_castconst sal_Char 
*(aString.getStr()), aString.getLength() * sizeof(sal_Unicode));
 }
+else
+{
+uno::Sequencesal_Int8 aSequence;
+aAny = aSequence;
+aRet = OString(reinterpret_castsal_Char*(aSequence.getArray()), 
aSequence.getLength());
+}
 
 return aRet;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-05-27 Thread Miklos Vajna
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   15 ++-
 sd/source/ui/view/Outliner.cxx   |8 
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 436b4451c6f36ca23c966e2391cfcf94091b6db7
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed May 27 14:10:00 2015 +0200

CppunitTest_sd_tiledrendering: add search-not-found testcase

Fails without commit c0cc9a8622a2cd0e3ba07e15a79dd65ca910b233 (sd LOKit
callback for search not found, 2015-05-27).

Change-Id: I26ce4eab3d0bf3abc4a59d0dd21d5f2f5de78017

diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 9889015..b41c427 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -74,13 +74,15 @@ private:
 #if !defined(WNT)  !defined(MACOSX)
 Rectangle m_aInvalidation;
 std::vectorRectangle m_aSelection;
+bool m_bFound;
 sal_Int32 m_nPart;
 #endif
 };
 
 SdTiledRenderingTest::SdTiledRenderingTest()
 #if !defined(WNT)  !defined(MACOSX)
-: m_nPart(0)
+: m_bFound(true),
+m_nPart(0)
 #endif
 {
 }
@@ -167,6 +169,11 @@ void SdTiledRenderingTest::callbackImpl(int nType, const 
char* pPayload)
 }
 }
 break;
+case LOK_CALLBACK_SEARCH_NOT_FOUND:
+{
+m_bFound = false;
+}
+break;
 case LOK_CALLBACK_SET_PART:
 {
 OUString aPayload = OUString::createFromAscii(pPayload);
@@ -353,6 +360,12 @@ void SdTiledRenderingTest::testSearch()
 // Search for something on the second slide, and make sure that the 
set-part callback fired.
 lcl_search(bbb);
 CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(1), m_nPart);
+CPPUNIT_ASSERT_EQUAL(true, m_bFound);
+
+// This should trigger the not-found callback.
+Application::EnableHeadlessMode(false);
+lcl_search(ccc);
+CPPUNIT_ASSERT_EQUAL(false, m_bFound);
 }
 
 #endif
commit 9328df9598286a94f0cf097462045a3c0a5721fc
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Wed May 27 14:09:18 2015 +0200

sd tiled rendering: avoid showing wrap around dialog

Change-Id: Id977c3a17f5e34d086ee3b68fa9ad2969f9d24c2

diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx
index 24031ef..60873d0 100644
--- a/sd/source/ui/view/Outliner.cxx
+++ b/sd/source/ui/view/Outliner.cxx
@@ -1098,6 +1098,14 @@ bool Outliner::ShowWrapArroundDialog()
 // Spell checking needs the dialog, too.
 bShowDialog = (meMode == SPELL);
 
+boost::shared_ptrViewShell pViewShell(mpWeakViewShell.lock());
+if (pViewShell  pViewShell-GetDoc()-isTiledRendering())
+{
+// Wrap around without asking anything.
+bShowDialog = false;
+bDoWrapArround = true;
+}
+
 if (bShowDialog)
 {
 // The question text depends on the search direction.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits