summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore/unoframe.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/unocore/unoframe.cxx')
-rw-r--r--sw/source/core/unocore/unoframe.cxx74
1 files changed, 24 insertions, 50 deletions
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 75f2f704a76b..bf9a249db400 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -35,10 +35,8 @@
#include <svx/sdtaitm.hxx>
#include <svx/xflclit.hxx>
#include <editeng/memberids.hrc>
-
#include <swtypes.hxx>
#include <cmdid.h>
-
#include <memory>
#include <hints.hxx>
#include <doc.hxx>
@@ -120,7 +118,7 @@
#include <cppuhelper/supportsservice.hxx>
//UUUU
-#include <unobrushitemhelper.hxx>
+#include <svx/unobrushitemhelper.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xgrscit.hxx>
@@ -138,6 +136,7 @@
#include <svx/unoshape.hxx>
#include <svx/xflhtit.hxx>
#include <svx/xfltrit.hxx>
+#include <swunohelper.hxx>
// from fefly1.cxx
extern bool sw_ChkAndSetNewAnchor( SwEditShell& rEditShell, const SwFlyFrm& rFly, SfxItemSet& rSet );
@@ -151,9 +150,6 @@ using ::com::sun::star::style::XStyleFamiliesSupplier;
const sal_Char sPackageProtocol[] = "vnd.sun.star.Package:";
const sal_Char sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:";
-//UUUU
-#define OWN_ATTR_FILLBMP_MODE (OWN_ATTR_VALUE_START+45)
-
class BaseFrameProperties_Impl
{
SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
@@ -184,6 +180,13 @@ bool BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId,
bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet& rFromSet, bool& rSizeFound)
{
+ //UUUU assert when the target SfxItemSet has no parent. It *should* have the pDfltFrmFmt
+ // from SwDoc set as parent (or similar) to have the necessary XFILL_NONE in the ItemSet
+ if(!rToSet.GetParent())
+ {
+ OSL_ENSURE(false, "OOps, target SfxItemSet *should* have a parent which contains XFILL_NONE as XFillStyleItem (!)");
+ }
+
bool bRet = true;
//Anker kommt auf jeden Fall in den Set
SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) );
@@ -278,7 +281,10 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
// in the obvious order some attributes may be wrong since they are set by the 1st set, but not
// redefined as needed by the 2nd set when they are default (and thus no tset) in the 2nd set. If
// it is necessary for any reason to set both (it should not) a in-between step will be needed
- // that resets the items for FillAttributes in rToSet to default
+ // that resets the items for FillAttributes in rToSet to default.
+ // Note: There are other mechanisms in XMLOFF to pre-sort this relationship already, but this version
+ // was used initially, is tested and works. Keep it to be able to react when another feed adds attributes
+ // from both sets.
if(bSvxBrushItemPropertiesUsed && !bXFillStyleItemUsed)
{
//UUUU create a temporary SvxBrushItem, fill the attributes to it and use it to set
@@ -327,7 +333,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY);
}
- sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
+ setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
}
if(bXFillStyleItemUsed)
@@ -354,7 +360,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
// Fill style is set to solid, but no fill color is given.
// On the other hand, we have a BackColor, so use that.
aBrush.PutValue(*pCol, MID_BACK_COLOR);
- sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
+ setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
}
if(pXFillGradientItem || pXFillGradientNameItem)
@@ -452,7 +458,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
// Fill style is set to solid, but no fill transparency is given.
// On the other hand, we have a BackColorTransparency, so use that.
aBrush.PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
- sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
+ setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet);
}
if(pXGradientStepCountItem)
@@ -1737,14 +1743,14 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
if(RES_BACKGROUND == pEntry->nWID)
{
const SwAttrSet& rSet = pFmt->GetAttrSet();
- const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
+ const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
SvxBrushItem aChangedBrushItem(aOriginalBrushItem);
aChangedBrushItem.PutValue(aValue, nMemberId);
if(!(aChangedBrushItem == aOriginalBrushItem))
{
- sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
+ setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet);
pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
}
@@ -2225,7 +2231,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
if(RES_BACKGROUND == pEntry->nWID)
{
//UUUU
- const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet));
+ const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND));
if(!aOriginalBrushItem.QueryValue(aAny, nMemberId))
{
@@ -2359,42 +2365,6 @@ beans::PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName )
return aStates.getConstArray()[0];
}
-//UUUU
-bool SwXFrame::needToMapFillItemsToSvxBrushItemTypes() const
-{
- SwFrmFmt* pFmt = GetFrmFmt();
-
- if(!pFmt)
- {
- return false;
- }
-
- const SwAttrSet& rFmtSet = pFmt->GetAttrSet();
- const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rFmtSet.GetItem(XATTR_FILLSTYLE, false)));
-
- if(!pXFillStyleItem)
- {
- return false;
- }
-
- //UUUU here different FillStyles can be excluded for export; it will depend on the
- // quality these fallbacks can reach. That again is done in sw::getSvxBrushItemFromSourceSet,
- // take a look there how the superset of DrawObject FillStyles is mapped to SvxBrushItem.
- // For now, take them all - except XFILL_NONE
-
- if(XFILL_NONE != pXFillStyleItem->GetValue())
- {
- return true;
- }
-
- //if(XFILL_SOLID == pXFillStyleItem->GetValue() || XFILL_BITMAP == pXFillStyleItem->GetValue())
- //{
- // return true;
- //}
-
- return false;
-}
-
uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
const uno::Sequence< OUString >& aPropertyNames )
throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception)
@@ -2440,7 +2410,7 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
// as beans::PropertyState_DIRECT_VALUE to let users of this property call
// getPropertyValue where the member properties will be mapped from the
// fill attributes to the according SvxBrushItem entries
- else if(RES_BACKGROUND == pEntry->nWID && needToMapFillItemsToSvxBrushItemTypes())
+ else if(RES_BACKGROUND == pEntry->nWID && SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(rFmtSet))
{
pStates[i] = beans::PropertyState_DIRECT_VALUE;
}
@@ -2747,6 +2717,10 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange );
SfxItemSet aFrmSet(pDoc->GetAttrPool(), aFrmAttrRange );
+
+ //UUUU set correct parent to get the XFILL_NONE FillStyle as needed
+ aFrmSet.SetParent(&pDoc->GetDfltFrmFmt()->GetAttrSet());
+
//jetzt muessen die passenden Items in den Set
bool bSizeFound;
if(!pProps->AnyToItemSet( pDoc, aFrmSet, aGrSet, bSizeFound))