[Libreoffice-commits] core.git: 8 commits - include/test oox/source sd/qa sfx2/source test/source
Tomaž Vajngerl
tomaz.vajngerl at collabora.com
Thu Aug 28 04:47:39 PDT 2014
include/test/xmltesttools.hxx | 2
oox/source/export/drawingml.cxx | 318 +++++++++++++++---------------
oox/source/export/shapes.cxx | 44 +---
sd/qa/unit/data/bnc822347_EmptyBullet.odp |binary
sd/qa/unit/export-tests.cxx | 37 +++
sd/qa/unit/sdmodeltestbase.hxx | 12 -
sfx2/source/doc/objstor.cxx | 83 +++----
test/source/xmltesttools.cxx | 2
8 files changed, 269 insertions(+), 229 deletions(-)
New commits:
commit 14fa2698f2f651343675761e75be01b84c4c5ff1
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Aug 28 13:32:38 2014 +0200
bnc#822347: if number type is not set, skip numbering
If numbering is detected then (level is > 0) and the number type
is not set, the defult bullet symbol is written. This is not
correct as the default should be SVX_NUM_NUMBER_NONE which should
skip numbering or set it to none. With this change the numbering
is skipped (as in MSO).
Change-Id: I8d08a6325509c7bd6f96f64c8d29e5f3045458ca
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 12ec0a5..caf6d04 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1560,6 +1560,9 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
}
}
+ if (nNumberingType == SVX_NUM_NUMBER_NONE)
+ return;
+
if( !aGraphicURL.isEmpty() )
{
OUString sRelId = WriteImage( aGraphicURL );
commit a870b029a072567cff06efb61fe915c621f178b4
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Aug 28 13:04:32 2014 +0200
bnc#822347: Test for bullet character defined as '' - empty char.
Change-Id: Ie771a5e53f04c0cd307d24a8bfc3ab7bc9a3094a
diff --git a/sd/qa/unit/data/bnc822347_EmptyBullet.odp b/sd/qa/unit/data/bnc822347_EmptyBullet.odp
new file mode 100644
index 0000000..73f7e02
Binary files /dev/null and b/sd/qa/unit/data/bnc822347_EmptyBullet.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index fa29403..0c856fd 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -8,6 +8,7 @@
*/
#include "sdmodeltestbase.hxx"
+#include "Outliner.hxx"
#include <svl/stritem.hxx>
#include <editeng/editobj.hxx>
@@ -21,8 +22,11 @@
#include <editeng/numitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/postitem.hxx>
+#include <editeng/bulletitem.hxx>
+
#include <rsc/rscsfx.hxx>
+#include <svx/svdoutl.hxx>
#include <svx/svdotext.hxx>
#include <svx/svdoashp.hxx>
#include <svx/svdograf.hxx>
@@ -64,6 +68,7 @@ public:
void testN828390();
void testBnc880763();
void testBnc862510_5();
+ void testBnc822347_EmptyBullet();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testN821567);
@@ -76,6 +81,7 @@ public:
CPPUNIT_TEST(testN828390);
CPPUNIT_TEST(testBnc880763);
CPPUNIT_TEST(testBnc862510_5);
+ CPPUNIT_TEST(testBnc822347_EmptyBullet);
CPPUNIT_TEST_SUITE_END();
};
@@ -420,6 +426,37 @@ void SdFiltersTest::testBnc862510_5()
xDocShRef->DoClose();
}
+// In numbering a bullet could be defined as empty (no character).
+// When exporting to OOXML make sure that the bullet is ignored and
+// not written into the file.
+void SdFiltersTest::testBnc822347_EmptyBullet()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/bnc822347_EmptyBullet.odp"), ODP);
+ xDocShRef = saveAndReload(xDocShRef, PPTX);
+
+ SdDrawDocument* pDoc = xDocShRef->GetDoc();
+ SdrOutliner* pOutliner = pDoc->GetInternalOutliner();
+ const SdrPage* pPage = pDoc->GetPage(1);
+ SdrObject* pObject = pPage->GetObj(0);
+ SdrTextObj* pTextObject = dynamic_cast<SdrTextObj*>(pObject);
+ CPPUNIT_ASSERT(pTextObject);
+
+ OutlinerParaObject* pOutlinerParagraphObject = pTextObject->GetOutlinerParaObject();
+ const EditTextObject& aEdit = pOutlinerParagraphObject->GetTextObject();
+
+ OUString sText = aEdit.GetText(0);
+ CPPUNIT_ASSERT_EQUAL(OUString("M3 Feature Test"), sText);
+
+ pOutliner->SetText(*pOutlinerParagraphObject);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pOutliner->GetParagraphCount());
+
+ const sal_Int16 nDepth = pOutliner->GetDepth(0);
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(-1), nDepth); // depth >= 0 means that the paragraph has bullets enabled
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT();
commit 3f1f2d71009776072078897293b6b222492c102f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Aug 28 13:00:57 2014 +0200
drawingml: remove AUTONUM macro, unneded checks
Change-Id: Ie0ad7ed9df9d0d1b19fa09b3a4b93a5cbd6b41c6
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e8c06f3..12ec0a5 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1386,11 +1386,12 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun )
if( sText.isEmpty()) {
Reference< XPropertySet > xPropSet( rRun, UNO_QUERY );
- try {
- if( !xPropSet.is() || !( xPropSet->getPropertyValue( "PlaceholderText" ) >>= sText ) )
- return;
- if( sText.isEmpty() )
- return;
+ try
+ {
+ if( !xPropSet.is() || !( xPropSet->getPropertyValue( "PlaceholderText" ) >>= sText ) )
+ return;
+ if( sText.isEmpty() )
+ return;
}
catch (const Exception &) {
return;
@@ -1422,44 +1423,45 @@ void DrawingML::WriteRun( Reference< XTextRange > rRun )
mpFS->endElementNS( XML_a, XML_r );
}
-#define AUTONUM(x) \
- if( bPBoth ) \
- pAutoNumType = #x "ParenBoth"; \
- else if( bPBehind ) \
- pAutoNumType = #x "ParenR"; \
- else if( bSDot ) \
- pAutoNumType = #x "Period";
-
-inline static const char* GetAutoNumType( sal_Int16 nNumberingType, bool bSDot, bool bPBehind, bool bPBoth )
+OUString GetAutoNumType(sal_Int16 nNumberingType, bool bSDot, bool bPBehind, bool bPBoth)
{
- const char* pAutoNumType = NULL;
+ OUString sPrefixSuffix;
+
+ if (bPBoth)
+ sPrefixSuffix = "ParenBoth";
+ else if (bPBehind)
+ sPrefixSuffix = "ParenR";
+ else if (bSDot)
+ sPrefixSuffix = "Period";
switch( (SvxExtNumType)nNumberingType )
- {
+ {
case SVX_NUM_CHARS_UPPER_LETTER_N :
case SVX_NUM_CHARS_UPPER_LETTER :
- AUTONUM( alphaUc );
- break;
+ return OUString("alphaUc") + sPrefixSuffix;
+
case SVX_NUM_CHARS_LOWER_LETTER_N :
case SVX_NUM_CHARS_LOWER_LETTER :
- AUTONUM( alphaLc );
- break;
+ return OUString("alphaLc") + sPrefixSuffix;
+
case SVX_NUM_ROMAN_UPPER :
- AUTONUM( romanUc );
- break;
+ return OUString("romanUc") + sPrefixSuffix;
+
case SVX_NUM_ROMAN_LOWER :
- AUTONUM( romanLc );
- break;
+ return OUString("romanLc") + sPrefixSuffix;
+
case SVX_NUM_ARABIC :
- AUTONUM( arabic )
+ {
+ if (sPrefixSuffix.isEmpty())
+ return OUString("arabicPlain");
else
- pAutoNumType = "arabicPlain";
- break;
+ return OUString("arabic") + sPrefixSuffix;
+ }
default:
break;
- }
+ }
- return pAutoNumType;
+ return OUString();
}
void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sal_Int16 nLevel )
@@ -1520,7 +1522,6 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
else if ( aPropName == "BulletChar" )
{
aBulletChar = OUString ( *( (OUString*)pValue ) )[ 0 ];
- //printf ("bullet char: %d\n", aBulletChar.getStr());
}
else if ( aPropName == "BulletFont" )
{
@@ -1549,7 +1550,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
if ( pPropValue[ i ].Value.getValueType() == cppu::UnoType<awt::Size>::get())
{
// don't cast awt::Size to Size as on 64-bits they are not the same.
- ::com::sun::star::awt::Size aSize;
+ css::awt::Size aSize;
pPropValue[ i ].Value >>= aSize;
//aBuGraSize.nA = aSize.Width;
//aBuGraSize.nB = aSize.Height;
@@ -1559,36 +1560,37 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
}
}
- const char* pAutoNumType = GetAutoNumType( nNumberingType, bSDot, bPBehind, bPBoth );
+ if( !aGraphicURL.isEmpty() )
+ {
+ OUString sRelId = WriteImage( aGraphicURL );
- if( nLevel >= 0 )
+ mpFS->startElementNS( XML_a, XML_buBlip, FSEND );
+ mpFS->singleElementNS( XML_a, XML_blip, FSNS( XML_r, XML_embed ), USS( sRelId ), FSEND );
+ mpFS->endElementNS( XML_a, XML_buBlip );
+ }
+ else
{
- if( !aGraphicURL.isEmpty() )
- {
- OUString sRelId = WriteImage( aGraphicURL );
+ if( nBulletRelSize && nBulletRelSize != 100 )
+ mpFS->singleElementNS( XML_a, XML_buSzPct,
+ XML_val, IS( std::max( (sal_Int32)25000, std::min( (sal_Int32)400000, 1000*( (sal_Int32)nBulletRelSize ) ) ) ), FSEND );
+ if( bHasFontDesc )
+ mpFS->singleElementNS( XML_a, XML_buFont,
+ XML_typeface, OUStringToOString( aFontDesc.Name, RTL_TEXTENCODING_UTF8 ).getStr(),
+ XML_charset, (aFontDesc.CharSet == awt::CharSet::SYMBOL) ? "2" : NULL,
+ FSEND );
- mpFS->startElementNS( XML_a, XML_buBlip, FSEND );
- mpFS->singleElementNS( XML_a, XML_blip, FSNS( XML_r, XML_embed ), USS( sRelId ), FSEND );
- mpFS->endElementNS( XML_a, XML_buBlip );
+ OUString pAutoNumType = GetAutoNumType( nNumberingType, bSDot, bPBehind, bPBoth );
+
+ if (!pAutoNumType.isEmpty())
+ {
+ mpFS->singleElementNS(XML_a, XML_buAutoNum,
+ XML_type, OUStringToOString(pAutoNumType, RTL_TEXTENCODING_UTF8).getStr(),
+ FSEND);
}
else
{
- if( nBulletRelSize && nBulletRelSize != 100 )
- mpFS->singleElementNS( XML_a, XML_buSzPct,
- XML_val, IS( std::max( (sal_Int32)25000, std::min( (sal_Int32)400000, 1000*( (sal_Int32)nBulletRelSize ) ) ) ), FSEND );
- if( bHasFontDesc )
- mpFS->singleElementNS( XML_a, XML_buFont,
- XML_typeface, OUStringToOString( aFontDesc.Name, RTL_TEXTENCODING_UTF8 ).getStr(),
- XML_charset, (aFontDesc.CharSet == awt::CharSet::SYMBOL) ? "2" : NULL,
- FSEND );
-
- if( pAutoNumType )
- mpFS->singleElementNS( XML_a, XML_buAutoNum, XML_type, pAutoNumType, FSEND );
- else
- {
- aBulletChar = SubstituteBullet( aBulletChar, aFontDesc );
- mpFS->singleElementNS( XML_a, XML_buChar, XML_char, USS( OUString( aBulletChar ) ), FSEND );
- }
+ aBulletChar = SubstituteBullet( aBulletChar, aFontDesc );
+ mpFS->singleElementNS(XML_a, XML_buChar, XML_char, USS( OUString( aBulletChar ) ), FSEND);
}
}
}
commit 2fa3aed1cb779b15773d98af23a3f705dc949f05
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Thu Aug 28 12:54:35 2014 +0200
parseXml should return xmlDocPtr instead of htmlDocPtr
Change-Id: Ia9fb79ea40ca840d7328a078e747ad64a63d18f1
diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx
index 058bbc2..6709c1c 100644
--- a/include/test/xmltesttools.hxx
+++ b/include/test/xmltesttools.hxx
@@ -35,7 +35,7 @@ protected:
XmlTestTools();
virtual ~XmlTestTools();
- htmlDocPtr parseXml(utl::TempFile& aTempFile);
+ xmlDocPtr parseXml(utl::TempFile& aTempFile);
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx);
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 20cdacc..a5d1133 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -29,8 +29,13 @@
using namespace ::com::sun::star;
-struct FileFormat {
- const char* pName; const char* pFilterName; const char* pTypeName; const char* pUserData; sal_uLong nFormatType;
+struct FileFormat
+{
+ const char* pName;
+ const char* pFilterName;
+ const char* pTypeName;
+ const char* pUserData;
+ sal_uLong nFormatType;
};
// These values are taken from "Flags" in filter/source/config/fragments/filters/*
@@ -47,7 +52,8 @@ pFilterName: <node oor:Name="...">
pTypeName: <prop oor:Name="UIName">...</prop>
nFormatType: <prop oor:name="Flags">...</prop>
*/
-FileFormat aFileFormats[] = {
+FileFormat aFileFormats[] =
+{
{ "odp", "impress8", "impress8", "", ODP_FORMAT_TYPE },
{ "ppt", "MS PowerPoint 97", "Microsoft PowerPoint 97/2000/XP/2003", "sdfilt", PPT_FORMAT_TYPE },
{ "pptx", "Impress MS PowerPoint 2007 XML", "MS PowerPoint 2007 XML", "", PPTX_FORMAT_TYPE },
diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx
index 129e286..d70ee86 100644
--- a/test/source/xmltesttools.cxx
+++ b/test/source/xmltesttools.cxx
@@ -17,7 +17,7 @@ XmlTestTools::XmlTestTools()
XmlTestTools::~XmlTestTools()
{}
-htmlDocPtr XmlTestTools::parseXml(utl::TempFile& aTempFile)
+xmlDocPtr XmlTestTools::parseXml(utl::TempFile& aTempFile)
{
SvFileStream aFileStream(aTempFile.GetURL(), STREAM_READ);
return parseXmlStream(&aFileStream);
commit c75bddd73b125453b1d3f355195ad964bf27af28
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Wed Aug 27 17:04:02 2014 +0200
reduce nesting in WriteParagraphNumbering
Change-Id: I49a3c3449d8354ce5e2a6e42414fbefdfc489388
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0df7e6c..e8c06f3 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1464,115 +1464,133 @@ inline static const char* GetAutoNumType( sal_Int16 nNumberingType, bool bSDot,
void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sal_Int16 nLevel )
{
- if( nLevel >= 0 && GETA( NumberingRules ) )
- {
- Reference< XIndexAccess > rXIndexAccess;
+ if( nLevel < 0 || !GETA( NumberingRules ) )
+ return;
+
+ Reference< XIndexAccess > rXIndexAccess;
+
+ if (!(mAny >>= rXIndexAccess) || nLevel >= rXIndexAccess->getCount())
+ return;
+
+ DBG(fprintf (stderr, "numbering rules\n"));
+
+ Sequence<PropertyValue> aPropertySequence;
+ rXIndexAccess->getByIndex(nLevel) >>= aPropertySequence;
+
+ if (!aPropertySequence.hasElements())
+ return;
+
+ sal_Int32 nPropertyCount = aPropertySequence.getLength();
+
+ const PropertyValue* pPropValue = aPropertySequence.getArray();
+
+ sal_Int16 nNumberingType = SVX_NUM_NUMBER_NONE;
+ bool bSDot = false;
+ bool bPBehind = false;
+ bool bPBoth = false;
+ sal_Unicode aBulletChar = 0x2022; // a bullet
+ awt::FontDescriptor aFontDesc;
+ bool bHasFontDesc = false;
+ OUString aGraphicURL;
+ sal_Int16 nBulletRelSize = 0;
- if ( ( mAny >>= rXIndexAccess ) && nLevel < rXIndexAccess->getCount() )
+ for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
+ {
+ const void* pValue = pPropValue[ i ].Value.getValue();
+ if ( pValue )
{
- DBG(fprintf (stderr, "numbering rules\n"));
-
- Sequence< PropertyValue > aPropertySequence;
- rXIndexAccess->getByIndex( nLevel ) >>= aPropertySequence;
-
- const PropertyValue* pPropValue = aPropertySequence.getArray();
-
- sal_Int32 nPropertyCount = aPropertySequence.getLength();
-
- if ( nPropertyCount ) {
-
- sal_Int16 nNumberingType = SVX_NUM_NUMBER_NONE;
- bool bSDot = false;
- bool bPBehind = false;
- bool bPBoth = false;
- sal_Unicode aBulletChar = 0x2022; // a bullet
- awt::FontDescriptor aFontDesc;
- bool bHasFontDesc = false;
- OUString aGraphicURL;
- sal_Int16 nBulletRelSize = 0;
-
- for ( sal_Int32 i = 0; i < nPropertyCount; i++ ) {
- const void* pValue = pPropValue[ i ].Value.getValue();
- if ( pValue ) {
- OUString aPropName( pPropValue[ i ].Name );
- DBG(fprintf (stderr, "pro name: %s\n", OUStringToOString( aPropName, RTL_TEXTENCODING_UTF8 ).getStr()));
- if ( aPropName == "NumberingType" )
- nNumberingType = *( (sal_Int16*)pValue );
- else if ( aPropName == "Prefix" ) {
- if( *(OUString*)pValue == ")")
- bPBoth = true;
- } else if ( aPropName == "Suffix" ) {
- if( *(OUString*)pValue == ".")
- bSDot = true;
- else if( *(OUString*)pValue == ")")
- bPBehind = true;
- } else if ( aPropName == "BulletChar" )
- {
- aBulletChar = OUString ( *( (OUString*)pValue ) )[ 0 ];
- //printf ("bullet char: %d\n", aBulletChar.getStr());
- }
- else if ( aPropName == "BulletFont" )
- {
- aFontDesc = *( (awt::FontDescriptor*)pValue );
- bHasFontDesc = true;
-
- // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font,
- // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used.
- // Because there might exist a lot of damaged documemts I added this two lines
- // which fixes the bullet problem for the export.
- if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") )
- aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
-
- } else if ( aPropName == "BulletRelSize" ) {
- nBulletRelSize = *( (sal_Int16*)pValue );
- } else if ( aPropName == "GraphicURL" ) {
- aGraphicURL = ( *(OUString*)pValue );
- DBG(fprintf (stderr, "graphic url: %s\n", OUStringToOString( aGraphicURL, RTL_TEXTENCODING_UTF8 ).getStr()));
- } else if ( aPropName == "GraphicSize" )
- {
- if ( pPropValue[ i ].Value.getValueType() == cppu::UnoType<awt::Size>::get())
- {
- // don't cast awt::Size to Size as on 64-bits they are not the same.
- ::com::sun::star::awt::Size aSize;
- pPropValue[ i ].Value >>= aSize;
- //aBuGraSize.nA = aSize.Width;
- //aBuGraSize.nB = aSize.Height;
- DBG(fprintf(stderr, "graphic size: %dx%d\n", int( aSize.Width ), int( aSize.Height )));
- }
- }
- }
- }
+ OUString aPropName( pPropValue[ i ].Name );
+ DBG(fprintf (stderr, "pro name: %s\n", OUStringToOString( aPropName, RTL_TEXTENCODING_UTF8 ).getStr()));
+ if ( aPropName == "NumberingType" )
+ {
+ nNumberingType = *( (sal_Int16*)pValue );
+ }
+ else if ( aPropName == "Prefix" )
+ {
+ if( *(OUString*)pValue == ")")
+ bPBoth = true;
+ }
+ else if ( aPropName == "Suffix" )
+ {
+ if( *(OUString*)pValue == ".")
+ bSDot = true;
+ else if( *(OUString*)pValue == ")")
+ bPBehind = true;
+ }
+ else if ( aPropName == "BulletChar" )
+ {
+ aBulletChar = OUString ( *( (OUString*)pValue ) )[ 0 ];
+ //printf ("bullet char: %d\n", aBulletChar.getStr());
+ }
+ else if ( aPropName == "BulletFont" )
+ {
+ aFontDesc = *( (awt::FontDescriptor*)pValue );
+ bHasFontDesc = true;
- const char* pAutoNumType = GetAutoNumType( nNumberingType, bSDot, bPBehind, bPBoth );
-
- if( nLevel >= 0 ) {
- if( !aGraphicURL.isEmpty() ) {
- OUString sRelId = WriteImage( aGraphicURL );
-
- mpFS->startElementNS( XML_a, XML_buBlip, FSEND );
- mpFS->singleElementNS( XML_a, XML_blip, FSNS( XML_r, XML_embed ), USS( sRelId ), FSEND );
- mpFS->endElementNS( XML_a, XML_buBlip );
- } else {
- if( nBulletRelSize && nBulletRelSize != 100 )
- mpFS->singleElementNS( XML_a, XML_buSzPct,
- XML_val, IS( std::max( (sal_Int32)25000, std::min( (sal_Int32)400000, 1000*( (sal_Int32)nBulletRelSize ) ) ) ), FSEND );
- if( bHasFontDesc )
- mpFS->singleElementNS( XML_a, XML_buFont,
- XML_typeface, OUStringToOString( aFontDesc.Name, RTL_TEXTENCODING_UTF8 ).getStr(),
- XML_charset, (aFontDesc.CharSet == awt::CharSet::SYMBOL) ? "2" : NULL,
- FSEND );
-
- if( pAutoNumType )
- mpFS->singleElementNS( XML_a, XML_buAutoNum, XML_type, pAutoNumType, FSEND );
- else {
- aBulletChar = SubstituteBullet( aBulletChar, aFontDesc );
- mpFS->singleElementNS( XML_a, XML_buChar, XML_char, USS( OUString( aBulletChar ) ), FSEND );
- }
- }
+ // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font,
+ // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used.
+ // Because there might exist a lot of damaged documemts I added this two lines
+ // which fixes the bullet problem for the export.
+ if ( aFontDesc.Name.equalsIgnoreAsciiCase("StarSymbol") )
+ aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252;
+
+ }
+ else if ( aPropName == "BulletRelSize" )
+ {
+ nBulletRelSize = *( (sal_Int16*)pValue );
+ }
+ else if ( aPropName == "GraphicURL" )
+ {
+ aGraphicURL = ( *(OUString*)pValue );
+ DBG(fprintf (stderr, "graphic url: %s\n", OUStringToOString( aGraphicURL, RTL_TEXTENCODING_UTF8 ).getStr()));
+ }
+ else if ( aPropName == "GraphicSize" )
+ {
+ if ( pPropValue[ i ].Value.getValueType() == cppu::UnoType<awt::Size>::get())
+ {
+ // don't cast awt::Size to Size as on 64-bits they are not the same.
+ ::com::sun::star::awt::Size aSize;
+ pPropValue[ i ].Value >>= aSize;
+ //aBuGraSize.nA = aSize.Width;
+ //aBuGraSize.nB = aSize.Height;
+ DBG(fprintf(stderr, "graphic size: %dx%d\n", int( aSize.Width ), int( aSize.Height )));
}
}
}
}
+
+ const char* pAutoNumType = GetAutoNumType( nNumberingType, bSDot, bPBehind, bPBoth );
+
+ if( nLevel >= 0 )
+ {
+ if( !aGraphicURL.isEmpty() )
+ {
+ OUString sRelId = WriteImage( aGraphicURL );
+
+ mpFS->startElementNS( XML_a, XML_buBlip, FSEND );
+ mpFS->singleElementNS( XML_a, XML_blip, FSNS( XML_r, XML_embed ), USS( sRelId ), FSEND );
+ mpFS->endElementNS( XML_a, XML_buBlip );
+ }
+ else
+ {
+ if( nBulletRelSize && nBulletRelSize != 100 )
+ mpFS->singleElementNS( XML_a, XML_buSzPct,
+ XML_val, IS( std::max( (sal_Int32)25000, std::min( (sal_Int32)400000, 1000*( (sal_Int32)nBulletRelSize ) ) ) ), FSEND );
+ if( bHasFontDesc )
+ mpFS->singleElementNS( XML_a, XML_buFont,
+ XML_typeface, OUStringToOString( aFontDesc.Name, RTL_TEXTENCODING_UTF8 ).getStr(),
+ XML_charset, (aFontDesc.CharSet == awt::CharSet::SYMBOL) ? "2" : NULL,
+ FSEND );
+
+ if( pAutoNumType )
+ mpFS->singleElementNS( XML_a, XML_buAutoNum, XML_type, pAutoNumType, FSEND );
+ else
+ {
+ aBulletChar = SubstituteBullet( aBulletChar, aFontDesc );
+ mpFS->singleElementNS( XML_a, XML_buChar, XML_char, USS( OUString( aBulletChar ) ), FSEND );
+ }
+ }
+ }
}
const char* DrawingML::GetAlignment( sal_Int32 nAlignment )
commit 1edf2c0f1b77a8bcafd004a449ff88aa6e7f42f8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Wed Aug 27 16:52:38 2014 +0200
drawingml: Use SVX_NUM_NUMBER_NONE as default numbering type
Change-Id: I159fcf41fdb6c49687004e959d4032aef28678a5
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 97e2dd7..0df7e6c 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1481,7 +1481,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
if ( nPropertyCount ) {
- sal_Int16 nNumberingType = -1;
+ sal_Int16 nNumberingType = SVX_NUM_NUMBER_NONE;
bool bSDot = false;
bool bPBehind = false;
bool bPBoth = false;
commit 64c4a651c8d1f12b3c8de415fa507071e15f3da8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Wed Aug 27 10:27:52 2014 +0200
sanitize "using" and "using namespace" declarations
Change-Id: I0b0cccc2d9cfe721c1ed421e614c4350a6b3dc7c
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 598a330..97e2dd7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -79,27 +79,18 @@
#include <svx/svdoashp.hxx>
#include <svx/unoshape.hxx>
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::drawing;
-using namespace ::com::sun::star::i18n;
-using namespace ::com::sun::star::style;
-using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::uno;
-using ::com::sun::star::beans::PropertyState;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::beans::XPropertyState;
-using ::com::sun::star::container::XEnumeration;
-using ::com::sun::star::container::XEnumerationAccess;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::geometry::IntegerRectangle2D;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::style::LineSpacing;
-using ::com::sun::star::text::XText;
-using ::com::sun::star::text::XTextContent;
-using ::com::sun::star::text::XTextField;
-using ::com::sun::star::text::XTextRange;
+using namespace ::css;
+using namespace ::css::beans;
+using namespace ::css::drawing;
+using namespace ::css::i18n;
+using namespace ::css::style;
+using namespace ::css::text;
+using namespace ::css::uno;
+using namespace ::css::container;
+using namespace ::css::text;
+
+using ::css::geometry::IntegerRectangle2D;
+using ::css::io::XOutputStream;
using ::sax_fastparser::FSHelperPtr;
namespace oox {
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 4389e3e..fc14776 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -76,34 +76,24 @@
#include <svx/unoapi.hxx>
#include <oox/export/chartexport.hxx>
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::drawing;
-using namespace ::com::sun::star::i18n;
-using namespace ::com::sun::star::table;
-using ::com::sun::star::beans::PropertyState;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::beans::XPropertyState;
-using ::com::sun::star::container::XEnumeration;
-using ::com::sun::star::container::XEnumerationAccess;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::document::XExporter;
-using ::com::sun::star::document::XFilter;
-using ::com::sun::star::drawing::FillStyle;
-using ::com::sun::star::graphic::XGraphic;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::lang::XComponent;
-using ::com::sun::star::text::XSimpleText;
-using ::com::sun::star::text::XText;
-using ::com::sun::star::text::XTextContent;
-using ::com::sun::star::text::XTextField;
-using ::com::sun::star::text::XTextRange;
+using namespace ::css;
+using namespace ::css::beans;
+using namespace ::css::uno;
+using namespace ::css::drawing;
+using namespace ::css::i18n;
+using namespace ::css::table;
+using namespace ::css::container;
+using namespace ::css::document;
+using namespace ::css::text;
+
+using ::css::graphic::XGraphic;
+using ::css::io::XOutputStream;
+using ::css::lang::XComponent;
+using ::css::chart2::XChartDocument;
+using ::css::frame::XModel;
+using ::css::sheet::XSpreadsheetDocument;
+
using ::oox::core::XmlFilterBase;
-using ::com::sun::star::chart2::XChartDocument;
-using ::com::sun::star::frame::XModel;
-using ::com::sun::star::sheet::XSpreadsheetDocument;
using ::sax_fastparser::FSHelperPtr;
#define IDS(x) OString(OStringLiteral(#x " ") + OString::number( mnShapeIdMax++ )).getStr()
commit 772323b4a94e18794f9932f34297c26974e17c5a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date: Tue Aug 26 19:02:37 2014 +0200
Reduce nesting / style in thumbnail creation routines
Change-Id: I733b677f4d4c7dfdf6fef531b43e1de36131f55d
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 6e8b659..a79ea8c 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3512,28 +3512,25 @@ bool SfxObjectShell::CopyStoragesOfUnknownMediaType( const uno::Reference< embed
return bResult;
}
-bool SfxObjectShell::GenerateAndStoreThumbnail( bool bEncrypted,
- bool bIsTemplate,
- const uno::Reference< embed::XStorage >& xStor )
+bool SfxObjectShell::GenerateAndStoreThumbnail(bool bEncrypted, bool bIsTemplate, const uno::Reference<embed::XStorage>& xStorage)
{
- bIsInGenerateThumbnail = true;//optimize thumbnail generate and store procedure to improve odt saving performance, i120030
+ //optimize thumbnail generate and store procedure to improve odt saving performance, i120030
+ bIsInGenerateThumbnail = true;
bool bResult = false;
- try {
- uno::Reference< embed::XStorage > xThumbnailStor =
- xStor->openStorageElement( OUString("Thumbnails"),
- embed::ElementModes::READWRITE );
- if ( xThumbnailStor.is() )
+ try
+ {
+ uno::Reference<embed::XStorage> xThumbnailStorage = xStorage->openStorageElement(OUString("Thumbnails"), embed::ElementModes::READWRITE);
+
+ if (xThumbnailStorage.is())
{
- uno::Reference< io::XStream > xStream = xThumbnailStor->openStreamElement(
- OUString("thumbnail.png"),
- embed::ElementModes::READWRITE );
+ uno::Reference<io::XStream> xStream = xThumbnailStorage->openStreamElement(OUString("thumbnail.png"), embed::ElementModes::READWRITE);
if (xStream.is() && WriteThumbnail(bEncrypted, bIsTemplate, xStream))
{
- uno::Reference< embed::XTransactedObject > xTransact( xThumbnailStor, uno::UNO_QUERY_THROW );
- xTransact->commit();
+ uno::Reference<embed::XTransactedObject> xTransactedObject(xThumbnailStorage, uno::UNO_QUERY_THROW);
+ xTransactedObject->commit();
bResult = true;
}
}
@@ -3542,49 +3539,45 @@ bool SfxObjectShell::GenerateAndStoreThumbnail( bool bEncrypted,
{
}
- bIsInGenerateThumbnail = false;//optimize thumbnail generate and store procedure to improve odt saving performance, i120030
+ //optimize thumbnail generate and store procedure to improve odt saving performance, i120030
+ bIsInGenerateThumbnail = false;
return bResult;
}
-bool SfxObjectShell::WriteThumbnail( bool bEncrypted,
- bool bIsTemplate,
- const uno::Reference< io::XStream >& xStream )
+bool SfxObjectShell::WriteThumbnail(bool bEncrypted, bool bIsTemplate, const uno::Reference<io::XStream>& xStream)
{
bool bResult = false;
- if ( xStream.is() )
+ if (!xStream.is())
+ return false;
+
+ try
{
- try {
- uno::Reference< io::XTruncate > xTruncate( xStream->getOutputStream(), uno::UNO_QUERY_THROW );
- xTruncate->truncate();
-
- uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY );
- if ( xSet.is() )
- xSet->setPropertyValue("MediaType",
- uno::makeAny( OUString("image/png") ) );
- if ( bEncrypted )
- {
- sal_uInt16 nResID = GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl(
- OUString::createFromAscii( GetFactory().GetShortName() ),
- bIsTemplate );
- if ( nResID )
- bResult = GraphicHelper::getThumbnailReplacement_Impl(nResID, xStream);
- }
- else
+ uno::Reference<io::XTruncate> xTruncate(xStream->getOutputStream(), uno::UNO_QUERY_THROW);
+ xTruncate->truncate();
+
+ uno::Reference <beans::XPropertySet> xSet(xStream, uno::UNO_QUERY);
+ if (xSet.is())
+ xSet->setPropertyValue("MediaType", uno::makeAny(OUString("image/png")));
+ if (bEncrypted)
+ {
+ OUString sFactoryName = OUString::createFromAscii(GetFactory().GetShortName());
+ sal_uInt16 nResID = GraphicHelper::getThumbnailReplacementIDByFactoryName_Impl(sFactoryName, bIsTemplate);
+ if (nResID)
+ bResult = GraphicHelper::getThumbnailReplacement_Impl(nResID, xStream);
+ }
+ else
+ {
+ boost::shared_ptr<GDIMetaFile> pMetaFile = GetPreviewMetaFile(false);
+ if (pMetaFile)
{
- ::boost::shared_ptr<GDIMetaFile> pMetaFile =
- GetPreviewMetaFile( false );
- if ( pMetaFile )
- {
- bResult = GraphicHelper::getThumbnailFormatFromGDI_Impl(
- pMetaFile.get(), xStream);
- }
+ bResult = GraphicHelper::getThumbnailFormatFromGDI_Impl(pMetaFile.get(), xStream);
}
}
- catch( uno::Exception& )
- {}
}
+ catch(uno::Exception&)
+ {}
return bResult;
}
More information about the Libreoffice-commits
mailing list