[Libreoffice-commits] core.git: 3 commits - svtools/inc sw/qa sw/source
Miklos Vajna
vmiklos at suse.cz
Sun Apr 7 11:24:43 PDT 2013
svtools/inc/svtools/rtfkeywd.hxx | 2 +
sw/qa/extras/rtfexport/data/i120928.rtf | 48 +++++++++++++++++++++++++++
sw/qa/extras/rtfexport/rtfexport.cxx | 23 ++++++++++++
sw/source/filter/ww8/attributeoutputbase.hxx | 3 +
sw/source/filter/ww8/docxattributeoutput.hxx | 3 -
sw/source/filter/ww8/docxexport.cxx | 16 ---------
sw/source/filter/ww8/docxexport.hxx | 3 -
sw/source/filter/ww8/rtfattributeoutput.cxx | 35 +++++++++++++++++++
sw/source/filter/ww8/rtfattributeoutput.hxx | 2 +
sw/source/filter/ww8/rtfexport.cxx | 11 +++++-
sw/source/filter/ww8/wrtww8.cxx | 17 +++++++++
sw/source/filter/ww8/wrtww8.hxx | 2 +
12 files changed, 142 insertions(+), 23 deletions(-)
New commits:
commit 41ac8040ab9d16615f7c0a02e8cbd4faf6cba2e0
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Sun Apr 7 20:24:11 2013 +0200
move BulletDefinitions() to MSWordExportBase to avoid copy&paste
Change-Id: I56b077e978a41668ea274f1e12440d44af80b66f
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 62b80c7..baad6ac 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -597,6 +597,9 @@ public:
( ww8::WW8TableNodeInfoInner * pTableTextNodeInfoInner,
sal_uInt32& rPageSize, bool& rRelBoxSize );
+ /// Exports the definition (image, size) of a single numbering picture bullet.
+ virtual void BulletDefinition(int /*nId*/, const Graphic& /*rGraphic*/, Size /*aSize*/) {}
+
};
#endif // _ATTRIBUTEOUTPUTBASE_HXX_
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 050980e..c044ad8 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -685,8 +685,7 @@ public:
virtual void WriteOutliner(const OutlinerParaObject& rParaObj);
virtual oox::drawingml::DrawingML& GetDrawingML();
- /// Exports the definition (image, size) of a single numbering picture bullet.
- void BulletDefinition(int nId, const Graphic& rGraphic, Size aSize);
+ void BulletDefinition(int nId, const Graphic& rGraphic, Size aSize) SAL_OVERRIDE;
};
#endif // _DOCXATTRIBUTEOUTPUT_HXX_
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index b25b1eb..e04f12d 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -61,7 +61,6 @@
#include <comphelper/string.hxx>
#include <rtl/ustrbuf.hxx>
#include <vcl/font.hxx>
-#include <vcl/svapp.hxx>
using namespace sax_fastparser;
using namespace ::comphelper;
@@ -528,21 +527,6 @@ void DocxExport::WritePostitFields()
}
}
-void DocxExport::BulletDefinitions()
-{
- for (size_t i = 0; i < m_vecBulletPic.size(); ++i)
- {
- const MapMode aMapMode(MAP_TWIP);
- const Graphic& rGraphic = *m_vecBulletPic[i];
- Size aSize(rGraphic.GetPrefSize());
- if (MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit())
- aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMapMode);
- else
- aSize = OutputDevice::LogicToLogic(aSize,rGraphic.GetPrefMapMode(), aMapMode);
- m_pAttrOutput->BulletDefinition(i, rGraphic, aSize);
- }
-}
-
void DocxExport::WriteNumbering()
{
if ( !pUsedNumTbl )
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index d8790f8..16bf73e 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -202,9 +202,6 @@ private:
/// Write word/settings.xml
void WriteSettings();
- /// Write the numbering picture bullets part of word/numbering.xml
- void BulletDefinitions();
-
/// All xml namespaces to be used at the top of any text .xml file (main doc, headers, footers,...)
sax_fastparser::XFastAttributeListRef MainXmlNamespaces( sax_fastparser::FSHelperPtr serializer );
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index c4c6e84..bfcb1ea 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -587,8 +587,7 @@ public:
/// Writes binary data as a hex dump.
static OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream = 0, sal_uInt32 nLimit = 64);
- /// Exports the definition (image, size) of a single numbering picture bullet.
- void BulletDefinition(int nId, const Graphic& rGraphic, Size aSize);
+ void BulletDefinition(int nId, const Graphic& rGraphic, Size aSize) SAL_OVERRIDE;
};
#endif // _RTFATTRIBUTEOUTPUT_HXX_
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index aaf8a5c..c98b780 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -225,21 +225,6 @@ void RtfExport::BuildNumbering()
}
}
-void RtfExport::BulletDefinitions()
-{
- for (size_t i = 0; i < m_vecBulletPic.size(); ++i)
- {
- const MapMode aMapMode(MAP_TWIP);
- const Graphic& rGraphic = *m_vecBulletPic[i];
- Size aSize(rGraphic.GetPrefSize());
- if (MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit())
- aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMapMode);
- else
- aSize = OutputDevice::LogicToLogic(aSize,rGraphic.GetPrefMapMode(), aMapMode);
- m_pAttrOutput->BulletDefinition(i, rGraphic, aSize);
- }
-}
-
void RtfExport::WriteNumbering()
{
SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start");
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index 0481fd6..4f4f24e 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -181,7 +181,6 @@ private:
void WriteFonts();
void WriteStyles();
- void BulletDefinitions();
void WriteMainText();
void WriteInfo();
/// Writes the writer-specific \pgdsctbl group.
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 2cdc3cb..550e1af 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -107,6 +107,7 @@
#include <filter/msfilter/svxmsbas.hxx>
#include <osl/time.h>
#include <rtl/random.h>
+#include <vcl/svapp.hxx>
#include "WW8Sttbf.hxx"
#include "WW8FibData.hxx"
#include "numrule.hxx"//For i120928
@@ -1447,6 +1448,22 @@ int MSWordExportBase::CollectGrfsOfBullets()
return m_vecBulletPic.size();
}
+
+void MSWordExportBase::BulletDefinitions()
+{
+ for (size_t i = 0; i < m_vecBulletPic.size(); ++i)
+ {
+ const MapMode aMapMode(MAP_TWIP);
+ const Graphic& rGraphic = *m_vecBulletPic[i];
+ Size aSize(rGraphic.GetPrefSize());
+ if (MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit())
+ aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMapMode);
+ else
+ aSize = OutputDevice::LogicToLogic(aSize,rGraphic.GetPrefMapMode(), aMapMode);
+ AttrOutput().BulletDefinition(i, rGraphic, aSize);
+ }
+}
+
//Export Graphic of Bullets
void WW8Export::ExportGrfBullet(const SwTxtNode& rNd)
{
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 6e061bc..7d33f29 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -826,6 +826,8 @@ protected:
/// Populates m_vecBulletPic with all the bullet graphics used by numberings.
int CollectGrfsOfBullets();
+ /// Write the numbering picture bullets.
+ void BulletDefinitions();
std::vector<const Graphic*> m_vecBulletPic; ///< Vector to record all the graphics of bullets
public:
commit 386772828680ae123174765715d44f6257cbc75a
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Sun Apr 7 20:23:49 2013 +0200
RTF_LISTPICTURE and RTF_LEVELPICTURE testcase
Change-Id: Ia6838d205ce25a22e2e5e8763f7bf4323c40879a
diff --git a/sw/qa/extras/rtfexport/data/i120928.rtf b/sw/qa/extras/rtfexport/data/i120928.rtf
new file mode 100644
index 0000000..2179a25
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/i120928.rtf
@@ -0,0 +1,48 @@
+{\rtf1
+{\*\listtable
+{\*\listpicture
+{\*\shppict
+{\pict
+{\*\picprop\shplid1027
+{\sp
+{\sn shapeType}
+{\sv 100}
+}
+{\sp
+{\sn geoRight}
+{\sv 1000}
+}
+{\sp
+{\sn geoBottom}
+{\sv 1000}
+}
+}
+\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0
+\picw397\pich397\picwgoal225\pichgoal225\pngblip\bliptag-1521418743
+{\*\blipuid a550fe0982405d70b83855d77707fc10}
+89504e470d0a1a0a0000000d494844520000000f0000000f08030000000c086578000000017352474200aece1ce9000000cc504c5445fff7d8c0c0c0ffd013ff
+d427ffd83bffdf620000005251ff7878ff8c8bff9f9effc5c5fffff0b0fff3c40504ff2c2bfffff4c4fff8d8ffefb0fff3c5ffe889fff0b1ffdadaffbfbfffb1
+b1ffa3a3ff8787ff7979ffd73bffe062ffcfcfffb3b3ffa6a6ff9897ffc4c4ffa8a7ff9a9aff8c8cff7170ff6262ffadadff9192ff8483ff7576ff5a5aff4c4c
+ffa2a2ff8686ff7877ff6a6aff4e4eff4140ff9696ff7a7aff6d6dff5e5fffd0149f9fffc6c5ff7977ff8b8bffffe88affe7897978ff7877ff5252ff2c2aff2b
+2bff58b516360000000c636d50504a436d7030373132020101068aba14ce0000000274524e53ff00e5b7304a000000824944415418955dcf3d0b82000004501f
+d49863e0d2d0d4140d46463f3f212a706b6a6a88700b0495246928fbbaedc10d77043fd1b9df7c4c940bd585a7177b519e643a8324ebb97e396cb5d7779fb056
+08c4b08fe48b4353084cc151457cb73101a738b5dc521a834b9c82d208e7afbd4350ccd7929dd9e6b57fa05add64caff3f0fdbb52a2460a505160000000049454e44ae426082}
+}
+}
+{\list\listtemplateid734824854
+{\listlevel\levelnfc23\leveljc0
+\levelfollow0\levelstartat1
+{\leveltext\'01\u-3913 ?;}
+{\levelnumbers;}
+\f3\levelpicture0\fi-360\li720\lin720 }
+\listid1181772884}
+}
+{\*\listoverridetable
+{\listoverride\listid1181772884\listoverridecount0\ls1}
+}
+\pard\plain \ltrpar
+\ql \fi-360\li720\ri0\ls1\rin0\lin720\itap0 \rtlch \af40\afs24\alang1081 \ltrch
+{\rtlch \af40 \ltrch \hich\af0\dbch\af40\loch\f0 A}
+{\rtlch \af40 \ltrch
+\par }
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index cd153fc..6d8fd6f 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -74,6 +74,7 @@ public:
void testFdo30983();
void testPlaceholder();
void testMnor();
+ void testI120928();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -122,6 +123,7 @@ void Test::run()
{"fdo30983.rtf", &Test::testFdo30983},
{"placeholder.odt", &Test::testPlaceholder},
{"mnor.rtf", &Test::testMnor},
+ {"i120928.rtf", &Test::testI120928},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -516,6 +518,27 @@ void Test::testMnor()
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
}
+void Test::testI120928()
+{
+ // \listpicture and \levelpicture0 was ignored, leading to missing graphic bullet in numbering.
+ 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
+
+ bool bIsGraphic = false;
+ for (int i = 0; i < aProps.getLength(); ++i)
+ {
+ const beans::PropertyValue& rProp = aProps[i];
+
+ if (rProp.Name == "NumberingType")
+ CPPUNIT_ASSERT_EQUAL(style::NumberingType::BITMAP, rProp.Value.get<sal_Int16>());
+ else if (rProp.Name == "GraphicURL")
+ bIsGraphic = true;
+ }
+ CPPUNIT_ASSERT_EQUAL(true, bIsGraphic);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
commit 92096d634ab93b42bb9ed6e634b2101452b2a609
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Sun Apr 7 20:22:33 2013 +0200
export RTF_LISTPICTURE and RTF_LEVELPICTURE
Change-Id: I5aac0e49013ce0f4b2e8e227bf4a6b61138884d4
diff --git a/svtools/inc/svtools/rtfkeywd.hxx b/svtools/inc/svtools/rtfkeywd.hxx
index 52c18f0..cf4e908 100644
--- a/svtools/inc/svtools/rtfkeywd.hxx
+++ b/svtools/inc/svtools/rtfkeywd.hxx
@@ -1204,6 +1204,8 @@
#define LO_STRING_SVTOOLS_RTF_MMATH "\\mmath"
#define LO_STRING_SVTOOLS_RTF_MMATHPICT "\\mmathPict"
#define LO_STRING_SVTOOLS_RTF_MNOR "\\mnor"
+#define LO_STRING_SVTOOLS_RTF_LISTPICTURE "\\listpicture"
+#define LO_STRING_SVTOOLS_RTF_LEVELPICTURE "\\levelpicture"
#endif // _RTFKEYWD_HXX
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index ce0c1e0..5d95a56 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1326,7 +1326,7 @@ void RtfAttributeOutput::NumberingLevel( sal_uInt8 nLevel,
sal_Int16 nFirstLineIndex,
sal_Int16 /*nListTabPos*/,
const String &rNumberingString,
- const SvxBrushItem* /*pBrush*/)
+ const SvxBrushItem* pBrush)
{
SAL_INFO("sw.rtf", OSL_THIS_FUNC);
@@ -1362,6 +1362,17 @@ void RtfAttributeOutput::NumberingLevel( sal_uInt8 nLevel,
m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LEVELJC;
m_rExport.OutULong( nVal );
+ // bullet
+ if (nNumberingType == SVX_NUM_BITMAP && pBrush)
+ {
+ int nIndex = m_rExport.GetGrfIndex(*pBrush);
+ if (nIndex != -1)
+ {
+ m_rExport.Strm() << LO_STRING_SVTOOLS_RTF_LEVELPICTURE;
+ m_rExport.OutULong(nIndex);
+ }
+ }
+
m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT;
m_rExport.OutULong( nStart );
@@ -3544,4 +3555,26 @@ void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const S
m_rExport.Strm() << m_rExport.sNewLine;
}
+void RtfAttributeOutput::BulletDefinition(int /*nId*/, const Graphic& rGraphic, Size aSize)
+{
+ m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT;
+ m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_PICT OOO_STRING_SVTOOLS_RTF_PNGBLIP;
+
+ m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_PICWGOAL;
+ m_rExport.OutULong(aSize.Width());
+ m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_PICHGOAL;
+ m_rExport.OutULong(aSize.Height());
+
+ m_rExport.Strm() << RtfExport::sNewLine;
+ const sal_uInt8* pGraphicAry = 0;
+ SvMemoryStream aStream;
+ if (GraphicConverter::Export(aStream, rGraphic, CVT_PNG) != ERRCODE_NONE)
+ SAL_WARN("sw.rtf", "failed to export the numbering picture bullet");
+ aStream.Seek(STREAM_SEEK_TO_END);
+ sal_uInt32 nSize = aStream.Tell();
+ pGraphicAry = (sal_uInt8*)aStream.GetData();
+ RtfAttributeOutput::WriteHex(pGraphicAry, nSize, &m_rExport.Strm());
+ m_rExport.Strm() << "}}"; // pict, shppict
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 5038f32..c4c6e84 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -586,6 +586,9 @@ public:
/// Writes binary data as a hex dump.
static OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream = 0, sal_uInt32 nLimit = 64);
+
+ /// Exports the definition (image, size) of a single numbering picture bullet.
+ void BulletDefinition(int nId, const Graphic& rGraphic, Size aSize);
};
#endif // _RTFATTRIBUTEOUTPUT_HXX_
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index cb769c7..aaf8a5c 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -57,6 +57,7 @@
#include <svtools/rtfkeywd.hxx>
#include <filter/msfilter/rtfutil.hxx>
#include <unotools/configmgr.hxx>
+#include <vcl/svapp.hxx>
#if OSL_DEBUG_LEVEL > 1
#include <iostream>
@@ -171,7 +172,7 @@ void RtfExport::AppendBookmark( const OUString& rName, bool /*bSkip*/ )
//For i120928,to export graphic of bullet for RTF filter
void RtfExport::ExportGrfBullet(const SwTxtNode&)
{
- SAL_INFO("sw.rtf", "TODO: " << OSL_THIS_FUNC);
+ // Noop, would be too late, see WriteNumbering() instead.
}
void RtfExport::WriteChar( sal_Unicode )
@@ -224,6 +225,21 @@ void RtfExport::BuildNumbering()
}
}
+void RtfExport::BulletDefinitions()
+{
+ for (size_t i = 0; i < m_vecBulletPic.size(); ++i)
+ {
+ const MapMode aMapMode(MAP_TWIP);
+ const Graphic& rGraphic = *m_vecBulletPic[i];
+ Size aSize(rGraphic.GetPrefSize());
+ if (MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit())
+ aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, aMapMode);
+ else
+ aSize = OutputDevice::LogicToLogic(aSize,rGraphic.GetPrefMapMode(), aMapMode);
+ m_pAttrOutput->BulletDefinition(i, rGraphic, aSize);
+ }
+}
+
void RtfExport::WriteNumbering()
{
SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start");
@@ -232,6 +248,14 @@ void RtfExport::WriteNumbering()
return; // no numbering is used
Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_LISTTABLE;
+
+ CollectGrfsOfBullets();
+ if (!m_vecBulletPic.empty())
+ Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << LO_STRING_SVTOOLS_RTF_LISTPICTURE;
+ BulletDefinitions();
+ if (!m_vecBulletPic.empty())
+ Strm() << '}';
+
AbstractNumberingDefinitions();
Strm() << '}';
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index 4f4f24e..0481fd6 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -181,6 +181,7 @@ private:
void WriteFonts();
void WriteStyles();
+ void BulletDefinitions();
void WriteMainText();
void WriteInfo();
/// Writes the writer-specific \pgdsctbl group.
More information about the Libreoffice-commits
mailing list