[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - 3 commits - include/oox oox/source sd/qa sw/qa writerfilter/source
Zolnai Tamás
tamas.zolnai at collabora.com
Sun Nov 30 23:48:38 PST 2014
include/oox/drawingml/shape.hxx | 2
oox/source/drawingml/shape.cxx | 12 +-
sd/qa/unit/data/pptx/ShapeLineProperties.pptx |binary
sd/qa/unit/data/pptx/bnc904423.pptx |binary
sd/qa/unit/import-tests.cxx | 127 +++++++++++++++++++++++++
sw/qa/extras/rtfimport/data/fdo72031.rtf | 1
sw/qa/extras/rtfimport/rtfimport.cxx | 9 +
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 26 +++--
8 files changed, 163 insertions(+), 14 deletions(-)
New commits:
commit 0996041998249b56f36ac579ae4c7968b70d5371
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sun Nov 30 14:31:39 2014 +0100
PPTX import: fix import of shape line properties defined by theme
See also:
81cd386facedfbb15be6dffc10351262abf733f3
(cherry picked from commit 664a56b3c81503bdf199edf1806676f0a35b956f)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
Conflicts:
sd/qa/unit/import-tests.cxx
Change-Id: Ibb21d3e5b52a4d4996202acd4a989910fa223632
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index b36584a..8024af7 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -249,6 +249,7 @@ protected:
TextBodyPtr mpTextBody;
LinePropertiesPtr mpLinePropertiesPtr;
+ LinePropertiesPtr mpShapeRefLinePropPtr;
FillPropertiesPtr mpFillPropertiesPtr;
FillPropertiesPtr mpShapeRefFillPropPtr;
GraphicPropertiesPtr mpGraphicPropertiesPtr;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 56f3dc0..93e9789 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -93,6 +93,7 @@ namespace oox { namespace drawingml {
Shape::Shape( const sal_Char* pServiceName, bool bDefaultHeight )
: mbIsChild( false )
, mpLinePropertiesPtr( new LineProperties )
+, mpShapeRefLinePropPtr( new LineProperties )
, mpFillPropertiesPtr( new FillProperties )
, mpShapeRefFillPropPtr( new FillProperties )
, mpGraphicPropertiesPtr( new GraphicProperties )
@@ -123,6 +124,7 @@ Shape::Shape( const ShapePtr& pSourceShape )
, mbIsChild( pSourceShape->mbIsChild )
, mpTextBody(pSourceShape->mpTextBody)
, mpLinePropertiesPtr( pSourceShape->mpLinePropertiesPtr )
+, mpShapeRefLinePropPtr( pSourceShape->mpShapeRefLinePropPtr )
, mpFillPropertiesPtr( pSourceShape->mpFillPropertiesPtr )
, mpShapeRefFillPropPtr( pSourceShape->mpShapeRefFillPropPtr )
, mpGraphicPropertiesPtr( pSourceShape->mpGraphicPropertiesPtr )
@@ -304,7 +306,7 @@ void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText )
else
mpTextBody.reset();
maShapeProperties = rReferencedShape.maShapeProperties;
- mpLinePropertiesPtr = LinePropertiesPtr( new LineProperties( *rReferencedShape.mpLinePropertiesPtr.get() ) );
+ mpShapeRefLinePropPtr = LinePropertiesPtr( new LineProperties( *rReferencedShape.mpLinePropertiesPtr.get() ) );
mpShapeRefFillPropPtr = FillPropertiesPtr( new FillProperties( *rReferencedShape.mpFillPropertiesPtr.get() ) );
mpCustomShapePropertiesPtr = CustomShapePropertiesPtr( new CustomShapeProperties( *rReferencedShape.mpCustomShapePropertiesPtr.get() ) );
mpTablePropertiesPtr = table::TablePropertiesPtr( rReferencedShape.mpTablePropertiesPtr.get() ? new table::TableProperties( *rReferencedShape.mpTablePropertiesPtr.get() ) : NULL );
@@ -586,6 +588,7 @@ Reference< XShape > Shape::createAndInsert(
// First apply reference shape's properties (shape on the master slide)
aFillProperties.assignUsed( *mpShapeRefFillPropPtr );
+ aLineProperties.assignUsed( *mpShapeRefLinePropPtr );
if( pTheme )
{
diff --git a/sd/qa/unit/data/pptx/ShapeLineProperties.pptx b/sd/qa/unit/data/pptx/ShapeLineProperties.pptx
new file mode 100644
index 0000000..36ece8c
Binary files /dev/null and b/sd/qa/unit/data/pptx/ShapeLineProperties.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index b92b475..316740e 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -31,6 +31,9 @@
#include <svx/svdoole2.hxx>
#include <svx/svdotable.hxx>
#include <svx/xflclit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlnwtit.hxx>
#include <animations/animationnodehelper.hxx>
#include <sax/tools/converter.hxx>
@@ -93,6 +96,7 @@ public:
void testBnc584721_4();
void testFdo79731();
void testBnc904423();
+ void testShapeLineStyle();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout);
@@ -127,6 +131,7 @@ public:
CPPUNIT_TEST(testBnc584721_4);
CPPUNIT_TEST(testFdo79731);
CPPUNIT_TEST(testBnc904423);
+ CPPUNIT_TEST(testShapeLineStyle);
CPPUNIT_TEST_SUITE_END();
};
@@ -1171,6 +1176,74 @@ void SdFiltersTest::testBnc904423()
xDocShRef->DoClose();
}
+void SdFiltersTest::testShapeLineStyle()
+{
+ // Here the problem was that different line properties were applied in wrong order on the shape
+ // Right order: 1) master slide line style, 2) theme, 3) direct formatting
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/ShapeLineProperties.pptx"));
+
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+ const SdrPage *pPage = pDoc->GetPage(1);
+ CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+
+ // First shape's line style is defined on master slide
+ {
+ SdrObject *const pObj = pPage->GetObj(0);
+ CPPUNIT_ASSERT(pObj);
+
+ const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
+ pObj->GetMergedItem(XATTR_LINESTYLE));
+ CPPUNIT_ASSERT_EQUAL(XLINE_DASH, rStyleItem.GetValue());
+
+ const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
+ pObj->GetMergedItem(XATTR_LINECOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor());
+
+ const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
+ pObj->GetMergedItem(XATTR_LINEWIDTH));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(132), rWidthItem.GetValue());
+ }
+
+ // Second shape's line style is defined by theme
+ {
+ SdrObject *const pObj = pPage->GetObj(1);
+ CPPUNIT_ASSERT(pObj);
+
+ const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
+ pObj->GetMergedItem(XATTR_LINESTYLE));
+ CPPUNIT_ASSERT_EQUAL(XLINE_SOLID, rStyleItem.GetValue());
+
+ const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
+ pObj->GetMergedItem(XATTR_LINECOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x3333CC), rColorItem.GetColorValue().GetColor());
+
+ const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
+ pObj->GetMergedItem(XATTR_LINEWIDTH));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(35), rWidthItem.GetValue());
+ }
+
+ // Third shape's line style is defined by direct formatting
+ {
+ SdrObject *const pObj = pPage->GetObj(2);
+ CPPUNIT_ASSERT(pObj);
+
+ const XLineStyleItem& rStyleItem = dynamic_cast<const XLineStyleItem&>(
+ pObj->GetMergedItem(XATTR_LINESTYLE));
+ CPPUNIT_ASSERT_EQUAL(XLINE_SOLID, rStyleItem.GetValue());
+
+ const XLineColorItem& rColorItem = dynamic_cast<const XLineColorItem&>(
+ pObj->GetMergedItem(XATTR_LINECOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x7030A0), rColorItem.GetColorValue().GetColor());
+
+ const XLineWidthItem& rWidthItem = dynamic_cast<const XLineWidthItem&>(
+ pObj->GetMergedItem(XATTR_LINEWIDTH));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(176), rWidthItem.GetValue());
+ }
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT();
commit 4c0f2b6b931aa627ae63996e4d1bd1d3fa7d8b35
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Fri Nov 28 19:57:58 2014 +0100
bnc#904423: Text(box) is rendered white on white when it is not
The problem was that the background color defined by theme
was not imported correctly, because the different fill
style comes from different sources (master slide, theme,
direct formatting) were applied on the shape in wrong order.
To solve this we need to store master slide defined fill style
in a different variable so theme style can be applied after master
slide defined style but before direct formatting.
(cherry picked from commit 81cd386facedfbb15be6dffc10351262abf733f3)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
Conflicts:
sd/qa/unit/import-tests.cxx
Change-Id: I99ea981858b9fa391915570187c8ddfdf2be1f7a
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 1f0411a..b36584a 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -250,6 +250,7 @@ protected:
TextBodyPtr mpTextBody;
LinePropertiesPtr mpLinePropertiesPtr;
FillPropertiesPtr mpFillPropertiesPtr;
+ FillPropertiesPtr mpShapeRefFillPropPtr;
GraphicPropertiesPtr mpGraphicPropertiesPtr;
CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
table::TablePropertiesPtr mpTablePropertiesPtr;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 21a5597..56f3dc0 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -94,6 +94,7 @@ Shape::Shape( const sal_Char* pServiceName, bool bDefaultHeight )
: mbIsChild( false )
, mpLinePropertiesPtr( new LineProperties )
, mpFillPropertiesPtr( new FillProperties )
+, mpShapeRefFillPropPtr( new FillProperties )
, mpGraphicPropertiesPtr( new GraphicProperties )
, mpCustomShapePropertiesPtr( new CustomShapeProperties )
, mp3DPropertiesPtr( new Shape3DProperties )
@@ -123,6 +124,7 @@ Shape::Shape( const ShapePtr& pSourceShape )
, mpTextBody(pSourceShape->mpTextBody)
, mpLinePropertiesPtr( pSourceShape->mpLinePropertiesPtr )
, mpFillPropertiesPtr( pSourceShape->mpFillPropertiesPtr )
+, mpShapeRefFillPropPtr( pSourceShape->mpShapeRefFillPropPtr )
, mpGraphicPropertiesPtr( pSourceShape->mpGraphicPropertiesPtr )
, mpCustomShapePropertiesPtr( pSourceShape->mpCustomShapePropertiesPtr )
, mpTablePropertiesPtr( pSourceShape->mpTablePropertiesPtr )
@@ -303,7 +305,7 @@ void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText )
mpTextBody.reset();
maShapeProperties = rReferencedShape.maShapeProperties;
mpLinePropertiesPtr = LinePropertiesPtr( new LineProperties( *rReferencedShape.mpLinePropertiesPtr.get() ) );
- mpFillPropertiesPtr = FillPropertiesPtr( new FillProperties( *rReferencedShape.mpFillPropertiesPtr.get() ) );
+ mpShapeRefFillPropPtr = FillPropertiesPtr( new FillProperties( *rReferencedShape.mpFillPropertiesPtr.get() ) );
mpCustomShapePropertiesPtr = CustomShapePropertiesPtr( new CustomShapeProperties( *rReferencedShape.mpCustomShapePropertiesPtr.get() ) );
mpTablePropertiesPtr = table::TablePropertiesPtr( rReferencedShape.mpTablePropertiesPtr.get() ? new table::TableProperties( *rReferencedShape.mpTablePropertiesPtr.get() ) : NULL );
mpEffectPropertiesPtr = EffectPropertiesPtr( new EffectProperties( *rReferencedShape.mpEffectPropertiesPtr.get() ) );
@@ -582,6 +584,9 @@ Reference< XShape > Shape::createAndInsert(
// TODO: use ph color when applying effect properties
//sal_Int32 nEffectPhClr = -1;
+ // First apply reference shape's properties (shape on the master slide)
+ aFillProperties.assignUsed( *mpShapeRefFillPropPtr );
+
if( pTheme )
{
if( const ShapeStyleRef* pLineRef = getShapeStyleRef( XML_lnRef ) )
diff --git a/sd/qa/unit/data/pptx/bnc904423.pptx b/sd/qa/unit/data/pptx/bnc904423.pptx
new file mode 100644
index 0000000..618ad1b
Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc904423.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index ede33d6..b92b475 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -92,6 +92,7 @@ public:
void testCreationDate();
void testBnc584721_4();
void testFdo79731();
+ void testBnc904423();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout);
@@ -125,6 +126,7 @@ public:
CPPUNIT_TEST(testCreationDate);
CPPUNIT_TEST(testBnc584721_4);
CPPUNIT_TEST(testFdo79731);
+ CPPUNIT_TEST(testBnc904423);
CPPUNIT_TEST_SUITE_END();
};
@@ -1116,6 +1118,58 @@ void SdFiltersTest::testFdo79731()
xDocShRef->DoClose();
}
+void SdFiltersTest::testBnc904423()
+{
+ // Here the problem was that different fill properties were applied in wrong order on the shape
+ // Right order: 1) master slide fill style, 2) theme, 3) direct formatting
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("sd/qa/unit/data/pptx/bnc904423.pptx"));
+
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+ const SdrPage *pPage = pDoc->GetPage(1);
+ CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+
+ // First shape's background color is defined on master slide
+ {
+ SdrObject *const pObj = pPage->GetObj(0);
+ CPPUNIT_ASSERT(pObj);
+
+ const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
+ pObj->GetMergedItem(XATTR_FILLSTYLE));
+ CPPUNIT_ASSERT_EQUAL(XFILL_SOLID, rStyleItem.GetValue());
+ const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
+ pObj->GetMergedItem(XATTR_FILLCOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x00CC99), rColorItem.GetColorValue().GetColor());
+ }
+
+ // Second shape's background color is defined by theme
+ {
+ SdrObject *const pObj = pPage->GetObj(1);
+ CPPUNIT_ASSERT(pObj);
+
+ const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
+ pObj->GetMergedItem(XATTR_FILLSTYLE));
+ CPPUNIT_ASSERT_EQUAL(XFILL_SOLID, rStyleItem.GetValue());
+ const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
+ pObj->GetMergedItem(XATTR_FILLCOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0x3333CC), rColorItem.GetColorValue().GetColor());
+ }
+
+ // Third shape's background color is defined by direct formatting
+ {
+ SdrObject *const pObj = pPage->GetObj(2);
+ CPPUNIT_ASSERT(pObj);
+
+ const XFillStyleItem& rStyleItem = dynamic_cast<const XFillStyleItem&>(
+ pObj->GetMergedItem(XATTR_FILLSTYLE));
+ CPPUNIT_ASSERT_EQUAL(XFILL_SOLID, rStyleItem.GetValue());
+ const XFillColorItem& rColorItem = dynamic_cast<const XFillColorItem&>(
+ pObj->GetMergedItem(XATTR_FILLCOLOR));
+ CPPUNIT_ASSERT_EQUAL(ColorData(0xFF0000), rColorItem.GetColorValue().GetColor());
+ }
+
+ xDocShRef->DoClose();
+}
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
commit 2bc3dec751921984978fd7335c9dbd39a583fc90
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Nov 29 11:43:10 2014 +0100
fdo#72031 RTF import: bogus call to getBestTextEncodingFromLocale()
There were two problems here. First, commit
bbe3627eece0c3486e7ea11f2f13377aaa3a8fed (rtftok: stop sending
sprm:CRgFtc{0,1,2} tokens, 2014-03-05) broke the use-case when the font
encoding is 0, but it's present. Before that commit, we parsed the font
encoding instantly; after that commit we parse it once we have a font
name. If we do that, then we have to have an idea if we have a font
encoding. Given that 0 is a valid encoding, use -1 for the "have no
encoding" case instead.
Second, commit 7839633fb356285652ed96f4bf3f85bcd5b561a4 (fdo#85889
handle pc, pca and mac rtf keywords in writerfilter, 2014-11-24) abused
m_nCurrentEncoding, which is meant to be used within the font table
only. The problem with this is that this way only the first font will
get the encoding, while the spec says it should be used in every context
where there is no other explicit encoding. Fix this by setting the
default encoding for those 3 control words instead -- and consider the
default encoding in getEncoding().
Change-Id: Ia1d71f8ce70f2a53a3770b4840e21362d082e71f
(cherry picked from commit fa15d039e3a553da8500c17190d27169a9477cf2)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
diff --git a/sw/qa/extras/rtfimport/data/fdo72031.rtf b/sw/qa/extras/rtfimport/data/fdo72031.rtf
new file mode 100644
index 0000000..ee589da
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo72031.rtf
@@ -0,0 +1 @@
+{\rtf1\ansi\ansicpg1250\deff0\deflang1038{\fonttbl{\f0\fnil\fcharset2 Symbol;}{\f1\fnil\fcharset238 MS Shell Dlg 2;}}\viewkind4\uc1\pard\f0\fs23\'c5\f1\fs17\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index bf4b176..e3fddac 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -64,7 +64,7 @@ public:
virtual void preTest(const char* filename) SAL_OVERRIDE
{
m_aSavedSettings = Application::GetSettings();
- if (OString(filename) == "fdo48023.rtf")
+ if (OString(filename) == "fdo48023.rtf" || OString(filename) == "fdo72031.rtf")
{
AllSettings aSettings(m_aSavedSettings);
aSettings.SetLanguageTag(LanguageTag("ru"));
@@ -80,7 +80,7 @@ public:
virtual void postTest(const char* filename) SAL_OVERRIDE
{
- if (OString(filename) == "fdo48023.rtf" || OString(filename) == "fdo44211.rtf")
+ if (OString(filename) == "fdo48023.rtf" || OString(filename) == "fdo72031.rtf" || OString(filename) == "fdo44211.rtf")
Application::SetSettings(m_aSavedSettings);
}
@@ -2048,6 +2048,11 @@ DECLARE_RTFIMPORT_TEST(testFdo85889mac, "fdo85889-mac.rtf")
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
+DECLARE_RTFIMPORT_TEST(testFdo72031, "fdo72031.rtf")
+{
+ OUString aExpected("\xc3\x85", 2, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_EQUAL(aExpected, getRun(getParagraph(1), 1)->getString());
+}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 27e0ab2..b61f5a7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -276,7 +276,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_bObject(false),
m_aFontTableEntries(),
m_nCurrentFontIndex(0),
- m_nCurrentEncoding(0),
+ m_nCurrentEncoding(-1),
m_nDefaultFontIndex(-1),
m_aStyleTableEntries(),
m_nCurrentStyleIndex(0),
@@ -639,8 +639,14 @@ rtl_TextEncoding RTFDocumentImpl::getEncoding(int nFontIndex)
{
std::map<int, rtl_TextEncoding>::iterator it = m_aFontEncodings.find(nFontIndex);
if (it != m_aFontEncodings.end())
+ // We have a font encoding associated to this font.
return it->second;
- return msfilter::util::getBestTextEncodingFromLocale(Application::GetSettings().GetLanguageTag().getLocale());
+ else if (m_aDefaultState.nCurrentEncoding != rtl_getTextEncodingFromWindowsCharset(0))
+ // We have a default encoding.
+ return m_aDefaultState.nCurrentEncoding;
+ else
+ // Guess based on locale.
+ return msfilter::util::getBestTextEncodingFromLocale(Application::GetSettings().GetLanguageTag().getLocale());
}
else
return m_pSuperstream->getEncoding(nFontIndex);
@@ -1154,10 +1160,10 @@ void RTFDocumentImpl::text(OUString& rString)
case DESTINATION_FONTENTRY:
{
m_aFontNames[m_nCurrentFontIndex] = aName;
- if (m_nCurrentEncoding > 0)
+ if (m_nCurrentEncoding >= 0)
{
m_aFontEncodings[m_nCurrentFontIndex] = m_nCurrentEncoding;
- m_nCurrentEncoding = 0;
+ m_nCurrentEncoding = -1;
}
m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Font_name, RTFValue::Pointer_t(new RTFValue(aName)));
@@ -2831,16 +2837,16 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252;
break;
case RTF_MAC:
- m_nCurrentEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
- m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
+ m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
+ m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding;
break;
case RTF_PC:
- m_nCurrentEncoding = RTL_TEXTENCODING_IBM_437;
- m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
+ m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_IBM_437;
+ m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding;
break;
case RTF_PCA:
- m_nCurrentEncoding = RTL_TEXTENCODING_IBM_850;
- m_aStates.top().nCurrentEncoding = m_nCurrentEncoding;
+ m_aDefaultState.nCurrentEncoding = RTL_TEXTENCODING_IBM_850;
+ m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding;
break;
case RTF_PLAIN:
{
More information about the Libreoffice-commits
mailing list