[Libreoffice-commits] core.git: 2 commits - android/source emfio/qa emfio/source
Bartosz Kosiorek (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 31 18:09:19 UTC 2021
android/source/res/values-de/strings.xml | 1
android/source/res/values-tr/strings.xml | 1
android/source/res/values/strings.xml | 1
android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java | 19 ----
emfio/qa/cppunit/emf/EmfImportTest.cxx | 24 +++++
emfio/qa/cppunit/emf/data/TestFillRegion.emf |binary
emfio/source/reader/emfreader.cxx | 46 +++++-----
7 files changed, 50 insertions(+), 42 deletions(-)
New commits:
commit 5d4d8278b7fd2a555d6c9678d37877853562bd85
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
AuthorDate: Wed Mar 31 17:50:59 2021 +0200
Commit: Bartosz Kosiorek <gang65 at poczta.onet.pl>
CommitDate: Wed Mar 31 20:08:37 2021 +0200
tdf#55058 tdf#141394 EMF FILLRGN record is not displayed correctly
The EMR_FILLRGN record fills the specified region by using the specified brush.
After deep analyse of [EMF] documentation, it seems that
bounds from RegionDataHeader was treated as first rectangle of
region. As a result whole bounds was treated as the Region.
Change-Id: Ie34877b71292c05a1f17381a6de51aaed2386565
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113423
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index f587135e1b1e..4213b373eebb 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -51,6 +51,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest:
void TestLinearGradient();
void TestTextMapMode();
void TestEnglishMapMode();
+ void TestFillRegion();
void TestCreatePen();
void TestPdfInEmf();
@@ -69,6 +70,7 @@ public:
CPPUNIT_TEST(TestLinearGradient);
CPPUNIT_TEST(TestTextMapMode);
CPPUNIT_TEST(TestEnglishMapMode);
+ CPPUNIT_TEST(TestFillRegion);
CPPUNIT_TEST(TestCreatePen);
CPPUNIT_TEST(TestPdfInEmf);
CPPUNIT_TEST_SUITE_END();
@@ -309,6 +311,28 @@ void Test::TestEnglishMapMode()
}
+void Test::TestFillRegion()
+{
+ // Check import of EMF image with records: CREATEBRUSHINDIRECT, FILLRGN. The SETICMMODE is also used.
+ Primitive2DSequence aSequence = parseEmf(u"/emfio/qa/cppunit/emf/data/TestFillRegion.emf");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequence));
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygon", "path", "m0 0h3943v3939h-3943z");
+
+ assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor", 1);
+ assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[1]/polypolygon",
+ "path", "m1323 0h1323v1322h1323v1322h-1323v1322h-1323v-1322h-1323v-1322h1323z");
+ assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polypolygoncolor[1]", "color", "#ff0000");
+
+ assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polygonhairline", 1);
+ assertXPathContent(pDocument, "/primitive2D/metafile/transform/mask/polygonhairline[1]/polygon",
+ "1323,0 2646,0 2646,1322 3969,1322 3969,2644 2646,2644 2646,3966 1323,3966 1323,2644 0,2644 0,1322 1323,1322");
+ assertXPath(pDocument, "/primitive2D/metafile/transform/mask/polygonhairline[1]", "color", "#000000");
+}
+
void Test::TestCreatePen()
{
// Check import of EMF image with records: RESTOREDC, SAVEDC, MOVETOEX, LINETO, POLYLINE16, EXTTEXTOUTW with DxBuffer
diff --git a/emfio/qa/cppunit/emf/data/TestFillRegion.emf b/emfio/qa/cppunit/emf/data/TestFillRegion.emf
new file mode 100644
index 000000000000..da7d4cd65d1f
Binary files /dev/null and b/emfio/qa/cppunit/emf/data/TestFillRegion.emf differ
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 451c998a7669..12b4fce29323 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -333,38 +333,42 @@ bool ImplReadRegion( tools::PolyPolygon& rPolyPoly, SvStream& rStream, sal_uInt3
if (nLen == 0)
return false;
- sal_uInt32 nHdSize, nType, nCount, nRgnSize, i;
+ sal_uInt32 nHdSize, nType, nCountRects, nRgnSize, i;
rStream.ReadUInt32(nHdSize);
rStream.ReadUInt32(nType);
- rStream.ReadUInt32(nCount);
+ rStream.ReadUInt32(nCountRects);
rStream.ReadUInt32(nRgnSize);
- if (!rStream.good() || nCount == 0 || nType != RDH_RECTANGLES)
+ if (!rStream.good() || nCountRects == 0 || nType != RDH_RECTANGLES)
return false;
sal_uInt32 nSize;
- if (o3tl::checked_multiply<sal_uInt32>(nCount, 16, nSize))
+ if (o3tl::checked_multiply<sal_uInt32>(nCountRects, 16, nSize))
return false;
if (o3tl::checked_add<sal_uInt32>(nSize, nHdSize - 16, nSize))
return false;
if (nLen < nSize)
return false;
- sal_Int32 nx1, ny1, nx2, ny2;
- for (i = 0; i < nCount; i++)
+ sal_Int32 nLeft, nTop, nRight, nBottom;
+
+ //bounds of the region
+ rStream.ReadInt32(nLeft);
+ rStream.ReadInt32(nTop);
+ rStream.ReadInt32(nRight);
+ rStream.ReadInt32(nBottom);
+ SAL_INFO("emfio", "\t\tLeft: " << nLeft << ", top: " << nTop << ", right: " << nRight << ", bottom: " << nBottom);
+
+ for (i = 0; i < nCountRects; i++)
{
- rStream.ReadInt32(nx1);
- rStream.ReadInt32(ny1);
- rStream.ReadInt32(nx2);
- rStream.ReadInt32(ny2);
-
- tools::Rectangle aRectangle(Point(nx1, ny1), Point(nx2, ny2));
-
- tools::Polygon aPolygon(aRectangle);
- tools::PolyPolygon aPolyPolyOr1(aPolygon);
- tools::PolyPolygon aPolyPolyOr2(rPolyPoly);
- rPolyPoly.GetUnion(aPolyPolyOr1, aPolyPolyOr2);
- rPolyPoly = aPolyPolyOr2;
+ rStream.ReadInt32(nLeft);
+ rStream.ReadInt32(nTop);
+ rStream.ReadInt32(nRight);
+ rStream.ReadInt32(nBottom);
+
+ SAL_INFO("emfio", "\t\tLeft: " << nLeft << ", top: " << nTop << ", right: " << nRight << ", bottom: " << nBottom);
+ tools::PolyPolygon aPolyPolyOr1(tools::Polygon(tools::Rectangle(nLeft, nTop, nRight, nBottom)));
+ rPolyPoly.GetUnion(aPolyPolyOr1, rPolyPoly);
}
return true;
}
@@ -1915,10 +1919,10 @@ namespace emfio
case EMR_FILLRGN :
{
- sal_uInt32 nLen;
+ sal_uInt32 nRgnDataSize;
tools::PolyPolygon aPolyPoly;
- mpInputStream->SeekRel( 0x10 );
- mpInputStream->ReadUInt32( nLen ).ReadUInt32( nIndex );
+ mpInputStream->SeekRel( 0x10 ); // RectL bounds
+ mpInputStream->ReadUInt32( nRgnDataSize ).ReadUInt32( nIndex );
if ( ImplReadRegion( aPolyPoly, *mpInputStream, nRecSize ) )
{
commit 1477401805e2a88cddb1df259456359398fa2b7d
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Wed Mar 31 14:32:32 2021 +0200
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Wed Mar 31 20:08:18 2021 +0200
android: Don't require that user presses 'Back' twice to exit
Drop the "Press back again to quit" info shown when pressing
"Back" in the file selection dialog in Android Viewer and
just quit the app right away.
It was originally added in
commit d1f671e053864d0bf54d04a855761b43a7f5a9c4
Date: Wed Jun 10 19:04:22 2015 +0200
tdf#87434: android: system back key to go one level up
Added an additional check so back has to be pressed twice on the root
folder to actually leave the application. It's a check seen in many
other apps.
but I don't really see any need to bother the user
about pressing "Back" again. Nothing is lost at
this stage when quitting the app, and I haven't
seen anything similar in many current apps myself
(but have rather seen some extra confirmation dialogs
disappear from desktop applications over the last
years).
The original request in tdf#87434 to go one level up
in the directory hierarchy is unaffected by this,
though this only applies for the custom widgets
to browse the file system, which will potentially be
dropped in the future anyway, now that support
for the system file picker has been added in
commit d678ee309b02b4cc8af29a097bf5053b8b1b4e06
Author: Michael Weghorn <m.weghorn at posteo.de>
Date: Fri Mar 19 14:29:36 2021 +0100
tdf#129833 android: Allow opening files using system file picker
Change-Id: Ib324b7f0b82427b04c7708665ff7492a758eec9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113413
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>
diff --git a/android/source/res/values-de/strings.xml b/android/source/res/values-de/strings.xml
index 6828066524c9..53854e94929d 100644
--- a/android/source/res/values-de/strings.xml
+++ b/android/source/res/values-de/strings.xml
@@ -14,7 +14,6 @@
<string name="about_license">Lizenz anzeigen</string>
<string name="about_notice">Hinweise anzeigen</string>
<string name="about_moreinfo">Weitere Informationen</string>
- <string name="back_again_to_quit">Zum Beenden noch einmal \'zurück\' drücken</string>
<string name="new_textdocument">Neues Textdokument</string>
<string name="new_presentation">Neue Präsentation</string>
diff --git a/android/source/res/values-tr/strings.xml b/android/source/res/values-tr/strings.xml
index 357f441a8e86..494e0575d0d1 100644
--- a/android/source/res/values-tr/strings.xml
+++ b/android/source/res/values-tr/strings.xml
@@ -14,7 +14,6 @@
<string name="about_license">Lisansı Görüntüle</string>
<string name="about_notice">Bildiriyi Görüntüle</string>
<string name="about_moreinfo">Daha Fazla Bilgi</string>
- <string name="back_again_to_quit">Çıkış için geri tuşuna tekrar basınız.</string>
<string name="new_textdocument">Yeni Kelime İşlemci</string>
<string name="new_presentation">Yeni Sunum</string>
diff --git a/android/source/res/values/strings.xml b/android/source/res/values/strings.xml
index 5cd2c978cef5..ddb396555dfc 100644
--- a/android/source/res/values/strings.xml
+++ b/android/source/res/values/strings.xml
@@ -14,7 +14,6 @@
<string name="about_license">Show License</string>
<string name="about_notice">Show Notice</string>
<string name="about_moreinfo">More Info</string>
- <string name="back_again_to_quit">Press back again to quit</string>
<string name="new_textdocument">New Text Document</string>
<string name="new_presentation">New Presentation</string>
diff --git a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
index 517aa158035d..f05bcae58a49 100644
--- a/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
+++ b/android/source/src/java/org/libreoffice/ui/LibreOfficeUIActivity.java
@@ -191,8 +191,6 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
private RecyclerView fileRecyclerView;
private RecyclerView recentRecyclerView;
- private boolean canQuit = false;
-
private Animation fabOpenAnimation;
private Animation fabCloseAnimation;
private boolean isFabMenuOpen = false;
@@ -440,22 +438,7 @@ public class LibreOfficeUIActivity extends AppCompatActivity implements Settings
} else if (isFabMenuOpen) {
collapseFabMenu();
} else {
- // only exit if warning has been shown
- if (canQuit) {
- super.onBackPressed();
- return;
- }
-
- // show warning about leaving the app and set a timer
- Toast.makeText(this, R.string.back_again_to_quit,
- Toast.LENGTH_SHORT).show();
- canQuit = true;
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- canQuit = false;
- }
- }, 3000);
+ super.onBackPressed();
}
}
More information about the Libreoffice-commits
mailing list