diff options
Diffstat (limited to 'sw')
63 files changed, 2452 insertions, 1823 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 4732226d5ca1..cef9a2c0f1e6 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -288,7 +288,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ 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 \ @@ -460,7 +459,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/unocore/unoparagraph \ sw/source/core/unocore/unoport \ sw/source/core/unocore/unoportenum \ - sw/source/core/unocore/unobrushitemhelper \ sw/source/core/unocore/unoredline \ sw/source/core/unocore/unoredlines \ sw/source/core/unocore/unorefmk \ diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 46c84b19ee50..fd119ce570ac 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -528,24 +528,6 @@ #define FN_UNO_FOOTER (FN_EXTRA2 + 38) #define FN_UNO_FOOTER_LEFT (FN_EXTRA2 + 39) #define FN_UNO_FOOTER_RIGHT (FN_EXTRA2 + 40) -#define FN_UNO_HEADER_BACKGROUND (FN_EXTRA2 + 41) -#define FN_UNO_HEADER_BOX (FN_EXTRA2 + 42) -#define FN_UNO_HEADER_LR_SPACE (FN_EXTRA2 + 43) -#define FN_UNO_HEADER_SHADOW (FN_EXTRA2 + 44) -#define FN_UNO_FOOTER_BACKGROUND (FN_EXTRA2 + 45) -#define FN_UNO_FOOTER_BOX (FN_EXTRA2 + 46) -#define FN_UNO_FOOTER_LR_SPACE (FN_EXTRA2 + 47) -#define FN_UNO_FOOTER_SHADOW (FN_EXTRA2 + 48) -#define FN_UNO_HEADER_BODY_DISTANCE (FN_EXTRA2 + 49) -#define FN_UNO_HEADER_IS_DYNAMIC_DISTANCE (FN_EXTRA2 + 50) -#define FN_UNO_FOOTER_BODY_DISTANCE (FN_EXTRA2 + 51) -#define FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE (FN_EXTRA2 + 52) -#define FN_UNO_HEADER_SHARE_CONTENT (FN_EXTRA2 + 53) -#define FN_UNO_FOOTER_SHARE_CONTENT (FN_EXTRA2 + 54) -#define FN_UNO_HEADER_HEIGHT (FN_EXTRA2 + 55) -#define FN_UNO_FOOTER_HEIGHT (FN_EXTRA2 + 56) -#define FN_UNO_HEADER_ON (FN_EXTRA2 + 57) -#define FN_UNO_FOOTER_ON (FN_EXTRA2 + 58) #define FN_UNO_FOLLOW_STYLE (FN_EXTRA2 + 59) #define FN_API_CALL (FN_EXTRA2 + 60) @@ -584,8 +566,6 @@ #define FN_NEW_GLOSSARY (FN_EXTRA2 + 90) #define FN_SET_ACT_GLOSSARY (FN_EXTRA2 + 91) -#define FN_UNO_HEADER_EAT_SPACING (FN_EXTRA2 + 92) -#define FN_UNO_FOOTER_EAT_SPACING (FN_EXTRA2 + 93) #define FN_UNO_CHARFMT_SEQUENCE (FN_EXTRA2 + 94) #define FN_UNO_CLSID (FN_EXTRA2 + 95) #define FN_UNO_MODEL (FN_EXTRA2 + 96) diff --git a/sw/inc/fillattributes.hxx b/sw/inc/fillattributes.hxx deleted file mode 100644 index 05624c4a8de5..000000000000 --- a/sw/inc/fillattributes.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ - -#ifndef INCLUDED_SW_INC_FILLATTRIBUTES_HXX -#define INCLUDED_SW_INC_FILLATTRIBUTES_HXX - -#include <drawinglayer/attribute/fillgradientattribute.hxx> -#include <drawinglayer/attribute/sdrfillattribute.hxx> -#include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <boost/shared_ptr.hpp> - -////////////////////////////////////////////////////////////////////////////// - -class Color; -class SfxItemSet; -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(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::primitive2d::Primitive2DSequence& getPrimitive2DSequence( - const basegfx::B2DRange& rPaintRange, - const basegfx::B2DRange& rDefineRange) const; -}; - -////////////////////////////////////////////////////////////////////////////// - -typedef boost::shared_ptr< FillAttributes > FillAttributesPtr; - -////////////////////////////////////////////////////////////////////////////// - -#endif // INCLUDED_SW_INC_FILLATTRIBUTES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index 325893105c0f..191a755dc740 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -25,8 +25,6 @@ #include <calbck.hxx> #include <hintids.hxx> #include <boost/shared_ptr.hpp> -//UUUU -#include <fillattributes.hxx> class IDocumentSettingAccess; class IDocumentDrawModelAccess; @@ -37,6 +35,11 @@ class IDocumentChartDataProviderAccess; class SwDoc; class SfxGrabBagItem; +namespace drawinglayer { namespace attribute { + class SdrAllFillAttributesHelper; + typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; +}} + /// Base class for various Writer styles. class SW_DLLPUBLIC SwFmt : public SwModify { @@ -241,7 +244,7 @@ public: inline const SvxBoxItem &GetBox( bool = true ) const; inline const SvxFmtKeepItem &GetKeep( bool = true ) const; - //UUUU + //UUUU Get SvxBrushItem for Background fill (partially for backwards compatibility) const SvxBrushItem& GetBackground( bool = true ) const; inline const SvxShadowItem &GetShadow( bool = true ) const; @@ -327,28 +330,16 @@ public: */ virtual bool IsShadowTransparent() const; - //UUUU - virtual FillAttributesPtr getFillAttributes() const; + //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; }; -//UUUUinline const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, -//UUUU bool bInParents ) const -//UUUU{ -//UUUU return aSet.Get( nWhich, bInParents ); -//UUUU} - inline void SwFmt::SetName( const sal_Char* pNewName, bool bBroadcast ) { SetName(OUString::createFromAscii(pNewName), bBroadcast); } -//UUUUinline SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, -//UUUU const SfxPoolItem **ppItem ) const -//UUUU{ -//UUUU return aSet.GetItemState( nWhich, bSrchInParent, ppItem ); -//UUUU} - #endif // INCLUDED_SW_INC_FORMAT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/frmatr.hxx b/sw/inc/frmatr.hxx index adde000b9c84..c3937dff459b 100644 --- a/sw/inc/frmatr.hxx +++ b/sw/inc/frmatr.hxx @@ -71,8 +71,6 @@ inline const SvxBoxItem &SwFmt::GetBox(bool bInP) const { return aSet.GetBox(bInP); } inline const SvxFmtKeepItem &SwFmt::GetKeep(bool bInP) const { return aSet.GetKeep(bInP); } -//UUUUinline const SvxBrushItem &SwFmt::GetBackground(sal_Bool bInP) const -//UUUU { return aSet.GetBackground(bInP); } inline const SvxShadowItem &SwFmt::GetShadow(bool bInP) const { return aSet.GetShadow(bInP); } inline const SvxFmtBreakItem &SwFmt::GetBreak(bool bInP) const diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index 1b063ff4a077..ebf23173387e 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -43,8 +43,8 @@ class SW_DLLPUBLIC SwFrmFmt: public SwFmt ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface> m_wXObject; - //UUUU - FillAttributesPtr maFillAttributes; + //UUUU DrawingLayer FillAttributes in a preprocessed form for primitive usage + drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes; protected: SwFrmFmt( @@ -134,8 +134,8 @@ public: DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt) void RegisterToFormat( SwFmt& rFmt ); - //UUUU - virtual FillAttributesPtr getFillAttributes() const SAL_OVERRIDE; + //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const SAL_OVERRIDE; }; // The FlyFrame-Format diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 4a0840d52e0b..4e481936bfc6 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -21,6 +21,7 @@ #include <tools/solar.h> #include <sal/types.h> +#include <svx/xdef.hxx> #include "swdllapi.h" // For SwTxtHints without end index the following char is added: @@ -398,11 +399,16 @@ inline bool isPARATR(const sal_uInt16 nWhich) } inline bool isPARATR_LIST(const sal_uInt16 nWhich) { - return (RES_PARATR_LIST_BEGIN <= nWhich) && (RES_PARATR_LIST_END > nWhich); } + return (RES_PARATR_LIST_BEGIN <= nWhich) && (RES_PARATR_LIST_END > nWhich); +} inline bool isFRMATR(const sal_uInt16 nWhich) { return (RES_FRMATR_BEGIN <= nWhich) && (RES_FRMATR_END > nWhich); } +inline bool isDrawingLayerAttribute(const sal_uInt16 nWhich) //UUUU +{ + return (XATTR_FILL_FIRST <= nWhich) && (XATTR_FILL_LAST >= nWhich); +} inline bool isGRFATR(const sal_uInt16 nWhich) { return (RES_GRFATR_BEGIN <= nWhich) && (RES_GRFATR_END > nWhich); diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index be1f1ac2fad7..a971b15f2928 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -93,15 +93,37 @@ public: SwDelTxt( sal_Int32 nS, sal_Int32 nL ); }; -class SwUpdateAttr: public SwMsgPoolItem +class SwUpdateAttr : public SwMsgPoolItem { -public: +private: sal_Int32 nStart; sal_Int32 nEnd; sal_uInt16 nWhichAttr; std::vector<sal_uInt16> aWhichFmtAttr; // attributes changed inside RES_TXTATR_AUTOFMT + +public: SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW ); SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW ); + + sal_Int32 getStart() const + { + return nStart; + } + + sal_Int32 getEnd() const + { + return nEnd; + } + + sal_uInt16 getWhichAttr() const + { + return nWhichAttr; + } + + const std::vector<sal_uInt16>& getFmtAttr() const + { + return aWhichFmtAttr; + } }; /** SwRefMarkFldUpdate is sent when the referencemarks should be updated. diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 46ef40180a5f..113ff62c021d 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -115,6 +115,9 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XTextContent> m_wXParagraph; + //UUUU DrawingLayer FillAttributes in a preprocessed form for primitive usage + drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes; + SAL_DLLPRIVATE SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl, const SfxItemSet* pAutoAttr = 0 ); @@ -797,6 +800,9 @@ public: bool CompareParRsid( const SwTxtNode &rTxtNode ) const; DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode) + + //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; }; inline SwpHints & SwTxtNode::GetSwpHints() diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index be64d454d690..4de9d182c952 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -75,6 +75,12 @@ class IDocumentListItems; class SwOLENodes; class Point; +//UUUU +namespace drawinglayer { namespace attribute { + class SdrAllFillAttributesHelper; + typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; +}} + /// Base class of the Writer document model elements. class SW_DLLPUBLIC SwNode : private BigPtrEntry @@ -479,6 +485,9 @@ public: static SwOLENodes* CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize ); + //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; + private: /// Private constructor because copying is never allowed!! SwCntntNode( const SwCntntNode & rNode ); diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx index fbd6c6d2e23b..b60bc45c02cc 100644 --- a/sw/inc/swatrset.hxx +++ b/sw/inc/swatrset.hxx @@ -138,8 +138,10 @@ class SwTblBoxValue; class SwAttrPool : public SfxItemPool { private: - ///UUUU helpers to add/rmove DrawingLayer ItemPool, used in constructor - /// and destructor; still isolated to evtl. allow other use later + //UUUU helpers to add/rmove DrawingLayer ItemPool, used in constructor + // and destructor; still isolated to evtl. allow other use later, but + // used bz default now to have it instantly as needed for DrawingLayer + // FillStyle support void createAndAddSecondaryPools(); void removeAndDeleteSecondaryPools(); diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx index 7856360130b8..6ebc335b2ae4 100644 --- a/sw/inc/swunohelper.hxx +++ b/sw/inc/swunohelper.hxx @@ -35,6 +35,9 @@ namespace rtl {class OUString;} class DateTime; +//UUUU +class SfxItemSet; + namespace SWUnoHelper { // calls over the compherl the getEnumAsInt32 function and handle the @@ -70,6 +73,12 @@ SW_DLLPUBLIC bool UCB_IsFile( const OUString& rURL ); // is the URL a existing directory? bool UCB_IsDirectory( const OUString& rURL ); + +///UUUU helper to check if fill style is set to color or bitmap +/// and thus formally used SvxBrushItem parts need to be mapped +/// for backwards compatibility +bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet); + } #endif diff --git a/sw/inc/unobrushitemhelper.hxx b/sw/inc/unobrushitemhelper.hxx deleted file mode 100644 index fd141e51d248..000000000000 --- a/sw/inc/unobrushitemhelper.hxx +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ - -#ifndef INCLUDED_SW_INC_UNOBRUSHITEMHELPER_HXX -#define INCLUDED_SW_INC_UNOBRUSHITEMHELPER_HXX - -#include <swdllapi.h> -#include <editeng/brushitem.hxx> - -namespace sw { - -//UUUU helper function definintions for UNO API fallbacks to replace SvxBrushItem -void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet); -SW_DLLPUBLIC SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSearchInParents = true); - -} // namespace sw - -#endif // INCLUDED_SW_INC_UNOBRUSHITEMHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index 0d9c761a8ce7..afd243736a44 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -72,11 +72,6 @@ private: SwPaM* m_pCopySource; - ///UUUU helper to check if fill style is set to color or bitmap - /// and thus formally used SvxBrushItem parts need to be mapped - /// for backwards compatibility - bool needToMapFillItemsToSvxBrushItemTypes() const; - protected: com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxStyleData; com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxStyleFamily; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 9f0267e872e2..197430400f7d 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -663,6 +663,60 @@ #define UNO_NAME_SW_FILLTRANSPARENCEGRADIENTNAME UNO_NAME_FILLTRANSPARENCEGRADIENTNAME #define UNO_NAME_SW_FILLCOLOR_2 UNO_NAME_FILLCOLOR_2 +#define UNO_NAME_HEADER_FILLBMP_LOGICAL_SIZE "Header" UNO_NAME_FILLBMP_LOGICAL_SIZE +#define UNO_NAME_HEADER_FILLBMP_OFFSET_X "Header" UNO_NAME_FILLBMP_OFFSET_X +#define UNO_NAME_HEADER_FILLBMP_OFFSET_Y "Header" UNO_NAME_FILLBMP_OFFSET_Y +#define UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_X "Header" UNO_NAME_FILLBMP_POSITION_OFFSET_X +#define UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_Y "Header" UNO_NAME_FILLBMP_POSITION_OFFSET_Y +#define UNO_NAME_HEADER_FILLBMP_RECTANGLE_POINT "Header" UNO_NAME_FILLBMP_RECTANGLE_POINT +#define UNO_NAME_HEADER_FILLBMP_SIZE_X "Header" UNO_NAME_FILLBMP_SIZE_X +#define UNO_NAME_HEADER_FILLBMP_SIZE_Y "Header" UNO_NAME_FILLBMP_SIZE_Y +#define UNO_NAME_HEADER_FILLBMP_STRETCH "Header" UNO_NAME_FILLBMP_STRETCH +#define UNO_NAME_HEADER_FILLBMP_TILE "Header" UNO_NAME_FILLBMP_TILE +#define UNO_NAME_HEADER_FILLBMP_MODE "Header" UNO_NAME_FILLBMP_MODE +#define UNO_NAME_HEADER_FILLCOLOR "Header" UNO_NAME_FILLCOLOR +#define UNO_NAME_HEADER_FILLBACKGROUND "Header" UNO_NAME_FILLBACKGROUND +#define UNO_NAME_HEADER_FILLBITMAP "Header" UNO_NAME_FILLBITMAP +#define UNO_NAME_HEADER_FILLBITMAPNAME "Header" UNO_NAME_FILLBITMAPNAME +#define UNO_NAME_HEADER_FILLBITMAPURL "Header" UNO_NAME_FILLBITMAPURL +#define UNO_NAME_HEADER_FILLGRADIENTSTEPCOUNT "Header" UNO_NAME_FILLGRADIENTSTEPCOUNT +#define UNO_NAME_HEADER_FILLGRADIENT "Header" UNO_NAME_FILLGRADIENT +#define UNO_NAME_HEADER_FILLGRADIENTNAME "Header" UNO_NAME_FILLGRADIENTNAME +#define UNO_NAME_HEADER_FILLHATCH "Header" UNO_NAME_FILLHATCH +#define UNO_NAME_HEADER_FILLHATCHNAME "Header" UNO_NAME_FILLHATCHNAME +#define UNO_NAME_HEADER_FILLSTYLE "Header" UNO_NAME_FILLSTYLE +#define UNO_NAME_HEADER_FILL_TRANSPARENCE "Header" UNO_NAME_FILL_TRANSPARENCE +#define UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENT "Header" UNO_NAME_FILLTRANSPARENCEGRADIENT +#define UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENTNAME "Header" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME +#define UNO_NAME_HEADER_FILLCOLOR_2 "Header" UNO_NAME_FILLCOLOR_2 + +#define UNO_NAME_FOOTER_FILLBMP_LOGICAL_SIZE "Footer" UNO_NAME_FILLBMP_LOGICAL_SIZE +#define UNO_NAME_FOOTER_FILLBMP_OFFSET_X "Footer" UNO_NAME_FILLBMP_OFFSET_X +#define UNO_NAME_FOOTER_FILLBMP_OFFSET_Y "Footer" UNO_NAME_FILLBMP_OFFSET_Y +#define UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_X "Footer" UNO_NAME_FILLBMP_POSITION_OFFSET_X +#define UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_Y "Footer" UNO_NAME_FILLBMP_POSITION_OFFSET_Y +#define UNO_NAME_FOOTER_FILLBMP_RECTANGLE_POINT "Footer" UNO_NAME_FILLBMP_RECTANGLE_POINT +#define UNO_NAME_FOOTER_FILLBMP_SIZE_X "Footer" UNO_NAME_FILLBMP_SIZE_X +#define UNO_NAME_FOOTER_FILLBMP_SIZE_Y "Footer" UNO_NAME_FILLBMP_SIZE_Y +#define UNO_NAME_FOOTER_FILLBMP_STRETCH "Footer" UNO_NAME_FILLBMP_STRETCH +#define UNO_NAME_FOOTER_FILLBMP_TILE "Footer" UNO_NAME_FILLBMP_TILE +#define UNO_NAME_FOOTER_FILLBMP_MODE "Footer" UNO_NAME_FILLBMP_MODE +#define UNO_NAME_FOOTER_FILLCOLOR "Footer" UNO_NAME_FILLCOLOR +#define UNO_NAME_FOOTER_FILLBACKGROUND "Footer" UNO_NAME_FILLBACKGROUND +#define UNO_NAME_FOOTER_FILLBITMAP "Footer" UNO_NAME_FILLBITMAP +#define UNO_NAME_FOOTER_FILLBITMAPNAME "Footer" UNO_NAME_FILLBITMAPNAME +#define UNO_NAME_FOOTER_FILLBITMAPURL "Footer" UNO_NAME_FILLBITMAPURL +#define UNO_NAME_FOOTER_FILLGRADIENTSTEPCOUNT "Footer" UNO_NAME_FILLGRADIENTSTEPCOUNT +#define UNO_NAME_FOOTER_FILLGRADIENT "Footer" UNO_NAME_FILLGRADIENT +#define UNO_NAME_FOOTER_FILLGRADIENTNAME "Footer" UNO_NAME_FILLGRADIENTNAME +#define UNO_NAME_FOOTER_FILLHATCH "Footer" UNO_NAME_FILLHATCH +#define UNO_NAME_FOOTER_FILLHATCHNAME "Footer" UNO_NAME_FILLHATCHNAME +#define UNO_NAME_FOOTER_FILLSTYLE "Footer" UNO_NAME_FILLSTYLE +#define UNO_NAME_FOOTER_FILL_TRANSPARENCE "Footer" UNO_NAME_FILL_TRANSPARENCE +#define UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT "Footer" UNO_NAME_FILLTRANSPARENCEGRADIENT +#define UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME "Footer" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME +#define UNO_NAME_FOOTER_FILLCOLOR_2 "Footer" UNO_NAME_FILLCOLOR_2 + #define UNO_NAME_PARA_STYLEHEADING "ParaStyleHeading" #define UNO_NAME_PARA_STYLELEVEL1 "ParaStyleLevel1" #define UNO_NAME_PARA_STYLELEVEL10 "ParaStyleLevel10" diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx index 0a661b4e75fd..7d210402e5d9 100644 --- a/sw/inc/unostyle.hxx +++ b/sw/inc/unostyle.hxx @@ -376,6 +376,7 @@ public: virtual sal_Bool SAL_CALL SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; }; + class SwXAutoStylesEnumerator : public cppu::WeakImplHelper1< ::com::sun::star::container::XEnumeration >, public SwClient { @@ -400,8 +401,10 @@ class SwXAutoStyle : public cppu::WeakImplHelper3 >, public SwClient { - SfxItemSet_Pointer_t pSet; - IStyleAccess::SwAutoStyleFamily eFamily; +private: + SfxItemSet_Pointer_t mpSet; + IStyleAccess::SwAutoStyleFamily meFamily; + SwDoc& mrDoc; ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 9c70eb15c652..a48455662e4e 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1042,7 +1042,7 @@ static bool lcl_GetBackgroundColor( Color & rColor, SwRect aDummyRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; if ( pFrm && pFrm->GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false ) ) diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx index e9bfb33504dc..a497e6b7dc05 100644 --- a/sw/source/core/attr/cellatr.cxx +++ b/sw/source/core/attr/cellatr.cxx @@ -162,8 +162,10 @@ void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem ) { // external rendering aCopy.PtrToBoxNm( &pTblNd->GetTable() ); - pUpdtFld->pHistory->Add( &aCopy, &aCopy, - pNd->FindTableBoxStartNode()->GetIndex() ); + pUpdtFld->pHistory->Add( + &aCopy, + &aCopy, + pNd->FindTableBoxStartNode()->GetIndex()); } } else diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index a99d7360bae8..e0be94b6e6ae 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -28,8 +28,10 @@ #include <swcache.hxx> #include <svl/grabbagitem.hxx> #include <com/sun/star/beans/PropertyValues.hpp> + //UUUU -#include <unobrushitemhelper.hxx> +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> +#include <svx/unobrushitemhelper.hxx> #include <svx/xdef.hxx> using namespace com::sun::star; @@ -388,7 +390,7 @@ bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom) const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const { - if(RES_BACKGROUND == nWhich && RES_FLYFRMFMT == Which()) + if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == 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)"); @@ -397,7 +399,7 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const // 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 = sw::getSvxBrushItemFromSourceSet(aSet, bInParents); + aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInParents); return aSvxBrushItem; } @@ -408,11 +410,11 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem ) const { - if(RES_BACKGROUND == nWhich && RES_FLYFRMFMT == Which()) + if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == 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(); + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper(); // check if the new fill attributes are used if(aFill.get() && aFill->isUsed()) @@ -422,7 +424,7 @@ SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const S // to and return as state that it is set static SvxBrushItem aSvxBrushItem(RES_BACKGROUND); - aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, bSrchInParent); + aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bSrchInParent); if( ppItem ) *ppItem = &aSvxBrushItem; @@ -452,7 +454,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr ) bool bRet = false; //UUUU - if(RES_BACKGROUND == rAttr.Which() && RES_FLYFRMFMT == Which()) + if(RES_BACKGROUND == rAttr.Which() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == 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)"); @@ -462,7 +464,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem& 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 - sw::setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet); + setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet); if(IsModifyLocked()) { @@ -541,7 +543,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) bool bRet = false; - //UUUU Usel local copy to be able to apply needed changes, e.g. call + //UUUU Use local copy to be able to apply needed changes, e.g. call // CheckForUniqueItemForLineFillNameOrIndex which is needed for NameOrIndex stuff SfxItemSet aTempSet(rSet); @@ -553,8 +555,8 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aTempSet); } - //UUUU - if(RES_FLYFRMFMT == Which()) + //UUUU FlyFrame PageStyle + if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) { const SfxPoolItem* pSource = 0; @@ -567,7 +569,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) // 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)); - sw::setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet); + setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet); if(IsModifyLocked()) { @@ -787,7 +789,8 @@ void SwFmt::SetGrabBagItem(const uno::Any& rVal) //UUUU const SvxBrushItem& SwFmt::GetBackground(bool bInP) const { - if(RES_FLYFRMFMT == Which()) + //UUUU FlyFrame PageStyle + if(RES_FLYFRMFMT == Which() || RES_FRMFMT == 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)"); @@ -796,7 +799,7 @@ const SvxBrushItem& SwFmt::GetBackground(bool bInP) const // 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 = sw::getSvxBrushItemFromSourceSet(aSet, bInP); + aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInP); return aSvxBrushItem; } @@ -805,12 +808,9 @@ const SvxBrushItem& SwFmt::GetBackground(bool bInP) const } //UUUU -FillAttributesPtr SwFmt::getFillAttributes() const +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFmt::getSdrAllFillAttributesHelper() const { - // FALLBACKBREAKHERE return empty pointer - OSL_ENSURE(false, "getFillAttributes() call only valid for RES_FLYFRMFMT currently (!)"); - - return FillAttributesPtr(); + return drawinglayer::attribute::SdrAllFillAttributesHelperPtr(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index a42044306506..b2fb6051d64c 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -170,6 +170,10 @@ sal_uInt16 aTxtNodeSetRange[] = { RES_PARATR_BEGIN, RES_PARATR_END-1, RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, + + //UUUU FillAttribute support (paragraph FillStyle) + XATTR_FILL_FIRST, XATTR_FILL_LAST, + 0 }; @@ -226,7 +230,7 @@ sal_uInt16 aFrmFmtSetRange[] = { RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, - //UUUU FillAttribute support + //UUUU FillAttribute support (TextFrame, OLE, Writer GraphicObject) XATTR_FILL_FIRST, XATTR_FILL_LAST, 0 diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 108dae512080..0ab73e7512cb 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -131,17 +131,19 @@ static void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, // correctly if we have different WhichRanges. // Take over the attributes which are of interest. - sal_uInt16 const aIdArr[] = { RES_FRM_SIZE, RES_UL_SPACE, - RES_BACKGROUND, RES_SHADOW, - RES_COL, RES_COL, - RES_FRAMEDIR, RES_FRAMEDIR, - RES_TEXTGRID, RES_TEXTGRID, - // #i45539# - RES_HEADER_FOOTER_EAT_SPACING, - RES_HEADER_FOOTER_EAT_SPACING, - RES_UNKNOWNATR_CONTAINER, - RES_UNKNOWNATR_CONTAINER, - 0 }; + sal_uInt16 const aIdArr[] = { + RES_FRM_SIZE, RES_UL_SPACE, // [83..86 + RES_BACKGROUND, RES_SHADOW, // [99..101 + RES_COL, RES_COL, // [103 + RES_TEXTGRID, RES_TEXTGRID, // [109 + RES_FRAMEDIR, RES_FRAMEDIR, // [114 + RES_HEADER_FOOTER_EAT_SPACING, RES_HEADER_FOOTER_EAT_SPACING, // [115 + RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER, // [143 + + //UUUU take over DrawingLayer FillStyles + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + 0}; const SfxPoolItem* pItem; for( sal_uInt16 n = 0; aIdArr[ n ]; n += 2 ) @@ -153,13 +155,49 @@ static void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING // bPage == false: // All in aIdArr except from RES_COL and RES_PAPER_BIN: - if( ( bPage && RES_HEADER_FOOTER_EAT_SPACING != nId ) || - ( !bPage && RES_COL != nId && RES_PAPER_BIN != nId )) + bool bExecuteId(true); + + if(bPage) { - if( SFX_ITEM_SET == rSource.GetItemState( nId, false, &pItem )) - rDest.SetFmtAttr( *pItem ); + // When Page + switch(nId) + { + // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING + case RES_HEADER_FOOTER_EAT_SPACING: + //UUUU take out SvxBrushItem; it's the result of the fallback + // at SwFmt::GetItemState and not really in state SFX_ITEM_SET + case RES_BACKGROUND: + bExecuteId = false; + break; + default: + break; + } + } + else + { + // When not Page + switch(nId) + { + // When not Page: All in aIdArr except from RES_COL and RES_PAPER_BIN: + case RES_COL: + case RES_PAPER_BIN: + bExecuteId = false; + break; + default: + break; + } + } + + if(bExecuteId) + { + if (SFX_ITEM_SET == rSource.GetItemState(nId, false, &pItem)) + { + rDest.SetFmtAttr(*pItem); + } else - rDest.ResetFmtAttr( nId ); + { + rDest.ResetFmtAttr(nId); + } } } } diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 8e357b7ac7ef..9d552ef5892f 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -787,7 +787,11 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const OUString &rStr ) ? pNode->GetpSwpHints()->Count() : 0; if( nOldAttrCnt != nNewAttrCnt ) { - SwUpdateAttr aHint( 0, 0, 0 ); + SwUpdateAttr aHint( + 0, + 0, + 0); + pNode->ModifyBroadcast( 0, &aHint, TYPE( SwCrsrShell ) ); } diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 0e45f7a4a1a2..31c9fe217ac9 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -516,13 +516,7 @@ bool SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) ); } - //UUUU Need to check for unique item for DrawingLayer items of type NameOrIndex - // and evtl. correct that item to ensure unique names for that type. This call may - // modify/correct entries inside of the given SfxItemSet - CheckForUniqueItemForLineFillNameOrIndex(rSet); - - bool const bRet = - lcl_SetFlyFrmAttr(*this, &SwDoc::SetFlyFrmAnchor, rFlyFmt, rSet); + bool const bRet = lcl_SetFlyFrmAttr(*this, &SwDoc::SetFlyFrmAnchor, rFlyFmt, rSet); if ( pSaveUndo.get() ) { diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 6e3d5d975efa..4795e1e895ca 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -505,7 +505,8 @@ static bool lcl_InsAttr( || isPARATR_LIST(nWhich) || isFRMATR(nWhich) || isGRFATR(nWhich) - || isUNKNOWNATR(nWhich) ) + || isUNKNOWNATR(nWhich) + || isDrawingLayerAttribute(nWhich) ) //UUUU { pOtherSet = &rChgSet; bOtherAttr = true; @@ -532,6 +533,10 @@ static bool lcl_InsAttr( RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_GRFATR_BEGIN, RES_GRFATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, + 0 ); pTmpCharItemSet->Put( rChgSet ); @@ -837,7 +842,14 @@ static bool lcl_InsAttr( if( pOtherSet && pOtherSet->Count() ) { SwRegHistory aRegH( pNode, *pNode, pHistory ); - bRet = pNode->SetAttr( *pOtherSet ) || bRet; + + //UUUU Need to check for unique item for DrawingLayer items of type NameOrIndex + // and evtl. correct that item to ensure unique names for that type. This call may + // modify/correct entries inside of the given SfxItemSet + SfxItemSet aTempLocalCopy(*pOtherSet); + + pDoc->CheckForUniqueItemForLineFillNameOrIndex(aTempLocalCopy); + bRet = pNode->SetAttr(aTempLocalCopy) || bRet; } DELETECHARSETS @@ -1252,7 +1264,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) { aCallMod.Add( mpDfltGrfFmtColl ); } - else if (isFRMATR(nWhich)) + else if (isFRMATR(nWhich) || isDrawingLayerAttribute(nWhich) ) //UUUU { aCallMod.Add( mpDfltGrfFmtColl ); aCallMod.Add( mpDfltTxtFmtColl ); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index b32744938215..882719e4060b 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -104,6 +104,9 @@ #include <fmtmeta.hxx> #include <boost/foreach.hpp> +//UUUU +#include <svx/xfillit0.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::document; @@ -281,6 +284,21 @@ SwDoc::SwDoc() mbReadOnly(false), meDocType(DOCTYPE_NATIVE) { + //UUUU The DrawingLayer ItemPool which is used as 2nd pool for Writer documents' pool + // has a default for the XFillStyleItem of XFILL_SOLID and the color for it is the default + // fill color (blue7 or similar). This is a problem, in Writer we want the default fill + // style to be XFILL_NONE. This cannot simply be done by changing it in the 2nd pool at the + // pool defaults when the DrawingLayer ItemPool is used for Writer, that would lead to + // countless problems like DrawObjects initial fill and others. + // It is also hard to find all places where the initial ItemSets for Writer (including + // style hierarchies) are created and to always set (but only at the root) the FillStyle + // to NONE fixed; that will add that attribute to the file format. It will be hard to reset + // attribbute sets (which is done at import and using UI). Also not a good solution. + // Luckily Writer uses pDfltTxtFmtColl as default parent for all paragraphs and similar, thus + // it is possible to set this attribute here. It will be not reset when importing. + mpDfltTxtFmtColl->SetFmtAttr(XFillStyleItem(XFILL_NONE)); + mpDfltFrmFmt->SetFmtAttr(XFillStyleItem(XFILL_NONE)); + /* * DefaultFormats and DefaultFormatCollections (FmtColl) * are inserted at position 0 at the respective array. diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index ab47e58d0965..d3fae50bb22d 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -3516,18 +3516,20 @@ void SwRangeRedline::InvalidateRange() // trigger the Layout sal_Int32 nTmp2 = nSttCnt; nSttCnt = nEndCnt; nEndCnt = nTmp2; } - SwUpdateAttr aHt( 0, 0, RES_FMT_CHG ); SwNodes& rNds = GetDoc()->GetNodes(); - for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) + for (sal_uLong n(nSttNd); n <= nEndNd; ++n) { - SwNode* pNd = rNds[n]; - if( pNd->IsTxtNode() ) + SwNode* pNode = rNds[n]; + + if (pNode && pNode->IsTxtNode()) { - aHt.nStart = n == nSttNd ? nSttCnt : 0; - aHt.nEnd = (n == nEndNd) - ? nEndCnt - : static_cast<SwTxtNode*>(pNd)->GetTxt().getLength(); - ((SwTxtNode*)pNd)->ModifyNotification( &aHt, &aHt ); + SwTxtNode* pNd = static_cast< SwTxtNode* >(pNode); + SwUpdateAttr aHt( + n == nSttNd ? nSttCnt : 0, + n == nEndNd ? nEndCnt : pNd->GetTxt().getLength(), + RES_FMT_CHG); + + pNd->ModifyNotification(&aHt, &aHt); } } } diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index b787b4f20bc6..e2cd1fcddca7 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -183,7 +183,7 @@ static void lcl_ClearArea( const SwFrm &rFrm, const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; if ( rFrm.GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigRect, false ) ) { diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index c3d6b30a206a..da5151e5a8f9 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -65,6 +65,9 @@ #include <numrule.hxx> #include <svx/xdef.hxx> +//UUUU +#include <svx/xfillit0.hxx> + using namespace ::editeng; using namespace ::com::sun::star; diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx index db255aee7805..a574e4ff44d8 100644 --- a/sw/source/core/doc/visiturl.cxx +++ b/sw/source/core/doc/visiturl.cxx @@ -75,12 +75,14 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint ) bUnLockView = !pESh->IsViewLocked(); pESh->LockView( true ); } - const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( false ); + const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid(false); const SwTxtAttr* pAttr = pTxtAttr; - SwUpdateAttr aUpdateAttr( pAttr->GetStart(), - *pAttr->End(), - RES_FMT_CHG ); - ((SwTxtNode*)pTxtNd)->ModifyNotification( &aUpdateAttr, &aUpdateAttr ); + SwUpdateAttr aUpdateAttr( + pAttr->GetStart(), + *pAttr->End(), + RES_FMT_CHG); + + const_cast< SwTxtNode* >(pTxtNd)->ModifyNotification(&aUpdateAttr, &aUpdateAttr); } } } diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 5cb751e91a83..37242a7cf126 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -987,7 +987,7 @@ void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewV case RES_UPDATE_ATTR: if( GetNodes().IsDocNodes() && IsTxtNode() ) { - const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->nWhichAttr; + const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->getWhichAttr(); if ( RES_ATTRSET_CHG == nTmp ) { // TODO: anybody wants to do some optimization here? @@ -1910,6 +1910,12 @@ SwOLENodes* SwCntntNode::CreateOLENodesArray( const SwFmtColl& rColl, bool bOnly return pNodes; } +//UUUU +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwCntntNode::getSdrAllFillAttributesHelper() const +{ + return drawinglayer::attribute::SdrAllFillAttributesHelperPtr(); +} + /* * Document Interface Access */ diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index a839716e42f4..058e64c13d8e 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SW_SOURCE_CORE_INC_DFLYOBJ_HXX #define INCLUDED_SW_SOURCE_CORE_INC_DFLYOBJ_HXX +#include <drawinglayer/geometry/viewinformation2d.hxx> #include <svx/svdovirt.hxx> class SwFlyFrm; diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 136244213d9c..1a8e33e08731 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -60,8 +60,6 @@ class SwPrintData; class SwSortedObjs; class SwAnchoredObject; typedef struct _xmlTextWriter *xmlTextWriterPtr; -//UUUU -class FillAttributes; // Each FrmType is represented here as a bit. // The bits must be set in a way that it can be determined with masking of @@ -222,6 +220,12 @@ enum MakePageType MAKEPAGE_NOSECTION // Don't create section frames }; +//UUUU +namespace drawinglayer { namespace attribute { + class SdrAllFillAttributesHelper; + typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; +}} + /** * Base class of the Writer layout elements. * @@ -512,7 +516,7 @@ public: void Retouche( const SwPageFrm *pPage, const SwRect &rRect ) const; bool GetBackgroundBrush( - boost::shared_ptr< FillAttributes >& rFillAttributes, + drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, const SvxBrushItem*& rpBrush, const Color*& rpColor, SwRect &rOrigRect, @@ -886,6 +890,9 @@ public: void RegisterToFormat( SwFmt& rFmt ); void ValidateThisAndAllLowers( const sal_uInt16 nStage ); + //UUUU + drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; + public: // if writer is NULL, dumps the layout structure as XML in layout.xml virtual void dumpAsXml(xmlTextWriterPtr writer = NULL); diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index c7e32b9dab1e..00cdf28b43d6 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -61,7 +61,7 @@ void DrawGraphic( const sal_uInt8 nGrfNum = GRFNUM_NO, const bool bConsiderBackgroundTransparency = false ); bool DrawFillAttributes( - const boost::shared_ptr< FillAttributes >& rFillAttributes, + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, const SwRect& rOriginalLayoutRect, const SwRect& rPaintRect, OutputDevice& rOut); diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 24ac07e45ed9..63ca034bb8ae 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -77,7 +77,7 @@ #endif //UUUU -#include <fillattributes.hxx> +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> #include <svx/xfillit0.hxx> #include <svl/itemiter.hxx> @@ -2378,20 +2378,6 @@ SwFrmFmt::SwFrmFmt( m_wXObject(), maFillAttributes() { - //UUUU - if(RES_FLYFRMFMT == nFmtWhich) - { - // when its a SwFlyFrmFmt do not do this, this setting - // will be derived from the parent style. In the future this - // may be needed for more formats; all which use the - // XATTR_FILL_FIRST, XATTR_FILL_LAST range as fill attributes - } - else - { - // set FillStyle to none; this is necessary since the pool default is - // to fill objects by color (blue8) - SetFmtAttr(XFillStyleItem(XFILL_NONE)); - } } SwFrmFmt::SwFrmFmt( @@ -2404,20 +2390,6 @@ SwFrmFmt::SwFrmFmt( m_wXObject(), maFillAttributes() { - //UUUU - if(RES_FLYFRMFMT == nFmtWhich) - { - // when its a SwFlyFrmFmt do not do this, this setting - // will be derived from the parent style. In the future this - // may be needed for more formats; all which use the - // XATTR_FILL_FIRST, XATTR_FILL_LAST range as fill attributes - } - else - { - // set FillStyle to none; this is necessary since the pool default is - // to fill objects by color (blue8) - SetFmtAttr(XFillStyleItem(XFILL_NONE)); - } } void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) @@ -2435,7 +2407,7 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) RES_FOOTER, false, (const SfxPoolItem**)&pF ); //UUUU reset fill information - if(RES_FLYFRMFMT == Which() && maFillAttributes.get()) + if(maFillAttributes.get() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())) { SfxItemIter aIter(*((SwAttrSetChg*)pNew)->GetChgSet()); bool bReset(false); @@ -2451,10 +2423,10 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) } } } - else if(RES_FMT_CHG == nWhich) //UUUU + else if(RES_FMT_CHG == nWhich) { //UUUU reset fill information on format change (e.g. style changed) - if(RES_FLYFRMFMT == Which() && maFillAttributes.get()) + if(maFillAttributes.get() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())) { maFillAttributes.reset(); } @@ -2975,9 +2947,9 @@ OUString SwFlyFrmFmt::GetObjDescription() const bool SwFlyFrmFmt::IsBackgroundTransparent() const { //UUUU - if(RES_FLYFRMFMT == Which() && getFillAttributes()) + if((RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) && getSdrAllFillAttributesHelper()) { - return getFillAttributes()->isTransparent(); + return getSdrAllFillAttributesHelper()->isTransparent(); } // NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT) @@ -3017,9 +2989,9 @@ bool SwFlyFrmFmt::IsBackgroundTransparent() const bool SwFlyFrmFmt::IsBackgroundBrushInherited() const { //UUUU - if(RES_FLYFRMFMT == Which() && getFillAttributes()) + if((RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) && getSdrAllFillAttributesHelper()) { - return !getFillAttributes()->isUsed(); + return !getSdrAllFillAttributesHelper()->isUsed(); } else if ( (GetBackground().GetColor() == COL_TRANSPARENT) && !(GetBackground().GetGraphicObject()) ) @@ -3242,20 +3214,20 @@ IMapObject* SwFrmFmt::GetIMapObject( const Point& rPoint, } //UUUU -FillAttributesPtr SwFrmFmt::getFillAttributes() const +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrmFmt::getSdrAllFillAttributesHelper() const { - if(RES_FLYFRMFMT == Which()) + if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) { // create FillAttributes on demand if(!maFillAttributes.get()) { - const_cast< SwFrmFmt* >(this)->maFillAttributes.reset(new FillAttributes(GetAttrSet())); + const_cast< SwFrmFmt* >(this)->maFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(GetAttrSet())); } } else { // FALLBACKBREAKHERE assert wrong usage - OSL_ENSURE(false, "getFillAttributes() call only valid for RES_FLYFRMFMT currently (!)"); + OSL_ENSURE(false, "getSdrAllFillAttributesHelper() call only valid for RES_FLYFRMFMT and RES_FRMFMT (!)"); } return maFillAttributes; diff --git a/sw/source/core/layout/fillattributes.cxx b/sw/source/core/layout/fillattributes.cxx deleted file mode 100644 index 8666c27ab092..000000000000 --- a/sw/source/core/layout/fillattributes.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ - -#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> -#include <tools/color.hxx> -#include <vcl/graph.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(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; - } - - if(hasSdrFillAttribute()) - { - const Graphic& rGraphic = getFillAttribute().getFillGraphic().getFillGraphic(); - - return rGraphic.IsSupportedGraphic() && rGraphic.IsTransparent(); - } - - 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::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; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 749fa8469c78..d8ff9576af8d 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -557,6 +557,19 @@ const SwAttrSet* SwFrm::GetAttrSet() const return &((const SwLayoutFrm*)this)->GetFmt()->GetAttrSet(); } +//UUUU +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrm::getSdrAllFillAttributesHelper() const +{ + if(IsCntntFrm()) + { + return static_cast< const SwCntntFrm* >(this)->GetNode()->getSdrAllFillAttributesHelper(); + } + else + { + return static_cast< const SwLayoutFrm* >(this)->GetFmt()->getSdrAllFillAttributesHelper(); + } +} + /* * SwFrm::_FindNext(), _FindPrev(), InvalidateNextPos() * _FindNextCnt() visits tables and sections and only returns SwCntntFrms. diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 849d29c74fa2..b47482329da4 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -63,6 +63,9 @@ #include <switerator.hxx> #include <DocumentSettingManager.hxx> +//UUUU +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> + // ftnfrm.cxx: void sw_RemoveFtns( SwFtnBossFrm* pBoss, bool bPageOnly, bool bEndNotes ); @@ -201,9 +204,23 @@ SwFrmNotify::~SwFrmNotify() (aPrt.*fnRect->fnGetHeight)()!=(pFrm->Prt().*fnRect->fnGetHeight)(); if ( bPrtWidth || bPrtHeight ) { - const SvxGraphicPosition ePos = pFrm->GetAttrSet()->GetBackground().GetGraphicPos(); - if ( GPOS_NONE != ePos && GPOS_TILED != ePos ) - pFrm->SetCompletePaint(); + //UUUU + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pFrm->getSdrAllFillAttributesHelper()); + + if(aFillAttributes.get() && aFillAttributes->isUsed()) + { + //UUUU use SetCompletePaint if needed + if(aFillAttributes->needCompleteRepaint()) + { + pFrm->SetCompletePaint(); + } + } + else + { + const SvxGraphicPosition ePos = pFrm->GetAttrSet()->GetBackground().GetGraphicPos(); + if(GPOS_NONE != ePos && GPOS_TILED != ePos) + pFrm->SetCompletePaint(); + } } else { diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index d046fb4b311e..f51680cde904 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -80,7 +80,9 @@ #include <vcl/settings.hxx> //UUUU +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> #include <drawinglayer/processor2d/processor2dtools.hxx> +#include <ndtxt.hxx> #define COL_NOTES_SIDEPANE RGB_COLORDATA(230,230,230) #define COL_NOTES_SIDEPANE_BORDER RGB_COLORDATA(200,200,200) @@ -1826,7 +1828,7 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut, } bool DrawFillAttributes( - const FillAttributesPtr& rFillAttributes, + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, const SwRect& rOriginalLayoutRect, const SwRect& rPaintRect, OutputDevice& rOut) @@ -1836,9 +1838,12 @@ bool DrawFillAttributes( if(bUseNew && rFillAttributes.get() && rFillAttributes->isUsed()) { + //UUUU Need to substract a half logical pixel unit from TopLeft to get the correct + // layering for AAed paints + const basegfx::B2DVector aHalfSingleUnit(rOut.GetInverseViewTransformation() * basegfx::B2DVector(0.5, 0.5)); const basegfx::B2DRange aPaintRange( - rPaintRect.Left(), - rPaintRect.Top(), + rPaintRect.Left() - aHalfSingleUnit.getX(), + rPaintRect.Top() - aHalfSingleUnit.getY(), rPaintRect.Right(), rPaintRect.Bottom()); @@ -3884,7 +3889,7 @@ bool SwFlyFrm::IsBackgroundTransparent() const const Color* pSectionTOXColor = 0; SwRect aDummyRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; if ( GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false) ) { @@ -4119,10 +4124,10 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const { const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* >(GetFmt()); - if(pSwFrmFmt && RES_FLYFRMFMT == pSwFrmFmt->Which()) + if(pSwFrmFmt && (RES_FLYFRMFMT == pSwFrmFmt->Which() || RES_FRMFMT == pSwFrmFmt->Which())) { //UUUU check for transparency - const FillAttributesPtr aFillAttributes(pSwFrmFmt->getFillAttributes()); + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pSwFrmFmt->getSdrAllFillAttributesHelper()); // check if the new fill attributes are used if(aFillAttributes.get() && aFillAttributes->isUsed()) @@ -5895,38 +5900,22 @@ void SwPageFrm::PaintGrid( OutputDevice* pOut, SwRect &rRect ) const void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect, SwViewShell* _pViewShell ) const { - if ( _pViewShell->GetWin() && - !_pViewShell->GetViewOptions()->getBrowseMode() ) + if ( _pViewShell->GetWin() && !_pViewShell->GetViewOptions()->getBrowseMode() ) { - SwRect aPgPrtRect( Prt() ); - aPgPrtRect.Pos() += Frm().Pos(); - if ( !aPgPrtRect.IsInside( _rOutputRect ) ) + //UUUU Simplified paint with DrawingLayer FillStyle + SwRect aPgRect = Frm(); + aPgRect._Intersection( _rOutputRect ); + + if(!aPgRect.IsEmpty()) { - SwRect aPgRect = Frm(); - aPgRect._Intersection( _rOutputRect ); - if(aPgRect.Height() < 0 || aPgRect.Width() <= 0) // No intersection - return; - SwRegionRects aPgRegion( aPgRect ); - aPgRegion -= aPgPrtRect; - //const SwPageFrm* pPage = static_cast<const SwPageFrm*>(this); - //if ( pPage->GetSortedObjs() ) - // ::lcl_SubtractFlys( this, pPage, aPgRect, aPgRegion ); - if ( !aPgRegion.empty() ) + OutputDevice *pOut = _pViewShell->GetOut(); + + if(pOut->GetFillColor() != aGlobalRetoucheColor) { - OutputDevice *pOut = _pViewShell->GetOut(); - if ( pOut->GetFillColor() != aGlobalRetoucheColor ) - pOut->SetFillColor( aGlobalRetoucheColor ); - for ( sal_uInt16 i = 0; i < aPgRegion.size(); ++i ) - { - if ( 1 < aPgRegion.size() ) - { - ::SwAlignRect( aPgRegion[i], pGlobalShell ); - if( !aPgRegion[i].HasArea() ) - continue; - } - pOut->DrawRect(aPgRegion[i].SVRect()); - } + pOut->SetFillColor(aGlobalRetoucheColor); } + + pOut->DrawRect(aPgRect.SVRect()); } } } @@ -6429,7 +6418,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, bool bLowMode = true; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; bool bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, bLowerMode ); //- Output if a separate background is used. @@ -6461,14 +6450,14 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, pTmpBackBrush = new SvxBrushItem( Color( COL_WHITE ), RES_BACKGROUND ); //UUU - aFillAttributes.reset(new FillAttributes(Color( COL_WHITE ))); + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(Color( COL_WHITE ))); } else { pTmpBackBrush = new SvxBrushItem( aGlobalRetoucheColor, RES_BACKGROUND); //UUU - aFillAttributes.reset(new FillAttributes(aGlobalRetoucheColor)); + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aGlobalRetoucheColor)); } pItem = pTmpBackBrush; @@ -6519,7 +6508,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, pItem = pNewItem; //UUUU - aFillAttributes.reset(new FillAttributes(*pCol)); + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pCol)); } //if ( pPage->GetSortedObjs() ) @@ -7207,32 +7196,40 @@ const Color SwPageFrm::GetDrawBackgrdColor() const SwRect aDummyRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; if ( GetBackgroundBrush( aFillAttributes, pBrushItem, pDummyColor, aDummyRect, true) ) { - OUString referer; - SwViewShell * sh1 = getRootFrm()->GetCurrShell(); - if (sh1 != 0) { - SfxObjectShell * sh2 = sh1->GetDoc()->GetPersist(); - if (sh2 != 0 && sh2->HasName()) { - referer = sh2->GetMedium()->GetName(); - } - } - const Graphic* pGraphic = pBrushItem->GetGraphic(referer); - - if(pGraphic) + if(aFillAttributes.get() && aFillAttributes->isUsed()) //UUUU { - // #i29105# when a graphic is set, it may be possible to calculate a single - // color which looks good in all places of the graphic. Since it is - // planned to have text edit on the overlay one day and the fallback - // to aGlobalRetoucheColor returns something useful, just use that - // for now. + // let SdrAllFillAttributesHelper do the average color calculation + return Color(aFillAttributes->getAverageColor(aGlobalRetoucheColor.getBColor())); } - else + else if(pBrushItem) { - // not a graphic, use (hopefully) initialized color - return pBrushItem->GetColor(); + OUString referer; + SwViewShell * sh1 = getRootFrm()->GetCurrShell(); + if (sh1 != 0) { + SfxObjectShell * sh2 = sh1->GetDoc()->GetPersist(); + if (sh2 != 0 && sh2->HasName()) { + referer = sh2->GetMedium()->GetName(); + } + } + const Graphic* pGraphic = pBrushItem->GetGraphic(referer); + + if(pGraphic) + { + // #29105# when a graphic is set, it may be possible to calculate a single + // color which looks good in all places of the graphic. Since it is + // planned to have text edit on the overlay one day and the fallback + // to aGlobalRetoucheColor returns something useful, just use that + // for now. + } + else + { + // not a graphic, use (hopefully) initialized color + return pBrushItem->GetColor(); + } } } @@ -7369,7 +7366,7 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const @return true, if a background brush for the frame is found */ bool SwFrm::GetBackgroundBrush( - FillAttributesPtr& rFillAttributes, + drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, const SvxBrushItem* & rpBrush, const Color*& rpCol, SwRect &rOrigRect, @@ -7385,18 +7382,7 @@ bool SwFrm::GetBackgroundBrush( return false; //UUUU - const SwLayoutFrm* pSwLayoutFrm = dynamic_cast< const SwLayoutFrm* >(pFrm); - - if(pSwLayoutFrm) - { - const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* >(pSwLayoutFrm->GetFmt()); - - if(pSwFrmFmt && RES_FLYFRMFMT == pSwFrmFmt->Which()) - { - rFillAttributes = pSwFrmFmt->getFillAttributes(); - } - } - + rFillAttributes = pFrm->getSdrAllFillAttributesHelper(); const SvxBrushItem &rBack = pFrm->GetAttrSet()->GetBackground(); if( pFrm->IsSctFrm() ) diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index f45a7aff2c7d..b66bf33aa936 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -505,7 +505,7 @@ static bool lcl_IsDarkBackground( const SwTxtPaintInfo& rInf ) SwRect aOrigBackRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; // Consider, that [GetBackgroundBrush(...)] can set <pCol> // See implementation in /core/layout/paintfrm.cxx diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 0fe340f2eacb..2f746477f453 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -847,7 +847,7 @@ static bool isA11yRelevantAttribute(MSHORT nWhich) return nWhich != RES_CHRATR_RSID; } -static bool hasA11yRelevantAttribute( const std::vector<MSHORT>& nWhich ) +static bool hasA11yRelevantAttribute( const std::vector<sal_uInt16>& nWhich ) { for( std::vector<MSHORT>::const_iterator nItr = nWhich.begin(); nItr < nWhich.end(); ++nItr ) @@ -955,8 +955,8 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) break; case RES_UPDATE_ATTR: { - nPos = ((SwUpdateAttr*)pNew)->nStart; - nLen = ((SwUpdateAttr*)pNew)->nEnd - nPos; + nPos = ((SwUpdateAttr*)pNew)->getStart(); + nLen = ((SwUpdateAttr*)pNew)->getEnd() - nPos; if( IsIdxInside( nPos, nLen ) ) { // Es muss in jedem Fall neu formatiert werden, @@ -969,7 +969,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) nLen = 1; _InvalidateRange( SwCharRange( nPos, nLen) ); - MSHORT nTmp = ((SwUpdateAttr*)pNew)->nWhichAttr; + MSHORT nTmp = ((SwUpdateAttr*)pNew)->getWhichAttr(); if( ! nTmp || RES_TXTATR_CHARFMT == nTmp || RES_TXTATR_AUTOFMT == nTmp || RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp ) @@ -979,8 +979,8 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) } } - if( isA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->nWhichAttr ) && - hasA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->aWhichFmtAttr ) ) + if( isA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->getWhichAttr() ) && + hasA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->getFmtAttr() ) ) { // #i104008# SwViewShell* pViewSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index de3583011b01..1aec6e54285d 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2518,7 +2518,7 @@ bool SwDrawTextInfo::ApplyAutoColor( Font* pFont ) SwRect aOrigBackRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; /// OD 21.08.2002 /// consider, that [GetBackgroundBrush(...)] can set <pCol> diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 2ba1b2b0a26c..0160bfa367cd 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -83,6 +83,10 @@ #include <attrhint.hxx> #include <boost/scoped_ptr.hpp> +//UUUU +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> +#include <svl/itemiter.hxx> + using namespace ::com::sun::star; typedef std::vector<SwTxtAttr*> SwpHts; @@ -186,18 +190,23 @@ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere, } while( true ); } -SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, - SwTxtFmtColl *pTxtColl, - const SfxItemSet* pAutoAttr ) - : SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ), - m_pSwpHints( 0 ), - mpNodeNum( 0 ), - m_bLastOutlineState( false ), - m_bNotifiable( false ), - // #i70748# - mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ), - mbInSetOrResetAttr( false ), - mpList( 0 ) +SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl, const SfxItemSet* pAutoAttr ) +: SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ), + m_pSwpHints( 0 ), + mpNodeNum( 0 ), + m_Text(), + m_pParaIdleData_Impl(0), + m_bContainsHiddenChars(false), + m_bHiddenCharsHidePara(false), + m_bRecalcHiddenCharFlags(false), + m_bLastOutlineState( false ), + m_bNotifiable( false ), + mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ), + mbInSetOrResetAttr( false ), + mpList( 0 ), + m_pNumStringCache(), + m_wXParagraph(), + maFillAttributes() { InitSwParaStatistics( true ); @@ -1521,7 +1530,11 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const sal_Int32 nTxtStartIdx, if( this != pDest ) { // Frames benachrichtigen, sonst verschwinden die Ftn-Nummern - SwUpdateAttr aHint( nOldPos, nOldPos, 0 ); + SwUpdateAttr aHint( + nOldPos, + nOldPos, + 0); + pDest->ModifyNotification( 0, &aHint ); } } @@ -2425,7 +2438,11 @@ void SwTxtNode::GCAttr() if(bChanged) { //TxtFrm's reagieren auf aHint, andere auf aNew - SwUpdateAttr aHint( nMin, nMax, 0 ); + SwUpdateAttr aHint( + nMin, + nMax, + 0); + NotifyClients( 0, &aHint ); SwFmtChg aNew( GetTxtColl() ); NotifyClients( 0, &aNew ); @@ -3645,6 +3662,28 @@ void SwTxtNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewVal (SwTxtFmtColl*)((SwFmtChg*)pNewValue)->pChangedFmt ); } + //UUUU reset fill information + if(maFillAttributes.get()) + { + sal_uInt16 nWhich = pNewValue ? pNewValue->Which() : 0; + bool bReset(RES_FMT_CHG == nWhich); // ..on format change (e.g. style changed) + + if(!bReset && RES_ATTRSET_CHG == nWhich) // ..on ItemChange from DrawingLayer FillAttributes + { + SfxItemIter aIter(*((SwAttrSetChg*)pNewValue)->GetChgSet()); + + for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem()) + { + bReset = !IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST; + } + } + + if(bReset) + { + maFillAttributes.reset(); + } + } + if ( !mbInSetOrResetAttr ) { HandleModifyAtTxtNode( *this, pOldValue, pNewValue ); @@ -3687,6 +3726,12 @@ SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl ) SwFmtChg aTmp2( pNewColl ); HandleModifyAtTxtNode( *this, &aTmp1, &aTmp2 ); } + + //UUUU reset fill information on parent style change + if(maFillAttributes.get()) + { + maFillAttributes.reset(); + } } // nur wenn im normalen Nodes-Array @@ -4976,4 +5021,16 @@ SwTxtNode::MakeUnoObject() return xMeta; } +//UUUU +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwTxtNode::getSdrAllFillAttributesHelper() const +{ + // create SdrAllFillAttributesHelper on demand + if(!maFillAttributes.get()) + { + const_cast< SwTxtNode* >(this)->maFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(GetSwAttrSet())); + } + + return maFillAttributes; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 465a7c5816c0..b83b86633cc3 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1661,7 +1661,10 @@ void SwTxtNode::DeleteAttribute( SwTxtAttr * const pAttr ) { // create MsgHint before start/end become invalid SwUpdateAttr aHint( - pAttr->GetStart(), *pAttr->GetEnd(), pAttr->Which() ); + pAttr->GetStart(), + *pAttr->GetEnd(), + pAttr->Which()); + m_pSwpHints->Delete( pAttr ); SwTxtAttr::Destroy( pAttr, GetDoc()->GetAttrPool() ); NotifyClients( 0, &aHint ); @@ -1734,7 +1737,11 @@ void SwTxtNode::DeleteAttributes( // Start und End weg. // Das CalcVisibleFlag bei HiddenParaFields entfaellt, // da dies das Feld im Dtor selbst erledigt. - SwUpdateAttr aHint( nStart, *pEndIdx, nWhich ); + SwUpdateAttr aHint( + nStart, + *pEndIdx, + nWhich); + m_pSwpHints->DeleteAtPos( nPos ); // gefunden, loeschen, SwTxtAttr::Destroy( pTxtHt, GetDoc()->GetAttrPool() ); NotifyClients( 0, &aHint ); @@ -3169,11 +3176,16 @@ bool SwpHints::TryInsertHint( CHECK; #endif // ... und die Abhaengigen benachrichtigen - if ( rNode.GetDepends() ) + if(rNode.GetDepends()) { - SwUpdateAttr aHint( nHtStart, nHtStart, nWhich ); - rNode.ModifyNotification( 0, &aHint ); + SwUpdateAttr aHint( + nHtStart, + nHtStart, + nWhich); + + rNode.ModifyNotification(0,&aHint); } + return true; } @@ -3250,8 +3262,11 @@ bool SwpHints::TryInsertHint( // ... und die Abhaengigen benachrichtigen if ( rNode.GetDepends() ) { - SwUpdateAttr aHint( nHtStart, nHtStart == nHintEnd ? nHintEnd + 1 : nHintEnd, - nWhich, aWhichSublist ); + SwUpdateAttr aHint( + nHtStart, + nHtStart == nHintEnd ? nHintEnd + 1 : nHintEnd, + nWhich); + rNode.ModifyNotification( 0, &aHint ); } diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index e676498d8c9e..11f4f2f37606 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -59,7 +59,11 @@ void SwTxtCharFmt::ModifyNotification( const SfxPoolItem* pOld, const SfxPoolIte if ( m_pTxtNode ) { - SwUpdateAttr aUpdateAttr( GetStart(), *GetEnd(), nWhich ); + SwUpdateAttr aUpdateAttr( + GetStart(), + *GetEnd(), + nWhich); + m_pTxtNode->ModifyNotification( &aUpdateAttr, &aUpdateAttr ); } } @@ -167,7 +171,11 @@ void SwTxtINetFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if ( m_pTxtNode ) { - SwUpdateAttr aUpdateAttr( GetStart(), *GetEnd(), nWhich ); + SwUpdateAttr aUpdateAttr( + GetStart(), + *GetEnd(), + nWhich); + m_pTxtNode->ModifyNotification( &aUpdateAttr, &aUpdateAttr ); } } @@ -212,7 +220,11 @@ void SwTxtRuby::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) if ( m_pTxtNode ) { - SwUpdateAttr aUpdateAttr( GetStart(), *GetEnd(), nWhich ); + SwUpdateAttr aUpdateAttr( + GetStart(), + *GetEnd(), + nWhich); + m_pTxtNode->ModifyNotification( &aUpdateAttr, &aUpdateAttr ); } } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index af8e9f2a10e3..307830c89941 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -626,14 +626,20 @@ void SwTxtNode::RstTxtAttr( } TryDeleteSwpHints(); + if (bChanged) { if ( HasHints() ) { // possibly sometimes Resort would be sufficient, but... m_pSwpHints->MergePortions(*this); } + // TxtFrm's respond to aHint, others to aNew - SwUpdateAttr aHint( nMin, nMax, 0 ); + SwUpdateAttr aHint( + nMin, + nMax, + 0); + NotifyClients( 0, &aHint ); SwFmtChg aNew( GetFmtColl() ); NotifyClients( 0, &aNew ); diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 44079f8fb2f7..002a988cef37 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -978,20 +978,31 @@ SwHistory::~SwHistory() delete *it; } -void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, - sal_uLong nNodeIdx ) +void SwHistory::Add( + const SfxPoolItem* pOldValue, + const SfxPoolItem* pNewValue, + sal_uLong nNodeIdx) { OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); + const sal_uInt16 nWhich(pNewValue->Which()); - sal_uInt16 nWhich = pNewValue->Which(); - if( (nWhich >= POOLATTR_END) - || (nWhich == RES_TXTATR_FIELD) - || (nWhich == RES_TXTATR_ANNOTATION) ) + // excluded values + if(nWhich == RES_TXTATR_FIELD || nWhich == RES_TXTATR_ANNOTATION) + { return; + } - // no default attribute? - SwHistoryHint * pHt; - if ( pOldValue && pOldValue != GetDfltAttr( pOldValue->Which() ) ) + // no default Attribute? + SwHistoryHint* pHt = 0; + + //UUUU To be able to include the DrawingLayer FillItems something more + // general has to be done to check if an Item is default than to check + // if it's pointzer equals that in Writer's global PoolDefaults (held in + // aAttrTab and used to fill the pool defaults in Writer - looks as if + // Writer is *older* than the SfxItemPool ?). I checked the possibility to + // get the SfxItemPool here (works), but decided to use the SfxPoolItem's + // global tooling aka IsDefaultItem(const SfxPoolItem*) for now + if(pOldValue && !IsDefaultItem(pOldValue)) { pHt = new SwHistorySetFmt( pOldValue, nNodeIdx ); } @@ -999,6 +1010,7 @@ void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, { pHt = new SwHistoryResetFmt( pNewValue, nNodeIdx ); } + m_SwpHstry.push_back( pHt ); } @@ -1195,21 +1207,34 @@ sal_uInt16 SwHistory::SetTmpEnd( sal_uInt16 nNewTmpEnd ) return nOld; } -void SwHistory::CopyFmtAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx ) +void SwHistory::CopyFmtAttr( + const SfxItemSet& rSet, + sal_uLong nNodeIdx) { - if( rSet.Count() ) + if(rSet.Count()) { - SfxItemIter aIter( rSet ); - do { - if( (SfxPoolItem*)-1 != aIter.GetCurItem() ) + SfxItemIter aIter(rSet); + + do + { + if(!IsInvalidItem(aIter.GetCurItem())) { const SfxPoolItem* pNew = aIter.GetCurItem(); - Add( pNew, pNew, nNodeIdx ); + + Add( + pNew, + pNew, + nNodeIdx); } - if( aIter.IsAtEnd() ) + + if(aIter.IsAtEnd()) + { break; + } + aIter.NextItem(); - } while( true ); + + } while(true); } } @@ -1296,29 +1321,38 @@ SwRegHistory::SwRegHistory( const SwNode& rNd, SwHistory* pHst ) void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { - // #i114861# - // Do not handle a "noop" modify - // - e.g. <SwTxtNode::NumRuleChgd()> uses such a "noop" modify - if ( m_pHistory && ( pOld || pNew ) && - pOld != pNew ) + if ( m_pHistory && ( pOld || pNew ) && pOld != pNew ) { if ( pNew->Which() < POOLATTR_END ) { - m_pHistory->Add( pOld, pNew, m_nNodeIndex ); + if(RES_UPDATE_ATTR == pNew->Which()) + { + // const SfxItemPool& rPool = static_cast< const SwUpdateAttr* >(pNew)->GetSfxItemPool(); + + m_pHistory->Add( + // rPool, + pOld, + pNew, + m_nNodeIndex); + } + else + { + OSL_ENSURE(false, "Unexpected update attribute (!)"); + } } else if (pOld && RES_ATTRSET_CHG == pNew->Which()) { SwHistoryHint* pNewHstr; - const SfxItemSet& rSet = - *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet(); + const SfxItemSet& rSet = *static_cast< const SwAttrSetChg* >(pOld)->GetChgSet(); + if ( 1 < rSet.Count() ) { - pNewHstr = - new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet ); + pNewHstr = new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet ); } else { const SfxPoolItem* pItem = SfxItemIter( rSet ).FirstItem(); + if ( m_WhichIdSet.count( pItem->Which() ) ) { pNewHstr = new SwHistorySetFmt( pItem, m_nNodeIndex ); @@ -1328,6 +1362,7 @@ void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) pNewHstr = new SwHistoryResetFmt( pItem, m_nNodeIndex ); } } + m_pHistory->m_SwpHstry.push_back( pNewHstr ); } } diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index d7157b578f3a..f91f541018ae 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -36,7 +36,12 @@ #include <ucbhelper/content.hxx> #include <swunohelper.hxx> -namespace SWUnoHelper { +//UUUU +#include <svx/xfillit0.hxx> +#include <svl/itemset.hxx> + +namespace SWUnoHelper +{ sal_Int32 GetEnumAsInt32( const ::com::sun::star::uno::Any& rVal ) { @@ -259,6 +264,34 @@ bool UCB_GetFileListOfFolder( const OUString& rURL, return bOk; } +//UUUU +bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet) +{ + const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rSet.GetItem(XATTR_FILLSTYLE, false))); + + if(!pXFillStyleItem) + { + return false; + } + + // here different FillStyles can be excluded for export; it will depend on the + // quality these fallbacks can reach. That again is done in 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; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unobrushitemhelper.cxx b/sw/source/core/unocore/unobrushitemhelper.cxx deleted file mode 100644 index fe1a4962b62d..000000000000 --- a/sw/source/core/unocore/unobrushitemhelper.cxx +++ /dev/null @@ -1,327 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * 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 . - */ - -#include <unobrushitemhelper.hxx> -#include <svx/xfillit0.hxx> -#include <svx/xbtmpit.hxx> -#include <svx/xgrscit.hxx> -#include <svx/xflbmtit.hxx> -#include <svx/xflbmpit.hxx> -#include <svx/xflbmsxy.hxx> -#include <svx/xflbmsxy.hxx> -#include <svx/xflftrit.hxx> -#include <svx/xsflclit.hxx> -#include <svx/xflbmsli.hxx> -#include <svx/xflbtoxy.hxx> -#include <svx/xflbstit.hxx> -#include <svx/xflboxy.hxx> -#include <svx/xflbckit.hxx> -#include <svx/unoshape.hxx> -#include <hintids.hxx> -#include <svx/xflclit.hxx> -#include <svx/xfltrit.hxx> -#include <svx/xflhtit.hxx> - -namespace sw { - -//UUUU -void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet) -{ - if(0xff != rBrush.GetColor().GetTransparency()) - { - const Color aColor(rBrush.GetColor().GetRGBColor()); - const sal_uInt8 nTransparency(rBrush.GetColor().GetTransparency()); - - rToSet.Put(XFillStyleItem(XFILL_SOLID)); - rToSet.Put(XFillColorItem(OUString(), aColor)); - - if(0xff != nTransparency) - { - // nTransparency is in range [0..255] - rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 255)); - } - } - else if(GPOS_NONE != rBrush.GetGraphicPos()) - { - const Graphic* pGraphic = rBrush.GetGraphic(); - - if(pGraphic) - { - // set fill style and graphic itself - rToSet.Put(XFillStyleItem(XFILL_BITMAP)); - rToSet.Put(XFillBitmapItem(OUString(), *pGraphic)); - - // set defaults - // already pool default rToSet.Put(XFillBmpPosItem(RP_MM)); - // already pool default rToSet.Put(XFillBmpTileOffsetXItem(0)); - // already pool default rToSet.Put(XFillBmpTileOffsetYItem(0)); - // already pool default rToSet.Put(XFillBmpPosOffsetXItem(0)); - // already pool default rToSet.Put(XFillBmpPosOffsetYItem(0)); - // already pool default rToSet.Put(XFillBmpSizeLogItem(true)); - // already pool default rToSet.Put(XFillBmpSizeXItem(0)); - // already pool default rToSet.Put(XFillBmpSizeYItem(0)); - - if(GPOS_AREA == rBrush.GetGraphicPos()) - { - // stretch, also means no tile (both items are defaulted to true) - // rToSet.Put(XFillBmpStretchItem(true)); - rToSet.Put(XFillBmpTileItem(false)); - - // default for strech is also top-left, but this will not be visible - // rToSet.Put(XFillBmpPosItem(RP_LT)); - } - else if(GPOS_TILED == rBrush.GetGraphicPos()) - { - // tiled, also means no stretch (both items are defaulted to true) - rToSet.Put(XFillBmpStretchItem(false)); - //rToSet.Put(XFillBmpTileItem(true)); - - // default for tiled is top-left - rToSet.Put(XFillBmpPosItem(RP_LT)); - } - else - { - // everything else means no tile and no stretch - rToSet.Put(XFillBmpStretchItem(false)); - rToSet.Put(XFillBmpTileItem(false)); - - switch(rBrush.GetGraphicPos()) - { - case GPOS_LT: rToSet.Put(XFillBmpPosItem(RP_LT)); break; - case GPOS_MT: rToSet.Put(XFillBmpPosItem(RP_MT)); break; - case GPOS_RT: rToSet.Put(XFillBmpPosItem(RP_RT)); break; - case GPOS_LM: rToSet.Put(XFillBmpPosItem(RP_LM)); break; - case GPOS_MM: rToSet.Put(XFillBmpPosItem(RP_MM)); break; - case GPOS_RM: rToSet.Put(XFillBmpPosItem(RP_RM)); break; - case GPOS_LB: rToSet.Put(XFillBmpPosItem(RP_LB)); break; - case GPOS_MB: rToSet.Put(XFillBmpPosItem(RP_MB)); break; - case GPOS_RB: rToSet.Put(XFillBmpPosItem(RP_RB)); break; - default: break; // already handled GPOS_AREA, GPOS_TILED and GPOS_NONE - } - } - - // check for transparency - const sal_Int8 nTransparency(rBrush.getGraphicTransparency()); - - if(0 != nTransparency) - { - // nTransparency is in range [0..100] - rToSet.Put(XFillTransparenceItem(nTransparency)); - } - } - else - { - OSL_ENSURE(false, "Could not get Graphic from SvxBrushItem (!)"); - } - } - else - { - // GPOS_NONE == rBrush.GetGraphicPos() && 0xff == rBrush.GetColor().GetTransparency(), - // still need to rescue the color used. There are sequences used on the UNO API at - // import time (OLE. e.g. chart) which first set RGB color (MID_BACK_COLOR_R_G_B, - // color stays transparent) and then set transparency (MID_BACK_COLOR_TRANSPARENCY) - // to zero later. When not saving the color, it will be lost - const Color aColor(rBrush.GetColor().GetRGBColor()); - - // rToSet.Put(XFillStyleItem(XFILL_NONE)); - rToSet.Put(XFillColorItem(OUString(), aColor)); - } -} - -//UUUU -sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, bool bSearchInParents) -{ - sal_uInt16 nFillTransparence(static_cast< const XFillTransparenceItem& >(rSourceSet.Get(XATTR_FILLTRANSPARENCE, bSearchInParents)).GetValue()); - const SfxPoolItem* pGradientItem = 0; - - if(SFX_ITEM_SET == rSourceSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, bSearchInParents, &pGradientItem) - && static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->IsEnabled()) - { - const XGradient& rGradient = static_cast< const XFillFloatTransparenceItem* >(pGradientItem)->GetGradientValue(); - const sal_uInt16 nStartLuminance(rGradient.GetStartColor().GetLuminance()); - const sal_uInt16 nEndLuminance(rGradient.GetEndColor().GetLuminance()); - - // luminance is [0..255], transparence needs to be in [0..100].Maximum is 51200, thus sal_uInt16 is okay to use - nFillTransparence = static_cast< sal_uInt16 >(((nStartLuminance + nEndLuminance) * 100) / 512); - } - - return nFillTransparence; -} - -//UUUU -SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents) -{ - Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue()); - - // get evtl. mixed transparence - const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); - - if(0 != nFillTransparence) - { - // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned - aFillColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100)); - } - - return SvxBrushItem(aFillColor, RES_BACKGROUND); -} - -//UUUU -SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSearchInParents) -{ - const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents))); - - if(!pXFillStyleItem || XFILL_NONE == pXFillStyleItem->GetValue()) - { - // need to rescue the evtl. set RGB color, but use as transparent color (we have XFILL_NONE) - Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue()); - aFillColor.SetTransparency(0xff); - - return SvxBrushItem(aFillColor, RES_BACKGROUND); - } - - SvxBrushItem aRetval(RES_BACKGROUND); - - switch(pXFillStyleItem->GetValue()) - { - case XFILL_NONE: - { - // already handled above, can not happen again - break; - } - case XFILL_SOLID: - { - // create SvxBrushItem with fill color - aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents); - break; - } - case XFILL_GRADIENT: - { - // cannot be directly supported, but do the best possible - const XGradient aXGradient(static_cast< const XFillGradientItem& >(rSourceSet.Get(XATTR_FILLGRADIENT)).GetGradientValue()); - const basegfx::BColor aStartColor(aXGradient.GetStartColor().getBColor() * (aXGradient.GetStartIntens() * 0.01)); - const basegfx::BColor aEndColor(aXGradient.GetEndColor().getBColor() * (aXGradient.GetEndIntens() * 0.01)); - - // use half/half mixed color from gradient start and end - Color aMixedColor((aStartColor + aEndColor) * 0.5); - - // get evtl. mixed transparence - const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); - - if(0 != nFillTransparence) - { - // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned - aMixedColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100)); - } - - aRetval = SvxBrushItem(aMixedColor, RES_BACKGROUND); - break; - } - case XFILL_HATCH: - { - // cannot be directly supported, but do the best possible - const XHatch& rHatch(static_cast< const XFillHatchItem& >(rSourceSet.Get(XATTR_FILLHATCH)).GetHatchValue()); - const bool bFillBackground(static_cast< const XFillBackgroundItem& >(rSourceSet.Get(XATTR_FILLBACKGROUND)).GetValue()); - - if(bFillBackground) - { - // hatch is background-filled, use FillColor as if XFILL_SOLID - aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents); - } - else - { - // hatch is not background-filled and using hatch color would be too dark; compensate - // somewhat by making it more transparent - Color aHatchColor(rHatch.GetColor()); - - // get evtl. mixed transparence - sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); - - // take half orig transparence, add half transparent, clamp result - nFillTransparence = basegfx::clamp((sal_uInt16)((nFillTransparence / 2) + 50), (sal_uInt16)0, (sal_uInt16)255); - - // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned - aHatchColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100)); - - aRetval = SvxBrushItem(aHatchColor, RES_BACKGROUND); - } - - break; - } - case XFILL_BITMAP: - { - // create SvxBrushItem with bitmap info and flags - 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, bSearchInParents)); - const XFillBmpTileItem& rTileItem = static_cast< const XFillBmpTileItem& >(rSourceSet.Get(XATTR_FILLBMP_TILE, bSearchInParents)); - - if(rTileItem.GetValue()) - { - aSvxGraphicPosition = GPOS_TILED; - } - else if(rStretchItem.GetValue()) - { - aSvxGraphicPosition = GPOS_AREA; - } - else - { - const XFillBmpPosItem& rPosItem = static_cast< const XFillBmpPosItem& >(rSourceSet.Get(XATTR_FILLBMP_POS, bSearchInParents)); - - switch(rPosItem.GetValue()) - { - case RP_LT: aSvxGraphicPosition = GPOS_LT; break; - case RP_MT: aSvxGraphicPosition = GPOS_MT; break; - case RP_RT: aSvxGraphicPosition = GPOS_RT; break; - case RP_LM: aSvxGraphicPosition = GPOS_LM; break; - case RP_MM: aSvxGraphicPosition = GPOS_MM; break; - case RP_RM: aSvxGraphicPosition = GPOS_RM; break; - case RP_LB: aSvxGraphicPosition = GPOS_LB; break; - case RP_MB: aSvxGraphicPosition = GPOS_MB; break; - case RP_RB: aSvxGraphicPosition = GPOS_RB; break; - } - } - - // create with given graphic and position - aRetval = SvxBrushItem(aGraphic, aSvxGraphicPosition, RES_BACKGROUND); - - // get evtl. mixed transparence - const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); - - if(0 != nFillTransparence) - { - // nFillTransparence is in range [0..100] and needs to be in [0..100] signed - aRetval.setGraphicTransparency(static_cast< sal_Int8 >(nFillTransparence)); - } - } - - break; - } - } - - return aRetval; -} - -} // namespace sw - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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)) diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 9464e49a9be0..2a3ad60a7619 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -639,6 +639,12 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s COMMON_TEXT_CONTENT_PROPERTIES { OUString(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, { OUString(UNO_NAME_CHAR_STYLE_NAMES), FN_UNO_CHARFMT_SEQUENCE, cppu::UnoType< cppu::UnoSequenceType<OUString> >::get(), PropertyAttribute::MAYBEVOID, 0}, + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to style import/export + //UUUU Added for paragraph backgrounds, this is for paragraph itself + FILL_PROPERTIES_SW { OUString(), 0, css::uno::Type(), 0, 0 } }; aMapEntriesArr[nPropertyId] = aParagraphMap_Impl; @@ -666,6 +672,12 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s TABSTOPS_MAP_ENTRY COMMON_TEXT_CONTENT_PROPERTIES { OUString(UNO_NAME_PARA_AUTO_STYLE_NAME), RES_AUTO_STYLE, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to style import/export + //UUUU Added for paragraph backgrounds, this is for Paragraph AutoStyles + FILL_PROPERTIES_SW { OUString(), 0, css::uno::Type(), 0, 0 } }; aMapEntriesArr[nPropertyId] = aAutoParaStyleMap; @@ -806,6 +818,12 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s static SfxItemPropertyMapEntry const aParaStyleMap [] = { COMMON_PARA_STYLE_PROPERTIES + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to style import/export + //UUUU Added for paragraph backgrounds, this is for Paragraph Styles + FILL_PROPERTIES_SW { OUString(), 0, css::uno::Type(), 0, 0 } }; aMapEntriesArr[nPropertyId] = aParaStyleMap; @@ -817,6 +835,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { COMMON_PARA_STYLE_PROPERTIES { OUString(UNO_NAME_PARA_STYLE_CONDITIONS), FN_UNO_PARA_STYLE_CONDITIONS, cppu::UnoType< cppu::UnoSequenceType<css::beans::NamedValue> >::get(), PropertyAttribute::MAYBEVOID, 0}, + + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to style import/export + //UUUU Added for paragraph backgrounds, this is for Paragraph Styles + FILL_PROPERTIES_SW + { OUString(), 0, css::uno::Type(), 0, 0 } }; aMapEntriesArr[nPropertyId] = aParaStyleMap; @@ -940,57 +966,62 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { OUString(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, { OUString(UNO_NAME_SHADOW_TRANSPARENCE), RES_SHADOW, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_SHADOW_TRANSPARENCE}, - { OUString(UNO_NAME_HEADER_BACK_COLOR), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_BACK_COLOR }, - // { OUString(UNO_NAME_HEADER_GRAPHIC), FN_UNO_HEADER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC - { OUString(UNO_NAME_HEADER_GRAPHIC_URL), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, - { OUString(UNO_NAME_HEADER_GRAPHIC_FILTER), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, - { OUString(UNO_NAME_HEADER_GRAPHIC_LOCATION), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, - { OUString(UNO_NAME_HEADER_LEFT_MARGIN), FN_UNO_HEADER_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, - { OUString(UNO_NAME_HEADER_RIGHT_MARGIN), FN_UNO_HEADER_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, - { OUString(UNO_NAME_HEADER_BACK_TRANSPARENT), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, - { OUString(UNO_NAME_HEADER_LEFT_BORDER), FN_UNO_HEADER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, LEFT_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_RIGHT_BORDER), FN_UNO_HEADER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, RIGHT_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_TOP_BORDER), FN_UNO_HEADER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, TOP_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_BOTTOM_BORDER), FN_UNO_HEADER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, BOTTOM_BORDER|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_TOP_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_SHADOW_FORMAT), FN_UNO_HEADER_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, - { OUString(UNO_NAME_HEADER_BODY_DISTANCE), FN_UNO_HEADER_BODY_DISTANCE,cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT), FN_UNO_HEADER_IS_DYNAMIC_DISTANCE,cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_HEADER_IS_SHARED), FN_UNO_HEADER_SHARE_CONTENT,cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_HEADER_HEIGHT), FN_UNO_HEADER_HEIGHT, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_IS_ON), FN_UNO_HEADER_ON, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_HEADER_DYNAMIC_SPACING), FN_UNO_HEADER_EAT_SPACING, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID ,0 }, + //UUU use real WhichIDs for Header, no longer use extra-defined WhichIDs which make handling harder as needed. + // The implementation will decide if these are part of Header/Footer or PageStyle depending on the SlotName, + // more precisely on the first characters. Thus it is necessary that these are 'Header' for the Header slots + { OUString(UNO_NAME_HEADER_BACK_COLOR), RES_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_BACK_COLOR }, + // { OUString(UNO_NAME_HEADER_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC + { OUString(UNO_NAME_HEADER_GRAPHIC_URL), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, + { OUString(UNO_NAME_HEADER_GRAPHIC_FILTER), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, + { OUString(UNO_NAME_HEADER_GRAPHIC_LOCATION), RES_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, + { OUString(UNO_NAME_HEADER_LEFT_MARGIN), RES_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, + { OUString(UNO_NAME_HEADER_RIGHT_MARGIN), RES_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, + { OUString(UNO_NAME_HEADER_BACK_TRANSPARENT), RES_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, + { OUString(UNO_NAME_HEADER_LEFT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, LEFT_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_RIGHT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, RIGHT_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_TOP_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, TOP_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_BOTTOM_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, BOTTOM_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_TOP_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_SHADOW_FORMAT), RES_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, + { OUString(UNO_NAME_HEADER_BODY_DISTANCE), RES_UL_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT), SID_ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_HEADER_IS_SHARED), SID_ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_HEADER_HEIGHT), SID_ATTR_PAGE_SIZE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_IS_ON), SID_ATTR_PAGE_ON, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_HEADER_DYNAMIC_SPACING), RES_HEADER_FOOTER_EAT_SPACING, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID ,0 }, + - { OUString(UNO_NAME_FIRST_IS_SHARED), FN_UNO_FIRST_SHARE_CONTENT,cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 }, + { OUString(UNO_NAME_FIRST_IS_SHARED), SID_ATTR_PAGE_SHARED_FIRST, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 }, - { OUString(UNO_NAME_FOOTER_BACK_COLOR), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_BACK_COLOR }, - // { OUString(UNO_NAME_FOOTER_GRAPHIC), FN_UNO_FOOTER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC - { OUString(UNO_NAME_FOOTER_GRAPHIC_URL), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, - { OUString(UNO_NAME_FOOTER_GRAPHIC_FILTER), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, - { OUString(UNO_NAME_FOOTER_GRAPHIC_LOCATION), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, - { OUString(UNO_NAME_FOOTER_LEFT_MARGIN), FN_UNO_FOOTER_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, - { OUString(UNO_NAME_FOOTER_RIGHT_MARGIN), FN_UNO_FOOTER_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, - { OUString(UNO_NAME_FOOTER_BACK_TRANSPARENT), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, - { OUString(UNO_NAME_FOOTER_LEFT_BORDER), FN_UNO_FOOTER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, LEFT_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_RIGHT_BORDER), FN_UNO_FOOTER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, RIGHT_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_TOP_BORDER), FN_UNO_FOOTER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, TOP_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_BOTTOM_BORDER), FN_UNO_FOOTER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, BOTTOM_BORDER|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_SHADOW_FORMAT), FN_UNO_FOOTER_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, - { OUString(UNO_NAME_FOOTER_BODY_DISTANCE), FN_UNO_FOOTER_BODY_DISTANCE,cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT), FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE,cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_FOOTER_IS_SHARED), FN_UNO_FOOTER_SHARE_CONTENT,cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_FOOTER_HEIGHT), FN_UNO_FOOTER_HEIGHT, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_IS_ON), FN_UNO_FOOTER_ON, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_FOOTER_DYNAMIC_SPACING), FN_UNO_FOOTER_EAT_SPACING, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID ,0 }, + //UUU use real WhichIDs for Footer, see Header (above) for more infos + { OUString(UNO_NAME_FOOTER_BACK_COLOR), RES_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_BACK_COLOR }, + // { OUString(UNO_NAME_FOOTER_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC + { OUString(UNO_NAME_FOOTER_GRAPHIC_URL), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, + { OUString(UNO_NAME_FOOTER_GRAPHIC_FILTER), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, + { OUString(UNO_NAME_FOOTER_GRAPHIC_LOCATION), RES_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, + { OUString(UNO_NAME_FOOTER_LEFT_MARGIN), RES_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, + { OUString(UNO_NAME_FOOTER_RIGHT_MARGIN), RES_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, + { OUString(UNO_NAME_FOOTER_BACK_TRANSPARENT), RES_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, + { OUString(UNO_NAME_FOOTER_LEFT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, LEFT_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_RIGHT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, RIGHT_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_TOP_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, TOP_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_BOTTOM_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, BOTTOM_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_SHADOW_FORMAT), RES_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, + { OUString(UNO_NAME_FOOTER_BODY_DISTANCE), RES_UL_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT), SID_ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_FOOTER_IS_SHARED), SID_ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_FOOTER_HEIGHT), SID_ATTR_PAGE_SIZE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_IS_ON), SID_ATTR_PAGE_ON, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_FOOTER_DYNAMIC_SPACING), RES_HEADER_FOOTER_EAT_SPACING, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID ,0 }, { OUString(UNO_NAME_IS_LANDSCAPE), SID_ATTR_PAGE, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_PAGE_ORIENTATION }, { OUString(UNO_NAME_NUMBERING_TYPE), SID_ATTR_PAGE, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE , MID_PAGE_NUMTYPE }, diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index aa13240304f1..dc8d6363e80b 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -47,8 +47,17 @@ #include <comphelper/servicehelper.hxx> #include <boost/scoped_ptr.hpp> +//UUUU +#include <swunohelper.hxx> +#include <svx/unobrushitemhelper.hxx> +#include <editeng/unoipset.hxx> +#include <svx/xflbstit.hxx> +#include <svx/xflbmtit.hxx> +#include <com/sun/star/drawing/BitmapMode.hpp> + using namespace ::com::sun::star; + class SwParaSelection { SwCursor & m_rCursor; @@ -151,6 +160,13 @@ public: throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException); + //UUUU + void GetSinglePropertyValue_Impl( + const SfxItemPropertySimpleEntry& rEntry, + const SfxItemSet& rSet, + uno::Any& rAny ) const + throw(uno::RuntimeException); + uno::Sequence< beans::GetDirectPropertyTolerantResult > GetPropertyValuesTolerant_Impl( const uno::Sequence< OUString >& rPropertyNames, @@ -424,6 +440,98 @@ throw (beans::PropertyVetoException, lang::IllegalArgumentException, } } +//UUUU Support for DrawingLayer FillStyles for GetPropertyValue() usages +void SwXParagraph::Impl::GetSinglePropertyValue_Impl( + const SfxItemPropertySimpleEntry& rEntry, + const SfxItemSet& rSet, + uno::Any& rAny ) const +throw(uno::RuntimeException) +{ + bool bDone(false); + + switch(rEntry.nWID) + { + case RES_BACKGROUND: + { + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); + const sal_uInt8 nMemberId(rEntry.nMemberId & (~SFX_METRIC_ITEM)); + + if(!aOriginalBrushItem.QueryValue(rAny, nMemberId)) + { + OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)"); + } + + bDone = true; + break; + } + case OWN_ATTR_FILLBMP_MODE: + { + const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&rSet.Get(XATTR_FILLBMP_STRETCH)); + const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&rSet.Get(XATTR_FILLBMP_TILE)); + + if( pTileItem && pTileItem->GetValue() ) + { + rAny <<= drawing::BitmapMode_REPEAT; + } + else if( pStretchItem && pStretchItem->GetValue() ) + { + rAny <<= drawing::BitmapMode_STRETCH; + } + else + { + rAny <<= drawing::BitmapMode_NO_REPEAT; + } + + bDone = true; + break; + } + default: break; + } + + if(!bDone) + { + // fallback to standard get value implementation used before this helper was created + m_rPropSet.getPropertyValue(rEntry, rSet, rAny); + + if(rEntry.aType == ::getCppuType((const sal_Int16*)0) && rEntry.aType != rAny.getValueType()) + { + // since the sfx uInt16 item now exports a sal_Int32, we may have to fix this here + sal_Int32 nValue(0); + + rAny >>= nValue; + rAny <<= static_cast< sal_Int16 >(nValue); + } + + //UUUU check for needed metric translation + if(rEntry.nMemberId & SFX_METRIC_ITEM) + { + bool bDoIt(true); + + if(XATTR_FILLBMP_SIZEX == rEntry.nWID || XATTR_FILLBMP_SIZEY == rEntry.nWID) + { + // exception: If these ItemTypes are used, do not convert when these are negative + // since this means they are intended as percent values + sal_Int32 nValue = 0; + + if(rAny >>= nValue) + { + bDoIt = nValue > 0; + } + } + + if(bDoIt) + { + const SfxMapUnit eMapUnit(rSet.GetPool()->GetMetric(rEntry.nWID)); + + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + SvxUnoConvertToMM(eMapUnit, rAny); + } + } + } + } +} + uno::Sequence< uno::Any > SwXParagraph::Impl::GetPropertyValues_Impl( const uno::Sequence< OUString > & rPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, @@ -456,8 +564,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, *pEntry, aPam, &(pValues[nProp]), eTemp, &rTxtNode ); if (!bDone) { - m_rPropSet.getPropertyValue( - *pEntry, rAttrSet, pValues[nProp]); + //UUUU + GetSinglePropertyValue_Impl(*pEntry, rAttrSet, pValues[nProp]); } } } @@ -717,8 +825,8 @@ throw (uno::RuntimeException) // if not found try the real paragraph attributes... if (!bDone) { - m_rPropSet.getPropertyValue( - *pEntry, rValueAttrSet, aValue ); + //UUUU + GetSinglePropertyValue_Impl(*pEntry, rValueAttrSet, aValue); } } @@ -832,61 +940,108 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, } static beans::PropertyState lcl_SwXParagraph_getPropertyState( -// SwUnoCrsr& rUnoCrsr, - const SwTxtNode& rTxtNode, - const SwAttrSet** ppSet, - const SfxItemPropertySimpleEntry& rEntry, - bool &rAttrSetFetched ) + // SwUnoCrsr& rUnoCrsr, + const SwTxtNode& rTxtNode, + const SwAttrSet** ppSet, + const SfxItemPropertySimpleEntry& rEntry, + bool &rAttrSetFetched) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { - beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE; + beans::PropertyState eRet(beans::PropertyState_DEFAULT_VALUE); - if(!(*ppSet) && !rAttrSetFetched ) + if(!(*ppSet) && !rAttrSetFetched) { (*ppSet) = rTxtNode.GetpSwAttrSet(); rAttrSetFetched = true; } - SwPosition aPos( rTxtNode ); - SwPaM aPam( aPos ); - switch( rEntry.nWID ) + + SwPosition aPos(rTxtNode); + SwPaM aPam(aPos); + bool bDone(false); + + switch(rEntry.nWID) { - case FN_UNO_NUM_RULES: - // if numbering is set, return it; else do nothing - SwUnoCursorHelper::getNumberingProperty( aPam, eRet, NULL ); - break; - case FN_UNO_ANCHOR_TYPES: - break; - case RES_ANCHOR: - if ( MID_SURROUND_SURROUNDTYPE != rEntry.nMemberId ) - goto lcl_SwXParagraph_getPropertyStateDEFAULT; - break; - case RES_SURROUND: - if ( MID_ANCHOR_ANCHORTYPE != rEntry.nMemberId ) - goto lcl_SwXParagraph_getPropertyStateDEFAULT; - break; - case FN_UNO_PARA_STYLE: - case FN_UNO_PARA_CONDITIONAL_STYLE_NAME: + case FN_UNO_NUM_RULES: { - SwFmtColl* pFmt = SwUnoCursorHelper::GetCurTxtFmtColl( - aPam, rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME); - eRet = pFmt ? beans::PropertyState_DIRECT_VALUE - : beans::PropertyState_AMBIGUOUS_VALUE; + // if numbering is set, return it; else do nothing + SwUnoCursorHelper::getNumberingProperty(aPam,eRet,NULL); + bDone = true; + break; } - break; - case FN_UNO_PAGE_STYLE: + case FN_UNO_ANCHOR_TYPES: + { + bDone = true; + break; + } + case RES_ANCHOR: + { + bDone = (MID_SURROUND_SURROUNDTYPE == rEntry.nMemberId); + break; + } + case RES_SURROUND: + { + bDone = (MID_ANCHOR_ANCHORTYPE == rEntry.nMemberId); + break; + } + case FN_UNO_PARA_STYLE: + case FN_UNO_PARA_CONDITIONAL_STYLE_NAME: + { + SwFmtColl* pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(aPam,rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME); + eRet = pFmt ? beans::PropertyState_DIRECT_VALUE : beans::PropertyState_AMBIGUOUS_VALUE; + bDone = true; + break; + } + case FN_UNO_PAGE_STYLE: { OUString sVal; SwUnoCursorHelper::GetCurPageStyle( aPam, sVal ); eRet = !sVal.isEmpty() ? beans::PropertyState_DIRECT_VALUE : beans::PropertyState_AMBIGUOUS_VALUE; + bDone = true; + break; } - break; - lcl_SwXParagraph_getPropertyStateDEFAULT: - default: + + //UUUU DrawingLayer PropertyStyle support + case OWN_ATTR_FILLBMP_MODE: + { + if(*ppSet) + { + if(SFX_ITEM_SET == (*ppSet)->GetItemState(XATTR_FILLBMP_STRETCH, false) + || SFX_ITEM_SET == (*ppSet)->GetItemState(XATTR_FILLBMP_TILE, false)) + { + eRet = beans::PropertyState_DIRECT_VALUE; + } + else + { + eRet = beans::PropertyState_AMBIGUOUS_VALUE; + } + + bDone = true; + } + break; + } + case RES_BACKGROUND: + { + if(*ppSet) + { + if(SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(**ppSet)) + { + eRet = beans::PropertyState_DIRECT_VALUE; + bDone = true; + } + } + break; + } + } + + if(!bDone) + { if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rEntry.nWID, false)) + { eRet = beans::PropertyState_DIRECT_VALUE; - break; + } } + return eRet; } @@ -990,10 +1145,24 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) static_cast<cppu::OWeakObject *>(this)); } - if (pEntry->nWID < RES_FRMATR_END) + const bool bBelowFrmAtrEnd(pEntry->nWID < RES_FRMATR_END); + const bool bDrawingLayerRange(XATTR_FILL_FIRST <= pEntry->nWID && XATTR_FILL_LAST >= pEntry->nWID); + + if(bBelowFrmAtrEnd || bDrawingLayerRange) { std::set<sal_uInt16> aWhichIds; - aWhichIds.insert( pEntry->nWID ); + + //UUUU For FillBitmapMode two IDs have to be reset (!) + if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID) + { + aWhichIds.insert(XATTR_FILLBMP_STRETCH); + aWhichIds.insert(XATTR_FILLBMP_TILE); + } + else + { + aWhichIds.insert(pEntry->nWID); + } + if (pEntry->nWID < RES_PARATR_BEGIN) { aCursor.GetDoc()->ResetAttrs(aCursor, true, aWhichIds); @@ -1010,14 +1179,19 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { pTemp->MovePara(fnParaCurr, fnParaStart); } + pTemp->SetMark(); *pTemp->GetPoint() = aEnd; //pTemp->Exchange(); + SwUnoCursorHelper::SelectPam(*pTemp, true); + if (!SwUnoCursorHelper::IsEndOfPara(*pTemp)) { pTemp->MovePara(fnParaCurr, fnParaEnd); } + + pTemp->GetDoc()->ResetAttrs(*pTemp, true, aWhichIds); } } @@ -1051,10 +1225,13 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, static_cast<cppu::OWeakObject *>(this)); } - if (pEntry->nWID < RES_FRMATR_END) + const bool bBelowFrmAtrEnd(pEntry->nWID < RES_FRMATR_END); + const bool bDrawingLayerRange(XATTR_FILL_FIRST <= pEntry->nWID && XATTR_FILL_LAST >= pEntry->nWID); + + if(bBelowFrmAtrEnd || bDrawingLayerRange) { - const SfxPoolItem& rDefItem = - rTxtNode.GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID); + const SfxPoolItem& rDefItem = rTxtNode.GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID); + rDefItem.QueryValue(aRet, pEntry->nMemberId); } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 49ede1a22d4e..cfbef1ff9a29 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -73,12 +73,14 @@ #include <comphelper/sequenceasvector.hxx> //UUUU -#include <unobrushitemhelper.hxx> +#include <svx/unobrushitemhelper.hxx> #include <editeng/unoipset.hxx> #include <editeng/memberids.hrc> #include <svx/unoshape.hxx> #include <svx/xflbstit.hxx> #include <svx/xflbmtit.hxx> +#include <swunohelper.hxx> +#include <svx/xbtmpit.hxx> #include <boost/shared_ptr.hpp> @@ -89,13 +91,6 @@ #include <set> #define STYLE_FAMILY_COUNT 5 // we have 5 style families -#define TYPE_BOOL 0 -#define TYPE_SIZE 1 -#define TYPE_BRUSH 2 -#define TYPE_ULSPACE 3 -#define TYPE_SHADOW 4 -#define TYPE_LRSPACE 5 -#define TYPE_BOX 6 const sal_uInt16 aStyleByIndex[] = { @@ -117,49 +112,6 @@ const IStyleAccess::SwAutoStyleFamily aAutoStyleByIndex[] = using namespace ::com::sun::star; -//convert FN_... to RES_ in header and footer itemset -static sal_uInt16 lcl_ConvertFNToRES(sal_uInt16 nFNId) -{ - sal_uInt16 nRes = USHRT_MAX; - switch(nFNId) - { - case FN_UNO_FOOTER_ON: - case FN_UNO_HEADER_ON: - break; - case FN_UNO_FOOTER_BACKGROUND: - case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; - break; - case FN_UNO_FOOTER_BOX: - case FN_UNO_HEADER_BOX: nRes = RES_BOX; - break; - case FN_UNO_FOOTER_LR_SPACE: - case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE; - break; - case FN_UNO_FOOTER_SHADOW: - case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW; - break; - case FN_UNO_FOOTER_BODY_DISTANCE: - case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE; - break; - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC; - break; - case FN_UNO_FOOTER_SHARE_CONTENT: - case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED; - break; - case FN_UNO_FIRST_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED_FIRST; - break; - case FN_UNO_FOOTER_HEIGHT: - case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE; - break; - case FN_UNO_FOOTER_EAT_SPACING: - case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING; - break; - } - return nRes; - -} - static SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum ( SfxStyleFamily eFamily ) { switch ( eFamily ) @@ -1578,66 +1530,100 @@ void SwXStyle::ApplyDescriptorProperties() } } -struct SwStyleBase_Impl +class SwStyleBase_Impl { - SwDoc& rDoc; +private: + SwDoc& mrDoc; + const SwPageDesc* mpOldPageDesc; + rtl::Reference< SwDocStyleSheet > mxNewBase; + SfxItemSet* mpItemSet; + OUString mrStyleName; + const SwAttrSet* mpParentStyle; + +public: + SwStyleBase_Impl(SwDoc& rSwDoc, const OUString& rName, const SwAttrSet* pParentStyle) + : mrDoc(rSwDoc) + , mpOldPageDesc(0) + , mpItemSet(0) + , mrStyleName(rName) + , mpParentStyle(pParentStyle) + { + } - const SwPageDesc* pOldPageDesc; + ~SwStyleBase_Impl() + { + delete mpItemSet; + } - rtl::Reference< SwDocStyleSheet > mxNewBase; - SfxItemSet* pItemSet; + rtl::Reference< SwDocStyleSheet >& getNewBase() + { + return mxNewBase; + } - OUString rStyleName; + void setNewBase(SwDocStyleSheet* pNew) + { + mxNewBase = pNew; + } - SwStyleBase_Impl(SwDoc& rSwDoc, const OUString& rName) : - rDoc(rSwDoc), - pOldPageDesc(0), - pItemSet(0), - rStyleName(rName) - {} + bool HasItemSet() const + { + return mxNewBase.is(); + } - ~SwStyleBase_Impl(){ delete pItemSet; } + SfxItemSet* replaceItemSet(SfxItemSet* pNew) + { + SfxItemSet* pRetval = mpItemSet; + mpItemSet = pNew; + return pRetval; + } - bool HasItemSet() {return mxNewBase.is();} SfxItemSet& GetItemSet() + { + OSL_ENSURE(mxNewBase.is(), "no SwDocStyleSheet available"); + if (!mpItemSet) { - OSL_ENSURE(mxNewBase.is(), "no SwDocStyleSheet available"); - if(!pItemSet) - pItemSet = new SfxItemSet(mxNewBase->GetItemSet()); - return *pItemSet; + mpItemSet = new SfxItemSet(mxNewBase->GetItemSet()); + + //UUUU set parent style to have the correct XFillStyle setting as XFILL_NONE + if(!mpItemSet->GetParent() && mpParentStyle) + { + mpItemSet->SetParent(mpParentStyle); + } } + return *mpItemSet; + } - const SwPageDesc& GetOldPageDesc(); + const SwPageDesc& GetOldPageDesc(); }; const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc() { - if(!pOldPageDesc) + if(!mpOldPageDesc) { - const sal_uInt16 nPDescCount = rDoc.GetPageDescCnt(); + const sal_uInt16 nPDescCount = mrDoc.GetPageDescCnt(); for(sal_uInt16 i = 0; i < nPDescCount; ++i) { - const SwPageDesc& rDesc = rDoc.GetPageDesc( i ); - if(rDesc.GetName() == rStyleName) + const SwPageDesc& rDesc = mrDoc.GetPageDesc( i ); + if(rDesc.GetName() == mrStyleName) { - pOldPageDesc = & rDesc; + mpOldPageDesc = & rDesc; break; } } - if(!pOldPageDesc) + if(!mpOldPageDesc) { for(sal_uInt16 i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i) { - if(SW_RESSTR(i) == rStyleName) + if(SW_RESSTR(i) == mrStyleName) { - pOldPageDesc = rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) ); + mpOldPageDesc = mrDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) ); break; } } } } - assert(pOldPageDesc != 0); - return *pOldPageDesc; + assert(mpOldPageDesc != 0); + return *mpOldPageDesc; } static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, @@ -1696,31 +1682,31 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, if ( rValue >>= bHidden ) { //make it a 'real' style - necessary for pooled styles - rBase.mxNewBase->GetItemSet(); - rBase.mxNewBase->SetHidden( bHidden ); + rBase.getNewBase()->GetItemSet(); + rBase.getNewBase()->SetHidden( bHidden ); } } break; case FN_UNO_STYLE_INTEROP_GRAB_BAG: { - rBase.mxNewBase->GetItemSet(); - rBase.mxNewBase->SetGrabBagItem(rValue); + rBase.getNewBase()->GetItemSet(); + rBase.getNewBase()->SetGrabBagItem(rValue); } break; - case XATTR_FILLBITMAP: case XATTR_FILLGRADIENT: case XATTR_FILLHATCH: + case XATTR_FILLBITMAP: case XATTR_FILLFLOATTRANSPARENCE: // not yet needed; activate when LineStyle support may be added // case XATTR_LINESTART: // case XATTR_LINEEND: // case XATTR_LINEDASH: { - //UUUU add set commands for FillName items if(MID_NAME == nMemberId) { + //UUUU add set commands for FillName items OUString aTempName; SfxItemSet& rStyleSet = rBase.GetItemSet(); @@ -1732,28 +1718,35 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, SvxShape::SetFillAttribute(rEntry.nWID, aTempName, rStyleSet); bDone = true; } + else if(MID_GRAFURL == nMemberId) + { + if(XATTR_FILLBITMAP == rEntry.nWID) + { + //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used + const Graphic aNullGraphic; + SfxItemSet& rStyleSet = rBase.GetItemSet(); + XFillBitmapItem aXFillBitmapItem(rStyleSet.GetPool(), aNullGraphic); + + aXFillBitmapItem.PutValue(aValue, nMemberId); + rStyleSet.Put(aXFillBitmapItem); + bDone = true; + } + } break; } case RES_BACKGROUND: { - //UUUU No new FillStyle for PageBackground; need to remove again when we want - // to support that, too. Add a break to *not* set bDone to true - if(SFX_STYLE_FAMILY_PAGE == eFamily) - { - break; - } - //UUUU SfxItemSet& rStyleSet = rBase.GetItemSet(); - const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rStyleSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND)); SvxBrushItem aChangedBrushItem(aOriginalBrushItem); aChangedBrushItem.PutValue(aValue, nMemberId); if(!(aChangedBrushItem == aOriginalBrushItem)) { - sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet); + setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet); } bDone = true; @@ -1893,7 +1886,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, aSetRule.Set( i, &aFmt ); } } - rBase.mxNewBase->SetNumRule(aSetRule); + rBase.getNewBase()->SetNumRule(aSetRule); } } else @@ -1908,7 +1901,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, sal_Int16 nLevel = 0; aValue >>= nLevel; if( 0 <= nLevel && nLevel <= MAXLEVEL) - rBase.mxNewBase->GetCollection()->SetAttrOutlineLevel( nLevel ); + rBase.getNewBase()->GetCollection()->SetAttrOutlineLevel( nLevel ); bDone = true; break; @@ -1920,7 +1913,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, aValue >>= sTmp; OUString aString; SwStyleNameMapper::FillUIName(sTmp, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true ) ; - rBase.mxNewBase->SetFollow( aString ); + rBase.getNewBase()->SetFollow( aString ); bDone = true; break; @@ -1979,9 +1972,9 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, { bool bAuto = *(sal_Bool*)aValue.getValue(); if(SFX_STYLE_FAMILY_PARA == eFamily) - rBase.mxNewBase->GetCollection()->SetAutoUpdateFmt(bAuto); + rBase.getNewBase()->GetCollection()->SetAutoUpdateFmt(bAuto); else if(SFX_STYLE_FAMILY_FRAME == eFamily) - rBase.mxNewBase->GetFrmFmt()->SetAutoUpdateFmt(bAuto); + rBase.getNewBase()->GetFrmFmt()->SetAutoUpdateFmt(bAuto); bDone = true; break; @@ -2042,7 +2035,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_CATEGORY: { - if(!rBase.mxNewBase->IsUserDefined()) + if(!rBase.getNewBase()->IsUserDefined()) throw lang::IllegalArgumentException(); short nSet = 0; aValue >>= nSet; @@ -2071,7 +2064,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, default: throw lang::IllegalArgumentException(); } - rBase.mxNewBase->SetMask( nId|SFXSTYLEBIT_USERDEF ); + rBase.getNewBase()->SetMask( nId|SFXSTYLEBIT_USERDEF ); bDone = true; break; } @@ -2173,16 +2166,16 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, // --> OD 2006-10-18 #i70223# if ( SFX_STYLE_FAMILY_PARA == eFamily && rEntry.nWID == RES_PARATR_NUMRULE && - rBase.mxNewBase.is() && rBase.mxNewBase->GetCollection() && - //rBase.mxNewBase->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei - rBase.mxNewBase->GetCollection()->IsAssignedToListLevelOfOutlineStyle() ) ////<-end,add by zhaojianwei + rBase.getNewBase().is() && rBase.getNewBase()->GetCollection() && + //rBase.getNewBase()->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei + rBase.getNewBase()->GetCollection()->IsAssignedToListLevelOfOutlineStyle() ) ////<-end,add by zhaojianwei { OUString sNewNumberingRuleName; aValue >>= sNewNumberingRuleName; if ( sNewNumberingRuleName.isEmpty() || sNewNumberingRuleName != pDoc->GetOutlineNumRule()->GetName() ) { - rBase.mxNewBase->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); + rBase.getNewBase()->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); } } } @@ -2197,26 +2190,29 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl( { if ( !m_pDoc ) throw uno::RuntimeException(); + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; + switch(eFamily) { case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ;break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); if(rPropertyNames.getLength() != rValues.getLength()) + { throw lang::IllegalArgumentException(); + } const OUString* pNames = rPropertyNames.getConstArray(); const uno::Any* pValues = rValues.getConstArray(); - SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName); + SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName, &GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); //UUUU add pDfltTxtFmtColl as parent if(pBasePool) { const sal_uInt16 nSaveMask = pBasePool->GetSearchMask(); @@ -2225,35 +2221,41 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl( pBasePool->SetSearchMask(eFamily, nSaveMask ); OSL_ENSURE(pBase, "where is the style?" ); if(pBase) - aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase); + aBaseImpl.setNewBase(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase)); else throw uno::RuntimeException(); } for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp]); + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(pNames[nProp]); if(!pEntry || (!bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS)) throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if(aBaseImpl.mxNewBase.is()) + if(aBaseImpl.getNewBase().is()) { - lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, - pBasePool, m_pDoc, eFamily); + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, pBasePool, m_pDoc, eFamily); } else if(bIsDescriptor) { if(!pPropImpl->SetProperty(pNames[nProp], pValues[nProp])) + { throw lang::IllegalArgumentException(); + } } else + { throw uno::RuntimeException(); + } } + if(aBaseImpl.HasItemSet()) - aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet()); + { + aBaseImpl.getNewBase()->SetItemSet(aBaseImpl.GetItemSet()); + } } void SwXStyle::setPropertyValues( @@ -2322,9 +2324,9 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } else if(pBase) { - if(!rBase.mxNewBase.is()) + if(!rBase.getNewBase().is()) { - rBase.mxNewBase = new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ); + rBase.setNewBase(new SwDocStyleSheet( *(SwDocStyleSheet*)pBase )); } //UUUU @@ -2358,7 +2360,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_NUM_RULES: //Sonderbehandlung fuer das SvxNumRuleItem: { - const SwNumRule* pRule = rBase.mxNewBase->GetNumRule(); + const SwNumRule* pRule = rBase.getNewBase()->GetNumRule(); OSL_ENSURE(pRule, "Wo ist die NumRule?"); uno::Reference< container::XIndexReplace > xRules = new SwXNumberingRules(*pRule, pDoc); @@ -2370,7 +2372,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, case RES_PARATR_OUTLINELEVEL: { OSL_ENSURE( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" ); - int nLevel = rBase.mxNewBase->GetCollection()->GetAttrOutlineLevel(); + int nLevel = rBase.getNewBase()->GetCollection()->GetAttrOutlineLevel(); aRet <<= static_cast<sal_Int16>( nLevel ); bDone = true; break; @@ -2378,7 +2380,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, case FN_UNO_FOLLOW_STYLE: { OUString aString; - SwStyleNameMapper::FillProgName(rBase.mxNewBase->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true); + SwStyleNameMapper::FillProgName(rBase.getNewBase()->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true); aRet <<= aString; bDone = true; break; @@ -2407,9 +2409,9 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, { sal_Bool bAuto = sal_False; if(SFX_STYLE_FAMILY_PARA == eFamily) - bAuto = rBase.mxNewBase->GetCollection()->IsAutoUpdateFmt(); + bAuto = rBase.getNewBase()->GetCollection()->IsAutoUpdateFmt(); else if(SFX_STYLE_FAMILY_FRAME == eFamily) - bAuto = rBase.mxNewBase->GetFrmFmt()->IsAutoUpdateFmt(); + bAuto = rBase.getNewBase()->GetFrmFmt()->IsAutoUpdateFmt(); aRet.setValue(&bAuto, ::getBooleanCppuType()); bDone = true; @@ -2417,7 +2419,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_DISPLAY_NAME: { - aRet <<= rBase.mxNewBase->GetDisplayName(); + aRet <<= rBase.getNewBase()->GetDisplayName(); bDone = true; break; @@ -2456,7 +2458,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_CATEGORY: { - const sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId(); + const sal_uInt16 nPoolId = rBase.getNewBase()->GetCollection()->GetPoolFmtId(); short nRet = -1; switch ( COLL_GET_RANGE_BITS & nPoolId ) @@ -2487,7 +2489,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case SID_SWREGISTER_COLLECTION: { - const SwPageDesc *pPageDesc = rBase.mxNewBase->GetPageDesc(); + const SwPageDesc *pPageDesc = rBase.getNewBase()->GetPageDesc(); const SwTxtFmtColl* pCol = 0; OUString aString; if( pPageDesc ) @@ -2501,16 +2503,9 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case RES_BACKGROUND: { - //UUUU No new FillStyle for PageBackground; need to remove again when we want - // to support that, too. Add a break to *not* set bDone to true - if(SFX_STYLE_FAMILY_PAGE == eFamily) - { - break; - } - //UUUU const SfxItemSet& rSet = rBase.GetItemSet(); - const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); if(!aOriginalBrushItem.QueryValue(aRet, nMemberId)) { @@ -2608,30 +2603,33 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( { if ( !m_pDoc ) throw uno::RuntimeException(); + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; + switch(eFamily) { case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ;break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break; - default: - ; + default: ; } + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); - const OUString* pNames = rPropertyNames.getConstArray(); uno::Sequence< uno::Any > aRet(rPropertyNames.getLength()); uno::Any* pRet = aRet.getArray(); - SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName); + SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName, &GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); //UUUU add pDfltTxtFmtColl as parent SfxStyleSheetBase* pBase = 0; + for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp]); if(!pEntry || (!bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS)) throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + if(pBasePool) { if(!pBase) @@ -2641,6 +2639,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( pBase = pBasePool->Find(m_sStyleName); pBasePool->SetSearchMask(eFamily, nSaveMask ); } + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, eFamily, GetDoc() ); } else if(bIsDescriptor) @@ -2750,6 +2749,7 @@ void SwXStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& r SolarMutexGuard aGuard; const uno::Sequence<OUString> aProperties(&rPropertyName, 1); const uno::Sequence<uno::Any> aValues(&rValue, 1); + SetPropertyValues_Impl( aProperties, aValues ); } @@ -2794,7 +2794,6 @@ beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName) throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - uno::Sequence< OUString > aNames(1); OUString* pNames = aNames.getArray(); pNames[0] = rPropertyName; @@ -2809,6 +2808,7 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( SolarMutexGuard aGuard; uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength()); beans::PropertyState* pStates = aRet.getArray(); + if(pBasePool) { pBasePool->SetSearchMask(eFamily ); @@ -2820,61 +2820,105 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( const OUString* pNames = rPropertyNames.getConstArray(); rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; + switch(eFamily) { case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break; - default: - ; + default: ; } + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); + const SfxItemSet& rSet = xStyle->GetItemSet(); - SfxItemSet aSet = xStyle->GetItemSet(); for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) { const OUString sPropName = pNames[i]; const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName); + bool bDone(false); + if(!pEntry) + { throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) ); - if( FN_UNO_NUM_RULES == pEntry->nWID || - FN_UNO_FOLLOW_STYLE == pEntry->nWID ) + } + + if( FN_UNO_NUM_RULES == pEntry->nWID || FN_UNO_FOLLOW_STYLE == pEntry->nWID ) { + // handle NumRules first, done pStates[i] = beans::PropertyState_DIRECT_VALUE; + bDone = true; } - else if(SFX_STYLE_FAMILY_PAGE == eFamily && - (sPropName.startsWith("Header") || sPropName.startsWith("Footer"))) + + // allow to retarget the SfxItemSet working on, default correctly. Only + // use pSourceSet below this point (except in header/footer processing) + const SfxItemSet* pSourceSet = &rSet; + + if(!bDone) { - const sal_uInt16 nResId = lcl_ConvertFNToRES(pEntry->nWID); - bool bFooter = sPropName.startsWith("Footer"); - const SvxSetItem* pSetItem; - if(SFX_ITEM_SET == aSet.GetItemState( - bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - false, (const SfxPoolItem**)&pSetItem)) + // check for Header/Footer entry + const bool bHeader(SFX_STYLE_FAMILY_PAGE == eFamily && sPropName.startsWith("Header")); + const bool bFooter(SFX_STYLE_FAMILY_PAGE == eFamily && sPropName.startsWith("Footer")); + + if(bHeader || bFooter) { - const SfxItemSet& rSet = pSetItem->GetItemSet(); - SfxItemState eState = rSet.GetItemState(nResId, false); - if(SFX_ITEM_SET == eState) - pStates[i] = beans::PropertyState_DIRECT_VALUE; + const SvxSetItem* pSetItem; + + if(SFX_ITEM_SET == rSet.GetItemState( + bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, + false, + (const SfxPoolItem**)&pSetItem)) + { + // retarget the SfxItemSet to the HeaderFooter SfxSetItem's SfxItenSet + pSourceSet = &pSetItem->GetItemSet(); + } else - pStates[i] = beans::PropertyState_DEFAULT_VALUE; + { + // if no SetItem, value is ambigous and we are done + pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE; + bDone = true; + } + } + } + + if(!bDone && OWN_ATTR_FILLBMP_MODE == pEntry->nWID) + { + //UUUU + if(SFX_ITEM_SET == pSourceSet->GetItemState(XATTR_FILLBMP_STRETCH, false) + || SFX_ITEM_SET == pSourceSet->GetItemState(XATTR_FILLBMP_TILE, false)) + { + pStates[i] = beans::PropertyState_DIRECT_VALUE; } else + { pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE; + } + + bDone = true; } - else + + //UUUU for FlyFrames we need to mark all properties from type RES_BACKGROUND + // 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 + if(!bDone && RES_BACKGROUND == pEntry->nWID + && SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(*pSourceSet)) + { + pStates[i] = beans::PropertyState_DIRECT_VALUE; + bDone = true; + } + + if(!bDone) { - pStates[i] = pPropSet->getPropertyState(*pEntry, aSet); - if( SFX_STYLE_FAMILY_PAGE == eFamily && - SID_ATTR_PAGE_SIZE == pEntry->nWID && - beans::PropertyState_DIRECT_VALUE == pStates[i] ) + pStates[i] = pPropSet->getPropertyState(*pEntry, *pSourceSet); + + if(SFX_STYLE_FAMILY_PAGE == eFamily && SID_ATTR_PAGE_SIZE == pEntry->nWID && beans::PropertyState_DIRECT_VALUE == pStates[i]) { - const SvxSizeItem& rSize = - static_cast < const SvxSizeItem& >( - aSet.Get(SID_ATTR_PAGE_SIZE) ); + const SvxSizeItem& rSize = static_cast <const SvxSizeItem&>( rSet.Get(SID_ATTR_PAGE_SIZE)); sal_uInt8 nMemberId = pEntry->nMemberId & 0x7f; + if( ( LONG_MAX == rSize.GetSize().Width() && (MID_SIZE_WIDTH == nMemberId || MID_SIZE_SIZE == nMemberId ) ) || @@ -2888,10 +2932,15 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( } } else + { throw uno::RuntimeException(); + } } else + { throw uno::RuntimeException(); + } + return aRet; } @@ -2919,60 +2968,97 @@ void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); switch(eFamily) { - case SFX_STYLE_FAMILY_CHAR: pTargetFmt = xStyle->GetCharFmt(); break; - case SFX_STYLE_FAMILY_PARA: pTargetFmt = xStyle->GetCollection(); break; - case SFX_STYLE_FAMILY_FRAME: pTargetFmt = xStyle->GetFrmFmt(); break; + case SFX_STYLE_FAMILY_CHAR: + pTargetFmt = xStyle->GetCharFmt(); + break; + + case SFX_STYLE_FAMILY_PARA: + pTargetFmt = xStyle->GetCollection(); + break; + + case SFX_STYLE_FAMILY_FRAME: + pTargetFmt = xStyle->GetFrmFmt(); + break; + case SFX_STYLE_FAMILY_PAGE: - { - SwPageDesc *pDesc = m_pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName()); - if( pDesc ) - pTargetFmt = &pDesc->GetMaster(); - } + { + SwPageDesc *pDesc = m_pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName()); + if( pDesc ) + pTargetFmt = &pDesc->GetMaster(); break; + } case SFX_STYLE_FAMILY_PSEUDO: break; - default: - ; + default: ; } } } + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; + switch(eFamily) { case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break; - default: - ; + default: ; } + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); - const OUString* pNames = aPropertyNames.getConstArray(); - if ( pTargetFmt ) + if(pTargetFmt) { - for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ ) + for(sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] ); + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(pNames[nProp]); + if( !pEntry ) + { throw beans::UnknownPropertyException ( "Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + } + if ( pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES ) + { throw uno::RuntimeException ("Cannot reset: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if ( pEntry->nFlags & beans::PropertyAttribute::READONLY ) + } + + if (pEntry->nFlags & beans::PropertyAttribute::READONLY) + { throw uno::RuntimeException("setPropertiesToDefault: property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + } if( pEntry->nWID == RES_PARATR_OUTLINELEVEL ) + { static_cast<SwTxtFmtColl*>(pTargetFmt)->DeleteAssignmentToListLevelOfOutlineStyle(); + } else + { pTargetFmt->ResetFmtAttr( pEntry->nWID ); + } + + if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID) + { + //UUUU + SwDoc* pDoc = pTargetFmt->GetDoc(); + SfxItemSet aSet(pDoc->GetAttrPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + aSet.SetParent(&pTargetFmt->GetAttrSet()); + + aSet.ClearItem(XATTR_FILLBMP_STRETCH); + aSet.ClearItem(XATTR_FILLBMP_TILE); + + pTargetFmt->SetFmtAttr(aSet); + } } } - else if ( bIsDescriptor ) + else if(bIsDescriptor) { - for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ ) - pPropImpl->ClearProperty ( pNames[ nProp ] ); + for(sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++) + { + pPropImpl->ClearProperty(pNames[nProp]); + } } } @@ -2980,6 +3066,7 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault( ) throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; + if(pBasePool) { pBasePool->SetSearchMask(eFamily); @@ -2989,98 +3076,116 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault( ) if(pBase) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); - SwFmt *pTargetFmt = 0; sal_uInt16 nPgDscPos = USHRT_MAX; - switch( eFamily ) + switch(eFamily) { - case SFX_STYLE_FAMILY_CHAR : - pTargetFmt = xStyle->GetCharFmt(); - break; - case SFX_STYLE_FAMILY_PARA : + case SFX_STYLE_FAMILY_CHAR: + pTargetFmt = xStyle->GetCharFmt(); + break; + + case SFX_STYLE_FAMILY_PARA: { pTargetFmt = xStyle->GetCollection(); - if ( xStyle->GetCollection() ) + if(xStyle->GetCollection()) + { xStyle->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); + } + break; } - break; - case SFX_STYLE_FAMILY_FRAME: - pTargetFmt = xStyle->GetFrmFmt(); - break; - case SFX_STYLE_FAMILY_PAGE: + + case SFX_STYLE_FAMILY_FRAME: + pTargetFmt = xStyle->GetFrmFmt(); + break; + + case SFX_STYLE_FAMILY_PAGE: { SwPageDesc *pDesc = m_pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName(), &nPgDscPos); if( pDesc ) { pTargetFmt = &pDesc->GetMaster(); - pDesc->SetUseOn ( nsUseOnPage::PD_ALL ); + pDesc->SetUseOn(nsUseOnPage::PD_ALL); } + break; } - break; - case SFX_STYLE_FAMILY_PSEUDO: - break; - default: - ; + case SFX_STYLE_FAMILY_PSEUDO: + break; + + default: ; } - if( pTargetFmt ) + + if(pTargetFmt) { - if( USHRT_MAX != nPgDscPos ) + if(USHRT_MAX != nPgDscPos) { SwPageDesc& rPageDesc = m_pDoc->GetPageDesc(nPgDscPos); rPageDesc.ResetAllMasterAttr(); SvxLRSpaceItem aLR(RES_LR_SPACE); - sal_Int32 nSize = GetMetricVal ( CM_1) * 2; - aLR.SetLeft ( nSize ); - aLR.SetLeft ( nSize ); - SvxULSpaceItem aUL( RES_UL_SPACE ); - aUL.SetUpper ( static_cast < sal_uInt16 > ( nSize ) ); - aUL.SetLower ( static_cast < sal_uInt16 > ( nSize ) ); - pTargetFmt->SetFmtAttr( aLR ); - pTargetFmt->SetFmtAttr( aUL ); - - SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD ); - SwFmtFrmSize aFrmSz( ATT_FIX_SIZE ); - if( RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId() ) + sal_Int32 nSize = GetMetricVal(CM_1) * 2; + aLR.SetLeft(nSize); + aLR.SetLeft(nSize); + SvxULSpaceItem aUL(RES_UL_SPACE); + aUL.SetUpper(static_cast <sal_uInt16> (nSize)); + aUL.SetLower(static_cast <sal_uInt16> (nSize)); + pTargetFmt->SetFmtAttr(aLR); + pTargetFmt->SetFmtAttr(aUL); + SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD); + SwFmtFrmSize aFrmSz(ATT_FIX_SIZE); + + if(RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId()) { - if( m_pDoc->getIDocumentDeviceAccess().getPrinter( false ) ) + if(m_pDoc->getIDocumentDeviceAccess().getPrinter(false)) { const Size aPhysSize( SvxPaperInfo::GetPaperSize( - static_cast<Printer*>( m_pDoc->getIDocumentDeviceAccess().getPrinter( false ) )) ); - aFrmSz.SetSize( aPhysSize ); + static_cast<Printer*>(m_pDoc->getIDocumentDeviceAccess().getPrinter(false)))); + aFrmSz.SetSize(aPhysSize); } else - aFrmSz.SetSize( SvxPaperInfo::GetDefaultPaperSize() ); + { + aFrmSz.SetSize(SvxPaperInfo::GetDefaultPaperSize()); + } } else { aFrmSz = pStdPgDsc->GetMaster().GetFrmSize(); } - if( pStdPgDsc->GetLandscape() ) + + if(pStdPgDsc->GetLandscape()) { SwTwips nTmp = aFrmSz.GetHeight(); - aFrmSz.SetHeight( aFrmSz.GetWidth() ); - aFrmSz.SetWidth( nTmp ); + aFrmSz.SetHeight(aFrmSz.GetWidth()); + aFrmSz.SetWidth(nTmp); } + pTargetFmt->SetFmtAttr( aFrmSz ); } else + { pTargetFmt->ResetAllFmtAttr(); + } - if( USHRT_MAX != nPgDscPos ) - m_pDoc->ChgPageDesc( nPgDscPos, m_pDoc->GetPageDesc(nPgDscPos) ); + if(USHRT_MAX != nPgDscPos) + { + m_pDoc->ChgPageDesc(nPgDscPos, m_pDoc->GetPageDesc(nPgDscPos)); + } } - } else + { throw uno::RuntimeException(); + } } else if ( bIsDescriptor ) + { pPropImpl->ClearAllProperties(); + } else + { throw uno::RuntimeException(); + } } uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) @@ -3088,10 +3193,12 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq { SolarMutexGuard aGuard; sal_Int32 nCount = aPropertyNames.getLength(); - uno::Sequence < uno::Any > aRet ( nCount ); - if ( nCount ) + + uno::Sequence < uno::Any > aRet(nCount); + + if(nCount) { - if( pBasePool) + if(pBasePool) { pBasePool->SetSearchMask(eFamily); SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName); @@ -3099,7 +3206,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq if(pBase) { - rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); + rtl::Reference< SwDocStyleSheet > xStyle(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase)); sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; switch(eFamily) { @@ -3107,8 +3214,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); @@ -3116,11 +3222,15 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq const SfxItemSet &rSet = xStyle->GetItemSet(), *pParentSet = rSet.GetParent(); const OUString *pNames = aPropertyNames.getConstArray(); uno::Any *pRet = aRet.getArray(); - for ( sal_Int32 i = 0 ; i < nCount; i++) + + for(sal_Int32 i = 0; i < nCount; i++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[i] ); - if ( !pEntry ) - throw beans::UnknownPropertyException ( "Unknown property: " + pNames[i], static_cast < cppu::OWeakObject * > ( this ) ); + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(pNames[i]); + + if(!pEntry) + { + throw beans::UnknownPropertyException("Unknown property: " + pNames[i], static_cast < cppu::OWeakObject * >(this)); + } if (pEntry->nWID >= RES_UNKNOWNATR_END) { @@ -3128,20 +3238,28 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq // parent set, so the default value is void continue; } - if( pParentSet ) + + if(pParentSet) + { aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(pNames[i], *pParentSet, pRet[i]); - else if( pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID) ) + } + else if(pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID)) { const SfxPoolItem& rItem = rSet.GetPool()->GetDefaultItem(pEntry->nWID); + rItem.QueryValue(pRet[i], pEntry->nMemberId); } } } else + { throw uno::RuntimeException(); + } } else + { throw uno::RuntimeException(); + } } return aRet; } @@ -3203,39 +3321,25 @@ SwXPageStyle::~SwXPageStyle() } -static void lcl_putItemToSet(const SvxSetItem* pSetItem, sal_uInt16 nRes, sal_uInt16 nItemType, const uno::Any& rVal, sal_uInt8 nMemberId, SwStyleBase_Impl& rBaseImpl) +static void lcl_putItemToSet(const SvxSetItem* pSetItem, const SfxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rVal, SwStyleBase_Impl& rBaseImpl, SfxStyleSheetBasePool* pPool, SwDoc *pDoc, SfxStyleFamily eFamily) { - SvxSetItem* pNewSetItem = (SvxSetItem*)pSetItem->Clone(); + // create a new SvxSetItem and get it's ItemSet as new target + SvxSetItem* pNewSetItem = static_cast< SvxSetItem* >(pSetItem->Clone()); SfxItemSet& rSetSet = pNewSetItem->GetItemSet(); - const SfxPoolItem* pItem = 0; - SfxPoolItem* pNewItem = 0; - rSetSet.GetItemState(nRes, true, &pItem); - if(!pItem && nRes != rSetSet.GetPool()->GetSlotId(nRes)) - pItem = &rSetSet.GetPool()->GetDefaultItem(nRes); - if(pItem) - { - pNewItem = pItem->Clone(); - } - else - { - switch(nItemType) - { - case TYPE_BOOL: pNewItem = new SfxBoolItem(nRes); break; - case TYPE_SIZE: pNewItem = new SvxSizeItem(nRes); break; - case TYPE_BRUSH: pNewItem = new SvxBrushItem(nRes); break; - case TYPE_ULSPACE: pNewItem = new SvxULSpaceItem(nRes); break; - case TYPE_SHADOW : pNewItem = new SvxShadowItem(nRes); break; - case TYPE_LRSPACE: pNewItem = new SvxLRSpaceItem(nRes); break; - case TYPE_BOX: pNewItem = new SvxBoxItem(nRes); break; - } - } - assert(pNewItem); - if (pNewItem) - { - pNewItem->PutValue(rVal, nMemberId); - rSetSet.Put(*pNewItem); - delete pNewItem; - } + + // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem + rSetSet.SetParent(&pDoc->GetDfltFrmFmt()->GetAttrSet()); + + // replace the used SfxItemSet at the SwStyleBase_Impl temporarily and use the + // default method to set the property + SfxItemSet* pRememberItemSet = rBaseImpl.replaceItemSet(&rSetSet); + lcl_SetStyleProperty(rEntry, rPropSet, rVal, rBaseImpl, pPool, pDoc, eFamily); + rBaseImpl.replaceItemSet(pRememberItemSet); + + // reset paret at ItemSet from SetItem + rSetSet.SetParent(0); + + // set the new SvxSetItem at the real target and delete it rBaseImpl.GetItemSet().Put(*pNewSetItem); delete pNewSetItem; } @@ -3257,7 +3361,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( const uno::Any* pValues = rValues.getConstArray(); const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); - SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName()); + SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrmFmt()->GetAttrSet()); //UUUU add pDfltFrmFmt as parent if(GetBasePool()) { const sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask(); @@ -3266,140 +3370,194 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( GetBasePool()->SetSearchMask(GetFamily(), nSaveMask ); OSL_ENSURE(pBase, "where is the style?" ); if(pBase) - aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase); + { + aBaseImpl.setNewBase(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase)); + } else + { throw uno::RuntimeException(); + } } for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] ); + const OUString& rPropName = pNames[nProp]; + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(rPropName); + if (!pEntry) + { throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + } + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) + { throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + } if(GetBasePool()) { switch(pEntry->nWID) { - case FN_UNO_HEADER_ON: - case FN_UNO_HEADER_BACKGROUND: - case FN_UNO_HEADER_BOX: - case FN_UNO_HEADER_LR_SPACE: - case FN_UNO_HEADER_SHADOW: - case FN_UNO_HEADER_BODY_DISTANCE: - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: - case FN_UNO_HEADER_SHARE_CONTENT: - case FN_UNO_HEADER_HEIGHT: - case FN_UNO_HEADER_EAT_SPACING: - - case FN_UNO_FIRST_SHARE_CONTENT: - - case FN_UNO_FOOTER_ON: - case FN_UNO_FOOTER_BACKGROUND: - case FN_UNO_FOOTER_BOX: - case FN_UNO_FOOTER_LR_SPACE: - case FN_UNO_FOOTER_SHADOW: - case FN_UNO_FOOTER_BODY_DISTANCE: - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: - case FN_UNO_FOOTER_SHARE_CONTENT: - case FN_UNO_FOOTER_HEIGHT: - case FN_UNO_FOOTER_EAT_SPACING: + case SID_ATTR_PAGE_ON: + case RES_BACKGROUND: + case RES_BOX: + case RES_LR_SPACE: + case RES_SHADOW: + case RES_UL_SPACE: + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + case SID_ATTR_PAGE_SHARED_FIRST: + case SID_ATTR_PAGE_SIZE: + case RES_HEADER_FOOTER_EAT_SPACING: { - bool bFooter = false; - sal_uInt16 nItemType = TYPE_BOOL; - sal_uInt16 nRes = 0; - switch(pEntry->nWID) + // these entries are used in Header, Footer and (partially) in the PageStyle itself. + // Check for Header/Footer entry + const bool bHeader(rPropName.startsWith("Header")); + const bool bFooter(rPropName.startsWith("Footer")); + + if(bHeader || bFooter) { - case FN_UNO_FOOTER_ON: bFooter = true; - // no break - case FN_UNO_HEADER_ON: nRes = SID_ATTR_PAGE_ON; - break; - case FN_UNO_FOOTER_BACKGROUND: bFooter = true; - // no break - case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; nItemType = TYPE_BRUSH; - break; - case FN_UNO_FOOTER_BOX: bFooter = true; - // no break - case FN_UNO_HEADER_BOX: nRes = RES_BOX; nItemType = TYPE_BOX; - break; - case FN_UNO_FOOTER_LR_SPACE: bFooter = true; - // no break - case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE;nItemType = TYPE_LRSPACE; - break; - case FN_UNO_FOOTER_SHADOW: bFooter = true; - // no break - case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW;nItemType = TYPE_SHADOW; - break; - case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = true; - // no break - case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE;nItemType = TYPE_ULSPACE; - break; - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = true; - // no break - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC; - break; - case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = true; - // no break - case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED; - break; - case FN_UNO_FIRST_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED_FIRST; - break; - case FN_UNO_FOOTER_HEIGHT: bFooter = true; - // no break - case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE;nItemType = TYPE_SIZE; - break; - case FN_UNO_FOOTER_EAT_SPACING: bFooter = true; - // no break - case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;nItemType = TYPE_SIZE; - break; + // it is a Header/Footer entry, access the SvxSetItem containing it's information + const SvxSetItem* pSetItem = 0; + + if (SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState( + bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, + false, (const SfxPoolItem**)&pSetItem)) + { + lcl_putItemToSet(pSetItem, *pPropSet, *pEntry, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + + if (pEntry->nWID == SID_ATTR_PAGE_SHARED_FIRST) + { + // Need to add this to the other as well + if (SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState( + bFooter ? SID_ATTR_PAGE_HEADERSET : SID_ATTR_PAGE_FOOTERSET, + false, (const SfxPoolItem**)&pSetItem)) + { + lcl_putItemToSet(pSetItem, *pPropSet, *pEntry, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + } + } + } + else if(pEntry->nWID == SID_ATTR_PAGE_ON) + { + bool bVal = *(sal_Bool*)pValues[nProp].getValue(); + + if(bVal) + { + // Header/footer gets switched on, create defauts and the needed SfxSetItem + SfxItemSet aTempSet(*aBaseImpl.GetItemSet().GetPool(), + RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [82 + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER, // [10023 + SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE, // [10051 + SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED, // [10060 + SID_ATTR_PAGE_SHARED_FIRST,SID_ATTR_PAGE_SHARED_FIRST, + 0); + + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + aTempSet.SetParent(&GetDoc()->GetDfltFrmFmt()->GetAttrSet()); + + aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_ON, true)); + aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(MM50, MM50))); + aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE)); + aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE)); + aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, true)); + aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED_FIRST, true)); + aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, true)); + + SvxSetItem aNewSetItem(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, aTempSet); + aBaseImpl.GetItemSet().Put(aNewSetItem); + } + } } - const SvxSetItem* pSetItem; - if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState( - bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - false, (const SfxPoolItem**)&pSetItem)) + else { - lcl_putItemToSet(pSetItem, nRes, nItemType, pValues[nProp], pEntry->nMemberId, aBaseImpl); - - if (nRes == SID_ATTR_PAGE_SHARED_FIRST) + switch(pEntry->nWID) { - // Need to add this to the other as well - if (SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState( - bFooter ? SID_ATTR_PAGE_HEADERSET : SID_ATTR_PAGE_FOOTERSET, - false, (const SfxPoolItem**)&pSetItem)) - lcl_putItemToSet(pSetItem, nRes, nItemType, pValues[nProp], pEntry->nMemberId, aBaseImpl); + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + case SID_ATTR_PAGE_SHARED_FIRST: + case SID_ATTR_PAGE_ON: + case RES_HEADER_FOOTER_EAT_SPACING: + { + // these slots are exclusive to Header/Footer, thus this is an error + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + break; + } + default: + { + // part of PageStyle, fallback to default + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + } } } - else if(SID_ATTR_PAGE_ON == nRes ) + break; + } + + case XATTR_FILLBMP_SIZELOG: + case XATTR_FILLBMP_TILEOFFSETX: + case XATTR_FILLBMP_TILEOFFSETY: + case XATTR_FILLBMP_POSOFFSETX: + case XATTR_FILLBMP_POSOFFSETY: + case XATTR_FILLBMP_POS: + case XATTR_FILLBMP_SIZEX: + case XATTR_FILLBMP_SIZEY: + case XATTR_FILLBMP_STRETCH: + case XATTR_FILLBMP_TILE: + case OWN_ATTR_FILLBMP_MODE: + case XATTR_FILLCOLOR: + case XATTR_FILLBACKGROUND: + case XATTR_FILLBITMAP: + case XATTR_GRADIENTSTEPCOUNT: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLSTYLE: + case XATTR_FILLTRANSPARENCE: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_SECONDARYFILLCOLOR: + { + // This DrawingLayer FillStyle attributes can be part of Header, Footer and PageStyle + // itself, so decide what to do using the name + const bool bHeader(rPropName.startsWith("Header")); + const bool bFooter(rPropName.startsWith("Footer")); + + if(bHeader || bFooter) { - bool bVal = *(sal_Bool*)pValues[nProp].getValue(); - if(bVal) + const SvxSetItem* pSetItem = 0; + + if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem)) { - SfxItemSet aTempSet(*aBaseImpl.GetItemSet().GetPool(), - RES_BACKGROUND, RES_SHADOW, - RES_LR_SPACE, RES_UL_SPACE, - nRes, nRes, - SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, - SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC, - SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED, - SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST, - 0 ); - aTempSet.Put(SfxBoolItem(nRes, true)); - aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(MM50, MM50))); - aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE)); - aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE)); - aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, true)); - aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED_FIRST, true)); - aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, true)); - - SvxSetItem aNewSetItem( bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - aTempSet); - aBaseImpl.GetItemSet().Put(aNewSetItem); + // create a new SvxSetItem and get it's ItemSet as new target + SvxSetItem* pNewSetItem = static_cast< SvxSetItem* >(pSetItem->Clone()); + SfxItemSet& rSetSet = pNewSetItem->GetItemSet(); + + // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem + rSetSet.SetParent(&GetDoc()->GetDfltFrmFmt()->GetAttrSet()); + + // replace the used SfxItemSet at the SwStyleBase_Impl temporarily and use the + // default method to set the property + SfxItemSet* pRememberItemSet = aBaseImpl.replaceItemSet(&rSetSet); + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + aBaseImpl.replaceItemSet(pRememberItemSet); + + // reset paret at ItemSet from SetItem + rSetSet.SetParent(0); + + // set the new SvxSetItem at the real target and delete it + aBaseImpl.GetItemSet().Put(*pNewSetItem); + delete pNewSetItem; } } + else + { + // part of PageStyle, fallback to default + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + } + + break; } - break; case FN_PARAM_FTN_INFO : { const SfxPoolItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO); @@ -3409,8 +3567,8 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( delete pNewFtnItem; if(!bPut) throw lang::IllegalArgumentException(); + break; } - break; case FN_UNO_HEADER : case FN_UNO_HEADER_LEFT : case FN_UNO_HEADER_RIGHT : @@ -3419,30 +3577,40 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( case FN_UNO_FOOTER_LEFT : case FN_UNO_FOOTER_RIGHT : case FN_UNO_FOOTER_FIRST : + { throw lang::IllegalArgumentException(); - //break; + break; + } default: - lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, - GetBasePool(), GetDoc(), GetFamily()); + { + //UUUU + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + break; + } } } else if(IsDescriptor()) { - if(!GetPropImpl()->SetProperty(pNames[nProp], pValues[nProp])) + if(!GetPropImpl()->SetProperty(rPropName, pValues[nProp])) throw lang::IllegalArgumentException(); } else + { throw uno::RuntimeException(); + } } + if(aBaseImpl.HasItemSet()) { ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo()); + if (undoGuard.UndoWasEnabled()) { // Fix i64460: as long as Undo of page styles with header/footer causes trouble... GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); } - aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet()); + + aBaseImpl.getNewBase()->SetItemSet(aBaseImpl.GetItemSet()); } } @@ -3505,13 +3673,18 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( uno::Any* pRet = aRet.getArray(); const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); - SwStyleBase_Impl aBase(*GetDoc(), GetStyleName()); + SwStyleBase_Impl aBase(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrmFmt()->GetAttrSet()); //UUUU add pDfltFrmFmt as parent SfxStyleSheetBase* pBase = 0; + for(sal_Int32 nProp = 0; nProp < nLength; nProp++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] ); + const OUString& rPropName = pNames[nProp]; + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(rPropName); + if (!pEntry) - throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + { + throw beans::UnknownPropertyException("Unknown property: " + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + } if(GetBasePool()) { @@ -3522,138 +3695,152 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( pBase = GetBasePool()->Find(GetStyleName()); GetBasePool()->SetSearchMask(GetFamily(), nSaveMask ); } + sal_uInt16 nRes = 0; - bool bHeader = false; bool bLeft = false; bool bFirst = false; + const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM)); + switch(pEntry->nWID) { - case FN_UNO_HEADER_ON: - case FN_UNO_HEADER_BACKGROUND: - case FN_UNO_HEADER_BOX: - case FN_UNO_HEADER_LR_SPACE: - case FN_UNO_HEADER_SHADOW: - case FN_UNO_HEADER_BODY_DISTANCE: - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: - case FN_UNO_HEADER_SHARE_CONTENT: - case FN_UNO_HEADER_HEIGHT: - case FN_UNO_HEADER_EAT_SPACING: - - case FN_UNO_FIRST_SHARE_CONTENT: - - case FN_UNO_FOOTER_ON: - case FN_UNO_FOOTER_BACKGROUND: - case FN_UNO_FOOTER_BOX: - case FN_UNO_FOOTER_LR_SPACE: - case FN_UNO_FOOTER_SHADOW: - case FN_UNO_FOOTER_BODY_DISTANCE: - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: - case FN_UNO_FOOTER_SHARE_CONTENT: - case FN_UNO_FOOTER_HEIGHT: - case FN_UNO_FOOTER_EAT_SPACING: + case SID_ATTR_PAGE_ON: + case RES_BACKGROUND: + case RES_BOX: + case RES_LR_SPACE: + case RES_SHADOW: + case RES_UL_SPACE: + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + case SID_ATTR_PAGE_SHARED_FIRST: + case SID_ATTR_PAGE_SIZE: + case RES_HEADER_FOOTER_EAT_SPACING: { - SfxStyleSheetBasePool* pBasePool2 = ((SwXPageStyle*)this)->GetBasePool(); - pBasePool2->SetSearchMask(GetFamily()); - SfxStyleSheetBase* pBase2 = pBasePool2->Find(GetStyleName()); - if(pBase2) + // These slots are used for Header, Footer and (partially) for PageStyle directly. + // Check for Header/Footer entry + const bool bHeader(rPropName.startsWith("Header")); + const bool bFooter(rPropName.startsWith("Footer")); + + if(bHeader || bFooter) { + // slot is a Header/Footer slot rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); const SfxItemSet& rSet = xStyle->GetItemSet(); - bool bFooter = false; + const SvxSetItem* pSetItem; + + if(SFX_ITEM_SET == rSet.GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem)) + { + // get from SfxItemSet of the corresponding SfxSetItem + const SfxItemSet& rSetSet = pSetItem->GetItemSet(); + SfxItemSet* pRememberItemSet = aBase.replaceItemSet(&const_cast< SfxItemSet& >(rSetSet)); + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + aBase.replaceItemSet(pRememberItemSet); + } + else if(pEntry->nWID == SID_ATTR_PAGE_ON) + { + // header/footer is not available, thus off. Default is sal_False, though + sal_Bool bRet = sal_False; + pRet[nProp].setValue(&bRet, ::getCppuBooleanType()); + } + } + else + { switch(pEntry->nWID) { - case FN_UNO_FOOTER_ON: - bFooter = true; - // no break - case FN_UNO_HEADER_ON: + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + case SID_ATTR_PAGE_SHARED_FIRST: + case SID_ATTR_PAGE_ON: + case RES_HEADER_FOOTER_EAT_SPACING: + { + // these slots are exclusive to Header/Footer, thus this is an error + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + break; + } + default: { - //falls das SetItem nicht da ist, dann ist der Wert sal_False - sal_Bool bRet = sal_False; - pRet[nProp].setValue(&bRet, ::getCppuBooleanType()); - nRes = SID_ATTR_PAGE_ON; + // part of PageStyle, fallback to default + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); } - break; - case FN_UNO_FOOTER_BACKGROUND: bFooter = true; - // no break - case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; - break; - case FN_UNO_FOOTER_BOX: bFooter = true; - // no break - case FN_UNO_HEADER_BOX: nRes = RES_BOX; - break; - case FN_UNO_FOOTER_LR_SPACE: bFooter = true; - // no break - case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE; - break; - case FN_UNO_FOOTER_SHADOW: bFooter = true; - // no break - case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW; - break; - case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = true; - // no break - case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE; - break; - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = true; - // no break - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC; - break; - case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = true; - // no break - case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED; - break; - case FN_UNO_FIRST_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED_FIRST; - break; - case FN_UNO_FOOTER_HEIGHT: bFooter = true; - // no break - case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE; - break; - case FN_UNO_FOOTER_EAT_SPACING: bFooter = true; - // no break - case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING; - break; } + } + + break; + } + + case XATTR_FILLBMP_SIZELOG: + case XATTR_FILLBMP_TILEOFFSETX: + case XATTR_FILLBMP_TILEOFFSETY: + case XATTR_FILLBMP_POSOFFSETX: + case XATTR_FILLBMP_POSOFFSETY: + case XATTR_FILLBMP_POS: + case XATTR_FILLBMP_SIZEX: + case XATTR_FILLBMP_SIZEY: + case XATTR_FILLBMP_STRETCH: + case XATTR_FILLBMP_TILE: + case OWN_ATTR_FILLBMP_MODE: + case XATTR_FILLCOLOR: + case XATTR_FILLBACKGROUND: + case XATTR_FILLBITMAP: + case XATTR_GRADIENTSTEPCOUNT: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLSTYLE: + case XATTR_FILLTRANSPARENCE: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_SECONDARYFILLCOLOR: + { + // This DrawingLayer FillStyle attributes can be part of Header, Footer and PageStyle + // itself, so decide what to do using the name + const bool bHeader(rPropName.startsWith("Header")); + const bool bFooter(rPropName.startsWith("Footer")); + + if(bHeader || bFooter) + { + rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); + const SfxItemSet& rSet = xStyle->GetItemSet(); const SvxSetItem* pSetItem; - if(SFX_ITEM_SET == rSet.GetItemState( - bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - false, (const SfxPoolItem**)&pSetItem)) + if(SFX_ITEM_SET == rSet.GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem)) { - const SfxItemSet& rTmpSet = pSetItem->GetItemSet(); - const SfxPoolItem* pItem = 0; - rTmpSet.GetItemState(nRes, true, &pItem); - if(!pItem && nRes != rTmpSet.GetPool()->GetSlotId(nRes)) - pItem = &rTmpSet.GetPool()->GetDefaultItem(nRes); - if(pItem) - pItem->QueryValue(pRet[nProp], pEntry->nMemberId); + // set at SfxItemSet of the corresponding SfxSetItem + const SfxItemSet& rSetSet = pSetItem->GetItemSet(); + SfxItemSet* pRememberItemSet = aBase.replaceItemSet(&const_cast< SfxItemSet& >(rSetSet)); + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + aBase.replaceItemSet(pRememberItemSet); } } + else + { + // part of PageStyle, fallback to default + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + } + + break; } - break; - case FN_UNO_HEADER : - goto Header; - case FN_UNO_HEADER_LEFT : - bLeft = true; goto Header; - case FN_UNO_HEADER_FIRST : - bFirst = true; goto Header; - case FN_UNO_HEADER_RIGHT : - goto Header; -Header: - bHeader = true; - nRes = RES_HEADER; goto MakeObject; - case FN_UNO_FOOTER : - goto Footer; - case FN_UNO_FOOTER_LEFT : - bLeft = true; goto Footer; - case FN_UNO_FOOTER_FIRST : - bFirst = true; goto Footer; - case FN_UNO_FOOTER_RIGHT : -Footer: - nRes = RES_FOOTER; -MakeObject: + + case FN_UNO_HEADER: + case FN_UNO_HEADER_LEFT: + case FN_UNO_HEADER_RIGHT: + case FN_UNO_FOOTER: + case FN_UNO_FOOTER_LEFT: + case FN_UNO_FOOTER_RIGHT: { + //UUUU cleanups for readability (undos removed, rearranged) + bool bHeader(false); + + switch(pEntry->nWID) + { + case FN_UNO_HEADER: bHeader = true; nRes = RES_HEADER; break; + case FN_UNO_HEADER_LEFT: bHeader = true; nRes = RES_HEADER; bLeft = true; break; + case FN_UNO_HEADER_RIGHT: bHeader = true; nRes = RES_HEADER; break; + case FN_UNO_FOOTER: bHeader = false; nRes = RES_FOOTER; break; + case FN_UNO_FOOTER_LEFT: bHeader = false; nRes = RES_FOOTER; bLeft = true; break; + case FN_UNO_FOOTER_RIGHT: bHeader = false; nRes = RES_FOOTER; break; + default: break; + } + const SwPageDesc& rDesc = aBase.GetOldPageDesc(); const SwFrmFmt* pFrmFmt = 0; - bool bShare = (bHeader && rDesc.IsHeaderShared())|| - (!bHeader && rDesc.IsFooterShared()); + bool bShare = (bHeader && rDesc.IsHeaderShared()) || (!bHeader && rDesc.IsFooterShared()); bool bShareFirst = rDesc.IsFirstShared(); // TextLeft returns the left content if there is one, // Text and TextRight return the master content. @@ -3679,32 +3866,45 @@ MakeObject: { pRet[nProp] <<= xRet; } + break; } - break; + case FN_PARAM_FTN_INFO : { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); const SfxItemSet& rSet = xStyle->GetItemSet(); const SfxPoolItem& rItem = rSet.Get(FN_PARAM_FTN_INFO); - rItem.QueryValue(pRet[nProp], pEntry->nMemberId); + rItem.QueryValue(pRet[nProp], nMemberId); + break; } - break; default: - pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + { + //UUUU + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + break; + } } } else if(IsDescriptor()) { uno::Any* pAny = 0; - GetPropImpl()->GetProperty(pNames[nProp], pAny); + GetPropImpl()->GetProperty(rPropName, pAny); + if ( !pAny ) - GetPropImpl()->GetProperty ( pNames[nProp], mxStyleData, pRet[ nProp ] ); + { + GetPropImpl()->GetProperty(rPropName, mxStyleData, pRet[nProp]); + } else + { pRet[nProp] = *pAny; + } } else + { throw uno::RuntimeException(); + } } + return aRet; } @@ -3915,8 +4115,11 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( const uno::Sequence< beans::PropertyValue >& Values ) throw (uno::RuntimeException, std::exception) { - if( !pDocShell ) + if (!pDocShell) + { throw uno::RuntimeException(); + } + const sal_uInt16* pRange = 0; const SfxItemPropertySet* pPropSet = 0; switch( eFamily ) @@ -3925,23 +4128,21 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( { pRange = aCharAutoFmtSetRange; pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE); + break; } - break; case IStyleAccess::AUTO_STYLE_RUBY: { pRange = 0;//aTxtNodeSetRange; pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_RUBY_AUTO_STYLE); + break; } - break; case IStyleAccess::AUTO_STYLE_PARA: { - pRange = aTxtNodeSetRange; + pRange = aTxtNodeSetRange; //UUUU checked, already added support for [XATTR_FILL_FIRST, XATTR_FILL_LAST] pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARA_AUTO_STYLE); + break; } - break; - - default: - ; + default: ; } if( !pPropSet) @@ -3950,24 +4151,183 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( SwAttrSet aSet( pDocShell->GetDoc()->GetAttrPool(), pRange ); const beans::PropertyValue* pSeq = Values.getConstArray(); sal_Int32 nLen = Values.getLength(); - for( sal_Int32 i = 0; i < nLen; ++i ) + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == eFamily); + + if(!bTakeCareOfDrawingLayerFillStyle) { - try + for( sal_Int32 i = 0; i < nLen; ++i ) { - pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet ); - } - catch (beans::UnknownPropertyException &) - { - OSL_FAIL( "Unknown property" ); + try + { + pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet ); + } + catch (beans::UnknownPropertyException &) + { + OSL_FAIL( "Unknown property" ); + } + catch (lang::IllegalArgumentException &) + { + OSL_FAIL( "Illegal argument" ); + } } - catch (lang::IllegalArgumentException &) + } + else + { + //UUUU set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem + // to make cases in RES_BACKGROUND work correct; target *is* a style + // where this is the case + aSet.SetParent(&pDocShell->GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); + + //UUUU here the used DrawingLayer FillStyles are imported when family is + // equal to IStyleAccess::AUTO_STYLE_PARA, thus we will need to serve the + // used slots functionality here to do this correctly + const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); + + for( sal_Int32 i = 0; i < nLen; ++i ) { - OSL_FAIL( "Illegal argument" ); - } + const OUString& rPropName = pSeq[i].Name; + uno::Any aValue(pSeq[i].Value); + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(rPropName); + + if(!pEntry) + { + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + } + + const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM)); + bool bDone(false); + + // check for needed metric translation + if(pEntry->nMemberId & SFX_METRIC_ITEM) + { + bool bDoIt(true); + + if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID) + { + // exception: If these ItemTypes are used, do not convert when these are negative + // since this means they are intended as percent values + sal_Int32 nValue = 0; + + if(aValue >>= nValue) + { + bDoIt = nValue > 0; + } + } + + if(bDoIt) + { + const SfxItemPool& rPool = pDocShell->GetDoc()->GetAttrPool(); + const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID)); + + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + SvxUnoConvertFromMM(eMapUnit, aValue); + } + } + } + + switch(pEntry->nWID) + { + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLBITMAP: + case XATTR_FILLFLOATTRANSPARENCE: + // not yet needed; activate when LineStyle support may be added + // case XATTR_LINESTART: + // case XATTR_LINEEND: + // case XATTR_LINEDASH: + { + if(MID_NAME == nMemberId) + { + //UUUU add set commands for FillName items + OUString aTempName; + + if(!(aValue >>= aTempName)) + { + throw lang::IllegalArgumentException(); + } + + SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet); + bDone = true; + } + else if(MID_GRAFURL == nMemberId) + { + if(XATTR_FILLBITMAP == pEntry->nWID) + { + //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used + const Graphic aNullGraphic; + XFillBitmapItem aXFillBitmapItem(aSet.GetPool(), aNullGraphic); + + aXFillBitmapItem.PutValue(aValue, nMemberId); + aSet.Put(aXFillBitmapItem); + bDone = true; + } + } + + break; + } + case RES_BACKGROUND: + { + //UUUU + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND)); + SvxBrushItem aChangedBrushItem(aOriginalBrushItem); + + aChangedBrushItem.PutValue(aValue, nMemberId); + + if(!(aChangedBrushItem == aOriginalBrushItem)) + { + setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet); + } + + bDone = true; + break; + } + case OWN_ATTR_FILLBMP_MODE: + { + //UUUU + drawing::BitmapMode eMode; + + if(!(aValue >>= eMode)) + { + sal_Int32 nMode = 0; + + if(!(aValue >>= nMode)) + { + throw lang::IllegalArgumentException(); + } + + eMode = (drawing::BitmapMode)nMode; + } + + aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode)); + aSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode)); + + bDone = true; + break; + } + default: break; + } + + if(!bDone) + { + pPropSet->setPropertyValue( rPropName, aValue, aSet ); + } + } + + //UUUU clear parent again + aSet.SetParent(0); } + //UUUU need to ensure uniqueness of evtl. added NameOrIndex items + // currently in principle only needed when bTakeCareOfDrawingLayerFillStyle, + // but does not hurt and is easily forgotten later eventually, so keep it + // as common case + pDocShell->GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aSet); + + // AutomaticStyle creation SfxItemSet_Pointer_t pSet = pDocShell->GetDoc()->GetIStyleAccess().cacheAutomaticStyle( aSet, eFamily ); uno::Reference<style::XAutoStyle> xRet = new SwXAutoStyle(pDocShell->GetDoc(), pSet, eFamily); + return xRet; } @@ -4070,11 +4430,23 @@ uno::Any SwXAutoStylesEnumerator::nextElement( ) return aRet; } -SwXAutoStyle::SwXAutoStyle( SwDoc* pDoc, SfxItemSet_Pointer_t pInitSet, IStyleAccess::SwAutoStyleFamily eFam ) -: pSet( pInitSet ), eFamily( eFam ) +//UUUU SwXAutoStyle with the family IStyleAccess::AUTO_STYLE_PARA (or +// PROPERTY_MAP_PARA_AUTO_STYLE) now uses DrawingLayer FillStyles to allow +// unified paragraph background fill, thus the UNO API implementation has to +// support the needed slots for these. This seems to be used only for reading +// (no setPropertyValue implementation here), so maybe specialized for saving +// the Writer Doc to ODF + +SwXAutoStyle::SwXAutoStyle( + SwDoc* pDoc, + SfxItemSet_Pointer_t pInitSet, + IStyleAccess::SwAutoStyleFamily eFam) +: mpSet(pInitSet), + meFamily(eFam), + mrDoc(*pDoc) { // Register ourselves as a listener to the document (via the page descriptor) - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + mrDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); } SwXAutoStyle::~SwXAutoStyle() @@ -4085,14 +4457,16 @@ void SwXAutoStyle::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) { ClientModify(this, pOld, pNew); if(!GetRegisteredIn()) - pSet.reset(); + { + mpSet.reset(); + } } uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( ) throw (uno::RuntimeException, std::exception) { uno::Reference< beans::XPropertySetInfo > xRet; - switch( eFamily ) + switch( meFamily ) { case IStyleAccess::AUTO_STYLE_CHAR: { @@ -4197,43 +4571,138 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl( const uno::Sequence< OUString > & rPropertyNames ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { - if( !pSet.get() ) + if( !mpSet.get() ) + { throw uno::RuntimeException(); - // query_item + } + // query_item sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; - switch(eFamily) + switch(meFamily) { case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); const OUString* pNames = rPropertyNames.getConstArray(); - sal_Int32 nLen = rPropertyNames.getLength(); + const sal_Int32 nLen(rPropertyNames.getLength()); uno::Sequence< uno::Any > aRet( nLen ); uno::Any* pValues = aRet.getArray(); - - SfxItemSet& rSet = *pSet.get(); + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily); for( sal_Int32 i = 0; i < nLen; ++i ) { const OUString sPropName = pNames[i]; const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName); if(!pEntry) + { throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) ); - else if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID ) + } + + uno::Any aTarget; + bool bDone(false); + + if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID ) { - pValues[i] <<= StylePool::nameOf( pSet ); + pValues[i] <<= StylePool::nameOf( mpSet ); + bDone = true; } - else - pPropSet->getPropertyValue( *pEntry, rSet, pValues[i] ); + else if(bTakeCareOfDrawingLayerFillStyle) + { + //UUUU add support for DrawingLayer FillStyle slots + switch(pEntry->nWID) + { + case RES_BACKGROUND: + { + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND)); + const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM)); + + if(!aOriginalBrushItem.QueryValue(aTarget, nMemberId)) + { + OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)"); + } + + bDone = true; + break; + } + case OWN_ATTR_FILLBMP_MODE: + { + const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&mpSet->Get(XATTR_FILLBMP_STRETCH)); + const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&mpSet->Get(XATTR_FILLBMP_TILE)); + + if( pTileItem && pTileItem->GetValue() ) + { + aTarget <<= drawing::BitmapMode_REPEAT; + } + else if( pStretchItem && pStretchItem->GetValue() ) + { + aTarget <<= drawing::BitmapMode_STRETCH; + } + else + { + aTarget <<= drawing::BitmapMode_NO_REPEAT; + } + + bDone = true; + break; + } + } + } + + if(!bDone) + { + pPropSet->getPropertyValue( *pEntry, *mpSet, aTarget ); + } + + if(bTakeCareOfDrawingLayerFillStyle) + { + if(pEntry->aType == ::getCppuType((const sal_Int16*)0) && pEntry->aType != aTarget.getValueType()) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + sal_Int32 nValue = 0; + aTarget >>= nValue; + aTarget <<= (sal_Int16)nValue; + } + + // check for needed metric translation + if(pEntry->nMemberId & SFX_METRIC_ITEM) + { + bool bDoIt(true); + + if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID) + { + // exception: If these ItemTypes are used, do not convert when these are negative + // since this means they are intended as percent values + sal_Int32 nValue = 0; + + if(aTarget >>= nValue) + { + bDoIt = nValue > 0; + } + } + + if(bDoIt) + { + const SfxItemPool& rPool = mrDoc.GetAttrPool(); + const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID)); + + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + SvxUnoConvertToMM(eMapUnit, aTarget); + } + } + } + } + + // add value + pValues[i] = aTarget; } + return aRet; } @@ -4313,34 +4782,79 @@ uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates( const uno::Sequence< OUString >& rPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { - if( !pSet.get() ) + if (!mpSet.get()) + { throw uno::RuntimeException(); + } + SolarMutexGuard aGuard; uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength()); beans::PropertyState* pStates = aRet.getArray(); const OUString* pNames = rPropertyNames.getConstArray(); sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; - switch(eFamily) + switch(meFamily) { case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); - SfxItemSet& rSet = *pSet.get(); + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily); + for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) { const OUString sPropName = pNames[i]; const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName); if(!pEntry) + { throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) ); - pStates[i] = pPropSet->getPropertyState(*pEntry, rSet ); + } + + bool bDone(false); + + if(bTakeCareOfDrawingLayerFillStyle) + { + //UUUU DrawingLayer PropertyStyle support + switch(pEntry->nWID) + { + case OWN_ATTR_FILLBMP_MODE: + { + if(SFX_ITEM_SET == mpSet->GetItemState(XATTR_FILLBMP_STRETCH, false) + || SFX_ITEM_SET == mpSet->GetItemState(XATTR_FILLBMP_TILE, false)) + { + pStates[i] = beans::PropertyState_DIRECT_VALUE; + } + else + { + pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE; + } + + bDone = true; + break; + } + case RES_BACKGROUND: + { + if(SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(*mpSet)) + { + pStates[i] = beans::PropertyState_DIRECT_VALUE; + bDone = true; + } + + break; + } + } + } + + if(!bDone) + { + pStates[i] = pPropSet->getPropertyState(*pEntry, *mpSet ); + } } + return aRet; } @@ -4350,9 +4864,56 @@ void SwXAutoStyle::setAllPropertiesToDefault( ) } void SwXAutoStyle::setPropertiesToDefault( - const uno::Sequence< OUString >& /*aPropertyNames*/ ) + const uno::Sequence< OUString >& rPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { + if( !mpSet.get() ) + { + throw uno::RuntimeException(); + } + + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily); + + if(!bTakeCareOfDrawingLayerFillStyle) + { + return; + } + + //UUUU support DrawingLayer FillStyle slots from here on + SolarMutexGuard aGuard; + const OUString* pNames = rPropertyNames.getConstArray(); + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; + + switch(meFamily) + { + case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; + default: ; + } + + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); + + for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) + { + const OUString& rPropName = pNames[i]; + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(rPropName); + + if(!pEntry) + { + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + } + + switch(pEntry->nWID) + { + case OWN_ATTR_FILLBMP_MODE: + { + mpSet->ClearItem(XATTR_FILLBMP_STRETCH); + mpSet->ClearItem(XATTR_FILLBMP_TILE); + } + } + } } uno::Sequence< uno::Any > SwXAutoStyle::getPropertyDefaults( @@ -4366,26 +4927,25 @@ uno::Sequence< uno::Any > SwXAutoStyle::getPropertyDefaults( uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno::RuntimeException, std::exception) { - if( !pSet.get() ) + if( !mpSet.get() ) throw uno::RuntimeException(); SolarMutexGuard aGuard; std::vector< beans::PropertyValue > aPropertyVector; sal_Int8 nPropSetId = 0; - switch(eFamily) + switch(meFamily) { case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); PropertyEntryVector_t aPropVector = rMap.getPropertyEntries(); - SfxItemSet& rSet = *pSet.get(); + SfxItemSet& rSet = *mpSet.get(); SfxItemIter aIter(rSet); const SfxPoolItem* pItem = aIter.FirstItem(); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 4eeb1766285b..83fd5d86fb1e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -113,7 +113,7 @@ #include <breakit.hxx> #include <com/sun/star/i18n/ScriptType.hpp> #include <unotools/localedatawrapper.hxx> -#include <unobrushitemhelper.hxx> +#include <svx/unobrushitemhelper.hxx> #include <svx/xenum.hxx> #include <tgrditem.hxx> #include <flddropdown.hxx> @@ -858,7 +858,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF case XFILL_SOLID: { // Construct an SvxBrushItem, as expected by the exporters. - aSet.Put(sw::getSvxBrushItemFromSourceSet(rFrmFmt.GetAttrSet())); + aSet.Put(getSvxBrushItemFromSourceSet(rFrmFmt.GetAttrSet(), RES_BACKGROUND)); break; } default: diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx index 215426c194e6..c805b8bd0347 100644 --- a/sw/source/ui/chrdlg/pardlg.cxx +++ b/sw/source/ui/chrdlg/pardlg.cxx @@ -65,6 +65,8 @@ SwParaDlg::SwParaDlg(Window *pParent, , m_nParaDrpCps(0) , m_nParaBckGrnd(0) , m_nParaBorder(0) + , m_nAreaId(0) + , m_nTransparenceId(0) { nHtmlMode = ::GetHtmlMode(rVw.GetDocShell()); bool bHtmlMode = (nHtmlMode & HTMLMODE_ON) == HTMLMODE_ON; @@ -139,13 +141,20 @@ SwParaDlg::SwParaDlg(Window *pParent, if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES))) { - OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); - OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); - m_nParaBckGrnd = AddTabPage("labelTP_BACKGROUND", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + //UUUU remove? + //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); + //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); + //m_nParaBckGrnd = AddTabPage("labelTP_BACKGROUND", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + // + //UUUU add Area and Transparence TabPages + m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA )); + m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) ); } else { - RemoveTabPage("labelTP_BACKGROUND"); + //UUUU RemoveTabPage("labelTP_BACKGROUND"); + RemoveTabPage("area"); + RemoveTabPage("transparence"); } OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!"); @@ -214,8 +223,15 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) if(!( nHtmlMode & HTMLMODE_ON ) || nHtmlMode & HTMLMODE_SOME_STYLES) { - aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); - rPage.PageCreated(aSet); + // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in + // einer Tabelle steht + const sal_uInt16 eType = rSh.GetFrmType(0,sal_True); + if(!(FRMTYPE_BODY & eType) || + rSh.GetSelectionType() & nsSelectionType::SEL_TBL) + { + aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_True)); + rPage.PageCreated(aSet); + } } } else if( m_nParaNumPara == nId) @@ -240,7 +256,29 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) for(std::set<OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it) rBox.InsertEntry(*it); } + //UUUU inits for Area and Transparency TabPages + // The selection attribute lists (XPropertyList derivates, e.g. XColorList for + // the color table) need to be added as items (e.g. SvxColorTableItem) to make + // these pages find the needed attributes for fill style suggestions. + // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on + // demand, but could also be directly added from the DrawModel. + else if (m_nAreaId == nId) + { + SfxItemSet aNew(*aSet.GetPool(), + SID_COLOR_TABLE, SID_BITMAP_LIST, + SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0); + + aNew.Put(*GetInputSetImpl()); + + // add flag for direct graphic content selection + aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true)); + rPage.PageCreated(aNew); + } + else if (m_nTransparenceId == nId) + { + rPage.PageCreated(*GetInputSetImpl()); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index f63907a3322d..29b5103c13e0 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -194,10 +194,17 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, m_nOutlineId = AddTabPage("outline", SwParagraphNumTabPage::Create, SwParagraphNumTabPage::GetRanges); m_nDropCapsId = AddTabPage("dropcaps", SwDropCapsPage::Create, - SwDropCapsPage::GetRanges ); - OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); - OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); - m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + SwDropCapsPage::GetRanges ); + + //UUUU add Area and Transparence TabPages + m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA )); + m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) ); + + //UUUU remove? + //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); + //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); + //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!"); OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!"); m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); @@ -242,8 +249,9 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, SwFrmAddPage::GetRanges); m_nWrapId = AddTabPage("wrap", SwWrapTabPage::Create, SwWrapTabPage::GetRanges); - OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); - OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); + //UUUU remove? + //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); + //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); //UUUU remove? //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); @@ -266,9 +274,15 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, // page styles case SFX_STYLE_FAMILY_PAGE: { - OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); - OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); - m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + //UUUU remove? + //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); + //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); + //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + + //UUUU add Area and Transparence TabPages + m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA )); + m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) ); + m_nHeaderId = AddTabPage("header", SvxHeaderPage::Create, SvxHeaderPage::GetRanges); m_nFooterId = AddTabPage("footer", SvxFooterPage::Create, SvxFooterPage::GetRanges); @@ -501,7 +515,9 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) pFirstStyle = pStyleSheetPool->Next(); } } - aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList)); + //UUUU set DrawingLayer FillStyles active + aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true)); + aSet.Put(SfxStringListItem(SID_COLLECT_LIST, &aList)); rPage.PageCreated(aSet); } } @@ -556,12 +572,24 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) else if (nId == m_nHeaderId) { if(0 == (nHtmlMode & HTMLMODE_ON )) + { ((SvxHeaderPage&)rPage).EnableDynamicSpacing(); + } + + //UUUU set DrawingLayer FillStyles active + aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true)); + rPage.PageCreated(aSet); } else if (nId == m_nFooterId) { if(0 == (nHtmlMode & HTMLMODE_ON )) + { ((SvxFooterPage&)rPage).EnableDynamicSpacing(); + } + + //UUUU set DrawingLayer FillStyles active + aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true)); + rPage.PageCreated(aSet); } else if (nId == m_nBorderId) { @@ -583,16 +611,12 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) // demand, but could also be directly added from the DrawModel. else if (nId == m_nAreaId) { - SfxItemSet aNew(*aSet.GetPool(), - SID_COLOR_TABLE, SID_BITMAP_LIST, - SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0); - - aNew.Put(GetStyleSheet().GetItemSet()); + aSet.Put(GetStyleSheet().GetItemSet()); // add flag for direct graphic content selection - aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true)); + aSet.Put(SfxBoolItem(SID_OFFER_IMPORT, true)); - rPage.PageCreated(aNew); + rPage.PageCreated(aSet); } else if (nId == m_nTransparenceId) { diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 8b7f77fe4406..b95e8e64e61a 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -48,6 +48,10 @@ #include <numrule.hxx> #include <swundo.hxx> +//UUUU +#include <svx/svdmodel.hxx> +#include <svx/drawitem.hxx> + #include "view.hxx" #include "wrtsh.hxx" #include "docsh.hxx" @@ -56,6 +60,8 @@ #include "globals.hrc" #include "viewopt.hxx" #include <doc.hxx> +#include <drawdoc.hxx> +#include "IDocumentDrawModelAccess.hxx" #include <IDocumentUndoRedo.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> @@ -573,13 +579,6 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl) ::ConvertAttrGenToChar(aTmpSet, CONV_ATTR_STD); } - //UUUU - if(m_bNew && SFX_STYLE_FAMILY_FRAME == m_nFamily) - { - // clear FillStyle so that it works as a derived attribute - aTmpSet.ClearItem(XATTR_FILLSTYLE); - } - m_xTmp->SetItemSet( aTmpSet ); if( SFX_STYLE_FAMILY_PAGE == m_nFamily && SvtLanguageOptions().IsCTLFontEnabled() ) @@ -589,6 +588,20 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl) SwChartHelper::DoUpdateAllCharts( pDoc ); } } + + //UUUU + if(m_bNew && SFX_STYLE_FAMILY_FRAME == m_nFamily) + { + if(SFX_STYLE_FAMILY_FRAME == m_nFamily || SFX_STYLE_FAMILY_PARA == m_nFamily) + { + // clear FillStyle so that it works as a derived attribute + SfxItemSet aTmpSet(*m_pDlg->GetOutputItemSet()); + + aTmpSet.ClearItem(XATTR_FILLSTYLE); + m_xTmp->SetItemSet(aTmpSet); + } + } + if(SFX_STYLE_FAMILY_PAGE == m_nFamily) pView->InvalidateRulerPos(); @@ -606,10 +619,6 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl) return m_nRet; } -//UUUU -//#include <svx/svdmodel.hxx> -//#include <svx/drawitem.hxx> - sal_uInt16 SwDocShell::Edit( const OUString &rName, const OUString &rParent, @@ -739,22 +748,22 @@ sal_uInt16 SwDocShell::Edit( { ::ConvertAttrCharToGen(xTmp->GetItemSet(), CONV_ATTR_STD); } - if (!bBasic) + + if(SFX_STYLE_FAMILY_PAGE == nFamily || SFX_STYLE_FAMILY_PARA == nFamily) { - //UUUU - //if(SFX_STYLE_FAMILY_FRAME == nFamily) - //{ - // //UUUU create needed items for XPropertyList entries from the DrawModel so that - // // the Area TabPage can access them - // SfxItemSet& rSet = xTmp->GetItemSet(); - // const SdrModel* pDrawModel = GetDoc()->GetDrawModel(); - // - // rSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE)); - // rSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST)); - // rSet.Put(SvxHatchListItem(pDrawModel->GetHatchListFromSdrModel(), SID_HATCH_LIST)); - // rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapListFromSdrModel(), SID_BITMAP_LIST)); - //} + //UUUU create needed items for XPropertyList entries from the DrawModel so that + // the Area TabPage can access them + SfxItemSet& rSet = xTmp->GetItemSet(); + const SdrModel* pDrawModel = GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); + + rSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE)); + rSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST)); + rSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST)); + rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST)); + } + if (!bBasic) + { // prior to the dialog the HtmlMode at the DocShell is being sunk sal_uInt16 nHtmlMode = ::GetHtmlMode(this); diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index fb5845ea11e4..ecc667fbda1c 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -57,7 +57,11 @@ #include <svx/xdef.hxx> #include <SwRewriter.hxx> -using namespace com::sun::star; +//UUUU +#include <svx/xfillit0.hxx> +#include <svx/xflftrit.hxx> +#include <svx/svdmodel.hxx> +#include <svx/drawitem.hxx> // The Format names in the list of all names have the // following family as their first character: @@ -68,6 +72,8 @@ using namespace com::sun::star; #define cPAGE (sal_Unicode)'g' #define cNUMRULE (sal_Unicode)'n' +using namespace com::sun::star; + // At the names' publication, this character is removed again and the // family is newly generated. @@ -768,6 +774,11 @@ OUString SwDocStyleSheet::GetDescription(SfxMapUnit eUnit) bool bHasCJKFontPrefix = false; SvtCJKOptions aCJKOptions; + //UUUU Get currently used FillStyle and remember, also need the XFillFloatTransparenceItem + // to decide if gradient transparence is used + const XFillStyle eFillStyle(static_cast< const XFillStyleItem& >(pSet->Get(XATTR_FILLSTYLE)).GetValue()); + const bool bUseFloatTransparence(static_cast< const XFillFloatTransparenceItem& >(pSet->Get(XATTR_FILLFLOATTRANSPARENCE)).IsEnabled()); + for ( const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem() ) { if(!IsInvalidItem(pItem)) @@ -795,6 +806,44 @@ OUString SwDocStyleSheet::GetDescription(SfxMapUnit eUnit) bool bIsDefault = false; switch ( pItem->Which() ) { + //UUUU + case XATTR_FILLCOLOR: + { + // only use active FillStyle information + bIsDefault = (XFILL_SOLID == eFillStyle); + break; + } + case XATTR_FILLGRADIENT: + { + // only use active FillStyle information + bIsDefault = (XFILL_GRADIENT == eFillStyle); + break; + } + case XATTR_FILLHATCH: + { + // only use active FillStyle information + bIsDefault = (XFILL_HATCH == eFillStyle); + break; + } + case XATTR_FILLBITMAP: + { + // only use active FillStyle information + bIsDefault = (XFILL_BITMAP == eFillStyle); + break; + } + case XATTR_FILLTRANSPARENCE: + { + // only active when not FloatTransparence + bIsDefault = !bUseFloatTransparence; + break; + } + case XATTR_FILLFLOATTRANSPARENCE: + { + // only active when FloatTransparence + bIsDefault = bUseFloatTransparence; + break; + } + case SID_ATTR_PARA_PAGENUM: sPageNum = aItemPresentation; break; @@ -1102,10 +1151,6 @@ bool SwDocStyleSheet::SetFollow( const OUString& rStr) // extract ItemSet to Name and Family, Mask -//UUUU -#include <svx/svdmodel.hxx> -#include <svx/drawitem.hxx> - SfxItemSet& SwDocStyleSheet::GetItemSet() { if(!bPhysical) @@ -1168,6 +1213,12 @@ SfxItemSet& SwDocStyleSheet::GetItemSet() case SFX_STYLE_FAMILY_PAGE : { + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + if(!aCoreSet.GetParent()) + { + aCoreSet.SetParent(&rDoc.GetDfltFrmFmt()->GetAttrSet()); + } + OSL_ENSURE(pDesc, "No PageDescriptor"); ::PageDescToItemSet(*((SwPageDesc*)pDesc), aCoreSet); } diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 98b4bad4a852..b1f04173bf80 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -20,7 +20,6 @@ #include "cmdid.h" #include "hintids.hxx" #include <algorithm> - #include <svl/eitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/ulspitem.hxx> @@ -37,6 +36,9 @@ #include "colex.hxx" #include "colmgr.hxx" +//UUUU +#include <svx/unobrushitemhelper.hxx> + // Taking the updated values from the set void SwPageExample::UpdateExample( const SfxItemSet& rSet ) { @@ -114,12 +116,20 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) SetHdLeft( rLR.GetLeft() ); SetHdRight( rLR.GetRight() ); SetHeader( true ); - if ( rHeaderSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET ) + + if(SFX_ITEM_SET == rHeaderSet.GetItemState(RES_BACKGROUND)) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rHeaderSet.Get( RES_BACKGROUND ); - SetHdColor( rItem.GetColor() ); + //UUUU create FillAttributes from SvxBrushItem //SetHdColor(rItem.GetColor()); + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(RES_BACKGROUND)); + SfxItemSet aTempSet(*rHeaderSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setHeaderFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + aTempSet))); } + if ( rHeaderSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) { const SvxBoxItem& rItem = @@ -153,12 +163,20 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) SetFtLeft( rLR.GetLeft() ); SetFtRight( rLR.GetRight() ); SetFooter( true ); + if( rFooterSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET ) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rFooterSet.Get( RES_BACKGROUND ); - SetFtColor( rItem.GetColor() ); + //UUUU create FillAttributes from SvxBrushItem //SetFtColor(rItem.GetColor()); + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rFooterSet.Get(RES_BACKGROUND)); + SfxItemSet aTempSet(*rFooterSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setFooterFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + aTempSet))); } + if( rFooterSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) { const SvxBoxItem& rItem = @@ -169,19 +187,18 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) else SetFooter( false ); } - if( SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, - false, &pItem ) ) - { - SetColor( ( (const SvxBrushItem*)pItem )->GetColor() ); - const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic(); - if ( pGrf ) - { - Bitmap aBitmap = pGrf->GetBitmap(); - SetBitmap( &aBitmap ); - } - else - SetBitmap( NULL ); + if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND, false, &pItem)) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem); + SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setPageFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + aTempSet))); } Invalidate(); @@ -215,14 +232,23 @@ void SwColExample::DrawPage( const Point& rOrg, - GetFtHeight() - GetFtDist(); DrawRect(aRect); - if(GetColor() == Color(COL_TRANSPARENT)) + //UUUU + const Rectangle aDefineRect(aRect); + + //UUUU + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes = getPageFillAttributes(); + + if(!rFillAttributes.get() || !rFillAttributes->isUsed()) { + //UUUU If there is no fill, use fallback color const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); const Color& rFieldColor = rStyleSettings.GetFieldColor(); - SetFillColor( rFieldColor ); + + setPageFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + rFieldColor))); } - else - SetFillColor( GetColor() ); // #97495# make sure that the automatic column width's are always equal bool bAutoWidth = pColMgr->IsAutoWidth(); @@ -242,7 +268,10 @@ void SwColExample::DrawPage( const Point& rOrg, if(!bAutoWidth) nAutoColWidth = pColMgr->GetColWidth( i ); aRect.Right() = aRect.Left() + nAutoColWidth; - DrawRect(aRect); + + //UUUU use primitive draw command + drawFillAttributes(getPageFillAttributes(), aRect, aDefineRect); + if(i < nColumnCount - 1) aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i); } diff --git a/sw/source/uibase/inc/swuipardlg.hxx b/sw/source/uibase/inc/swuipardlg.hxx index 99192eab4120..cf59afd6a9dd 100644 --- a/sw/source/uibase/inc/swuipardlg.hxx +++ b/sw/source/uibase/inc/swuipardlg.hxx @@ -34,6 +34,8 @@ class SwParaDlg: public SfxTabDialog sal_uInt16 m_nParaDrpCps; sal_uInt16 m_nParaBckGrnd; sal_uInt16 m_nParaBorder; + sal_uInt16 m_nAreaId; + sal_uInt16 m_nTransparenceId; void PageCreated(sal_uInt16 nId, SfxTabPage& rPage) SAL_OVERRIDE; diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 6d544b4bd240..57ab6e7256be 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -21,7 +21,6 @@ #include <hintids.hxx> #include <svl/urihelper.hxx> #include <svl/languageoptions.hxx> - #include <svx/svxids.hrc> #include <sfx2/linkmgr.hxx> #include <sfx2/htmlmode.hxx> @@ -95,7 +94,6 @@ #include <fmtinfmt.hxx> #include <doc.hxx> #include <IDocumentSettingAccess.hxx> - #include "swabstdlg.hxx" #include "dialog.hrc" #include "fldui.hrc" @@ -105,12 +103,14 @@ #include <svx/fmshell.hxx> #include <SwRewriter.hxx> #include <comcore.hrc> - #include <unomid.h> #include <svx/galleryitem.hxx> #include <com/sun/star/gallery/GalleryItemType.hpp> #include <boost/scoped_ptr.hpp> +//UUUU +#include <svx/unobrushitemhelper.hxx> + FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END; // These variables keep the state of Gallery (slot SID_GALLERY_BG_BRUSH) @@ -2134,27 +2134,10 @@ void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet ) void SwBaseShell::GetBckColState(SfxItemSet &rSet) { SwWrtShell &rSh = GetShell(); - SfxWhichIter aIter( rSet ); - sal_uInt16 nWhich = aIter.FirstWhich(); - int nSelType = rSh.GetSelectionType(); - - if( nSelType & nsSelectionType::SEL_OLE ) - { - rSet.DisableItem( SID_BACKGROUND_COLOR ); - return; - } - - if ( nSelType & nsSelectionType::SEL_FRM ) - { - bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; - if (bParentCntProt) - { - rSet.DisableItem( SID_BACKGROUND_COLOR ); - return; - } - } - - SvxBrushItem aBrushItem( RES_BACKGROUND ); + SfxWhichIter aIter(rSet); + sal_uInt16 nWhich(aIter.FirstWhich()); + int nSelType(rSh.GetSelectionType()); + SvxBrushItem aBrushItem(RES_BACKGROUND); if( nsSelectionType::SEL_TBL_CELLS & nSelType ) { @@ -2162,54 +2145,41 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet) } else { - //UUUU - if(nSelType & nsSelectionType::SEL_GRF) - { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - - rSh.GetFlyFrmAttr( aCoreSet ); - aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); - } - else if(nsSelectionType::SEL_FRM & nSelType) - { - SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - const XFillStyleItem& rXFillStyleItem(static_cast< const XFillStyleItem& >(aCoreSet.Get(XATTR_FILLSTYLE))); + //UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set + SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - if(XFILL_SOLID == rXFillStyleItem.GetValue()) - { - const Color aFillColor(static_cast< const XFillColorItem& >(aCoreSet.Get(XATTR_FILLCOLOR)).GetColorValue()); + aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrmFmt()->GetAttrSet()); - aBrushItem.SetColor(aFillColor); - } - else - { - // keep default in SvxBrushItem which equals no fill - } + if(nSelType & nsSelectionType::SEL_GRF || nsSelectionType::SEL_FRM & nSelType) + { + rSh.GetFlyFrmAttr(aCoreSet); } else { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - - rSh.GetCurAttr( aCoreSet ); - aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); + rSh.GetCurAttr(aCoreSet); } + + aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND); } - while ( nWhich ) + while(nWhich) { switch(nWhich) { - case SID_BACKGROUND_COLOR : + case SID_BACKGROUND_COLOR: { - SvxColorItem aColorItem(aBrushItem.GetColor(), SID_BACKGROUND_COLOR); - rSet.Put( aColorItem, SID_BACKGROUND_COLOR ); + SvxColorItem aColorItem(aBrushItem.GetColor(),SID_BACKGROUND_COLOR); + rSet.Put(aColorItem,SID_BACKGROUND_COLOR); + break; } - break; case SID_ATTR_BRUSH: case RES_BACKGROUND: - rSet.Put( aBrushItem, GetPool().GetWhich(nWhich) ); - break; + { + rSet.Put(aBrushItem,GetPool().GetWhich(nWhich)); + break; + } } + nWhich = aIter.NextWhich(); } } @@ -2217,18 +2187,16 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet) void SwBaseShell::ExecBckCol(SfxRequest& rReq) { SwWrtShell &rSh = GetShell(); - int nSelType = rSh.GetSelectionType(); - if ( nSelType & nsSelectionType::SEL_OLE ) + int nSelType(rSh.GetSelectionType()); + const SfxItemSet* pArgs = rReq.GetArgs(); + sal_uInt16 nSlot(rReq.GetSlot()); + + if(!pArgs && nSlot != SID_BACKGROUND_COLOR) { return; } - const SfxItemSet* pArgs = rReq.GetArgs(); - sal_uInt16 nSlot = rReq.GetSlot(); - if( !pArgs && nSlot != SID_BACKGROUND_COLOR) - return ; - - SvxBrushItem aBrushItem( RES_BACKGROUND ); + SvxBrushItem aBrushItem(RES_BACKGROUND); if( nsSelectionType::SEL_TBL_CELLS & nSelType ) { @@ -2236,123 +2204,98 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) } else { - //UUUU - if(nSelType & nsSelectionType::SEL_GRF) - { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - - rSh.GetFlyFrmAttr( aCoreSet ); - aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); - } - else if(nsSelectionType::SEL_FRM & nSelType) - { - SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - const XFillStyleItem& rXFillStyleItem(static_cast< const XFillStyleItem& >(aCoreSet.Get(XATTR_FILLSTYLE))); + //UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set + SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - if(XFILL_SOLID == rXFillStyleItem.GetValue()) - { - const Color aFillColor(static_cast< const XFillColorItem& >(aCoreSet.Get(XATTR_FILLCOLOR)).GetColorValue()); + aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrmFmt()->GetAttrSet()); - aBrushItem.SetColor(aFillColor); - } - else - { - // keep default in SvxBrushItem which equals no fill - } + if((nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType)) + { + rSh.GetFlyFrmAttr(aCoreSet); } else { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - - rSh.GetCurAttr( aCoreSet ); - aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); + rSh.GetCurAttr(aCoreSet); } + + aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND); } - switch (nSlot) + switch(nSlot) { - // RES_BACKGROUND (=SID_ATTR_BRUSH) must be set with two IDs: case SID_BACKGROUND_COLOR: - { - aBrushItem.SetGraphicPos(GPOS_NONE); + { + aBrushItem.SetGraphicPos(GPOS_NONE); - if(pArgs) - { - const SvxColorItem& rNewColorItem = (const SvxColorItem&) - pArgs->Get(SID_BACKGROUND_COLOR); - const Color& rNewColor = rNewColorItem.GetValue(); - aBrushItem.SetColor( rNewColor ); - GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem); - } - else - { - aBrushItem.SetColor( COL_TRANSPARENT ); - rReq.AppendItem( SvxColorItem( Color( COL_TRANSPARENT ), nSlot ) ); - } + if(pArgs) + { + const SvxColorItem& rNewColorItem = (const SvxColorItem&)pArgs->Get(SID_BACKGROUND_COLOR); + const Color& rNewColor = rNewColorItem.GetValue(); + aBrushItem.SetColor(rNewColor); + GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem); + } + else + { + aBrushItem.SetColor(COL_TRANSPARENT); + rReq.AppendItem(SvxColorItem(Color(COL_TRANSPARENT),nSlot)); } break; + } case SID_ATTR_BRUSH: case RES_BACKGROUND: { - const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&) - pArgs->Get( GetPool().GetWhich(nSlot) ); + const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&)pArgs->Get(GetPool().GetWhich(nSlot)); aBrushItem = rNewBrushItem; + break; } - break; default: + { rReq.Ignore(); OSL_FAIL("unknown message in ExecuteAttr!" ); return; + } } if( nsSelectionType::SEL_TBL_CELLS & nSelType ) { rSh.SetBoxBackground( aBrushItem ); } - //UUUU - else if(nsSelectionType::SEL_GRF & nSelType) - { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - aCoreSet.Put( aBrushItem ); - // Template autoupdate - SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); - if(pFmt && pFmt->IsAutoUpdateFmt()) - rSh.AutoUpdateFrame( pFmt, aCoreSet); - else - rSh.SetFlyFrmAttr( aCoreSet ); - } - else if(nsSelectionType::SEL_FRM & nSelType) + else { + //UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - // set FillStyle and color when applying - aCoreSet.Put(XFillStyleItem(XFILL_SOLID)); - aCoreSet.Put(XFillColorItem(OUString(), aBrushItem.GetColor())); - - // Vorlagen-AutoUpdate - SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); + aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrmFmt()->GetAttrSet()); + setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, aCoreSet); - if(pFmt && pFmt->IsAutoUpdateFmt()) + if((nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType)) { - rSh.AutoUpdateFrame( pFmt, aCoreSet); + // Template autoupdate + SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); + + if(pFmt && pFmt->IsAutoUpdateFmt()) + { + rSh.AutoUpdateFrame(pFmt, aCoreSet); + } + else + { + rSh.SetFlyFrmAttr(aCoreSet); + } } else { - rSh.SetFlyFrmAttr( aCoreSet ); - } - } - else - { - SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); - if( pColl && pColl->IsAutoUpdateFmt()) - { - SfxItemSet aSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND ); - aSet.Put(aBrushItem); - rSh.AutoUpdatePara( pColl, aSet); + SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); + + if(pColl && pColl->IsAutoUpdateFmt()) + { + rSh.AutoUpdatePara(pColl, aCoreSet); + } + else + { + rSh.SetAttrSet(aCoreSet); + } } - else - rSh.SetAttrItem( aBrushItem ); } rReq.Done(); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index a01bd9f8d267..3bb5a6301840 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -48,6 +48,7 @@ #include <editeng/svxacorr.hxx> #include <svl/cjkoptions.hxx> #include <svl/ctloptions.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <IDocumentSettingAccess.hxx> #include <charfmt.hxx> #include <editeng/fontitem.hxx> @@ -107,6 +108,7 @@ #include <editeng/unolingu.hxx> #include <unotools/syslocaleoptions.hxx> #include <doc.hxx> +#include <drawdoc.hxx> #include <view.hxx> #include <ndtxt.hxx> #include <pam.hxx> @@ -117,6 +119,11 @@ #include <tools/diagnose_ex.h> #include <svx/nbdtmgfact.hxx> #include <svx/nbdtmg.hxx> + +//UUUU +#include <svx/svdmodel.hxx> +#include <svx/drawitem.hxx> + #include <numrule.hxx> #include <boost/scoped_ptr.hpp> @@ -891,23 +898,45 @@ void SwTextShell::Execute(SfxRequest &rReq) bool bApplyCharUnit = ::HasCharUnit(0 != PTR_CAST(SwWebView, &GetView())); SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit)); - SfxItemSet aCoreSet( GetPool(), - RES_PARATR_BEGIN, RES_PARATR_END - 1, - RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1, - RES_FRMATR_BEGIN, RES_FRMATR_END - 1, - SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS, - SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS, - SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, - SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP, - SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM, - SID_HTML_MODE, SID_HTML_MODE, - FN_PARAM_1, FN_PARAM_1, - FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT, - FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME, + SfxItemSet aCoreSet( GetPool(), //UUUU sorted by indices, one group of three concatenated + RES_PARATR_BEGIN, RES_PARATR_END - 1, // [60 + RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1, // [77 + RES_FRMATR_BEGIN, RES_FRMATR_END - 1, // [82 + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + // includes SID_ATTR_TABSTOP_POS + SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_OFFSET, // [10003 .. 10005 + + SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, // [10023 + SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP, // [10065 + + //UUUU items to hand over XPropertyList things like + // XColorList, XHatchList, XGradientList and XBitmapList + // to the Area TabPage + SID_COLOR_TABLE, SID_BITMAP_LIST, // [10179 + + SID_HTML_MODE, SID_HTML_MODE, // [10414 + SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM, // [10457 + FN_PARAM_1, FN_PARAM_1, // [21160 + FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT, // [21738 + FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME, // [22418 0); + // get also the list level indent values merged as LR-SPACE item, if needed. - rWrtSh.GetPaMAttr( pPaM, aCoreSet, true ); + rWrtSh.GetCurAttr( aCoreSet, true ); + + //UUUU create needed items for XPropertyList entries from the DrawModel so that + // the Area TabPage can access them + // Do this after GetCurAttr, this resets the ItemSet content again + const SdrModel* pDrawModel = GetView().GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); + + aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE)); + aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST)); + aCoreSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST)); + aCoreSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST)); + aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index f545c04e55d3..171ee44c355f 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -25,7 +25,6 @@ #include <svl/aeitem.hxx> #include <svl/whiter.hxx> #include <svl/cjkoptions.hxx> - #include <sfx2/viewfrm.hxx> #include <sfx2/objitem.hxx> #include <svl/imageitm.hxx> @@ -57,10 +56,12 @@ #include <docary.hxx> #include <cmdid.h> - #include <IDocumentRedlineAccess.hxx> #include <doc.hxx> +//UUUU +#include <doc.hxx> + using namespace ::com::sun::star; void SwView::GetState(SfxItemSet &rSet) @@ -146,6 +147,15 @@ void SwView::GetState(SfxItemSet &rSet) { const sal_uInt16 nCurIdx = m_pWrtShell->GetCurPageDesc(); const SwPageDesc& rDesc = m_pWrtShell->GetPageDesc( nCurIdx ); + + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + if(!rSet.GetParent()) + { + const SwFrmFmt& rMaster = rDesc.GetMaster(); + + rSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet()); + } + ::PageDescToItemSet( rDesc, rSet); } break; diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 1327f482af25..48ffaaf80a48 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -448,13 +448,20 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) OSL_ENSURE(pHeaderFmt != 0, "no header format"); // HeaderInfo, margins, background, border - SfxItemSet aHeaderSet( *rSet.GetPool(), - SID_ATTR_PAGE_ON, SID_ATTR_PAGE_SHARED, - SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST, - SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, - RES_FRMATR_BEGIN, RES_FRMATR_END-1, - 0); + SfxItemSet aHeaderSet(*rSet.GetPool(), + RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [82 + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER, // [10023 + SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE, // [10051 + SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED, // [10060 + SID_ATTR_PAGE_SHARED_FIRST,SID_ATTR_PAGE_SHARED_FIRST, + 0, 0); + + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + aHeaderSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet()); // Dynamic or fixed height SfxBoolItem aOn(SID_ATTR_PAGE_ON, true); @@ -492,13 +499,20 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) OSL_ENSURE(pFooterFmt != 0, "no footer format"); // FooterInfo, margins, background, border - SfxItemSet aFooterSet( *rSet.GetPool(), - SID_ATTR_PAGE_ON, SID_ATTR_PAGE_SHARED, - SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST, - SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, - RES_FRMATR_BEGIN, RES_FRMATR_END-1, - 0); + SfxItemSet aFooterSet(*rSet.GetPool(), + RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [82 + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER, // [10023 + SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE, // [10051 + SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED, // [10060 + SID_ATTR_PAGE_SHARED_FIRST,SID_ATTR_PAGE_SHARED_FIRST, + 0, 0); + + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + aFooterSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet()); // Dynamic or fixed height SfxBoolItem aOn(SID_ATTR_PAGE_ON, true); |