2012-02-11 17:06:42 +01:00
|
|
|
/*
|
|
|
|
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Miklos Vajna <vmiklos@suse.cz> (SUSE, Inc.)
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2012 the
|
|
|
|
* Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
|
|
|
|
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
|
|
|
|
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
|
|
|
|
* instead of those above.
|
|
|
|
*/
|
|
|
|
|
2012-05-09 15:25:44 +02:00
|
|
|
#include "../swmodeltestbase.hxx"
|
|
|
|
|
2012-02-11 17:06:42 +01:00
|
|
|
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
|
2012-02-21 18:25:37 +01:00
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
2012-03-24 17:14:12 +01:00
|
|
|
#include <com/sun/star/style/CaseMap.hpp>
|
2012-04-21 12:53:22 +02:00
|
|
|
#include <com/sun/star/style/LineSpacing.hpp>
|
|
|
|
#include <com/sun/star/style/LineSpacingMode.hpp>
|
2012-03-01 11:38:47 +01:00
|
|
|
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
|
2012-02-22 13:05:37 +01:00
|
|
|
#include <com/sun/star/table/BorderLine2.hpp>
|
|
|
|
#include <com/sun/star/table/BorderLineStyle.hpp>
|
2012-02-21 18:25:37 +01:00
|
|
|
#include <com/sun/star/text/RelOrientation.hpp>
|
2012-02-18 23:05:52 +01:00
|
|
|
#include <com/sun/star/text/SizeType.hpp>
|
2012-03-24 13:04:54 +01:00
|
|
|
#include <com/sun/star/text/TextContentAnchorType.hpp>
|
2012-04-03 16:49:41 +02:00
|
|
|
#include <com/sun/star/text/XFootnotesSupplier.hpp>
|
2012-03-16 14:23:36 +01:00
|
|
|
#include <com/sun/star/text/XPageCursor.hpp>
|
2012-02-11 17:06:42 +01:00
|
|
|
#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
|
2012-04-25 17:51:45 +02:00
|
|
|
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
|
2012-02-18 23:05:52 +01:00
|
|
|
#include <com/sun/star/text/XTextFramesSupplier.hpp>
|
2012-03-30 10:44:09 +02:00
|
|
|
#include <com/sun/star/text/XTextTablesSupplier.hpp>
|
2012-03-16 14:23:36 +01:00
|
|
|
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
|
2012-04-25 17:51:45 +02:00
|
|
|
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
|
2012-02-11 17:06:42 +01:00
|
|
|
|
2012-02-18 23:05:52 +01:00
|
|
|
#include <rtl/oustringostreaminserter.hxx>
|
2012-02-11 17:06:42 +01:00
|
|
|
#include <vcl/outdev.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
|
|
|
|
#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
|
|
|
|
|
|
|
|
using rtl::OString;
|
|
|
|
using rtl::OUString;
|
|
|
|
using rtl::OUStringBuffer;
|
|
|
|
|
2012-05-09 15:25:44 +02:00
|
|
|
class Test : public SwModelTestBase
|
2012-02-11 17:06:42 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
void testFdo45553();
|
|
|
|
void testN192129();
|
2012-02-13 21:54:18 +01:00
|
|
|
void testFdo45543();
|
2012-02-18 23:05:52 +01:00
|
|
|
void testN695479();
|
2012-02-22 17:53:03 +01:00
|
|
|
void testFdo42465();
|
2012-02-27 11:19:38 +01:00
|
|
|
void testFdo45187();
|
2012-03-01 11:38:47 +01:00
|
|
|
void testFdo46662();
|
2012-03-12 20:43:42 +01:00
|
|
|
void testN750757();
|
2012-03-13 10:16:27 +01:00
|
|
|
void testFdo45563();
|
2012-03-16 14:23:36 +01:00
|
|
|
void testFdo43965();
|
2012-03-19 10:45:28 +01:00
|
|
|
void testN751020();
|
2012-03-23 12:47:41 +01:00
|
|
|
void testFdo47326();
|
2012-03-24 13:04:54 +01:00
|
|
|
void testFdo47036();
|
2012-03-24 17:14:12 +01:00
|
|
|
void testFdo46955();
|
2012-03-30 10:44:09 +02:00
|
|
|
void testFdo45394();
|
2012-04-02 14:10:39 +02:00
|
|
|
void testFdo48104();
|
2012-04-03 15:07:06 +02:00
|
|
|
void testFdo47107();
|
2012-04-03 16:49:41 +02:00
|
|
|
void testFdo45182();
|
2012-04-11 09:45:53 +02:00
|
|
|
void testFdo44176();
|
2012-04-15 14:39:27 +02:00
|
|
|
void testFdo39053();
|
2012-04-20 12:42:23 +02:00
|
|
|
void testFdo48356();
|
2012-04-21 11:25:18 +02:00
|
|
|
void testFdo48023();
|
2012-04-21 12:53:22 +02:00
|
|
|
void testFdo48876();
|
2012-04-25 11:21:06 +02:00
|
|
|
void testFdo48193();
|
2012-04-21 23:01:09 +03:00
|
|
|
void testFdo44211();
|
2012-04-25 17:51:45 +02:00
|
|
|
void testFdo48037();
|
2012-05-02 17:50:55 +02:00
|
|
|
void testFdo47764();
|
2012-05-07 09:50:02 +02:00
|
|
|
void testFdo38786();
|
2012-05-09 10:21:30 +02:00
|
|
|
void testN757651();
|
2012-05-09 11:30:13 +02:00
|
|
|
void testFdo49501();
|
2012-05-09 16:07:12 +02:00
|
|
|
void testFdo49271();
|
2012-05-10 10:35:47 +02:00
|
|
|
void testFdo49692();
|
2012-02-11 17:06:42 +01:00
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
CPPUNIT_TEST_SUITE(Test);
|
2012-02-11 17:06:42 +01:00
|
|
|
#if !defined(MACOSX) && !defined(WNT)
|
|
|
|
CPPUNIT_TEST(testFdo45553);
|
|
|
|
CPPUNIT_TEST(testN192129);
|
2012-02-13 21:54:18 +01:00
|
|
|
CPPUNIT_TEST(testFdo45543);
|
2012-02-18 23:05:52 +01:00
|
|
|
CPPUNIT_TEST(testN695479);
|
2012-02-22 17:53:03 +01:00
|
|
|
CPPUNIT_TEST(testFdo42465);
|
2012-02-27 11:19:38 +01:00
|
|
|
CPPUNIT_TEST(testFdo45187);
|
2012-03-01 11:38:47 +01:00
|
|
|
CPPUNIT_TEST(testFdo46662);
|
2012-03-12 20:43:42 +01:00
|
|
|
CPPUNIT_TEST(testN750757);
|
2012-03-13 10:16:27 +01:00
|
|
|
CPPUNIT_TEST(testFdo45563);
|
2012-03-16 14:23:36 +01:00
|
|
|
CPPUNIT_TEST(testFdo43965);
|
2012-03-19 10:45:28 +01:00
|
|
|
CPPUNIT_TEST(testN751020);
|
2012-03-23 12:47:41 +01:00
|
|
|
CPPUNIT_TEST(testFdo47326);
|
2012-03-24 13:04:54 +01:00
|
|
|
CPPUNIT_TEST(testFdo47036);
|
2012-03-25 23:00:45 +02:00
|
|
|
CPPUNIT_TEST(testFdo46955);
|
2012-03-30 10:44:09 +02:00
|
|
|
CPPUNIT_TEST(testFdo45394);
|
2012-04-02 14:10:39 +02:00
|
|
|
CPPUNIT_TEST(testFdo48104);
|
2012-04-03 15:07:06 +02:00
|
|
|
CPPUNIT_TEST(testFdo47107);
|
2012-04-03 16:49:41 +02:00
|
|
|
CPPUNIT_TEST(testFdo45182);
|
2012-04-11 09:45:53 +02:00
|
|
|
CPPUNIT_TEST(testFdo44176);
|
2012-04-15 14:39:27 +02:00
|
|
|
CPPUNIT_TEST(testFdo39053);
|
2012-04-20 12:42:23 +02:00
|
|
|
CPPUNIT_TEST(testFdo48356);
|
2012-04-21 11:25:18 +02:00
|
|
|
CPPUNIT_TEST(testFdo48023);
|
2012-04-21 12:53:22 +02:00
|
|
|
CPPUNIT_TEST(testFdo48876);
|
2012-05-01 09:06:17 +01:00
|
|
|
CPPUNIT_TEST(testFdo48193);
|
2012-04-21 23:01:09 +03:00
|
|
|
CPPUNIT_TEST(testFdo44211);
|
2012-04-25 17:51:45 +02:00
|
|
|
CPPUNIT_TEST(testFdo48037);
|
2012-05-02 17:50:55 +02:00
|
|
|
CPPUNIT_TEST(testFdo47764);
|
2012-05-07 09:50:02 +02:00
|
|
|
CPPUNIT_TEST(testFdo38786);
|
2012-05-09 10:21:30 +02:00
|
|
|
CPPUNIT_TEST(testN757651);
|
2012-05-09 11:30:13 +02:00
|
|
|
CPPUNIT_TEST(testFdo49501);
|
2012-05-09 16:07:12 +02:00
|
|
|
CPPUNIT_TEST(testFdo49271);
|
2012-05-10 10:35:47 +02:00
|
|
|
CPPUNIT_TEST(testFdo49692);
|
2012-02-11 17:06:42 +01:00
|
|
|
#endif
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
|
|
|
|
private:
|
2012-02-22 17:53:03 +01:00
|
|
|
/// Load an RTF file and make the document available via mxComponent.
|
2012-02-11 17:06:42 +01:00
|
|
|
void load(const OUString& rURL);
|
2012-04-02 14:24:53 +02:00
|
|
|
/// Get page count.
|
|
|
|
int getPages();
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<container::XNameAccess> getStyles(OUString aFamily);
|
2012-02-11 17:06:42 +01:00
|
|
|
};
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::load(const OUString& rFilename)
|
2012-02-11 17:06:42 +01:00
|
|
|
{
|
|
|
|
mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/rtftok/data/") + rFilename);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
int Test::getPages()
|
2012-04-02 14:24:53 +02:00
|
|
|
{
|
|
|
|
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
|
|
|
|
xCursor->jumpToLastPage();
|
|
|
|
return xCursor->getPage();
|
|
|
|
}
|
|
|
|
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<container::XNameAccess> Test::getStyles(OUString aFamily)
|
|
|
|
{
|
|
|
|
uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XNameAccess> xStyles(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName(aFamily), uno::UNO_QUERY);
|
|
|
|
return xPageStyles;
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45553()
|
2012-02-11 17:06:42 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo45553.rtf");
|
2012-02-11 17:06:42 +01:00
|
|
|
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
while (xParaEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
|
|
|
|
while (xRangeEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
uno::Reference<text::XTextRange> xRange(xRangeEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
OUString aStr = xRange->getString();
|
2012-04-06 15:05:52 +02:00
|
|
|
if ( aStr == "space-before" )
|
2012-02-11 17:06:42 +01:00
|
|
|
{
|
|
|
|
sal_Int32 nMargin = 0;
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xRange, uno::UNO_QUERY);
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("ParaTopMargin") >>= nMargin;
|
2012-02-11 17:06:42 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(120)), nMargin);
|
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( aStr == "space-after" )
|
2012-02-11 17:06:42 +01:00
|
|
|
{
|
|
|
|
sal_Int32 nMargin = 0;
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xRange, uno::UNO_QUERY);
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("ParaBottomMargin") >>= nMargin;
|
2012-02-11 17:06:42 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(240)), nMargin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testN192129()
|
2012-02-11 17:06:42 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("n192129.rtf");
|
2012-02-11 17:06:42 +01:00
|
|
|
|
|
|
|
// We expect that the result will be 16x16px.
|
|
|
|
Size aExpectedSize(16, 16);
|
|
|
|
MapMode aMap(MAP_100TH_MM);
|
|
|
|
aExpectedSize = Application::GetDefaultDevice()->PixelToLogic( aExpectedSize, aMap );
|
|
|
|
|
|
|
|
uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
awt::Size aActualSize(xShape->getSize());
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Width()), aActualSize.Width);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45543()
|
2012-02-13 21:54:18 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo45543.rtf");
|
2012-02-22 17:53:03 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(5, getLength());
|
2012-02-13 21:54:18 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testN695479()
|
2012-02-18 23:05:52 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("n695479.rtf");
|
2012-02-18 23:05:52 +01:00
|
|
|
|
|
|
|
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
|
|
|
|
// Negative ABSH should mean fixed size.
|
|
|
|
sal_Int16 nSizeType = 0;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("SizeType") >>= nSizeType;
|
2012-02-18 23:05:52 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, nSizeType);
|
|
|
|
sal_Int32 nHeight = 0;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("Height") >>= nHeight;
|
2012-02-18 23:05:52 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(300)), nHeight);
|
|
|
|
|
2012-02-21 18:25:37 +01:00
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
bool bFrameFound = false, bDrawFound = false;
|
|
|
|
for (int i = 0; i < xDraws->getCount(); ++i)
|
2012-02-18 23:05:52 +01:00
|
|
|
{
|
2012-02-21 18:25:37 +01:00
|
|
|
uno::Reference<lang::XServiceInfo> xServiceInfo(xDraws->getByIndex(i), uno::UNO_QUERY);
|
2012-05-02 15:01:05 +02:00
|
|
|
if (xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
|
2012-02-21 18:25:37 +01:00
|
|
|
{
|
|
|
|
// Both frames should be anchored to the first paragraph.
|
|
|
|
bFrameFound = true;
|
|
|
|
uno::Reference<text::XTextContent> xTextContent(xServiceInfo, uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xRange(xTextContent->getAnchor(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XText> xText(xRange->getText(), uno::UNO_QUERY);
|
2012-05-02 15:01:05 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("plain"), xText->getString());
|
2012-02-22 13:05:37 +01:00
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
{
|
|
|
|
// Additonally, the frist frame should have double border at the bottom.
|
|
|
|
table::BorderLine2 aBorder;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("BottomBorder") >>= aBorder;
|
2012-02-22 13:05:37 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::DOUBLE, aBorder.LineStyle);
|
|
|
|
}
|
2012-02-21 18:25:37 +01:00
|
|
|
}
|
2012-05-02 15:01:05 +02:00
|
|
|
else if (xServiceInfo->supportsService("com.sun.star.drawing.LineShape"))
|
2012-02-21 18:25:37 +01:00
|
|
|
{
|
|
|
|
// The older "drawing objects" syntax should be recognized.
|
|
|
|
bDrawFound = true;
|
|
|
|
xPropertySet.set(xServiceInfo, uno::UNO_QUERY);
|
|
|
|
sal_Int16 nHori = 0;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("HoriOrientRelation") >>= nHori;
|
2012-02-21 18:25:37 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, nHori);
|
|
|
|
sal_Int16 nVert = 0;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("VertOrientRelation") >>= nVert;
|
2012-02-21 18:25:37 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, nVert);
|
|
|
|
}
|
2012-02-18 23:05:52 +01:00
|
|
|
}
|
2012-02-21 18:25:37 +01:00
|
|
|
CPPUNIT_ASSERT(bFrameFound);
|
|
|
|
CPPUNIT_ASSERT(bDrawFound);
|
2012-02-18 23:05:52 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo42465()
|
2012-02-22 17:53:03 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo42465.rtf");
|
2012-02-22 17:53:03 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(3, getLength());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45187()
|
2012-02-27 11:19:38 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo45187.rtf");
|
2012-02-27 11:19:38 +01:00
|
|
|
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
// There should be two shapes.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
|
|
|
|
// They should be anchored to different paragraphs.
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
awt::Point aFirstPoint;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("AnchorPosition") >>= aFirstPoint;
|
2012-02-27 11:19:38 +01:00
|
|
|
xPropertySet.set(xDraws->getByIndex(1), uno::UNO_QUERY);
|
|
|
|
awt::Point aSecondPoint;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("AnchorPosition") >>= aSecondPoint;
|
2012-02-27 11:19:38 +01:00
|
|
|
CPPUNIT_ASSERT(aFirstPoint.Y != aSecondPoint.Y);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo46662()
|
2012-03-01 11:38:47 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo46662.rtf");
|
2012-03-01 11:38:47 +01:00
|
|
|
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY);
|
2012-05-02 15:01:05 +02:00
|
|
|
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
|
2012-03-01 11:38:47 +01:00
|
|
|
uno::Sequence<beans::PropertyValue> aProps;
|
2012-05-02 15:01:05 +02:00
|
|
|
xLevels->getByIndex(1) >>= aProps; // 2nd level
|
2012-03-01 11:38:47 +01:00
|
|
|
|
|
|
|
for (int i = 0; i < aProps.getLength(); ++i)
|
|
|
|
{
|
|
|
|
const beans::PropertyValue& rProp = aProps[i];
|
|
|
|
|
2012-04-06 15:05:52 +02:00
|
|
|
if ( rProp.Name == "ParentNumbering" )
|
2012-03-01 11:38:47 +01:00
|
|
|
{
|
|
|
|
sal_Int16 nValue;
|
|
|
|
rProp.Value >>= nValue;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), nValue);
|
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( rProp.Name == "Suffix" )
|
2012-03-01 11:38:47 +01:00
|
|
|
{
|
|
|
|
rtl::OUString sValue;
|
|
|
|
rProp.Value >>= sValue;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), sValue.getLength());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testN750757()
|
2012-03-12 20:43:42 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("n750757.rtf");
|
2012-03-12 20:43:42 +01:00
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
sal_Bool bValue;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("ParaContextMargin") >>= bValue;
|
2012-03-12 20:43:42 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Bool(false), bValue);
|
|
|
|
|
|
|
|
xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("ParaContextMargin") >>= bValue;
|
2012-03-12 20:43:42 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Bool(true), bValue);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45563()
|
2012-03-13 10:16:27 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo45563.rtf");
|
2012-03-13 10:16:27 +01:00
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
int i = 0;
|
|
|
|
while (xParaEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
xParaEnum->nextElement();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
CPPUNIT_ASSERT_EQUAL(4, i);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo43965()
|
2012-03-16 14:23:36 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo43965.rtf");
|
2012-03-16 14:23:36 +01:00
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
|
|
|
|
// First paragraph: the parameter of \up was ignored
|
|
|
|
uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
sal_Int32 nValue;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("CharEscapement") >>= nValue;
|
2012-03-16 14:23:36 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(58), nValue);
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("CharEscapementHeight") >>= nValue;
|
2012-03-16 14:23:36 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(100), nValue);
|
|
|
|
|
|
|
|
// Second paragraph: Word vs Writer border default problem
|
|
|
|
xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
table::BorderLine2 aBorder;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("TopBorder") >>= aBorder;
|
2012-03-16 14:23:36 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), aBorder.LineWidth);
|
|
|
|
|
|
|
|
// Finally, make sure that we have two pages
|
2012-04-02 14:24:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
2012-03-16 14:23:36 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testN751020()
|
2012-03-19 10:45:28 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("n751020.rtf");
|
2012-03-19 10:45:28 +01:00
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
sal_Int32 nValue = 0;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("ParaBottomMargin") >>= nValue;
|
2012-03-19 10:45:28 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), nValue);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo47326()
|
2012-03-23 12:47:41 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo47326.rtf");
|
2012-03-23 12:47:41 +01:00
|
|
|
// This was 15 only, as \super buffered text, then the contents of it got lost.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(19, getLength());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo47036()
|
2012-03-24 13:04:54 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo47036.rtf");
|
2012-03-24 13:04:54 +01:00
|
|
|
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
int nAtCharacter = 0;
|
|
|
|
for (int i = 0; i < xDraws->getCount(); ++i)
|
|
|
|
{
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(i), uno::UNO_QUERY);
|
|
|
|
text::TextContentAnchorType eValue;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("AnchorType") >>= eValue;
|
2012-03-24 13:04:54 +01:00
|
|
|
if (eValue == text::TextContentAnchorType_AT_CHARACTER)
|
|
|
|
nAtCharacter++;
|
|
|
|
}
|
|
|
|
// The image at the document start was ignored.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, nAtCharacter);
|
2012-03-24 14:55:09 +01:00
|
|
|
|
|
|
|
// There should be 2 textboxes, not 4
|
|
|
|
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
|
2012-03-24 13:04:54 +01:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo46955()
|
2012-03-24 17:14:12 +01:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo46955.rtf");
|
2012-03-24 17:14:12 +01:00
|
|
|
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
while (xParaEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
|
|
|
|
while (xRangeEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
sal_Int16 nValue;
|
2012-05-02 15:01:05 +02:00
|
|
|
xPropertySet->getPropertyValue("CharCaseMap") >>= nValue;
|
2012-03-24 17:14:12 +01:00
|
|
|
CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, nValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45394()
|
2012-03-30 10:44:09 +02:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo45394.rtf");
|
2012-03-30 10:44:09 +02:00
|
|
|
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
|
2012-03-30 10:44:09 +02:00
|
|
|
uno::Reference<text::XText> xHeaderText(xPropertySet->getPropertyValue("HeaderText"), uno::UNO_QUERY);
|
|
|
|
OUString aActual = xHeaderText->getString();
|
|
|
|
// Encoding in the header was wrong.
|
|
|
|
OUString aExpected("ПК РИК", 11, RTL_TEXTENCODING_UTF8);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
|
|
|
|
|
|
|
|
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48104()
|
2012-04-02 14:10:39 +02:00
|
|
|
{
|
2012-05-02 15:01:05 +02:00
|
|
|
load("fdo48104.rtf");
|
2012-04-02 14:24:53 +02:00
|
|
|
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
2012-04-02 14:10:39 +02:00
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo47107()
|
2012-04-03 15:07:06 +02:00
|
|
|
{
|
|
|
|
load("fdo47107.rtf");
|
|
|
|
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<container::XNameAccess> xNumberingStyles(getStyles("NumberingStyles"));
|
2012-04-03 15:07:06 +02:00
|
|
|
// Make sure numbered and bullet legacy syntax is recognized, this used to throw a NoSuchElementException
|
|
|
|
xNumberingStyles->getByName("WWNum1");
|
|
|
|
xNumberingStyles->getByName("WWNum2");
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo45182()
|
2012-04-03 16:49:41 +02:00
|
|
|
{
|
|
|
|
load("fdo45182.rtf");
|
|
|
|
|
|
|
|
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
|
|
|
|
// Encoding in the footnote was wrong.
|
|
|
|
OUString aExpected("živností", 10, RTL_TEXTENCODING_UTF8);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo44176()
|
2012-04-11 09:45:53 +02:00
|
|
|
{
|
|
|
|
load("fdo44176.rtf");
|
|
|
|
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles"));
|
2012-04-11 09:45:53 +02:00
|
|
|
uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"), uno::UNO_QUERY);
|
|
|
|
uno::Reference<beans::XPropertySet> xDefault(xPageStyles->getByName("Default"), uno::UNO_QUERY);
|
|
|
|
sal_Int32 nFirstTop = 0, nDefaultTop = 0, nDefaultHeader = 0;
|
|
|
|
xFirstPage->getPropertyValue("TopMargin") >>= nFirstTop;
|
|
|
|
xDefault->getPropertyValue("TopMargin") >>= nDefaultTop;
|
|
|
|
xDefault->getPropertyValue("HeaderHeight") >>= nDefaultHeader;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo39053()
|
2012-04-15 14:39:27 +02:00
|
|
|
{
|
|
|
|
load("fdo39053.rtf");
|
|
|
|
|
|
|
|
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
|
|
|
int nAsCharacter = 0;
|
|
|
|
for (int i = 0; i < xDraws->getCount(); ++i)
|
|
|
|
{
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(i), uno::UNO_QUERY);
|
|
|
|
text::TextContentAnchorType eValue;
|
|
|
|
xPropertySet->getPropertyValue("AnchorType") >>= eValue;
|
|
|
|
if (eValue == text::TextContentAnchorType_AS_CHARACTER)
|
|
|
|
nAsCharacter++;
|
|
|
|
}
|
|
|
|
// The image in binary format was ignored.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, nAsCharacter);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48356()
|
2012-04-20 12:42:23 +02:00
|
|
|
{
|
|
|
|
load("fdo48356.rtf");
|
|
|
|
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
OUStringBuffer aBuf;
|
|
|
|
int i = 0;
|
|
|
|
while (xParaEnum->hasMoreElements())
|
|
|
|
{
|
|
|
|
xParaEnum->nextElement();
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
// The document used to be imported as two paragraphs.
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, i);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48023()
|
2012-04-21 11:25:18 +02:00
|
|
|
{
|
|
|
|
lang::Locale aLocale;
|
|
|
|
aLocale.Language = "ru";
|
|
|
|
AllSettings aSettings(Application::GetSettings());
|
|
|
|
AllSettings aSavedSettings(aSettings);
|
|
|
|
aSettings.SetLocale(aLocale);
|
|
|
|
Application::SetSettings(aSettings);
|
|
|
|
load("fdo48023.rtf");
|
|
|
|
Application::SetSettings(aSavedSettings);
|
|
|
|
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
|
|
|
|
uno::Reference<text::XTextRange> xTextRange(xRangeEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
|
|
|
|
// Implicit encoding detection based on locale was missing
|
|
|
|
OUString aExpected("Программист", 22, RTL_TEXTENCODING_UTF8);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48876()
|
2012-04-21 12:53:22 +02:00
|
|
|
{
|
|
|
|
load("fdo48876.rtf");
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
style::LineSpacing aSpacing;
|
|
|
|
xPropertySet->getPropertyValue("ParaLineSpacing") >>= aSpacing;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, aSpacing.Mode);
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48193()
|
2012-04-25 11:21:06 +02:00
|
|
|
{
|
|
|
|
load("fdo48193.rtf");
|
|
|
|
CPPUNIT_ASSERT_EQUAL(7, getLength());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo44211()
|
2012-04-21 23:01:09 +03:00
|
|
|
{
|
|
|
|
lang::Locale aLocale;
|
|
|
|
aLocale.Language = "lt";
|
|
|
|
AllSettings aSettings(Application::GetSettings());
|
|
|
|
AllSettings aSavedSettings(aSettings);
|
|
|
|
aSettings.SetLocale(aLocale);
|
|
|
|
Application::SetSettings(aSettings);
|
|
|
|
load("fdo44211.rtf");
|
|
|
|
Application::SetSettings(aSavedSettings);
|
|
|
|
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
|
|
|
|
uno::Reference<text::XTextRange> xTextRange(xRangeEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
|
|
|
|
OUString aExpected("ąčę", 6, RTL_TEXTENCODING_UTF8);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
void Test::testFdo48037()
|
2012-04-25 17:51:45 +02:00
|
|
|
{
|
|
|
|
load("fdo48037.rtf");
|
|
|
|
|
|
|
|
uno::Reference<util::XNumberFormatsSupplier> xNumberSupplier(mxComponent, uno::UNO_QUERY_THROW);
|
|
|
|
lang::Locale aUSLocale, aFRLocale;
|
|
|
|
aUSLocale.Language = "en";
|
|
|
|
aFRLocale.Language = "fr";
|
|
|
|
sal_Int32 nExpected = xNumberSupplier->getNumberFormats()->addNewConverted("d MMMM yyyy", aUSLocale, aFRLocale);
|
|
|
|
|
|
|
|
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
|
|
|
|
uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
|
|
|
|
sal_Int32 nActual = 0;
|
|
|
|
xPropertySet->getPropertyValue("NumberFormat") >>= nActual;
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
|
|
|
|
}
|
|
|
|
|
2012-05-02 17:50:55 +02:00
|
|
|
void Test::testFdo47764()
|
|
|
|
{
|
|
|
|
load("fdo47764.rtf");
|
|
|
|
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
sal_Int32 nValue = 0;
|
|
|
|
// \cbpat with zero argument should mean the auto (-1) color, not a default color (black)
|
|
|
|
xPropertySet->getPropertyValue("ParaBackColor") >>= nValue;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), nValue);
|
|
|
|
}
|
|
|
|
|
2012-05-07 09:50:02 +02:00
|
|
|
void Test::testFdo38786()
|
|
|
|
{
|
|
|
|
load("fdo38786.rtf");
|
|
|
|
|
|
|
|
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
|
|
|
|
uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
|
|
|
|
// \chpgn was ignored, so exception was thrown
|
|
|
|
xFields->nextElement();
|
|
|
|
}
|
|
|
|
|
2012-05-09 10:21:30 +02:00
|
|
|
void Test::testN757651()
|
|
|
|
{
|
|
|
|
load("n757651.rtf");
|
|
|
|
|
|
|
|
// The bug was that due to buggy layout the text expanded to two pages.
|
|
|
|
if (Application::GetDefaultDevice()->IsFontAvailable(OUString("Times New Roman")))
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, getPages());
|
|
|
|
}
|
|
|
|
|
2012-05-09 11:30:13 +02:00
|
|
|
void Test::testFdo49501()
|
|
|
|
{
|
|
|
|
load("fdo49501.rtf");
|
|
|
|
|
2012-05-09 12:51:01 +02:00
|
|
|
uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Default"), uno::UNO_QUERY);
|
2012-05-09 11:30:13 +02:00
|
|
|
|
|
|
|
sal_Bool bIsLandscape = sal_False;
|
|
|
|
xStyle->getPropertyValue("IsLandscape") >>= bIsLandscape;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_True, bIsLandscape);
|
|
|
|
sal_Int32 nExpected(TWIP_TO_MM100(567));
|
|
|
|
sal_Int32 nValue = 0;
|
|
|
|
xStyle->getPropertyValue("LeftMargin") >>= nValue;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
|
|
|
|
xStyle->getPropertyValue("RightMargin") >>= nValue;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
|
|
|
|
xStyle->getPropertyValue("TopMargin") >>= nValue;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
|
|
|
|
xStyle->getPropertyValue("BottomMargin") >>= nValue;
|
|
|
|
CPPUNIT_ASSERT_EQUAL(nExpected, nValue);
|
|
|
|
}
|
|
|
|
|
2012-05-09 16:07:12 +02:00
|
|
|
void Test::testFdo49271()
|
|
|
|
{
|
|
|
|
load("fdo49271.rtf");
|
|
|
|
|
|
|
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
|
|
|
|
xParaEnum->nextElement();
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
|
|
|
|
float fValue = 0;
|
|
|
|
xPropertySet->getPropertyValue("CharHeight") >>= fValue;
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT_EQUAL(25.f, fValue);
|
|
|
|
}
|
|
|
|
|
2012-05-10 10:35:47 +02:00
|
|
|
void Test::testFdo49692()
|
|
|
|
{
|
|
|
|
load("fdo49692.rtf");
|
|
|
|
|
|
|
|
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
|
|
|
|
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
|
|
|
|
uno::Sequence<beans::PropertyValue> aProps;
|
|
|
|
xLevels->getByIndex(0) >>= aProps; // 1st level
|
|
|
|
|
|
|
|
for (int i = 0; i < aProps.getLength(); ++i)
|
|
|
|
{
|
|
|
|
const beans::PropertyValue& rProp = aProps[i];
|
|
|
|
|
|
|
|
if (rProp.Name == "Suffix")
|
|
|
|
{
|
|
|
|
rtl::OUString sValue;
|
|
|
|
rProp.Value >>= sValue;
|
|
|
|
|
|
|
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), sValue.getLength());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-27 15:36:23 +02:00
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
2012-02-11 17:06:42 +01:00
|
|
|
|
|
|
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|