summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-15 09:29:04 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-09-15 10:43:59 +0100
commit1ed0f437679d702b633e381eaf6f6d6f9aecdd9b (patch)
tree5f483dd62ad92baca826d45a23738be77daadfcf
parent63c707ad358942d9a469d59a008d89dbf1c7341d (diff)
Related: tdf#93675 wrong font used in drawings in exported .docx
get the right font so stuff fits in the shapes like its supposed to Change-Id: Ic9777166395fcbf64572494034f06ef182073e19
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx40
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx2
2 files changed, 39 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 2b7cebe8ffae..6ce03c93c922 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -28,6 +28,7 @@
#include <sot/storage.hxx>
#include <vcl/graphicfilter.hxx>
#include <svl/itemiter.hxx>
+#include <svl/whiter.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdotext.hxx>
#include <svx/svdmodel.hxx>
@@ -88,6 +89,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/form/XFormComponent.hpp>
#include "docsh.hxx"
+#include "IDocumentStylePoolAccess.hxx"
#include <oox/ole/olehelper.hxx>
#include <fstream>
#include <unotools/streamwrap.hxx>
@@ -1308,10 +1310,43 @@ const SfxPoolItem& MSWord_SdrAttrIter::GetItem( sal_uInt16 nWhich ) const
return *pRet;
}
+//Drawing shapes properties inherit from a different pool that the document
+//styles. On export to .doc[x] they will default to style "Normal". Here explicitly
+//set any items which are not already set, but differ from "Normal".
+void MSWord_SdrAttrIter::SetItemsThatDifferFromStandard(bool bCharAttr, SfxItemSet& rSet)
+{
+ SwTextFormatColl* pC = m_rExport.m_pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool
+ (RES_POOLCOLL_STANDARD, false);
+
+ SfxWhichIter aWhichIter(rSet);
+ for (sal_uInt16 nEEWhich = aWhichIter.FirstWhich(); nEEWhich; nEEWhich = aWhichIter.NextWhich())
+ {
+ if (SfxItemState::SET != rSet.GetItemState(nEEWhich, false))
+ {
+ sal_uInt16 nSwWhich = sw::hack::TransformWhichBetweenPools(m_rExport.m_pDoc->GetAttrPool(),
+ *pEditPool, nEEWhich);
+ if (!nSwWhich)
+ continue;
+ bool bWanted = ( bCharAttr ? ( nSwWhich >= RES_CHRATR_BEGIN && nSwWhich < RES_TXTATR_END )
+ : ( nSwWhich >= RES_PARATR_BEGIN && nSwWhich < RES_FRMATR_END ) );
+ if (!bWanted)
+ continue;
+
+ const SfxPoolItem& rDrawItem = rSet.Get(nEEWhich);
+ const SfxPoolItem& rStandardItem = pC->GetFormatAttr(nSwWhich);
+ if (rDrawItem != rStandardItem)
+ rSet.Put(rDrawItem);
+ }
+ }
+}
+
void MSWord_SdrAttrIter::OutParaAttr(bool bCharAttr, const std::set<sal_uInt16>* pWhichsToIgnore)
{
SfxItemSet aSet( pEditObj->GetParaAttribs( nPara ));
- if( aSet.Count() )
+
+ SetItemsThatDifferFromStandard(bCharAttr, aSet);
+
+ if (aSet.Count())
{
const SfxItemSet* pOldSet = m_rExport.GetCurItemSet();
m_rExport.SetCurItemSet( &aSet );
@@ -1325,7 +1360,6 @@ void MSWord_SdrAttrIter::OutParaAttr(bool bCharAttr, const std::set<sal_uInt16>*
do
{
sal_uInt16 nWhich = pItem->Which();
-
if (pWhichsToIgnore && pWhichsToIgnore->find(nWhich) != pWhichsToIgnore->end())
continue;
@@ -1341,7 +1375,7 @@ void MSWord_SdrAttrIter::OutParaAttr(bool bCharAttr, const std::set<sal_uInt16>*
SfxPoolItem* pI = pItem->Clone();
pI->SetWhich( nWhich );
if (m_rExport.CollapseScriptsforWordOk(nScript,nWhich))
- m_rExport.AttrOutput().OutputItem( *pI );
+ m_rExport.AttrOutput().OutputItem(*pI);
delete pI;
}
} while( !aIter.IsAtEnd() && 0 != ( pItem = aIter.NextItem() ) );
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 4fbc1cb74242..970f0c5f4661 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1416,6 +1416,8 @@ private:
sal_Int32 SearchNext( sal_Int32 nStartPos );
void SetCharSet(const EECharAttrib& rTextAttr, bool bStart);
+ void SetItemsThatDifferFromStandard(bool bCharAttr, SfxItemSet& rSet);
+
MSWord_SdrAttrIter(const MSWord_SdrAttrIter&) SAL_DELETED_FUNCTION;
MSWord_SdrAttrIter& operator=(const MSWord_SdrAttrIter&) SAL_DELETED_FUNCTION;
public: