summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/grabbagitem.hxx5
-rw-r--r--sw/qa/extras/globalfilter/globalfilter.cxx18
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx21
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx13
-rw-r--r--sw/source/ui/envelp/envfmt.cxx2
-rw-r--r--sw/source/uibase/app/docst.cxx4
-rw-r--r--sw/source/uibase/inc/uitool.hxx3
-rw-r--r--sw/source/uibase/shells/textsh1.cxx2
-rw-r--r--sw/source/uibase/utlui/uitool.cxx22
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.cxx1
-rw-r--r--writerfilter/source/dmapper/PropertyIds.hxx1
12 files changed, 76 insertions, 17 deletions
diff --git a/include/svl/grabbagitem.hxx b/include/svl/grabbagitem.hxx
index c02edaae7de3..6454d2c42d6e 100644
--- a/include/svl/grabbagitem.hxx
+++ b/include/svl/grabbagitem.hxx
@@ -35,6 +35,11 @@ public:
return m_aMap;
}
+ std::map<OUString, com::sun::star::uno::Any>& GetGrabBag()
+ {
+ return m_aMap;
+ }
+
virtual bool operator==(const SfxPoolItem&) const SAL_OVERRIDE;
virtual SfxPoolItem* Clone(SfxItemPool* pPool = 0) const SAL_OVERRIDE;
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx
index a74103765447..f62b2319eecb 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -30,6 +30,7 @@ public:
void testImageWithSpecialID();
void testGraphicShape();
void testCharHighlight();
+ void testCharHighlightBody();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testSwappedOutImageExport);
@@ -353,7 +354,7 @@ void Test::testGraphicShape()
}
}
-void Test::testCharHighlight()
+void Test::testCharHighlightBody()
{
// MS Word has two kind of character backgrounds called character shading and highlighting
// MS filters handle these attributes separately, but ODF export merges them into one background attribute
@@ -365,9 +366,6 @@ void Test::testCharHighlight()
"Office Open XML Text",
};
- SvtFilterOptions& rOpt = SvtFilterOptions::Get();
- rOpt.SetCharBackground2Shading();
-
for( size_t nFilter = 0; nFilter < SAL_N_ELEMENTS(aFilterNames); ++nFilter )
{
if (mxComponent.is())
@@ -453,6 +451,18 @@ void Test::testCharHighlight()
}
}
+void Test::testCharHighlight()
+{
+ SvtFilterOptions& rOpt = SvtFilterOptions::Get();
+ rOpt.SetCharBackground2Shading();
+
+ testCharHighlightBody();
+
+ rOpt.SetCharBackground2Highlighting();
+
+ testCharHighlightBody();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 1bd05c8854b2..6e77450c9b34 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5636,15 +5636,28 @@ const SwRedlineData* AttributeOutputBase::GetParagraphMarkerRedline( const SwTxt
void AttributeOutputBase::CharBackgroundBase( const SvxBrushItem& rBrush )
{
- const SvtFilterOptions& rOpt = SvtFilterOptions::Get();
- if( rOpt.IsCharBackground2Highlighting() )
+ bool bConvertToShading = SvtFilterOptions::Get().IsCharBackground2Shading();
+ bool bHasShadingMarker = false;
+
+ // Check shading marker
{
- CharHighlight(rBrush);
+ const SfxGrabBagItem& aGrabBag = static_cast< const SfxGrabBagItem& >( GetExport().GetItem( RES_CHRATR_GRABBAG ) );
+ const std::map<OUString, com::sun::star::uno::Any>& rMap = aGrabBag.GetGrabBag();
+ auto aIterator = rMap.find("CharShadingMarker");
+ if( aIterator != rMap.end() )
+ {
+ aIterator->second >>= bHasShadingMarker;
+ }
}
- else
+
+ if( bConvertToShading || bHasShadingMarker )
{
CharBackground(rBrush);
}
+ else
+ {
+ CharHighlight(rBrush);
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 842857309f7f..8911d364c195 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -19,6 +19,7 @@
#include <stdlib.h>
#include <svl/itemiter.hxx>
+#include <svl/grabbagitem.hxx>
#include <rtl/tencinfo.h>
#include <hintids.hxx>
@@ -3799,6 +3800,12 @@ void SwWW8ImplReader::Read_CharShadow( sal_uInt16, const sal_uInt8* pData, shor
SwWW8Shade aSh( bVer67, aSHD );
NewAttr( SvxBrushItem( aSh.aColor, RES_CHRATR_BACKGROUND ));
+
+ // Add a marker to the grabbag indicating that character background was imported from MSO shading
+ SfxGrabBagItem aGrabBag = *(static_cast<const SfxGrabBagItem*>(GetFmtAttr(RES_CHRATR_GRABBAG)));
+ std::map<OUString, com::sun::star::uno::Any>& rMap = aGrabBag.GetGrabBag();
+ rMap.insert(std::pair<OUString, com::sun::star::uno::Any>("CharShadingMarker",uno::makeAny(true)));
+ NewAttr(aGrabBag);
}
}
@@ -3815,6 +3822,12 @@ void SwWW8ImplReader::Read_TxtBackColor(sal_uInt16, const sal_uInt8* pData, shor
return;
Color aColour(ExtractColour(pData, bVer67));
NewAttr(SvxBrushItem(aColour, RES_CHRATR_BACKGROUND));
+
+ // Add a marker to the grabbag indicating that character background was imported from MSO shading
+ SfxGrabBagItem aGrabBag = *(static_cast<const SfxGrabBagItem*>(GetFmtAttr(RES_CHRATR_GRABBAG)));
+ std::map<OUString, com::sun::star::uno::Any>& rMap = aGrabBag.GetGrabBag();
+ rMap.insert(std::pair<OUString, com::sun::star::uno::Any>("CharShadingMarker",uno::makeAny(true)));
+ NewAttr(aGrabBag);
}
}
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index ee77182d7ac0..996a39dc6eff 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -265,7 +265,7 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
if (pDlg->Execute() == RET_OK)
{
SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() );
- ::ConvertAttrGenToChar(aOutputSet, CONV_ATTR_ENV);
+ ::ConvertAttrGenToChar(aOutputSet, aTmpSet, CONV_ATTR_ENV);
pCollSet->Put(aOutputSet);
}
}
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index c33689c26f96..638d0fc305b5 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -573,7 +573,7 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl)
SfxItemSet aTmpSet( *m_pDlg->GetOutputItemSet() );
if( SFX_STYLE_FAMILY_CHAR == m_nFamily )
{
- ::ConvertAttrGenToChar(aTmpSet, CONV_ATTR_STD);
+ ::ConvertAttrGenToChar(aTmpSet, m_xTmp->GetItemSet(), CONV_ATTR_STD);
}
m_xTmp->SetItemSet( aTmpSet );
@@ -823,7 +823,7 @@ sal_uInt16 SwDocShell::Edit(
::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() );
else
{
- ::ConvertAttrGenToChar(xTmp->GetItemSet(), CONV_ATTR_STD);
+ ::ConvertAttrGenToChar(xTmp->GetItemSet(), xTmp->GetItemSet(), CONV_ATTR_STD);
}
if(SFX_STYLE_FAMILY_PAGE == nFamily)
mpView->InvalidateRulerPos();
diff --git a/sw/source/uibase/inc/uitool.hxx b/sw/source/uibase/inc/uitool.hxx
index 765087f55397..fe7aebc9b6f4 100644
--- a/sw/source/uibase/inc/uitool.hxx
+++ b/sw/source/uibase/inc/uitool.hxx
@@ -59,9 +59,10 @@ SW_DLLPUBLIC void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode);
* This method is used after executed a character dialog.
*
* @param[in,out] rSet the set in which character attributes are stored
+ * @param[in] rOrigSet original itemset used as input for the dialog
* @param[in] nMode specify the dialog which was called before
**/
-SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet& rSet, const sal_uInt8 nMode);
+SW_DLLPUBLIC void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, const sal_uInt8 nMode);
// SfxItemSets <-> PageDesc
void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc );
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index b474ede3c4fe..3cab3dd8f71f 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -202,7 +202,7 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const
if ( pSet)
{
SfxItemSet aTmpSet( *pSet );
- ::ConvertAttrGenToChar(aTmpSet, CONV_ATTR_STD);
+ ::ConvertAttrGenToChar(aTmpSet, aCoreSet, CONV_ATTR_STD);
const SfxPoolItem* pSelectionItem;
bool bInsert = false;
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index a105aae3aa8b..be0a0457751d 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -25,6 +25,7 @@
#include <unotools/collatorwrapper.hxx>
#include <svl/urihelper.hxx>
#include <svl/stritem.hxx>
+#include <svl/grabbagitem.hxx>
#include <unotools/syslocale.hxx>
#include <sfx2/app.hxx>
#include <IDocumentStylePoolAccess.hxx>
@@ -175,20 +176,33 @@ void ConvertAttrCharToGen(SfxItemSet& rSet, const sal_uInt8 nMode)
}
}
-void ConvertAttrGenToChar(SfxItemSet& rSet, const sal_uInt8 nMode)
+void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet, const sal_uInt8 nMode)
{
// Background / highlighting
{
- const SfxPoolItem *pTmpBrush;
- if( SfxItemState::SET == rSet.GetItemState( RES_BACKGROUND, false, &pTmpBrush ) )
+ const SfxPoolItem *pTmpItem;
+ if( SfxItemState::SET == rSet.GetItemState( RES_BACKGROUND, false, &pTmpItem ) )
{
- SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpBrush) );
+ SvxBrushItem aTmpBrush( *static_cast<const SvxBrushItem*>(pTmpItem) );
aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
rSet.Put( aTmpBrush );
// Highlight is an MS specific thing, so remove it at the first time when LO modifies
// this part of the imported document.
rSet.Put( SvxBrushItem(RES_CHRATR_HIGHLIGHT) );
+
+ // Remove shading marker
+ if( SfxItemState::SET == rOrigSet.GetItemState( RES_CHRATR_GRABBAG, false, &pTmpItem ) )
+ {
+ SfxGrabBagItem aGrabBag(*static_cast<const SfxGrabBagItem*>(pTmpItem));
+ std::map<OUString, com::sun::star::uno::Any>& rMap = aGrabBag.GetGrabBag();
+ auto aIterator = rMap.find("CharShadingMarker");
+ if( aIterator != rMap.end() )
+ {
+ aIterator->second = uno::makeAny(false);
+ }
+ rSet.Put( aGrabBag );
+ }
}
rSet.ClearItem( RES_BACKGROUND );
}
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 989465101f62..b64e2165bc25 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1662,6 +1662,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
pCellColorHandler->setOutputFormat( CellColorHandler::Character );
pProperties->resolve(*pCellColorHandler);
rContext->InsertProps(pCellColorHandler->getProperties());
+ m_pImpl->GetTopContext()->Insert(PROP_CHAR_SHADING_MARKER, uno::makeAny(true), true, CHAR_GRAB_BAG );
}
break;
}
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index f380c457c8a0..53d101ce9c57 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -349,6 +349,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_GRAPHIC_URL: sName = "GraphicURL"; break;
case PROP_GRAPHIC_BITMAP: sName = "GraphicBitmap"; break;
case PROP_CHAR_SHADING_VALUE: sName = "CharShadingValue"; break;
+ case PROP_CHAR_SHADING_MARKER: sName = "CharShadingMarker"; break;
case PROP_LABEL_CATEGORY: sName = "LabelCategory"; break;
case PROP_FIRST_IS_SHARED : sName = "FirstIsShared"; break;
case PROP_MIRROR_INDENTS : sName = "MirrorIndents"; break;
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index cd52d488fbbc..618d02dec441 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -320,6 +320,7 @@ enum PropertyIds
,PROP_GRAPHIC_URL
,PROP_GRAPHIC_BITMAP
,PROP_CHAR_SHADING_VALUE
+ ,PROP_CHAR_SHADING_MARKER
,PROP_FIRST_IS_SHARED
,PROP_MIRROR_INDENTS
,PROP_SURROUND_TEXT_WRAP_SMALL