Author: alg
Date: Tue Jan 14 21:43:43 2014
New Revision: 1558210

URL: http://svn.apache.org/r1558210
Log:
Rearranged helpers, added fallbacks as preparation for adaption of im/exporters 
and as last rescue

Added:
    openoffice/branches/alg_writerframes/main/sw/inc/fillattributes.hxx   (with 
props)
    
openoffice/branches/alg_writerframes/main/sw/source/core/layout/fillattributes.cxx
   (with props)
Modified:
    openoffice/branches/alg_writerframes/main/sw/Library_sw.mk
    openoffice/branches/alg_writerframes/main/sw/inc/format.hxx
    openoffice/branches/alg_writerframes/main/sw/inc/frmatr.hxx
    openoffice/branches/alg_writerframes/main/sw/inc/frmfmt.hxx
    openoffice/branches/alg_writerframes/main/sw/inc/unobrushitemhelper.hxx
    openoffice/branches/alg_writerframes/main/sw/source/core/attr/format.cxx
    openoffice/branches/alg_writerframes/main/sw/source/core/layout/atrfrm.cxx
    openoffice/branches/alg_writerframes/main/sw/source/core/layout/paintfrm.cxx
    
openoffice/branches/alg_writerframes/main/sw/source/core/unocore/unobrushitemhelper.cxx

Modified: openoffice/branches/alg_writerframes/main/sw/Library_sw.mk
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/Library_sw.mk?rev=1558210&r1=1558209&r2=1558210&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/Library_sw.mk (original)
+++ openoffice/branches/alg_writerframes/main/sw/Library_sw.mk Tue Jan 14 
21:43:43 2014
@@ -281,6 +281,7 @@ $(eval $(call gb_Library_add_exception_o
        sw/source/core/layout/anchoreddrawobject \
        sw/source/core/layout/anchoredobject \
        sw/source/core/layout/atrfrm \
+    sw/source/core/layout/fillattributes \
        sw/source/core/layout/calcmove \
        sw/source/core/layout/colfrm \
        sw/source/core/layout/dbg_lay \

Added: openoffice/branches/alg_writerframes/main/sw/inc/fillattributes.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/inc/fillattributes.hxx?rev=1558210&view=auto
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/inc/fillattributes.hxx (added)
+++ openoffice/branches/alg_writerframes/main/sw/inc/fillattributes.hxx Tue Jan 
14 21:43:43 2014
@@ -0,0 +1,72 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef FILLATTRIBUTES_HXX
+#define FILLATTRIBUTES_HXX
+
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <boost/shared_ptr.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+
+class FillAttributes
+{
+private:
+    basegfx::B2DRange                                                   
maLastPaintRange;
+    basegfx::B2DRange                                                   
maLastDefineRange;
+    boost::shared_ptr< drawinglayer::attribute::SdrFillAttribute >      
maFillAttribute;
+    boost::shared_ptr< drawinglayer::attribute::FillGradientAttribute > 
maFillGradientAttribute;
+    drawinglayer::primitive2d::Primitive2DSequence                      
maPrimitives;
+
+    void createPrimitive2DSequence(
+        const basegfx::B2DRange& rPaintRange,
+        const basegfx::B2DRange& rDefineRange);
+
+protected:
+public:
+    FillAttributes();
+    FillAttributes(const Color& rColor);
+    FillAttributes(const SfxItemSet& rSet);
+    ~FillAttributes();
+
+    bool isUsed() const;
+    bool hasSdrFillAttribute() const { return maFillAttribute.get(); }
+    bool hasFillGradientAttribute() const { return 
maFillGradientAttribute.get(); }
+    bool isTransparent() const;
+
+    const drawinglayer::attribute::SdrFillAttribute& getFillAttribute() const;
+    const drawinglayer::attribute::FillGradientAttribute& 
getFillGradientAttribute() const;
+    const drawinglayer::primitive2d::Primitive2DSequence& 
getPrimitive2DSequence(
+        const basegfx::B2DRange& rPaintRange,
+        const basegfx::B2DRange& rDefineRange) const;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+typedef boost::shared_ptr< FillAttributes > FillAttributesPtr;
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // FILLATTRIBUTES_HXX
+
+// eof

Propchange: openoffice/branches/alg_writerframes/main/sw/inc/fillattributes.hxx
------------------------------------------------------------------------------
    svn:executable = *

Modified: openoffice/branches/alg_writerframes/main/sw/inc/format.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/inc/format.hxx?rev=1558210&r1=1558209&r2=1558210&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/inc/format.hxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/inc/format.hxx Tue Jan 14 
21:43:43 2014
@@ -29,6 +29,8 @@
 #include <swatrset.hxx>                // fuer SfxItemPool/-Set, Attr forward 
decl.
 #include <calbck.hxx>          // fuer SwModify
 #include <hintids.hxx>
+//UUUU
+#include <fillattributes.hxx>
 
 class IDocumentSettingAccess;
 class IDocumentDrawModelAccess;
@@ -89,10 +91,11 @@ public:
 
        // Ist bInParents sal_False,
        // wird nur in diesem Format nach dem Attribut gesucht.
-    inline const SfxPoolItem& GetFmtAttr( sal_uInt16 nWhich,
-                                          sal_Bool bInParents = sal_True ) 
const;
-       inline SfxItemState GetItemState( sal_uInt16 nWhich, sal_Bool 
bSrchInParent = sal_True,
-                                                                       const 
SfxPoolItem **ppItem = 0 ) const;
+    //UUUUinline 
+    const SfxPoolItem& GetFmtAttr( sal_uInt16 nWhich, sal_Bool bInParents = 
sal_True ) const;
+    //UUUUinline 
+    SfxItemState GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent = 
sal_True, const SfxPoolItem **ppItem = 0 ) const;
+
     // --> OD 2008-03-03 #refactorlists#
     // methods renamed and made virtual
     virtual sal_Bool SetFmtAttr( const SfxPoolItem& rAttr );
@@ -239,7 +242,10 @@ public:
     inline const SwFmtVertOrient      &GetVertOrient( sal_Bool = sal_True ) 
const;
     inline const SvxBoxItem               &GetBox( sal_Bool = sal_True ) const;
     inline const SvxFmtKeepItem         &GetKeep( sal_Bool = sal_True ) const;
-    inline const SvxBrushItem           &GetBackground( sal_Bool = sal_True ) 
const;
+
+    //UUUU
+    const SvxBrushItem& GetBackground( sal_Bool = sal_True ) const;
+
     inline const SvxShadowItem            &GetShadow( sal_Bool = sal_True ) 
const;
     inline const SwFmtPageDesc            &GetPageDesc( sal_Bool = sal_True ) 
const;
     inline const SvxFmtBreakItem      &GetBreak( sal_Bool = sal_True ) const;
@@ -323,15 +329,18 @@ public:
         @return false, default implementation
     */
     virtual sal_Bool IsShadowTransparent() const;
+
+    //UUUU
+    virtual FillAttributesPtr getFillAttributes() const;
 };
 
 // --------------- inline Implementierungen ------------------------
 
-inline const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich,
-                                             sal_Bool bInParents ) const
-{
-       return aSet.Get( nWhich, bInParents );
-}
+//UUUUinline const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich,
+//UUUU                                             sal_Bool bInParents ) const
+//UUUU{
+//UUUU return aSet.Get( nWhich, bInParents );
+//UUUU}
 
 inline void SwFmt::SetName( const sal_Char* pNewName,
                                                        sal_Bool bBroadcast )
@@ -340,11 +349,11 @@ inline void SwFmt::SetName( const sal_Ch
        SetName( aTmp, bBroadcast );
 }
 
-inline SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool 
bSrchInParent,
-                                                                               
const SfxPoolItem **ppItem ) const
-{
-       return aSet.GetItemState( nWhich, bSrchInParent, ppItem );
-}
+//UUUUinline SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool 
bSrchInParent,
+//UUUU                                                                         
const SfxPoolItem **ppItem ) const
+//UUUU{
+//UUUU return aSet.GetItemState( nWhich, bSrchInParent, ppItem );
+//UUUU}
 
 #undef inline
 

Modified: openoffice/branches/alg_writerframes/main/sw/inc/frmatr.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/inc/frmatr.hxx?rev=1558210&r1=1558209&r2=1558210&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/inc/frmatr.hxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/inc/frmatr.hxx Tue Jan 14 
21:43:43 2014
@@ -81,8 +81,8 @@ inline const SvxBoxItem &SwFmt::GetBox(s
        { return aSet.GetBox(bInP); }
 inline const SvxFmtKeepItem &SwFmt::GetKeep(sal_Bool bInP) const
        { return aSet.GetKeep(bInP); }
-inline const SvxBrushItem &SwFmt::GetBackground(sal_Bool bInP) const
-       { return aSet.GetBackground(bInP); }
+//UUUUinline const SvxBrushItem &SwFmt::GetBackground(sal_Bool bInP) const
+//UUUU { return aSet.GetBackground(bInP); }
 inline const SvxShadowItem &SwFmt::GetShadow(sal_Bool bInP) const
        { return aSet.GetShadow(bInP); }
 inline const SvxFmtBreakItem &SwFmt::GetBreak(sal_Bool bInP) const

Modified: openoffice/branches/alg_writerframes/main/sw/inc/frmfmt.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/inc/frmfmt.hxx?rev=1558210&r1=1558209&r2=1558210&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/inc/frmfmt.hxx (original)
+++ openoffice/branches/alg_writerframes/main/sw/inc/frmfmt.hxx Tue Jan 14 
21:43:43 2014
@@ -29,12 +29,6 @@
 #include <format.hxx>
 #include "swdllapi.h"
 
-//UUUU
-#include <drawinglayer/attribute/fillgradientattribute.hxx>
-#include <drawinglayer/attribute/sdrfillattribute.hxx>
-#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
-#include <boost/shared_ptr.hpp>
-
 class SwFlyFrm;
 class SwAnchoredObject;
 class Graphic;
@@ -45,41 +39,6 @@ class SwRect;
 class SwContact;
 class SdrObject;
 
-//UUUU
-class FillAttributes
-{
-private:
-    basegfx::B2DRange                                                   
maLastPaintRange;
-    basegfx::B2DRange                                                   
maLastDefineRange;
-    boost::shared_ptr< drawinglayer::attribute::SdrFillAttribute >      
maFillAttribute;
-    boost::shared_ptr< drawinglayer::attribute::FillGradientAttribute > 
maFillGradientAttribute;
-    drawinglayer::primitive2d::Primitive2DSequence                      
maPrimitives;
-
-    void createPrimitive2DSequence(
-        const basegfx::B2DRange& rPaintRange,
-        const basegfx::B2DRange& rDefineRange);
-
-protected:
-public:
-    FillAttributes();
-    FillAttributes(const Color& rColor);
-    FillAttributes(const SfxItemSet& rSet);
-    ~FillAttributes();
-
-    bool isUsed() const;
-    bool hasSdrFillAttribute() const { return maFillAttribute.get(); }
-    bool hasFillGradientAttribute() const { return 
maFillGradientAttribute.get(); }
-    bool isTransparent() const;
-
-    const drawinglayer::attribute::SdrFillAttribute& getFillAttribute() const;
-    const drawinglayer::attribute::FillGradientAttribute& 
getFillGradientAttribute() const;
-    const drawinglayer::primitive2d::Primitive2DSequence& 
getPrimitive2DSequence(
-        const basegfx::B2DRange& rPaintRange,
-        const basegfx::B2DRange& rDefineRange) const;
-};
-
-typedef boost::shared_ptr< FillAttributes > FillAttributesPtr;
-
 class SW_DLLPUBLIC SwFrmFmt: public SwFmt
 {
        friend class SwDoc;
@@ -189,7 +148,7 @@ public:
     void RegisterToFormat( SwFmt& rFmt );
 
     //UUUU
-    FillAttributesPtr getFillAttributes() const;
+    virtual FillAttributesPtr getFillAttributes() const;
 };
 
 //Das FlyFrame-Format ------------------------------

Modified: 
openoffice/branches/alg_writerframes/main/sw/inc/unobrushitemhelper.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/inc/unobrushitemhelper.hxx?rev=1558210&r1=1558209&r2=1558210&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/inc/unobrushitemhelper.hxx 
(original)
+++ openoffice/branches/alg_writerframes/main/sw/inc/unobrushitemhelper.hxx Tue 
Jan 14 21:43:43 2014
@@ -26,7 +26,7 @@
 
 //UUUU helper function definintions for UNO API fallbacks to replace 
SvxBrushItem
 void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, 
SfxItemSet& rToSet);
-SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet);
+SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, 
sal_Bool bSearchInParents = sal_True);
 
 #endif // _UNOBRUSHITEMHELPER_HXX
 

Modified: 
openoffice/branches/alg_writerframes/main/sw/source/core/attr/format.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/attr/format.cxx?rev=1558210&r1=1558209&r2=1558210&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/attr/format.cxx 
(original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/attr/format.cxx 
Tue Jan 14 21:43:43 2014
@@ -19,12 +19,9 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #include <hintids.hxx>                         // fuer RES_..
 #include <frame.hxx>                   // fuer AttrCache
 #include <format.hxx>
@@ -33,6 +30,8 @@
 #include <paratr.hxx>                  // fuer SwParaFmt - SwHyphenBug
 #include <swcache.hxx>
 #include <fmtcolfunc.hxx>
+//UUUU
+#include <unobrushitemhelper.hxx>
 
 TYPEINIT1( SwFmt, SwClient );  //rtti fuer SwFmt
 
@@ -431,6 +430,59 @@ sal_Bool SwFmt::SetDerivedFrom(SwFmt *pD
 }
 
 
+const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, sal_Bool bInParents ) 
const
+{
+    if(RES_BACKGROUND == nWhich && RES_FLYFRMFMT == Which())
+    {
+        //UUUU FALLBACKBREAKHERE should not be used; instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST]
+        OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in 
place and used)");
+        static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
+
+        // fill the local static SvxBrushItem from the current ItemSet so that
+        // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
+        // as good as possible to create a fallback representation and return 
that
+        aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bInParents);
+
+        return aSvxBrushItem;
+    }
+
+    return aSet.Get( nWhich, bInParents );
+}
+
+
+SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent, 
const SfxPoolItem **ppItem ) const
+{
+    if(RES_BACKGROUND == nWhich && RES_FLYFRMFMT == Which())
+    {
+        //UUUU FALLBACKBREAKHERE should not be used; instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST]
+        OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in 
place and used)");
+        const FillAttributesPtr aFill = getFillAttributes();
+
+        // check if the new fill attributes are used
+        if(aFill.get() && aFill->isUsed())
+        {
+            // if yes, fill the local SvxBrushItem using the new fill 
attributes
+            // as good as possible to have an instance for the pointer to 
point 
+            // to and return as state that it is set
+            static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
+
+            aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bSrchInParent);
+            *ppItem = &aSvxBrushItem;
+
+            return SFX_ITEM_SET;
+        }
+
+        // if not, reset pointer and return SFX_ITEM_DEFAULT to signal that
+        // the item is not set
+        *ppItem = 0;
+
+        return SFX_ITEM_DEFAULT;
+    }
+
+    return aSet.GetItemState( nWhich, bSrchInParent, ppItem );
+}
+
+
 sal_Bool SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
 {
        if ( IsInCache() || IsInSwFntCache() )
@@ -439,9 +491,50 @@ sal_Bool SwFmt::SetFmtAttr(const SfxPool
                CheckCaching( nWhich );
        }
 
+       sal_Bool bRet = sal_False;
+
+    //UUUU
+    if(RES_BACKGROUND == rAttr.Which() && RES_FLYFRMFMT == Which())
+    {
+        //UUUU FALLBACKBREAKHERE should not be used; instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST]
+        OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in 
place and used)");
+        SfxItemSet aTempSet(*aSet.GetPool(), XATTR_FILL_FIRST, 
XATTR_FILL_LAST, 0, 0);
+        const SvxBrushItem& rSource = static_cast< const SvxBrushItem& 
>(rAttr);
+
+        // fill a local ItemSet with the attributes corresponding as good as 
possible
+        // to the new fill properties [XATTR_FILL_FIRST .. XATTR_FILL_LAST] 
and set these
+        // as ItemSet
+        setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
+
+        if(IsModifyLocked())
+        {
+            if( 0 != ( bRet = (0 != aSet.Put( aTempSet ))) )
+            {
+                aSet.SetModifyAtAttr( this );
+            }
+        }
+        else
+        {
+            SwAttrSet aOld(*aSet.GetPool(), aSet.GetRanges()), 
aNew(*aSet.GetPool(), aSet.GetRanges());
+
+            bRet = 0 != aSet.Put_BC(aTempSet, &aOld, &aNew);
+
+            if(bRet)
+            {
+                aSet.SetModifyAtAttr(this);
+
+                SwAttrSetChg aChgOld(aSet, aOld);
+                SwAttrSetChg aChgNew(aSet, aNew);
+
+                ModifyNotification(&aChgOld, &aChgNew);
+            }
+        }
+
+        return bRet;
+    }
+
        // wenn Modify gelockt ist, werden keine Modifies verschickt;
        // fuer FrmFmt's immer das Modify verschicken!
-       sal_Bool bRet = sal_False;
     const sal_uInt16 nFmtWhich = Which();
        if( IsModifyLocked() || (!GetDepends() &&
         (RES_GRFFMTCOLL == nFmtWhich  ||
@@ -489,9 +582,55 @@ sal_Bool SwFmt::SetFmtAttr( const SfxIte
        }
        SetInSwFntCache( sal_False );
 
-       // wenn Modify gelockt ist, werden keine Modifies verschickt;
-       // fuer FrmFmt's immer das Modify verschicken!
        sal_Bool bRet = sal_False;
+
+    //UUUU
+    if(RES_FLYFRMFMT == Which())
+    {
+        const SfxPoolItem* pSource = 0;
+
+        if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND, sal_False, 
&pSource))
+        {
+            //UUUU FALLBACKBREAKHERE should not be used; instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST]
+            OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in 
place and used)");
+            SfxItemSet aTempSet(rSet);
+
+            // copy all items to be set anyways to a local ItemSet with is 
also prepared for the new
+            // fill attribute ranges [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. 
Add the attributes 
+            // corresponding as good as possible to the new fill properties 
and set the whole ItemSet
+            const SvxBrushItem& rSource(static_cast< const SvxBrushItem& 
>(*pSource));
+            setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
+
+            if(IsModifyLocked())
+            {
+                if( 0 != ( bRet = (0 != aSet.Put( aTempSet ))) )
+                {
+                    aSet.SetModifyAtAttr( this );
+                }
+            }
+            else
+            {
+                SwAttrSet aOld(*aSet.GetPool(), aSet.GetRanges()), 
aNew(*aSet.GetPool(), aSet.GetRanges());
+
+                bRet = 0 != aSet.Put_BC(aTempSet, &aOld, &aNew);
+
+                if(bRet)
+                {
+                    aSet.SetModifyAtAttr(this);
+
+                    SwAttrSetChg aChgOld(aSet, aOld);
+                    SwAttrSetChg aChgNew(aSet, aNew);
+
+                    ModifyNotification(&aChgOld, &aChgNew);
+                }
+            }
+        }
+
+        return bRet;
+    }
+
+    // wenn Modify gelockt ist, werden keine Modifies verschickt;
+       // fuer FrmFmt's immer das Modify verschicken!
     const sal_uInt16 nFmtWhich = Which();
     if ( IsModifyLocked() ||
          ( !GetDepends() &&
@@ -686,3 +825,32 @@ IDocumentTimerAccess* SwFmt::getIDocumen
 IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return GetDoc(); }
 IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() 
{ return GetDoc(); }
 
+//UUUU
+const SvxBrushItem& SwFmt::GetBackground(sal_Bool bInP) const
+{ 
+    if(RES_FLYFRMFMT == Which())
+    {
+        //UUUU FALLBACKBREAKHERE should not be used; instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST]
+        OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use 
[XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in 
place and used)");
+        static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
+
+        // fill the local static SvxBrushItem from the current ItemSet so that
+        // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
+        // as good as possible to create a fallback representation and return 
that
+        aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, bInP);
+        return aSvxBrushItem;
+    }
+
+    return aSet.GetBackground(bInP); 
+}
+
+//UUUU
+FillAttributesPtr SwFmt::getFillAttributes() const
+{
+    // FALLBACKBREAKHERE return empty pointer
+    OSL_ENSURE(false, "getFillAttributes() call only valid for RES_FLYFRMFMT 
currently (!)");
+
+    return FillAttributesPtr();
+}
+
+// eof

Modified: 
openoffice/branches/alg_writerframes/main/sw/source/core/layout/atrfrm.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/layout/atrfrm.cxx?rev=1558210&r1=1558209&r2=1558210&view=diff
==============================================================================
--- openoffice/branches/alg_writerframes/main/sw/source/core/layout/atrfrm.cxx 
(original)
+++ openoffice/branches/alg_writerframes/main/sw/source/core/layout/atrfrm.cxx 
Tue Jan 14 21:43:43 2014
@@ -106,15 +106,9 @@
 #include <svl/cjkoptions.hxx>
 #include <switerator.hxx>
 #include <pagedeschint.hxx>
-#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
 
 //UUUU
-#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <drawinglayer/attribute/fillhatchattribute.hxx>
-#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
+#include <fillattributes.hxx>
 #include <svx/xfillit0.hxx>
 
 using namespace ::com::sun::star;
@@ -2481,130 +2475,6 @@ SfxPoolItem* SwHeaderAndFooterEatSpacing
 }
 
 //////////////////////////////////////////////////////////////////////////////
-//UUUU FillAttributes
-
-void FillAttributes::createPrimitive2DSequence(
-    const basegfx::B2DRange& rPaintRange,
-    const basegfx::B2DRange& rDefineRange)
-{
-    // reset and remember new target range for object geometry
-    maLastPaintRange = rPaintRange;
-    maLastDefineRange = rDefineRange;
-
-    if(isUsed())
-    {
-        maPrimitives.realloc(1);
-        maPrimitives[0] = 
drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
-            basegfx::B2DPolyPolygon(
-                basegfx::tools::createPolygonFromRect(
-                    maLastPaintRange)), 
-                maLastDefineRange,
-            maFillAttribute.get() ? *maFillAttribute.get() : 
drawinglayer::attribute::SdrFillAttribute(),
-            maFillGradientAttribute.get() ? *maFillGradientAttribute.get() : 
drawinglayer::attribute::FillGradientAttribute());
-    }
-}
-
-FillAttributes::FillAttributes()
-:   maLastPaintRange(),
-    maLastDefineRange(),
-    maFillAttribute(),
-    maFillGradientAttribute(),
-    maPrimitives()
-{
-}
-
-FillAttributes::FillAttributes(const Color& rColor)
-:   maLastPaintRange(),
-    maLastDefineRange(),
-    maFillAttribute(),
-    maFillGradientAttribute(),
-    maPrimitives()
-{
-    maFillAttribute.reset(
-        new drawinglayer::attribute::SdrFillAttribute(
-            0.0,
-            Color(rColor.GetRGBColor()).getBColor(),
-            drawinglayer::attribute::FillGradientAttribute(),
-            drawinglayer::attribute::FillHatchAttribute(),
-            drawinglayer::attribute::SdrFillGraphicAttribute()));
-}
-
-FillAttributes::FillAttributes(const SfxItemSet& rSet)
-:   maLastPaintRange(),
-    maLastDefineRange(),
-    maFillAttribute(
-        new drawinglayer::attribute::SdrFillAttribute(
-            drawinglayer::primitive2d::createNewSdrFillAttribute(rSet))),
-    maFillGradientAttribute(
-        new drawinglayer::attribute::FillGradientAttribute(
-            
drawinglayer::primitive2d::createNewTransparenceGradientAttribute(rSet))),
-    maPrimitives()
-{
-}
-
-FillAttributes::~FillAttributes()
-{
-}
-
-bool FillAttributes::isUsed() const
-{
-    // only depends on fill, FillGradientAttribute alone defines no fill
-    return maFillAttribute.get() && !maFillAttribute->isDefault();
-}
-
-bool FillAttributes::isTransparent() const
-{
-    if(hasSdrFillAttribute() && 0.0 != maFillAttribute->getTransparence())
-    {
-        return true;
-    }
-
-    if(hasFillGradientAttribute() && !maFillGradientAttribute->isDefault())
-    {
-        return true;
-    }
-
-    return false;
-}
-
-const drawinglayer::attribute::SdrFillAttribute& 
FillAttributes::getFillAttribute() const 
-{ 
-    if(!maFillAttribute.get())
-    {
-        const_cast< FillAttributes* >(this)->maFillAttribute.reset(new 
drawinglayer::attribute::SdrFillAttribute());
-    }
-
-    return *maFillAttribute.get(); 
-}
-
-const drawinglayer::attribute::FillGradientAttribute& 
FillAttributes::getFillGradientAttribute() const 
-{ 
-    if(!maFillGradientAttribute.get())
-    {
-        const_cast< FillAttributes* >(this)->maFillGradientAttribute.reset(new 
drawinglayer::attribute::FillGradientAttribute());
-    }
-
-    return *maFillGradientAttribute.get(); 
-}
-
-const drawinglayer::primitive2d::Primitive2DSequence& 
FillAttributes::getPrimitive2DSequence(
-    const basegfx::B2DRange& rPaintRange,
-    const basegfx::B2DRange& rDefineRange) const
-{
-    if(maPrimitives.getLength() && (maLastPaintRange != rPaintRange || 
maLastDefineRange != rDefineRange))
-    {
-        const_cast< FillAttributes* >(this)->maPrimitives.realloc(0);
-    }
-
-    if(!maPrimitives.getLength())
-    {
-        const_cast< FillAttributes* 
>(this)->createPrimitive2DSequence(rPaintRange, rDefineRange);
-    }
-
-    return maPrimitives;
-}
-
-//////////////////////////////////////////////////////////////////////////////
 //  class SwFrmFmt
 //     Implementierung teilweise inline im hxx
 
@@ -2686,7 +2556,7 @@ void SwFrmFmt::Modify( const SfxPoolItem
                        RES_FOOTER, sal_False, (const SfxPoolItem**)&pF );
 
         //UUUU reset fill information
-        if(maFillAttributes.get())
+        if(RES_FLYFRMFMT == Which() && maFillAttributes.get())
         {
             SfxItemIter aIter(*((SwAttrSetChg*)pNew)->GetChgSet());
             bool bReset(false);
@@ -2704,8 +2574,11 @@ void SwFrmFmt::Modify( const SfxPoolItem
     }
     else if(RES_FMT_CHG == nWhich) //UUUU
     {
-        // reset fill information on format change (e.g. style changed)
-        maFillAttributes.reset();
+        //UUUU reset fill information on format change (e.g. style changed)
+        if(RES_FLYFRMFMT == Which() && maFillAttributes.get())
+        {
+            maFillAttributes.reset();
+        }
     }
     else if( RES_HEADER == nWhich )
         pH = (SwFmtHeader*)pNew;
@@ -3530,9 +3403,18 @@ SwFrmFmt* SwFrmFmt::GetCaptionFmt() cons
 //UUUU
 FillAttributesPtr SwFrmFmt::getFillAttributes() const
 {
-    if(!maFillAttributes.get())
+    if(RES_FLYFRMFMT == Which())
+    {
+        // create FillAttributes on demand
+        if(!maFillAttributes.get())
+        {
+            const_cast< SwFrmFmt* >(this)->maFillAttributes.reset(new 
FillAttributes(GetAttrSet()));
+        }
+    }
+    else
     {
-        const_cast< SwFrmFmt* >(this)->maFillAttributes.reset(new 
FillAttributes(GetAttrSet()));
+        // FALLBACKBREAKHERE assert wrong usage
+        OSL_ENSURE(false, "getFillAttributes() call only valid for 
RES_FLYFRMFMT currently (!)");
     }
 
     return maFillAttributes;

Added: 
openoffice/branches/alg_writerframes/main/sw/source/core/layout/fillattributes.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/layout/fillattributes.cxx?rev=1558210&view=auto
==============================================================================
--- 
openoffice/branches/alg_writerframes/main/sw/source/core/layout/fillattributes.cxx
 (added)
+++ 
openoffice/branches/alg_writerframes/main/sw/source/core/layout/fillattributes.cxx
 Tue Jan 14 21:43:43 2014
@@ -0,0 +1,159 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <fillattributes.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
+#include <svx/xfillit0.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+void FillAttributes::createPrimitive2DSequence(
+    const basegfx::B2DRange& rPaintRange,
+    const basegfx::B2DRange& rDefineRange)
+{
+    // reset and remember new target range for object geometry
+    maLastPaintRange = rPaintRange;
+    maLastDefineRange = rDefineRange;
+
+    if(isUsed())
+    {
+        maPrimitives.realloc(1);
+        maPrimitives[0] = 
drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+            basegfx::B2DPolyPolygon(
+                basegfx::tools::createPolygonFromRect(
+                    maLastPaintRange)), 
+                maLastDefineRange,
+            maFillAttribute.get() ? *maFillAttribute.get() : 
drawinglayer::attribute::SdrFillAttribute(),
+            maFillGradientAttribute.get() ? *maFillGradientAttribute.get() : 
drawinglayer::attribute::FillGradientAttribute());
+    }
+}
+
+FillAttributes::FillAttributes()
+:   maLastPaintRange(),
+    maLastDefineRange(),
+    maFillAttribute(),
+    maFillGradientAttribute(),
+    maPrimitives()
+{
+}
+
+FillAttributes::FillAttributes(const Color& rColor)
+:   maLastPaintRange(),
+    maLastDefineRange(),
+    maFillAttribute(),
+    maFillGradientAttribute(),
+    maPrimitives()
+{
+    maFillAttribute.reset(
+        new drawinglayer::attribute::SdrFillAttribute(
+            0.0,
+            Color(rColor.GetRGBColor()).getBColor(),
+            drawinglayer::attribute::FillGradientAttribute(),
+            drawinglayer::attribute::FillHatchAttribute(),
+            drawinglayer::attribute::SdrFillGraphicAttribute()));
+}
+
+FillAttributes::FillAttributes(const SfxItemSet& rSet)
+:   maLastPaintRange(),
+    maLastDefineRange(),
+    maFillAttribute(
+        new drawinglayer::attribute::SdrFillAttribute(
+            drawinglayer::primitive2d::createNewSdrFillAttribute(rSet))),
+    maFillGradientAttribute(
+        new drawinglayer::attribute::FillGradientAttribute(
+            
drawinglayer::primitive2d::createNewTransparenceGradientAttribute(rSet))),
+    maPrimitives()
+{
+}
+
+FillAttributes::~FillAttributes()
+{
+}
+
+bool FillAttributes::isUsed() const
+{
+    // only depends on fill, FillGradientAttribute alone defines no fill
+    return maFillAttribute.get() && !maFillAttribute->isDefault();
+}
+
+bool FillAttributes::isTransparent() const
+{
+    if(hasSdrFillAttribute() && 0.0 != maFillAttribute->getTransparence())
+    {
+        return true;
+    }
+
+    if(hasFillGradientAttribute() && !maFillGradientAttribute->isDefault())
+    {
+        return true;
+    }
+
+    return false;
+}
+
+const drawinglayer::attribute::SdrFillAttribute& 
FillAttributes::getFillAttribute() const 
+{ 
+    if(!maFillAttribute.get())
+    {
+        const_cast< FillAttributes* >(this)->maFillAttribute.reset(new 
drawinglayer::attribute::SdrFillAttribute());
+    }
+
+    return *maFillAttribute.get(); 
+}
+
+const drawinglayer::attribute::FillGradientAttribute& 
FillAttributes::getFillGradientAttribute() const 
+{ 
+    if(!maFillGradientAttribute.get())
+    {
+        const_cast< FillAttributes* >(this)->maFillGradientAttribute.reset(new 
drawinglayer::attribute::FillGradientAttribute());
+    }
+
+    return *maFillGradientAttribute.get(); 
+}
+
+const drawinglayer::primitive2d::Primitive2DSequence& 
FillAttributes::getPrimitive2DSequence(
+    const basegfx::B2DRange& rPaintRange,
+    const basegfx::B2DRange& rDefineRange) const
+{
+    if(maPrimitives.getLength() && (maLastPaintRange != rPaintRange || 
maLastDefineRange != rDefineRange))
+    {
+        const_cast< FillAttributes* >(this)->maPrimitives.realloc(0);
+    }
+
+    if(!maPrimitives.getLength())
+    {
+        const_cast< FillAttributes* 
>(this)->createPrimitive2DSequence(rPaintRange, rDefineRange);
+    }
+
+    return maPrimitives;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof

Propchange: 
openoffice/branches/alg_writerframes/main/sw/source/core/layout/fillattributes.cxx
------------------------------------------------------------------------------
    svn:executable = *

Modified: 
openoffice/branches/alg_writerframes/main/sw/source/core/layout/paintfrm.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/layout/paintfrm.cxx?rev=1558210&r1=1558209&r2=1558210&view=diff
==============================================================================
--- 
openoffice/branches/alg_writerframes/main/sw/source/core/layout/paintfrm.cxx 
(original)
+++ 
openoffice/branches/alg_writerframes/main/sw/source/core/layout/paintfrm.cxx 
Tue Jan 14 21:43:43 2014
@@ -3663,7 +3663,7 @@ void SwFlyFrm::Paint(SwRect const& rRect
                {
             const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* 
>(GetFmt());
 
-            if(pSwFrmFmt)
+            if(pSwFrmFmt && RES_FLYFRMFMT == pSwFrmFmt->Which())
             {
                 //UUUU check for transparency
                 const FillAttributesPtr 
aFillAttributes(pSwFrmFmt->getFillAttributes());
@@ -6702,7 +6702,7 @@ sal_Bool SwFrm::GetBackgroundBrush( 
         {
             const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* 
>(pSwLayoutFrm->GetFmt());
 
-            if(pSwFrmFmt)
+            if(pSwFrmFmt  && RES_FLYFRMFMT == pSwFrmFmt->Which())
             {
                 rFillAttributes = pSwFrmFmt->getFillAttributes();
             }

Modified: 
openoffice/branches/alg_writerframes/main/sw/source/core/unocore/unobrushitemhelper.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg_writerframes/main/sw/source/core/unocore/unobrushitemhelper.cxx?rev=1558210&r1=1558209&r2=1558210&view=diff
==============================================================================
--- 
openoffice/branches/alg_writerframes/main/sw/source/core/unocore/unobrushitemhelper.cxx
 (original)
+++ 
openoffice/branches/alg_writerframes/main/sw/source/core/unocore/unobrushitemhelper.cxx
 Tue Jan 14 21:43:43 2014
@@ -133,11 +133,11 @@ void setSvxBrushItemAsFillAttributesToTa
 }
 
 //UUUU
-SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet)
+SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, 
sal_Bool bSearchInParents)
 {
     SvxBrushItem aRetval(RES_BACKGROUND);
 
-    const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem*  
>(rSourceSet.GetItem(XATTR_FILLSTYLE, false)));
+    const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem*  
>(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents)));
 
     if(!pXFillStyleItem)
     {
@@ -154,8 +154,8 @@ SvxBrushItem getSvxBrushItemFromSourceSe
         case XFILL_SOLID:
         {
             // create SvxBrushItem with fill color
-            Color aFillColor(static_cast< const XFillColorItem& 
>(rSourceSet.Get(XATTR_FILLCOLOR)).GetColorValue());
-            const sal_uInt16 nFillTransparence(static_cast< const 
XFillTransparenceItem& >(rSourceSet.Get(XATTR_FILLTRANSPARENCE)).GetValue());
+            Color aFillColor(static_cast< const XFillColorItem& 
>(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue());
+            const sal_uInt16 nFillTransparence(static_cast< const 
XFillTransparenceItem& >(rSourceSet.Get(XATTR_FILLTRANSPARENCE, 
bSearchInParents)).GetValue());
 
             if(0 != nFillTransparence)
             {
@@ -174,15 +174,15 @@ SvxBrushItem getSvxBrushItemFromSourceSe
         case XFILL_BITMAP:
         {
             // create SvxBrushItem with bitmap info and flags
-            const XFillBitmapItem& rBmpItm = static_cast< const 
XFillBitmapItem& >(rSourceSet.Get(XATTR_FILLBITMAP));
+            const XFillBitmapItem& rBmpItm = static_cast< const 
XFillBitmapItem& >(rSourceSet.Get(XATTR_FILLBITMAP, bSearchInParents));
             const Graphic aGraphic(rBmpItm.GetGraphicObject().GetGraphic());
 
             if(GRAPHIC_NONE != aGraphic.GetType())
             {
                 // get graphic position
                 SvxGraphicPosition aSvxGraphicPosition(GPOS_NONE);
-                const XFillBmpStretchItem& rStretchItem = static_cast< const 
XFillBmpStretchItem& >(rSourceSet.Get(XATTR_FILLBMP_STRETCH));
-                const XFillBmpTileItem& rTileItem = static_cast< const 
XFillBmpTileItem& >(rSourceSet.Get(XATTR_FILLBMP_TILE));
+                const XFillBmpStretchItem& rStretchItem = static_cast< const 
XFillBmpStretchItem& >(rSourceSet.Get(XATTR_FILLBMP_STRETCH, bSearchInParents));
+                const XFillBmpTileItem& rTileItem = static_cast< const 
XFillBmpTileItem& >(rSourceSet.Get(XATTR_FILLBMP_TILE, bSearchInParents));
 
                 if(rTileItem.GetValue())
                 {
@@ -194,7 +194,7 @@ SvxBrushItem getSvxBrushItemFromSourceSe
                 }
                 else
                 {
-                    const XFillBmpPosItem& rPosItem = static_cast< const 
XFillBmpPosItem& >(rSourceSet.Get(XATTR_FILLBMP_POS));
+                    const XFillBmpPosItem& rPosItem = static_cast< const 
XFillBmpPosItem& >(rSourceSet.Get(XATTR_FILLBMP_POS, bSearchInParents));
 
                     switch(rPosItem.GetValue())
                     {
@@ -213,7 +213,7 @@ SvxBrushItem getSvxBrushItemFromSourceSe
                 // create with given graphic and position
                 aRetval = SvxBrushItem(aGraphic, aSvxGraphicPosition, 
RES_BACKGROUND);
 
-                const sal_uInt16 nFillTransparence(static_cast< const 
XFillTransparenceItem& >(rSourceSet.Get(XATTR_FILLTRANSPARENCE)).GetValue());
+                const sal_uInt16 nFillTransparence(static_cast< const 
XFillTransparenceItem& >(rSourceSet.Get(XATTR_FILLTRANSPARENCE, 
bSearchInParents)).GetValue());
 
                 if(0 != nFillTransparence)
                 {


Reply via email to