diff options
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r-- | sw/source/core/unocore/XMLRangeHelper.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/swunohelper.cxx | 41 | ||||
-rw-r--r-- | sw/source/core/unocore/unochart.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 191 | ||||
-rw-r--r-- | sw/source/core/unocore/unoframe.cxx | 275 | ||||
-rw-r--r-- | sw/source/core/unocore/unomap.cxx | 241 | ||||
-rw-r--r-- | sw/source/core/unocore/unoparagraph.cxx | 281 | ||||
-rw-r--r-- | sw/source/core/unocore/unoprnms.cxx | 107 | ||||
-rw-r--r-- | sw/source/core/unocore/unosett.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 2100 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 2 |
12 files changed, 2115 insertions, 1160 deletions
diff --git a/sw/source/core/unocore/XMLRangeHelper.cxx b/sw/source/core/unocore/XMLRangeHelper.cxx index 8e50525e8186..d4cb11dcb66b 100644 --- a/sw/source/core/unocore/XMLRangeHelper.cxx +++ b/sw/source/core/unocore/XMLRangeHelper.cxx @@ -347,7 +347,7 @@ CellRange getCellRangeFromXMLString( const OUString & rXMLString ) nStartPos, nEndPos - 1, aResult )) { - // if an error occured, bail out + // if an error occurred, bail out return CellRange(); } } diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index 6d1711adff13..cf59ea79e4cc 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" @@ -31,9 +29,7 @@ #include <com/sun/star/ucb/XContentProvider.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/ucb/TransferInfo.hpp> -#ifndef _COM_SUN_STAR_UCB_NAMECLASH_HDL_ #include <com/sun/star/ucb/NameClash.hdl> -#endif #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -50,7 +46,12 @@ #include <swunodef.hxx> #include <errhdl.hxx> -namespace SWUnoHelper { +//UUUU +#include <svx/xfillit0.hxx> +#include <svl/itemset.hxx> + +namespace SWUnoHelper +{ sal_Int32 GetEnumAsInt32( const UNO_NMSPC::Any& rVal ) { @@ -284,4 +285,34 @@ sal_Bool UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList, 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; +} + } + +// eof diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 696ed773b67a..36d7f14eb397 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -697,12 +697,12 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData //Therefore we need to shift the range one row up SwRangeDescriptor aDesc; if (aRangeRepresentation.getLength() == 0) - return xRes; // we cant handle this thus returning an empty references + return xRes; // we can't handle this thus returning an empty references aRangeRepresentation = aRangeRepresentation.copy( 1 ); // get rid of '.' to have only the cell range left FillRangeDescriptor( aDesc, aRangeRepresentation ); aDesc.Normalize(); if (aDesc.nTop <= 0) // no chance to shift the range one row up? - return xRes; // we cant handle this thus returning an empty references + return xRes; // we can't handle this thus returning an empty references aDesc.nTop -= 1; aDesc.nBottom -= 1; @@ -743,7 +743,7 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData { SwTable* pTable = SwTable::FindTable( pTblFmt ); if(pTable->IsTblComplex()) - return xRes; // we cant handle this thus returning an empty references + return xRes; // we can't handle this thus returning an empty references else { // get a character map in the size of the table to mark @@ -833,7 +833,7 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData } aDataLen[oi] = nL; - // check that there is no other seperate sequence of data + // check that there is no other separate sequence of data // to be found because that is not supported while (ii < iiEnd) { diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index bd0f03a33480..a087d17cef84 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -19,14 +19,11 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" #include <swtypes.hxx> #include <cmdid.h> - #include <unomid.h> #include <unodraw.hxx> #include <unocoll.hxx> @@ -87,6 +84,7 @@ #include <svx/svdlegacy.hxx> #include <svx/fmmodel.hxx> #include <switerator.hxx> +#include <drawdoc.hxx> using ::rtl::OUString; using namespace ::com::sun::star; @@ -874,7 +872,7 @@ SwFmDrawPage* SwXDrawPage::GetSvxPage() { vos::OGuard aGuard(Application::GetSolarMutex()); // --> OD 2005-08-08 #i52858# - method name changed - SdrModel* pModel = pDoc->GetOrCreateDrawModel(); + SwDrawModel* pModel = pDoc->GetOrCreateDrawModel(); // <-- SdrPage* pPage = pModel->GetPage( 0 ); diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index c476763d1bcd..550f11d6cb6a 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -539,18 +539,29 @@ void SwXFieldMaster::setPropertyValue( const OUString& rPropertyName, } } } - if( bSetValue ) + if ( bSetValue ) { // nothing special to be done here for the properties // UNO_NAME_DATA_BASE_NAME and UNO_NAME_DATA_BASE_URL. // We just call PutValue (empty string is allowed). // Thus the last property set will be used as Data Source. - sal_uInt16 nMId = GetFieldTypeMId( rPropertyName, *pType ); - if( USHRT_MAX != nMId ) - pType->PutValue( rValue, nMId ); + const sal_uInt16 nMemberValueId = GetFieldTypeMId( rPropertyName, *pType ); + if ( USHRT_MAX != nMemberValueId ) + { + pType->PutValue( rValue, nMemberValueId ); + if ( pType->Which() == RES_USERFLD ) + { + // trigger update of User field in order to get depending Input Fields updated. + pType->UpdateFlds(); + } + } else - throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); + { + throw beans::UnknownPropertyException( + OUString( RTL_CONSTASCII_USTRINGPARAM( "Unknown property: " ) ) + rPropertyName, + static_cast< cppu::OWeakObject * >( this ) ); + } } } else if(!pType && m_pDoc && @@ -898,37 +909,34 @@ void SwXFieldMaster::removeVetoableChangeListener(const OUString& /*PropertyName void SwXFieldMaster::dispose(void) throw( uno::RuntimeException ) { - vos::OGuard aGuard(Application::GetSolarMutex()); - SwFieldType* pFldType = GetFldType(sal_True); - if(pFldType) + vos::OGuard aGuard( Application::GetSolarMutex() ); + + SwFieldType* pFldType = GetFldType( sal_True ); + if ( pFldType != NULL ) { sal_uInt16 nTypeIdx = USHRT_MAX; const SwFldTypes* pTypes = GetDoc()->GetFldTypes(); - for( sal_uInt16 i = 0; i < pTypes->Count(); i++ ) + for ( sal_uInt16 i = 0; i < pTypes->Count(); i++ ) { - if((*pTypes)[i] == pFldType) + if ( ( *pTypes )[i] == pFldType ) nTypeIdx = i; } // zuerst alle Felder loeschen - SwIterator<SwFmtFld,SwFieldType> aIter( *pFldType ); + SwIterator< SwFmtFld, SwFieldType > aIter( *pFldType ); SwFmtFld* pFld = aIter.First(); - while(pFld) + while ( pFld != NULL ) { - // Feld im Undo? - SwTxtFld *pTxtFld = pFld->GetTxtFld(); - if(pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) + SwTxtFld* pTxtFld = pFld->GetTxtFld(); + if ( pTxtFld != NULL + && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) { - SwTxtNode& rTxtNode = (SwTxtNode&)*pTxtFld->GetpTxtNode(); - SwPaM aPam(rTxtNode, *pTxtFld->GetStart()); - aPam.SetMark(); - aPam.Move(); - GetDoc()->DeleteAndJoin(aPam); + SwTxtFld::DeleteTxtFld( *pTxtFld ); } pFld = aIter.Next(); } // dann den FieldType loeschen - GetDoc()->RemoveFldType(nTypeIdx); + GetDoc()->RemoveFldType( nTypeIdx ); } else throw uno::RuntimeException(); @@ -1877,38 +1885,41 @@ void SwXTextField::attach( const uno::Reference< text::XTextRange > & xTextRange uno::Reference< text::XTextRange > SwXTextField::getAnchor(void) throw( uno::RuntimeException ) { - vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Reference< text::XTextRange > aRef; - SwField* pField = (SwField*)GetField(); - if(pField) + vos::OGuard aGuard( Application::GetSolarMutex() ); + + uno::Reference< text::XTextRange > aRef; + + SwField* pField = (SwField*) GetField(); + if ( pField != NULL ) { const SwTxtFld* pTxtFld = m_pFmtFld->GetTxtFld(); - if(!pTxtFld) + if ( !pTxtFld ) throw uno::RuntimeException(); - const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode(); - - SwPaM aPam(rTxtNode, *pTxtFld->GetStart() + 1, rTxtNode, *pTxtFld->GetStart()); - aRef = SwXTextRange::CreateXTextRange( - *m_pDoc, *aPam.GetPoint(), aPam.GetMark()); + boost::shared_ptr< SwPaM > pPamForTxtFld; + SwTxtFld::GetPamForTxtFld( *pTxtFld, pPamForTxtFld ); + if ( pPamForTxtFld.get() != NULL ) + { + aRef = SwXTextRange::CreateXTextRange( *m_pDoc, + *(pPamForTxtFld->GetPoint()), + pPamForTxtFld->GetMark() ); + } } return aRef; } + void SwXTextField::dispose(void) throw( uno::RuntimeException ) { - vos::OGuard aGuard(Application::GetSolarMutex()); - SwField* pField = (SwField*)GetField(); - if(pField) + vos::OGuard aGuard( Application::GetSolarMutex() ); + SwField* pField = (SwField*) GetField(); + if ( pField != NULL ) { - UnoActionContext aContext(GetDoc()); - const SwTxtFld* pTxtFld = m_pFmtFld->GetTxtFld(); - SwTxtNode& rTxtNode = (SwTxtNode&)*pTxtFld->GetpTxtNode(); - SwPaM aPam(rTxtNode, *pTxtFld->GetStart()); - aPam.SetMark(); - aPam.Move(); - GetDoc()->DeleteAndJoin(aPam); + UnoActionContext aContext( GetDoc() ); + + ASSERT( m_pFmtFld->GetTxtFld(), "<SwXTextField::dispose()> - missing <SwTxtFld> --> crash" ); + SwTxtFld::DeleteTxtFld( *( m_pFmtFld->GetTxtFld() ) ); } if ( m_pTextObject ) @@ -1969,19 +1980,19 @@ void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::An if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); - if(pField) + if ( pField ) { // Sonderbehandlung Serienbrieffeld sal_uInt16 nWhich = pField->Which(); - if( RES_DBFLD == nWhich && - (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)) || - rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_URL))|| - rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_TABLE_NAME))|| - rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COLUMN_NAME)))) + if ( RES_DBFLD == nWhich + && ( rPropertyName.equalsAsciiL( SW_PROP_NAME( UNO_NAME_DATA_BASE_NAME ) ) + || rPropertyName.equalsAsciiL( SW_PROP_NAME( UNO_NAME_DATA_BASE_URL ) ) + || rPropertyName.equalsAsciiL( SW_PROP_NAME( UNO_NAME_DATA_TABLE_NAME ) ) + || rPropertyName.equalsAsciiL( SW_PROP_NAME( UNO_NAME_DATA_COLUMN_NAME ) ) ) ) { // hier muss ein neuer Feldtyp angelegt werden und // das Feld an den neuen Typ umgehaengt werden - DBG_WARNING("not implemented"); + DBG_WARNING( "not implemented" ); } else { @@ -2001,30 +2012,30 @@ void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::An } pField->PutValue( rValue, pEntry->nWID ); - //#i100374# notify SwPostIt about new field content - if (RES_POSTITFLD== nWhich && m_pFmtFld) - { - const_cast<SwFmtFld*>(m_pFmtFld)->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED )); - } + //#i100374# notify SwPostIt about new field content + if ( RES_POSTITFLD == nWhich && m_pFmtFld ) + { + const_cast< SwFmtFld* >( m_pFmtFld )->Broadcast( SwFmtFldHint( 0, SWFMTFLD_CHANGED ) ); + } //#114571# changes of the expanded string have to be notified //#to the SwTxtFld - if(RES_DBFLD == nWhich && m_pFmtFld->GetTxtFld()) + if ( RES_DBFLD == nWhich && m_pFmtFld->GetTxtFld() ) { m_pFmtFld->GetTxtFld()->ExpandTxtFld(); } - //#i100374# changing a document field should set the modify flag - SwDoc* pDoc = GetDoc(); - if (pDoc) - pDoc->SetModified(); + //#i100374# changing a document field should set the modify flag + SwDoc* pDoc = GetDoc(); + if ( pDoc ) + pDoc->SetModified(); } - else if(m_pProps) + else if ( m_pProps ) { String* pStr = 0; sal_Bool* pBool = 0; - switch(pEntry->nWID) + switch (pEntry->nWID) { case FIELD_PROP_PAR1: pStr = &m_pProps->sPar1; @@ -2045,54 +2056,54 @@ void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::An case FIELD_PROP_SUBTYPE: m_pProps->nSubType = SWUnoHelper::GetEnumAsInt32( rValue ); break; - case FIELD_PROP_BYTE1 : + case FIELD_PROP_BYTE1: rValue >>= m_pProps->nByte1; break; - case FIELD_PROP_BOOL1 : + case FIELD_PROP_BOOL1: pBool = &m_pProps->bBool1; break; - case FIELD_PROP_BOOL2 : + case FIELD_PROP_BOOL2: pBool = &m_pProps->bBool2; break; - case FIELD_PROP_BOOL3 : + case FIELD_PROP_BOOL3: pBool = &m_pProps->bBool3; break; case FIELD_PROP_BOOL4: pBool = &m_pProps->bBool4; - break; - case FIELD_PROP_DATE : - { - if(rValue.getValueType() != ::getCppuType(static_cast<const util::Date*>(0))) + break; + case FIELD_PROP_DATE: + { + if ( rValue.getValueType() != ::getCppuType( static_cast< const util::Date* >( 0 ) ) ) throw lang::IllegalArgumentException(); - util::Date aTemp = *(const util::Date*)rValue.getValue(); - m_pProps->aDate = Date(aTemp.Day, aTemp.Month, aTemp.Year); + util::Date aTemp = *(const util::Date*) rValue.getValue(); + m_pProps->aDate = Date( aTemp.Day, aTemp.Month, aTemp.Year ); } - break; + break; case FIELD_PROP_USHORT1: - case FIELD_PROP_USHORT2: + case FIELD_PROP_USHORT2: { - sal_Int16 nVal = 0; - rValue >>= nVal; - if( FIELD_PROP_USHORT1 == pEntry->nWID) - m_pProps->nUSHORT1 = nVal; - else - m_pProps->nUSHORT2 = nVal; - } + sal_Int16 nVal = 0; + rValue >>= nVal; + if ( FIELD_PROP_USHORT1 == pEntry->nWID ) + m_pProps->nUSHORT1 = nVal; + else + m_pProps->nUSHORT2 = nVal; + } break; case FIELD_PROP_SHORT1: rValue >>= m_pProps->nSHORT1; break; case FIELD_PROP_DOUBLE: - if(rValue.getValueType() != ::getCppuType(static_cast<const double*>(0))) + if ( rValue.getValueType() != ::getCppuType( static_cast< const double* >( 0 ) ) ) throw lang::IllegalArgumentException(); - m_pProps->fDouble = *(double*)rValue.getValue(); + m_pProps->fDouble = *(double*) rValue.getValue(); break; - case FIELD_PROP_DATE_TIME : - if(!m_pProps->pDateTime) + case FIELD_PROP_DATE_TIME: + if ( !m_pProps->pDateTime ) m_pProps->pDateTime = new util::DateTime; - rValue >>= (*m_pProps->pDateTime); + rValue >>= ( *m_pProps->pDateTime ); break; case FIELD_PROP_PROP_SEQ: rValue >>= m_pProps->aPropSeq; @@ -2101,12 +2112,12 @@ void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::An rValue >>= m_pProps->aStrings; break; } - if( pStr ) + if ( pStr ) ::GetString( rValue, *pStr ); - else if( pBool ) + else if ( pBool ) { - if( rValue.getValueType() == getCppuBooleanType() ) - *pBool = *(sal_Bool*)rValue.getValue(); + if ( rValue.getValueType() == getCppuBooleanType() ) + *pBool = *(sal_Bool*) rValue.getValue(); else throw lang::IllegalArgumentException(); } @@ -2369,10 +2380,8 @@ void SwXTextField::update( ) throw (uno::RuntimeException) } break; } - // --> FME 2004-10-06 #116480# // Text formatting has to be triggered. - const_cast<SwFmtFld*>(m_pFmtFld)->ModifyNotification( 0, 0 ); - // <-- + const_cast< SwFmtFld* >( m_pFmtFld )->ModifyNotification( 0, 0 ); } else m_bCallUpdate = sal_True; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 47cb131d7243..ab3ae3bf65bc 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -36,10 +36,8 @@ #include <svx/xflhtit.hxx> #include <svx/xfltrit.hxx> #include <editeng/memberids.hrc> - #include <swtypes.hxx> #include <cmdid.h> - #include <memory> #include <hints.hxx> #include <doc.hxx> @@ -105,10 +103,8 @@ #include <vos/mutex.hxx> #include <vcl/svapp.hxx> #include <sfx2/printer.hxx> -//Begin Bug 119922 #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> -//End Bug 119922 #include <SwStyleNameMapper.hxx> #include <xmloff/xmlcnitm.hxx> #include <poolfmt.hxx> @@ -121,9 +117,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <svx/fmmodel.hxx> #include <switerator.hxx> - -//UUUU -#include <unobrushitemhelper.hxx> +#include <svx/unobrushitemhelper.hxx> #include <svx/xfillit0.hxx> #include <svx/xbtmpit.hxx> #include <svx/xgrscit.hxx> @@ -139,6 +133,8 @@ #include <svx/xflboxy.hxx> #include <svx/xflbckit.hxx> #include <svx/unoshape.hxx> +#include <swunohelper.hxx> +#include <drawdoc.hxx> // from fefly1.cxx extern sal_Bool lcl_ChkAndSetNewAnchor( SwEditShell& rEditShell, const SwFlyFrm& rFly, SfxItemSet& rSet ); @@ -153,9 +149,6 @@ using ::com::sun::star::style::XStyleFamiliesSupplier; const sal_Char __FAR_DATA sPackageProtocol[] = "vnd.sun.star.Package:"; const sal_Char __FAR_DATA sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:"; -//UUUU -#define OWN_ATTR_FILLBMP_MODE (OWN_ATTR_VALUE_START+45) - /**************************************************************************** Rahmenbeschreibung ****************************************************************************/ @@ -204,6 +197,13 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const sal_Bool bOasis /*sal_False*/ ) //End Bug 119922 { + //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 (!)"); + } + sal_Bool bRet = sal_True; //Anker kommt auf jeden Fall in den Set SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) ); @@ -298,7 +298,10 @@ sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, // 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 @@ -910,43 +913,50 @@ inline void lcl_FillCol ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, con rToSet.Put(aCol); } } -sal_Bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, sal_Bool& rSizeFound) +sal_Bool SwFrameProperties_Impl::AnyToItemSet( + SwDoc *pDoc, + SfxItemSet& rSet, + SfxItemSet&, + sal_Bool& rSizeFound ) { - //Properties fuer alle Frames - const ::uno::Any *pStyleName; - SwDocStyleSheet* pStyle = NULL; - sal_Bool bRet; + sal_Bool bRet = sal_False; - if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) + SwDocStyleSheet* pStyle = NULL; + const ::uno::Any *pStyleName; + if ( GetProperty( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) { - OUString sStyle; - *pStyleName >>= sStyle; - pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, - SFX_STYLE_FAMILY_FRAME); + OUString sTmpStylename; + *pStyleName >>= sTmpStylename; + String sStylename; + SwStyleNameMapper::FillUIName( String(sTmpStylename), sStylename, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, sal_True ); + pStyle = + (SwDocStyleSheet*) pDoc->GetDocShell()->GetStyleSheetPool()->Find( sStylename, SFX_STYLE_FAMILY_FRAME ); } const ::uno::Any* pColumns = NULL; - GetProperty (RES_COL, MID_COLUMNS, pColumns); - if ( pStyle ) + GetProperty( RES_COL, MID_COLUMNS, pColumns ); + if ( pStyle != NULL ) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *pStyle ) ); - const :: SfxItemSet *pItemSet = &xStyle->GetItemSet(); - bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); - lcl_FillCol ( rSet, *pItemSet, pColumns ); + const ::SfxItemSet *pItemSet = &xStyle->GetItemSet(); + bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); + lcl_FillCol( rSet, *pItemSet, pColumns ); } else { - const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet(); - bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); - lcl_FillCol ( rSet, *pItemSet, pColumns ); + const ::SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet(); + bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); + lcl_FillCol( rSet, *pItemSet, pColumns ); } + const ::uno::Any* pEdit; - if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit)) + if ( GetProperty( RES_EDIT_IN_READONLY, 0, pEdit ) ) { - SfxBoolItem aBool(RES_EDIT_IN_READONLY); - ((SfxPoolItem&)aBool).PutValue(*pEdit, 0); - rSet.Put(aBool); + SfxBoolItem aBool( RES_EDIT_IN_READONLY ); + ( (SfxPoolItem&) aBool ).PutValue( *pEdit, 0 ); + rSet.Put( aBool ); } + return bRet; } /**************************************************************************** @@ -982,23 +992,24 @@ inline void lcl_FillMirror ( SfxItemSet &rToSet, const :: SfxItemSet &rFromSet, } } -sal_Bool SwGraphicProperties_Impl::AnyToItemSet( - SwDoc* pDoc, - SfxItemSet& rFrmSet, - SfxItemSet& rGrSet, - sal_Bool& rSizeFound) +sal_Bool SwGraphicProperties_Impl::AnyToItemSet( + SwDoc* pDoc, + SfxItemSet& rFrmSet, + SfxItemSet& rGrSet, + sal_Bool& rSizeFound ) { - //Properties fuer alle Frames - sal_Bool bRet; - const ::uno::Any *pStyleName; - SwDocStyleSheet* pStyle = NULL; + sal_Bool bRet = sal_False; - if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) + SwDocStyleSheet* pStyle = NULL; + const ::uno::Any *pStyleName; + if ( GetProperty( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) ) { - OUString sStyle; - *pStyleName >>= sStyle; - pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, - SFX_STYLE_FAMILY_FRAME); + OUString sTmpStylename; + *pStyleName >>= sTmpStylename; + String sStylename; + SwStyleNameMapper::FillUIName( String(sTmpStylename), sStylename, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, sal_True ); + pStyle = + (SwDocStyleSheet*) pDoc->GetDocShell()->GetStyleSheetPool()->Find( sStylename, SFX_STYLE_FAMILY_FRAME ); } const ::uno::Any* pHEvenMirror = 0; @@ -1008,24 +1019,22 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES, pHOddMirror); GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT, pVMirror); - if ( pStyle ) + if ( pStyle != NULL ) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet(*pStyle) ); const :: SfxItemSet *pItemSet = &xStyle->GetItemSet(); - //Begin Bug 119922 sal_Bool bOasis = sal_False; { const SfxMedium* pMedium = pDoc->GetDocShell()->GetMedium(); - const SfxFilter * pFilter = pMedium - ? pMedium->GetFilter() - : NULL; - if ( pMedium && pFilter ) + const SfxFilter * pFilter = pMedium != NULL + ? pMedium->GetFilter() + : NULL; + if ( pFilter != NULL ) { bOasis = pFilter->GetVersion() > SOFFICE_FILEFORMAT_60; } } bRet = FillBaseProperties( rFrmSet, *pItemSet, rSizeFound, bOasis ); - //End Bug 119922 lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet ); } else @@ -1035,8 +1044,7 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet ); } - - static const :: sal_uInt16 nIDs[] = + static const ::sal_uInt16 nIDs[] = { RES_GRFATR_CROPGRF, RES_GRFATR_ROTATION, @@ -1052,14 +1060,14 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( 0 }; const ::uno::Any* pAny; - for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++) + for ( sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++ ) { - sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0; - if(GetProperty(nIDs[nIndex], nMId, pAny )) + const sal_uInt8 nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0; + if ( GetProperty( nIDs[nIndex], nMId, pAny ) ) { SfxPoolItem* pItem = ::GetDfltAttr( nIDs[nIndex] )->Clone(); - bRet &= pItem->PutValue(*pAny, nMId ); - rGrSet.Put(*pItem); + bRet &= pItem->PutValue( *pAny, nMId ); + rGrSet.Put( *pItem ); delete pItem; } } @@ -1067,6 +1075,7 @@ sal_Bool SwGraphicProperties_Impl::AnyToItemSet( return bRet; } + class SwOLEProperties_Impl : public SwFrameProperties_Impl { public: @@ -1077,17 +1086,22 @@ public: virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound); }; -sal_Bool SwOLEProperties_Impl::AnyToItemSet( - SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound) + +sal_Bool SwOLEProperties_Impl::AnyToItemSet( + SwDoc* pDoc, + SfxItemSet& rFrmSet, + SfxItemSet& rSet, + sal_Bool& rSizeFound ) { const ::uno::Any* pTemp; - if(!GetProperty(FN_UNO_CLSID, 0, pTemp) && !GetProperty(FN_UNO_STREAM_NAME, 0, pTemp) ) + if ( !GetProperty( FN_UNO_CLSID, 0, pTemp ) && !GetProperty( FN_UNO_STREAM_NAME, 0, pTemp ) ) return sal_False; - SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound); - // + SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound ); + return sal_True; } + /****************************************************************** * SwXFrame ******************************************************************/ @@ -1282,7 +1296,7 @@ SdrObject *SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt *pFmt ) { SwDoc *pDoc = pFmt->GetDoc(); // --> OD 2005-08-08 #i52858# - method name changed - SdrModel *pDrawModel = pDoc->GetOrCreateDrawModel(); + SwDrawModel* pDrawModel = pDoc->GetOrCreateDrawModel(); // <-- SwFlyDrawContact* pContactObject = new SwFlyDrawContact( pFmt, *pDrawModel ); pObject = pContactObject->GetMaster(); @@ -1674,7 +1688,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: { SdrObject* pObject = GetOrCreateSdrObject( (SwFlyFrmFmt*)pFmt ); - SdrModel *pDrawModel = pDoc->GetDrawModel(); + SwDrawModel* pDrawModel = pDoc->GetDrawModel(); pDrawModel->GetPage(0)-> SetNavigationPosition(pObject->GetNavigationPosition(), nZOrder); } @@ -1727,7 +1741,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: if(RES_BACKGROUND == pEntry->nWID) { const SwAttrSet& rSet = pFmt->GetAttrSet(); - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); SvxBrushItem aChangedBrushItem(aOriginalBrushItem); aChangedBrushItem.PutValue(aValue, nMemberId); @@ -1763,6 +1777,64 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: bDone = true; } + switch(nMemberId) + { + case MID_NAME: + { + //UUUU when named items get set, replace these with the NameOrIndex items + // which exist already in the pool + switch(pEntry->nWID) + { + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLBITMAP: + case XATTR_FILLFLOATTRANSPARENCE: + { + OUString aTempName; + + if(!(aValue >>= aTempName )) + { + throw lang::IllegalArgumentException(); + } + + bDone = SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet); + break; + } + default: + { + break; + } + } + break; + } + case MID_GRAFURL: + { + //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used + switch(pEntry->nWID) + { + case XATTR_FILLBITMAP: + { + const Graphic aNullGraphic; + XFillBitmapItem aXFillBitmapItem(aSet.GetPool(), aNullGraphic); + + aXFillBitmapItem.PutValue(aValue, nMemberId); + aSet.Put(aXFillBitmapItem); + bDone = true; + break; + } + default: + { + break; + } + } + break; + } + default: + { + break; + } + } + if(!bDone) { m_pPropSet->setPropertyValue(*pEntry, aValue, aSet); @@ -1830,7 +1902,9 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: throw lang::IllegalArgumentException(); } else + { pFmt->SetFmtAttr(aSet); + } } } else if(IsDescriptor()) @@ -1941,26 +2015,25 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) { String sGrfName; const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); - if(pIdx) + if ( pIdx ) { - SwNodeIndex aIdx(*pIdx, 1); -// SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode(); + SwNodeIndex aIdx( *pIdx, 1 ); SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode(); - if(!pGrfNode) + if ( !pGrfNode ) throw uno::RuntimeException(); - if( pGrfNode->IsGrfLink() ) + if ( pGrfNode->IsGrfLink() ) { - pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, 0 ); + pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*) pFmt, &sGrfName, 0 ); } else { - String sPrefix( RTL_CONSTASCII_STRINGPARAM(sGraphicObjectProtocol) ); + String sPrefix( RTL_CONSTASCII_STRINGPARAM( sGraphicObjectProtocol ) ); String sId( pGrfNode->GetGrfObj().GetUniqueID(), - RTL_TEXTENCODING_ASCII_US ); - (sGrfName = sPrefix) += sId; + RTL_TEXTENCODING_ASCII_US ); + ( sGrfName = sPrefix ) += sId; } } - aAny <<= OUString(sGrfName); + aAny <<= OUString( sGrfName ); } else if( FN_UNO_REPLACEMENT_GRAPHIC_U_R_L == pEntry->nWID) { @@ -2157,7 +2230,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) if(RES_BACKGROUND == pEntry->nWID) { //UUUU - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); if(!aOriginalBrushItem.QueryValue(aAny, nMemberId)) { @@ -2291,42 +2364,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 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) @@ -2372,7 +2409,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; } @@ -2682,6 +2719,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 sal_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 85ca8e7419af..1d2c108d84f6 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -297,6 +297,9 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() // OD 18.09.2003 #i18732# - add property // OD 2004-05-05 #i28701# - add property 'WrapInfluenceOnObjPos' // OD 2009-07-13 #i73249# - add properties 'Title' and 'Description' +//UUUU all users of COMMON_FRAME_PROPERTIES add the new XATTR_FILL_FIRST, XATTR_FILL_LAST FillStyle, +// thus it may be possible to remove the RES_BACKGROUND entries from SvxBrushItem completely (this includes +// all using UNO_NAME_BACK_* slots) in the future #define COMMON_FRAME_PROPERTIES \ { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ANCHOR_PAGENUM }, \ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE, MID_ANCHOR_ANCHORTYPE}, \ @@ -582,6 +585,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s COMMON_TEXT_CONTENT_PROPERTIES { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},\ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAMES), FN_UNO_CHARFMT_SEQUENCE, CPPU_E2T(CPPUTYPE_OUSTRINGS), 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 + {0,0,0,0,0,0} }; aMapEntriesArr[nPropertyId] = aParagraphMap_Impl; @@ -609,6 +620,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s TABSTOPS_MAP_ENTRY COMMON_TEXT_CONTENT_PROPERTIES { SW_PROP_NMID(UNO_NAME_PARA_AUTO_STYLE_NAME), RES_AUTO_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), 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 + {0,0,0,0,0,0} }; aMapEntriesArr[nPropertyId] = aAutoParaStyleMap; @@ -724,6 +743,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s static SfxItemPropertyMapEntry 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 + {0,0,0,0,0,0} }; aMapEntriesArr[nPropertyId] = aParaStyleMap; @@ -735,6 +762,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { COMMON_PARA_STYLE_PROPERTIES { SW_PROP_NMID(UNO_NAME_PARA_STYLE_CONDITIONS), FN_UNO_PARA_STYLE_CONDITIONS, CPPU_E2T(CPPUTYPE_SEQNAMEDVALUE), 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 + {0,0,0,0,0,0} }; aMapEntriesArr[nPropertyId] = aParaStyleMap; @@ -818,9 +853,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_WRAP_INFLUENCE_ON_POSITION), RES_WRAP_INFLUENCE_ON_OBJPOS, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_WRAP_INFLUENCE}, { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 }, - //UUUU adf FillProperties for SW, same as FILL_PROPERTIES in svx + //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 metjhod and definition of SW_PROP_NMID) + // 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 FILL_PROPERTIES_SW {0,0,0,0,0,0} @@ -851,56 +887,59 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, - { SW_PROP_NMID(UNO_NAME_HEADER_BACK_COLOR), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, - // { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC), FN_UNO_HEADER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC - { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_URL), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, - { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_FILTER), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, - { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_LOCATION), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, - { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_MARGIN), FN_UNO_HEADER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, - { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_MARGIN), FN_UNO_HEADER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, - { SW_PROP_NMID(UNO_NAME_HEADER_BACK_TRANSPARENT), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, - { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_SHADOW_FORMAT), FN_UNO_HEADER_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, - { SW_PROP_NMID(UNO_NAME_HEADER_BODY_DISTANCE), FN_UNO_HEADER_BODY_DISTANCE,CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT), FN_UNO_HEADER_IS_DYNAMIC_DISTANCE,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, - { SW_PROP_NMID(UNO_NAME_HEADER_IS_SHARED), FN_UNO_HEADER_SHARE_CONTENT,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, - { SW_PROP_NMID(UNO_NAME_HEADER_HEIGHT), FN_UNO_HEADER_HEIGHT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_HEADER_IS_ON), FN_UNO_HEADER_ON, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, - { SW_PROP_NMID(UNO_NAME_HEADER_DYNAMIC_SPACING), FN_UNO_HEADER_EAT_SPACING, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 }, - - { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_COLOR), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, - // { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC), FN_UNO_FOOTER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC - { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_URL), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, - { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_FILTER), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, - { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_LOCATION), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, - { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_MARGIN), FN_UNO_FOOTER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, - { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_MARGIN), FN_UNO_FOOTER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, - { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_TRANSPARENT), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, - { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_SHADOW_FORMAT), FN_UNO_FOOTER_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, - { SW_PROP_NMID(UNO_NAME_FOOTER_BODY_DISTANCE), FN_UNO_FOOTER_BODY_DISTANCE,CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT), FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, - { SW_PROP_NMID(UNO_NAME_FOOTER_IS_SHARED), FN_UNO_FOOTER_SHARE_CONTENT,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, - { SW_PROP_NMID(UNO_NAME_FOOTER_HEIGHT), FN_UNO_FOOTER_HEIGHT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, - { SW_PROP_NMID(UNO_NAME_FOOTER_IS_ON), FN_UNO_FOOTER_ON, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, - { SW_PROP_NMID(UNO_NAME_FOOTER_DYNAMIC_SPACING), FN_UNO_FOOTER_EAT_SPACING, CPPU_E2T(CPPUTYPE_BOOLEAN), 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 + { SW_PROP_NMID(UNO_NAME_HEADER_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, + // { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC + { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, + { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, + { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, + { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, + { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, + { SW_PROP_NMID(UNO_NAME_HEADER_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, + { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, + { SW_PROP_NMID(UNO_NAME_HEADER_BODY_DISTANCE), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT), SID_ATTR_PAGE_DYNAMIC, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, + { SW_PROP_NMID(UNO_NAME_HEADER_IS_SHARED), SID_ATTR_PAGE_SHARED, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, + { SW_PROP_NMID(UNO_NAME_HEADER_HEIGHT), SID_ATTR_PAGE_SIZE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_HEADER_IS_ON), SID_ATTR_PAGE_ON, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, + { SW_PROP_NMID(UNO_NAME_HEADER_DYNAMIC_SPACING), RES_HEADER_FOOTER_EAT_SPACING, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 }, + + //UUU use real WhichIDs for Footer, see Header (above) for more infos + { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, + // { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC + { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, + { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, + { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, + { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, + { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, + { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, + { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, + { SW_PROP_NMID(UNO_NAME_FOOTER_BODY_DISTANCE), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT), SID_ATTR_PAGE_DYNAMIC, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, + { SW_PROP_NMID(UNO_NAME_FOOTER_IS_SHARED), SID_ATTR_PAGE_SHARED, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, + { SW_PROP_NMID(UNO_NAME_FOOTER_HEIGHT), SID_ATTR_PAGE_SIZE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, + { SW_PROP_NMID(UNO_NAME_FOOTER_IS_ON), SID_ATTR_PAGE_ON, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 }, + { SW_PROP_NMID(UNO_NAME_FOOTER_DYNAMIC_SPACING), RES_HEADER_FOOTER_EAT_SPACING, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 }, { SW_PROP_NMID(UNO_NAME_IS_LANDSCAPE), SID_ATTR_PAGE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_PAGE_ORIENTATION }, { SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), SID_ATTR_PAGE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_PAGE_NUMTYPE }, @@ -932,7 +971,8 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_TEXT_DISTANCE), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_TEXT_DIST |CONVERT_TWIPS }, { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_DISTANCE), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_FOOTNOTE_DIST|CONVERT_TWIPS}, { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 }, - // writing grid + + // writing grid { SW_PROP_NMID(UNO_NAME_GRID_COLOR), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_COLOR}, { SW_PROP_NMID(UNO_NAME_GRID_LINES), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_GRID_LINES}, { SW_PROP_NMID(UNO_NAME_GRID_BASE_HEIGHT), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_BASEHEIGHT|CONVERT_TWIPS}, @@ -944,6 +984,72 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_GRID_BASE_WIDTH), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_BASEWIDTH|CONVERT_TWIPS}, { SW_PROP_NMID(UNO_NAME_GRID_SNAP_TO_CHARS), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_SNAPTOCHARS}, { SW_PROP_NMID(UNO_NAME_GRID_STANDARD_PAGE_MODE), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_STANDARD_MODE}, + + //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 + FILL_PROPERTIES_SW + + //UUUU Added DrawingLayer FillStyle Properties for Header. These need an own unique name, + // but reuse the same WhichIDs as the regular fill. The implementation will decide to which + // group of fill properties it belongs based on the start of the name (was already done in + // the implementation partially), thus all SlotNames *have* to start with 'Header' + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_LOGICAL_SIZE), XATTR_FILLBMP_SIZELOG, CPPU_E2T(CPPUTYPE_BOOLEAN) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_OFFSET_X), XATTR_FILLBMP_TILEOFFSETX, CPPU_E2T(CPPUTYPE_INT32) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_OFFSET_Y), XATTR_FILLBMP_TILEOFFSETY, CPPU_E2T(CPPUTYPE_INT32) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_X), XATTR_FILLBMP_POSOFFSETX, CPPU_E2T(CPPUTYPE_INT32) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_Y), XATTR_FILLBMP_POSOFFSETY, CPPU_E2T(CPPUTYPE_INT32) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_RECTANGLE_POINT), XATTR_FILLBMP_POS, CPPU_E2T(CPPUTYPE_RECTANGLEPOINT) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_SIZE_X), XATTR_FILLBMP_SIZEX, CPPU_E2T(CPPUTYPE_INT32) , 0, SFX_METRIC_ITEM}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_SIZE_Y), XATTR_FILLBMP_SIZEY, CPPU_E2T(CPPUTYPE_INT32) , 0, SFX_METRIC_ITEM}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_STRETCH), XATTR_FILLBMP_STRETCH, CPPU_E2T(CPPUTYPE_BOOLEAN) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_TILE), XATTR_FILLBMP_TILE, CPPU_E2T(CPPUTYPE_BOOLEAN) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBMP_MODE), OWN_ATTR_FILLBMP_MODE, CPPU_E2T(CPPUTYPE_BITMAPMODE), 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLCOLOR), XATTR_FILLCOLOR, CPPU_E2T(CPPUTYPE_INT32), 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBACKGROUND), XATTR_FILLBACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBITMAP), XATTR_FILLBITMAP, CPPU_E2T(CPPUTYPE_REFBITMAP), 0, MID_BITMAP}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBITMAPNAME), XATTR_FILLBITMAP, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_NAME }, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLBITMAPURL), XATTR_FILLBITMAP, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_GRAFURL }, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLGRADIENTSTEPCOUNT), XATTR_GRADIENTSTEPCOUNT, CPPU_E2T(CPPUTYPE_INT16), 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLGRADIENT), XATTR_FILLGRADIENT, CPPU_E2T(CPPUTYPE_GRADIENT), 0, MID_FILLGRADIENT}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLGRADIENTNAME), XATTR_FILLGRADIENT, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_NAME }, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLHATCH), XATTR_FILLHATCH, CPPU_E2T(CPPUTYPE_HATCH), 0, MID_FILLHATCH}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLHATCHNAME), XATTR_FILLHATCH, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_NAME }, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLSTYLE), XATTR_FILLSTYLE, CPPU_E2T(CPPUTYPE_FILLSTYLE), 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILL_TRANSPARENCE), XATTR_FILLTRANSPARENCE, CPPU_E2T(CPPUTYPE_INT16), 0, 0}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENT), XATTR_FILLFLOATTRANSPARENCE, CPPU_E2T(CPPUTYPE_GRADIENT), 0, MID_FILLGRADIENT}, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENTNAME), XATTR_FILLFLOATTRANSPARENCE, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_NAME }, + { SW_PROP_NMID(UNO_NAME_HEADER_FILLCOLOR_2), XATTR_SECONDARYFILLCOLOR, CPPU_E2T(CPPUTYPE_INT32), 0, 0}, + + //UUUU Added DrawingLayer FillStyle Properties for Footer, similar as for Header (see there) + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_LOGICAL_SIZE), XATTR_FILLBMP_SIZELOG, CPPU_E2T(CPPUTYPE_BOOLEAN) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_OFFSET_X), XATTR_FILLBMP_TILEOFFSETX, CPPU_E2T(CPPUTYPE_INT32) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_OFFSET_Y), XATTR_FILLBMP_TILEOFFSETY, CPPU_E2T(CPPUTYPE_INT32) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_X), XATTR_FILLBMP_POSOFFSETX, CPPU_E2T(CPPUTYPE_INT32) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_Y), XATTR_FILLBMP_POSOFFSETY, CPPU_E2T(CPPUTYPE_INT32) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_RECTANGLE_POINT), XATTR_FILLBMP_POS, CPPU_E2T(CPPUTYPE_RECTANGLEPOINT) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_SIZE_X), XATTR_FILLBMP_SIZEX, CPPU_E2T(CPPUTYPE_INT32) , 0, SFX_METRIC_ITEM}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_SIZE_Y), XATTR_FILLBMP_SIZEY, CPPU_E2T(CPPUTYPE_INT32) , 0, SFX_METRIC_ITEM}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_STRETCH), XATTR_FILLBMP_STRETCH, CPPU_E2T(CPPUTYPE_BOOLEAN) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_TILE), XATTR_FILLBMP_TILE, CPPU_E2T(CPPUTYPE_BOOLEAN) , 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBMP_MODE), OWN_ATTR_FILLBMP_MODE, CPPU_E2T(CPPUTYPE_BITMAPMODE), 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLCOLOR), XATTR_FILLCOLOR, CPPU_E2T(CPPUTYPE_INT32), 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBACKGROUND), XATTR_FILLBACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBITMAP), XATTR_FILLBITMAP, CPPU_E2T(CPPUTYPE_REFBITMAP), 0, MID_BITMAP}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBITMAPNAME), XATTR_FILLBITMAP, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_NAME }, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLBITMAPURL), XATTR_FILLBITMAP, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_GRAFURL }, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLGRADIENTSTEPCOUNT), XATTR_GRADIENTSTEPCOUNT, CPPU_E2T(CPPUTYPE_INT16), 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLGRADIENT), XATTR_FILLGRADIENT, CPPU_E2T(CPPUTYPE_GRADIENT), 0, MID_FILLGRADIENT}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLGRADIENTNAME), XATTR_FILLGRADIENT, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_NAME }, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLHATCH), XATTR_FILLHATCH, CPPU_E2T(CPPUTYPE_HATCH), 0, MID_FILLHATCH}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLHATCHNAME), XATTR_FILLHATCH, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_NAME }, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLSTYLE), XATTR_FILLSTYLE, CPPU_E2T(CPPUTYPE_FILLSTYLE), 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILL_TRANSPARENCE), XATTR_FILLTRANSPARENCE, CPPU_E2T(CPPUTYPE_INT16), 0, 0}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT), XATTR_FILLFLOATTRANSPARENCE, CPPU_E2T(CPPUTYPE_GRADIENT), 0, MID_FILLGRADIENT}, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME), XATTR_FILLFLOATTRANSPARENCE, CPPU_E2T(CPPUTYPE_OUSTRING), 0, MID_NAME }, + { SW_PROP_NMID(UNO_NAME_FOOTER_FILLCOLOR_2), XATTR_SECONDARYFILLCOLOR, CPPU_E2T(CPPUTYPE_INT32), 0, 0}, + {0,0,0,0,0,0} }; aMapEntriesArr[nPropertyId] = aPageStyleMap; @@ -1174,9 +1280,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_WIDTH_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_WIDTH_TYPE }, { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 }, - //UUUU adf FillProperties for SW, same as FILL_PROPERTIES in svx + //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 metjhod and definition of SW_PROP_NMID) + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to FlyFrame import/export FILL_PROPERTIES_SW {0,0,0,0,0,0} @@ -1187,7 +1294,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s case PROPERTY_MAP_TEXT_GRAPHIC: { static SfxItemPropertyMapEntry aGraphicPropertyMap_Impl[] = - { + { //UUUU + // evtl. completely remove SvxBrushItem stuff () + // add support for XATTR_FILL_FIRST, XATTR_FILL_LAST + // COMMON_FRAME_PROPERTIES currently hosts the RES_BACKGROUND entries from SvxBrushItem COMMON_FRAME_PROPERTIES { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR }, { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE }, @@ -1214,6 +1324,13 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_GRAPHIC_IS_INVERTED), RES_GRFATR_INVERT, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, 0}, { SW_PROP_NMID(UNO_NAME_TRANSPARENCY), RES_GRFATR_TRANSPARENCY, CPPU_E2T(CPPUTYPE_INT16), 0, 0}, { SW_PROP_NMID(UNO_NAME_GRAPHIC_COLOR_MODE), RES_GRFATR_DRAWMODE, CPPU_E2T(CPPUTYPE_COLORMODE), 0, 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 Writer GraphicObject import/export + FILL_PROPERTIES_SW + {0,0,0,0,0,0} }; aMapEntriesArr[nPropertyId] = aGraphicPropertyMap_Impl; @@ -1222,7 +1339,10 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s case PROPERTY_MAP_EMBEDDED_OBJECT: { static SfxItemPropertyMapEntry aEmbeddedPropertyMap_Impl[] = - { + { //UUUU + // evtl. completely remove SvxBrushItem stuff () + // add support for XATTR_FILL_FIRST, XATTR_FILL_LAST + // COMMON_FRAME_PROPERTIES currently hosts the RES_BACKGROUND entries from SvxBrushItem COMMON_FRAME_PROPERTIES { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR }, { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE}, @@ -1237,6 +1357,13 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { SW_PROP_NMID(UNO_NAME_COMPONENT),FN_UNO_COMPONENT, CPPU_E2T(CPPUTYPE_REFCOMPONENT), PropertyAttribute::READONLY, 0}, { SW_PROP_NMID(UNO_NAME_EMBEDDED_OBJECT),FN_EMBEDDED_OBJECT, CPPU_E2T(CPPUTPYE_REFEMBEDDEDOBJECT), PropertyAttribute::READONLY, 0}, // { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 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 OLE/EmbeddedObject import/export + FILL_PROPERTIES_SW + {0,0,0,0,0,0} }; aMapEntriesArr[nPropertyId] = aEmbeddedPropertyMap_Impl; diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index c7968ce65fa6..9df686af04b7 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" @@ -52,11 +50,17 @@ #include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/TextContentAnchorType.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; using ::rtl::OUString; - /* -----------------------------01.12.00 18:09-------------------------------- ---------------------------------------------------------------------------*/ @@ -174,6 +178,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< ::rtl::OUString >& rPropertyNames, @@ -481,6 +492,99 @@ throw (beans::PropertyVetoException, lang::IllegalArgumentException, /* -----------------------------02.04.01 11:43-------------------------------- ---------------------------------------------------------------------------*/ + +//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.pType && *(rEntry.pType) == ::getCppuType((const sal_Int16*)0) && *(rEntry.pType) != 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, @@ -514,8 +618,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]); } } } @@ -797,8 +901,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); } } @@ -931,61 +1035,107 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, //----------------------------------------------------------------------------- beans::PropertyState lcl_SwXParagraph_getPropertyState( -// SwUnoCrsr& rUnoCrsr, - const SwTxtNode& rTxtNode, - const SwAttrSet** ppSet, - const SfxItemPropertySimpleEntry& rEntry, - sal_Bool &rAttrSetFetched ) -throw (beans::UnknownPropertyException) + // SwUnoCrsr& rUnoCrsr, + const SwTxtNode& rTxtNode, + const SwAttrSet** ppSet, + const SfxItemPropertySimpleEntry& rEntry, + sal_Bool &rAttrSetFetched) + throw (beans::UnknownPropertyException) { - beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE; + beans::PropertyState eRet(beans::PropertyState_DEFAULT_VALUE); - if(!(*ppSet) && !rAttrSetFetched ) + if(!(*ppSet) && !rAttrSetFetched) { (*ppSet) = rTxtNode.GetpSwAttrSet(); rAttrSetFetched = sal_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: { String sVal; - SwUnoCursorHelper::GetCurPageStyle( aPam, sVal ); - eRet = sVal.Len() ? beans::PropertyState_DIRECT_VALUE - : beans::PropertyState_AMBIGUOUS_VALUE; + SwUnoCursorHelper::GetCurPageStyle(aPam,sVal); + eRet = sVal.Len() ? beans::PropertyState_DIRECT_VALUE : beans::PropertyState_AMBIGUOUS_VALUE; + bDone = true; + break; } - break; - lcl_SwXParagraph_getPropertyStateDEFAULT: - default: - if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rEntry.nWID, sal_False)) + + //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,sal_False)) + { eRet = beans::PropertyState_DIRECT_VALUE; - break; + } } + return eRet; } @@ -1102,10 +1252,24 @@ throw (beans::UnknownPropertyException, uno::RuntimeException) 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) { SvUShortsSort 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, sal_True, &aWhichIds); @@ -1116,20 +1280,24 @@ throw (beans::UnknownPropertyException, uno::RuntimeException) // to paragraph boundaries SwPosition aStart( *aCursor.Start() ); SwPosition aEnd ( *aCursor.End() ); - ::std::auto_ptr<SwUnoCrsr> pTemp( - aCursor.GetDoc()->CreateUnoCrsr(aStart, sal_False) ); + ::std::auto_ptr<SwUnoCrsr> pTemp( aCursor.GetDoc()->CreateUnoCrsr(aStart, sal_False) ); + if(!SwUnoCursorHelper::IsStartOfPara(*pTemp)) { 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, sal_True, &aWhichIds); } } @@ -1167,10 +1335,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/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index c74c0ba61572..024981084c01 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -781,32 +781,87 @@ const SwPropNameTab aPropNameTab = { /* 0743 UNO_NAME_INITIALS */ {MAP_CHAR_LEN("Initials")}, //UUUU names for FillAttributes from SVX; use already existing string defines from editengine -/* 0744 UNO_NAME_FILLBMP_LOGICAL_SIZE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_LOGICAL_SIZE)}, -/* 0745 UNO_NAME_FILLBMP_OFFSET_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_X)}, -/* 0746 UNO_NAME_FILLBMP_OFFSET_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_Y)}, -/* 0747 UNO_NAME_FILLBMP_POSITION_OFFSET_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_X)}, -/* 0748 UNO_NAME_FILLBMP_POSITION_OFFSET_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_Y)}, -/* 0749 UNO_NAME_FILLBMP_RECTANGLE_POINT */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_RECTANGLE_POINT)}, -/* 0750 UNO_NAME_FILLBMP_SIZE_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_X)}, -/* 0751 UNO_NAME_FILLBMP_SIZE_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_Y)}, -/* 0752 UNO_NAME_FILLBMP_STRETCH */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_STRETCH)}, -/* 0753 UNO_NAME_FILLBMP_TILE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_TILE)}, -/* 0754 UNO_NAME_FILLBMP_MODE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_MODE)}, -/* 0755 UNO_NAME_FILLCOLOR */ {MAP_CHAR_LEN(UNO_NAME_FILLCOLOR)}, -/* 0756 UNO_NAME_FILLBACKGROUND */ {MAP_CHAR_LEN(UNO_NAME_FILLBACKGROUND)}, -/* 0757 UNO_NAME_FILLBITMAP */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAP)}, -/* 0758 UNO_NAME_FILLBITMAPNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAPNAME)}, -/* 0759 UNO_NAME_FILLBITMAPURL */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAPURL)}, -/* 0760 UNO_NAME_FILLGRADIENTSTEPCOUNT */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENTSTEPCOUNT)}, -/* 0761 UNO_NAME_FILLGRADIENT */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENT)}, -/* 0762 UNO_NAME_FILLGRADIENTNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENTNAME)}, -/* 0763 UNO_NAME_FILLHATCH */ {MAP_CHAR_LEN(UNO_NAME_FILLHATCH)}, -/* 0764 UNO_NAME_FILLHATCHNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLHATCHNAME)}, -/* 0765 UNO_NAME_FILLSTYLE */ {MAP_CHAR_LEN(UNO_NAME_FILLSTYLE)}, -/* 0766 UNO_NAME_FILL_TRANSPARENCE */ {MAP_CHAR_LEN(UNO_NAME_FILL_TRANSPARENCE)}, -/* 0767 UNO_NAME_FILLTRANSPARENCEGRADIENT */ {MAP_CHAR_LEN(UNO_NAME_FILLTRANSPARENCEGRADIENT)}, -/* 0768 UNO_NAME_FILLTRANSPARENCEGRADIENTNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLTRANSPARENCEGRADIENTNAME)}, -/* 0769 UNO_NAME_FILLCOLOR_2 */ {MAP_CHAR_LEN(UNO_NAME_FILLCOLOR_2)} +/* 0744 UNO_NAME_SW_FILLBMP_LOGICAL_SIZE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_LOGICAL_SIZE)}, +/* 0745 UNO_NAME_SW_FILLBMP_OFFSET_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_X)}, +/* 0746 UNO_NAME_SW_FILLBMP_OFFSET_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_OFFSET_Y)}, +/* 0747 UNO_NAME_SW_FILLBMP_POSITION_OFFSET_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_X)}, +/* 0748 UNO_NAME_SW_FILLBMP_POSITION_OFFSET_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_POSITION_OFFSET_Y)}, +/* 0749 UNO_NAME_SW_FILLBMP_RECTANGLE_POINT */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_RECTANGLE_POINT)}, +/* 0750 UNO_NAME_SW_FILLBMP_SIZE_X */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_X)}, +/* 0751 UNO_NAME_SW_FILLBMP_SIZE_Y */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_SIZE_Y)}, +/* 0752 UNO_NAME_SW_FILLBMP_STRETCH */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_STRETCH)}, +/* 0753 UNO_NAME_SW_FILLBMP_TILE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_TILE)}, +/* 0754 UNO_NAME_SW_FILLBMP_MODE */ {MAP_CHAR_LEN(UNO_NAME_FILLBMP_MODE)}, +/* 0755 UNO_NAME_SW_FILLCOLOR */ {MAP_CHAR_LEN(UNO_NAME_FILLCOLOR)}, +/* 0756 UNO_NAME_SW_FILLBACKGROUND */ {MAP_CHAR_LEN(UNO_NAME_FILLBACKGROUND)}, +/* 0757 UNO_NAME_SW_FILLBITMAP */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAP)}, +/* 0758 UNO_NAME_SW_FILLBITMAPNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAPNAME)}, +/* 0759 UNO_NAME_SW_FILLBITMAPURL */ {MAP_CHAR_LEN(UNO_NAME_FILLBITMAPURL)}, +/* 0760 UNO_NAME_SW_FILLGRADIENTSTEPCOUNT */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENTSTEPCOUNT)}, +/* 0761 UNO_NAME_SW_FILLGRADIENT */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENT)}, +/* 0762 UNO_NAME_SW_FILLGRADIENTNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLGRADIENTNAME)}, +/* 0763 UNO_NAME_SW_FILLHATCH */ {MAP_CHAR_LEN(UNO_NAME_FILLHATCH)}, +/* 0764 UNO_NAME_SW_FILLHATCHNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLHATCHNAME)}, +/* 0765 UNO_NAME_SW_FILLSTYLE */ {MAP_CHAR_LEN(UNO_NAME_FILLSTYLE)}, +/* 0766 UNO_NAME_SW_FILL_TRANSPARENCE */ {MAP_CHAR_LEN(UNO_NAME_FILL_TRANSPARENCE)}, +/* 0767 UNO_NAME_SW_FILLTRANSPARENCEGRADIENT */ {MAP_CHAR_LEN(UNO_NAME_FILLTRANSPARENCEGRADIENT)}, +/* 0768 UNO_NAME_SW_FILLTRANSPARENCEGRADIENTNAME */ {MAP_CHAR_LEN(UNO_NAME_FILLTRANSPARENCEGRADIENTNAME)}, +/* 0769 UNO_NAME_SW_FILLCOLOR_2 */ {MAP_CHAR_LEN(UNO_NAME_FILLCOLOR_2)}, + +/* 0770 UNO_NAME_HEADER_FILLBMP_LOGICAL_SIZE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_LOGICAL_SIZE)}, +/* 0771 UNO_NAME_HEADER_FILLBMP_OFFSET_X */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_OFFSET_X)}, +/* 0772 UNO_NAME_HEADER_FILLBMP_OFFSET_Y */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_OFFSET_Y)}, +/* 0773 UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_X */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_POSITION_OFFSET_X)}, +/* 0774 UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_Y */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_POSITION_OFFSET_Y)}, +/* 0775 UNO_NAME_HEADER_FILLBMP_RECTANGLE_POINT */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_RECTANGLE_POINT)}, +/* 0776 UNO_NAME_HEADER_FILLBMP_SIZE_X */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_SIZE_X)}, +/* 0777 UNO_NAME_HEADER_FILLBMP_SIZE_Y */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_SIZE_Y)}, +/* 0778 UNO_NAME_HEADER_FILLBMP_STRETCH */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_STRETCH)}, +/* 0779 UNO_NAME_HEADER_FILLBMP_TILE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_TILE)}, +/* 0780 UNO_NAME_HEADER_FILLBMP_MODE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBMP_MODE)}, +/* 0781 UNO_NAME_HEADER_FILLCOLOR */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLCOLOR)}, +/* 0782 UNO_NAME_HEADER_FILLBACKGROUND */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBACKGROUND)}, +/* 0783 UNO_NAME_HEADER_FILLBITMAP */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBITMAP)}, +/* 0784 UNO_NAME_HEADER_FILLBITMAPNAME */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBITMAPNAME)}, +/* 0785 UNO_NAME_HEADER_FILLBITMAPURL */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLBITMAPURL)}, +/* 0786 UNO_NAME_HEADER_FILLGRADIENTSTEPCOUNT */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLGRADIENTSTEPCOUNT)}, +/* 0787 UNO_NAME_HEADER_FILLGRADIENT */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLGRADIENT)}, +/* 0788 UNO_NAME_HEADER_FILLGRADIENTNAME */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLGRADIENTNAME)}, +/* 0789 UNO_NAME_HEADER_FILLHATCH */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLHATCH)}, +/* 0790 UNO_NAME_HEADER_FILLHATCHNAME */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLHATCHNAME)}, +/* 0791 UNO_NAME_HEADER_FILLSTYLE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLSTYLE)}, +/* 0792 UNO_NAME_HEADER_FILL_TRANSPARENCE */ {MAP_CHAR_LEN("Header" UNO_NAME_FILL_TRANSPARENCE)}, +/* 0793 UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENT */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLTRANSPARENCEGRADIENT)}, +/* 0794 UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENTNAME */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME)}, +/* 0795 UNO_NAME_HEADER_FILLCOLOR_2 */ {MAP_CHAR_LEN("Header" UNO_NAME_FILLCOLOR_2)}, + +/* 0776 UNO_NAME_FOOTER_FILLBMP_LOGICAL_SIZE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_LOGICAL_SIZE)}, +/* 0777 UNO_NAME_FOOTER_FILLBMP_OFFSET_X */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_OFFSET_X)}, +/* 0778 UNO_NAME_FOOTER_FILLBMP_OFFSET_Y */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_OFFSET_Y)}, +/* 0779 UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_X */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_POSITION_OFFSET_X)}, +/* 0780 UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_Y */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_POSITION_OFFSET_Y)}, +/* 0781 UNO_NAME_FOOTER_FILLBMP_RECTANGLE_POINT */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_RECTANGLE_POINT)}, +/* 0782 UNO_NAME_FOOTER_FILLBMP_SIZE_X */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_SIZE_X)}, +/* 0783 UNO_NAME_FOOTER_FILLBMP_SIZE_Y */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_SIZE_Y)}, +/* 0784 UNO_NAME_FOOTER_FILLBMP_STRETCH */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_STRETCH)}, +/* 0785 UNO_NAME_FOOTER_FILLBMP_TILE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_TILE)}, +/* 0786 UNO_NAME_FOOTER_FILLBMP_MODE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBMP_MODE)}, +/* 0787 UNO_NAME_FOOTER_FILLCOLOR */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLCOLOR)}, +/* 0788 UNO_NAME_FOOTER_FILLBACKGROUND */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBACKGROUND)}, +/* 0789 UNO_NAME_FOOTER_FILLBITMAP */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBITMAP)}, +/* 0790 UNO_NAME_FOOTER_FILLBITMAPNAME */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBITMAPNAME)}, +/* 0791 UNO_NAME_FOOTER_FILLBITMAPURL */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLBITMAPURL)}, +/* 0792 UNO_NAME_FOOTER_FILLGRADIENTSTEPCOUNT */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLGRADIENTSTEPCOUNT)}, +/* 0793 UNO_NAME_FOOTER_FILLGRADIENT */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLGRADIENT)}, +/* 0794 UNO_NAME_FOOTER_FILLGRADIENTNAME */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLGRADIENTNAME)}, +/* 0795 UNO_NAME_FOOTER_FILLHATCH */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLHATCH)}, +/* 0796 UNO_NAME_FOOTER_FILLHATCHNAME */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLHATCHNAME)}, +/* 0797 UNO_NAME_FOOTER_FILLSTYLE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLSTYLE)}, +/* 0798 UNO_NAME_FOOTER_FILL_TRANSPARENCE */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILL_TRANSPARENCE)}, +/* 0799 UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLTRANSPARENCEGRADIENT)}, +/* 0800 UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME)}, +/* 0801 UNO_NAME_FOOTER_FILLCOLOR_2 */ {MAP_CHAR_LEN("Footer" UNO_NAME_FILLCOLOR_2)} + }; const SwPropNameLen& SwGetPropName( sal_uInt16 nId ) diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index df0a4a10872d..ca2ceeb8c990 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -2167,29 +2167,24 @@ void SwXNumberingRules::SetNumberingRuleByIndex( OUString uTmp; pData->aVal >>= uTmp; String sStyleName; - SwStyleNameMapper::FillUIName(uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True ); + SwStyleNameMapper::FillUIName( uTmp, sStyleName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True ); const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls(); const sal_uInt16 nCount = pColls->Count(); - for(sal_uInt16 k = 0; k < nCount; ++k) + for ( sal_uInt16 k = 0; k < nCount; ++k ) { - SwTxtFmtColl &rTxtColl = *((*pColls)[k]); - if(rTxtColl.IsDefault()) + SwTxtFmtColl &rTxtColl = *( ( *pColls )[k] ); + if ( rTxtColl.IsDefault() ) continue; - //if(rTxtColl.GetOutlineLevel() == nIndex && //#outline level,removed by zhaojianwei - // rTxtColl.GetName() != sStyleName) - // rTxtColl..SetOutlineLevel(NO_NUMBERING); - //else if(rTxtColl.GetName() == sStyleName) - // rTxtColl.SetOutlineLevel(sal_Int8(nIndex)); - if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && //add by zhaojianwei - rTxtColl.GetAssignedOutlineStyleLevel() == nIndex && - rTxtColl.GetName() != sStyleName ) + if ( rTxtColl.IsAssignedToListLevelOfOutlineStyle() + && rTxtColl.GetAssignedOutlineStyleLevel() == nIndex + && rTxtColl.GetName() != sStyleName ) { rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle(); } else if ( rTxtColl.GetName() == sStyleName ) { rTxtColl.AssignToListLevelOfOutlineStyle( nIndex ); - } //<-end,,zhaojianwei, + } } } break; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index e6eb8cce0fe3..45bc45b75cec 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" @@ -76,12 +74,14 @@ #include <numrule.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> @@ -124,47 +124,6 @@ using ::rtl::OUString; * ******************************************************************************/ -//convert FN_... to RES_ in header and footer itemset -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_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; - -} - SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum ( SfxStyleFamily eFamily ) { switch ( eFamily ) @@ -1737,99 +1696,138 @@ void SwXStyle::ApplyDescriptorProperties() /*-- 18.04.01 13:07:27--------------------------------------------------- -----------------------------------------------------------------------*/ -struct SwStyleBase_Impl +class SwStyleBase_Impl { - SwDoc& rDoc; +private: + SwDoc& mrDoc; + const SwPageDesc* mpOldPageDesc; + rtl::Reference< SwDocStyleSheet > mxNewBase; + SfxItemSet* mpItemSet; + const String& mrStyleName; + sal_uInt16 mnPDescPos; + const SwAttrSet* mpParentStyle; - const SwPageDesc* pOldPageDesc; +public: + SwStyleBase_Impl( + SwDoc& rSwDoc, + const String& rName, + const SwAttrSet* pParentStyle) + : mrDoc(rSwDoc), + mpOldPageDesc(0), + mxNewBase(), + mpItemSet(0), + mrStyleName(rName), + mnPDescPos(0xffff), + mpParentStyle(pParentStyle) + { + } - rtl::Reference< SwDocStyleSheet > mxNewBase; - SfxItemSet* pItemSet; + ~SwStyleBase_Impl() + { + delete mpItemSet; + } - const String& rStyleName; - sal_uInt16 nPDescPos; + rtl::Reference< SwDocStyleSheet >& getNewBase() + { + return mxNewBase; + } - SwStyleBase_Impl(SwDoc& rSwDoc, const String& rName) : - rDoc(rSwDoc), - pOldPageDesc(0), - pItemSet(0), - rStyleName(rName), - nPDescPos(0xffff) - {} + void setNewBase(SwDocStyleSheet* pNew) + { + mxNewBase = pNew; + } - ~SwStyleBase_Impl(){ delete pItemSet; } + sal_Bool HasItemSet() + { + return mxNewBase.is(); + } + + SfxItemSet* replaceItemSet(SfxItemSet* pNew) + { + SfxItemSet* pRetval = mpItemSet; + mpItemSet = pNew; + return pRetval; + } - sal_Bool HasItemSet() {return mxNewBase.is();} SfxItemSet& GetItemSet() + { + DBG_ASSERT(mxNewBase.is(), "no SwDocStyleSheet available"); + + if(!mpItemSet) { - DBG_ASSERT(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); + } } - const SwPageDesc& GetOldPageDesc(); + return *mpItemSet; + } + + const SwPageDesc& GetOldPageDesc(); }; /* -----------------------------25.04.01 12:44-------------------------------- ---------------------------------------------------------------------------*/ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc() { - if(!pOldPageDesc) + if(!mpOldPageDesc) { sal_uInt16 i; - sal_uInt16 nPDescCount = rDoc.GetPageDescCnt(); + sal_uInt16 nPDescCount = mrDoc.GetPageDescCnt(); for(i = 0; i < nPDescCount; i++) { const SwPageDesc& rDesc = - const_cast<const SwDoc &>(rDoc).GetPageDesc( i ); - if(rDesc.GetName() == rStyleName) + const_cast<const SwDoc &>(mrDoc).GetPageDesc( i ); + if(rDesc.GetName() == mrStyleName) { - pOldPageDesc = & rDesc; - nPDescPos = i; + mpOldPageDesc = & rDesc; + mnPDescPos = i; break; } } - if(!pOldPageDesc) + if(!mpOldPageDesc) { for(i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i) { const String aFmtName(SW_RES(i)); - if(aFmtName == rStyleName) + if(aFmtName == 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; } } for(i = 0; i < nPDescCount + 1; i++) { const SwPageDesc& rDesc = - const_cast<const SwDoc &>(rDoc).GetPageDesc( i ); - if(rDesc.GetName() == rStyleName) + const_cast<const SwDoc &>(mrDoc).GetPageDesc( i ); + if(rDesc.GetName() == mrStyleName) { - nPDescPos = i; + mnPDescPos = i; break; } } } } - return *pOldPageDesc; + return *mpOldPageDesc; } /* -----------------------------19.04.01 09:44-------------------------------- ---------------------------------------------------------------------------*/ -void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, - const SfxItemPropertySet& rPropSet, - const uno::Any& rValue, - SwStyleBase_Impl& rBase, - SfxStyleSheetBasePool* pBasePool, - SwDoc* pDoc, - SfxStyleFamily eFamily) - throw(beans::PropertyVetoException, lang::IllegalArgumentException, - lang::WrappedTargetException, uno::RuntimeException) - +void lcl_SetStyleProperty( + const SfxItemPropertySimpleEntry& rEntry, + const SfxItemPropertySet& rPropSet, + const uno::Any& rValue, + SwStyleBase_Impl& rBase, + SfxStyleSheetBasePool* pBasePool, + SwDoc* pDoc, + SfxStyleFamily eFamily) +throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { //UUUU adapted switch logic to a more readable state; removed goto's and made // execution of standard setting of proerty in ItemSet dependent of this variable @@ -1870,18 +1868,18 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, switch(rEntry.nWID) { - 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(); @@ -1893,6 +1891,20 @@ 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; } @@ -1900,7 +1912,7 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, { //UUUU SfxItemSet& rStyleSet = rBase.GetItemSet(); - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND)); SvxBrushItem aChangedBrushItem(aOriginalBrushItem); aChangedBrushItem.PutValue(aValue, nMemberId); @@ -2053,7 +2065,7 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, aSetRule.Set( i, &aFmt ); } } - rBase.mxNewBase->SetNumRule(aSetRule); + rBase.getNewBase()->SetNumRule(aSetRule); } } else @@ -2062,34 +2074,25 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, bDone = true; break; } - // case FN_UNO_DEFAULT_OUTLINE_LEVEL: //#outline level,removed by zahojianwei - //{ - // sal_Int8 nLevel = 0; - // if( aValue >>= nLevel ) - // rBase.mxNewBase->GetCollection()->SetOutlineLevel( nLevel ); - // else - // rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING ); - // - // bDone = true; - // break; - //} - case RES_PARATR_OUTLINELEVEL: //add by zahojianwei + + case RES_PARATR_OUTLINELEVEL: { sal_Int16 nLevel = 0; aValue >>= nLevel; if( 0 <= nLevel && nLevel <= MAXLEVEL) - rBase.mxNewBase->GetCollection()->SetAttrOutlineLevel( nLevel ); + rBase.getNewBase()->GetCollection()->SetAttrOutlineLevel( nLevel ); bDone = true; - break; //<-end,zhaojianwei + break; } + case FN_UNO_FOLLOW_STYLE: { OUString sTmp; aValue >>= sTmp; String aString; SwStyleNameMapper::FillUIName(sTmp, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True ) ; - rBase.mxNewBase->SetFollow( aString ); + rBase.getNewBase()->SetFollow( aString ); bDone = true; break; @@ -2151,9 +2154,9 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, { sal_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; @@ -2214,7 +2217,7 @@ 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; @@ -2243,7 +2246,7 @@ 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; } @@ -2345,9 +2348,9 @@ 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; @@ -2355,8 +2358,8 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, if ( sNewNumberingRuleName.getLength() == 0 || sTmp != pDoc->GetOutlineNumRule()->GetName() ) { // delete assignment to list level of outline style. - //rBase.mxNewBase->GetCollection()->SetOutlineLevel( NO_NUMBERING ); //#outline level,removed by zhaojianwei - rBase.mxNewBase->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,adde by zhaojianwei + //rBase.getNewBase()->GetCollection()->SetOutlineLevel( NO_NUMBERING ); //#outline level,removed by zhaojianwei + rBase.getNewBase()->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,adde by zhaojianwei } } } @@ -2367,31 +2370,34 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, void SAL_CALL SwXStyle::SetPropertyValues_Impl( const uno::Sequence< OUString >& rPropertyNames, const uno::Sequence< uno::Any >& rValues ) - throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, - lang::WrappedTargetException, uno::RuntimeException) +throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { 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 *pMap = 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, sStyleName, &GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); //UUUU add pDfltTxtFmtColl as parent - SwStyleBase_Impl aBaseImpl(*m_pDoc, sStyleName); if(pBasePool) { sal_uInt16 nSaveMask = pBasePool->GetSearchMask(); @@ -2399,43 +2405,50 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl( SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName); pBasePool->SetSearchMask(eFamily, nSaveMask ); DBG_ASSERT(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 = pMap->getByName( pNames[nProp]); + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pNames[nProp]); if(!pEntry || (!bIsConditional && pNames[nProp].equalsAsciiL(SW_PROP_NAME(UNO_NAME_PARA_STYLE_CONDITIONS)))) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "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( const uno::Sequence< OUString >& rPropertyNames, const uno::Sequence< uno::Any >& rValues ) - throw(beans::PropertyVetoException, lang::IllegalArgumentException, - lang::WrappedTargetException, uno::RuntimeException) +throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); @@ -2455,12 +2468,14 @@ void SwXStyle::setPropertyValues( } -uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, - const SfxItemPropertySet& rPropSet, - SwStyleBase_Impl& rBase, - SfxStyleSheetBase* pBase, - SfxStyleFamily eFamily, - SwDoc *pDoc) throw(uno::RuntimeException) +uno::Any lcl_GetStyleProperty( + const SfxItemPropertySimpleEntry& rEntry, + const SfxItemPropertySet& rPropSet, + SwStyleBase_Impl& rBase, + SfxStyleSheetBase* pBase, + SfxStyleFamily eFamily, + SwDoc *pDoc) +throw(uno::RuntimeException) { uno::Any aRet; @@ -2480,9 +2495,9 @@ 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 @@ -2516,7 +2531,7 @@ 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(); DBG_ASSERT(pRule, "Wo ist die NumRule?"); uno::Reference< container::XIndexReplace > xRules = new SwXNumberingRules(*pRule); @@ -2528,7 +2543,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, //case FN_UNO_DEFAULT_OUTLINE_LEVEL: //#outline level,removed by zahojianwei //{ // DBG_ASSERT( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" ); - // sal_uInt8 nLevel = rBase.mxNewBase->GetCollection()->GetOutlineLevel(); + // sal_uInt8 nLevel = rBase.getNewBase()->GetCollection()->GetOutlineLevel(); // if( nLevel != NO_NUMBERING ) // aRet <<= static_cast<sal_Int8>( nLevel ); // bDone = true; @@ -2537,7 +2552,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, case RES_PARATR_OUTLINELEVEL: //add by zahojianwei { DBG_ASSERT( 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; @@ -2547,7 +2562,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, { String aString; - SwStyleNameMapper::FillProgName(rBase.mxNewBase->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True); + SwStyleNameMapper::FillProgName(rBase.getNewBase()->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True); aRet <<= OUString( aString ); bDone = true; break; @@ -2578,9 +2593,9 @@ 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; @@ -2588,7 +2603,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_DISPLAY_NAME: { - OUString sName(rBase.mxNewBase->GetDisplayName()); + OUString sName(rBase.getNewBase()->GetDisplayName()); aRet <<= sName; bDone = true; @@ -2629,7 +2644,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_CATEGORY: { - sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId(); + sal_uInt16 nPoolId = rBase.getNewBase()->GetCollection()->GetPoolFmtId(); short nRet = -1; switch ( COLL_GET_RANGE_BITS & nPoolId ) @@ -2660,7 +2675,7 @@ 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; String aString; if( pPageDesc ) @@ -2677,7 +2692,7 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, { //UUUU const SfxItemSet& rSet = rBase.GetItemSet(); - const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); if(!aOriginalBrushItem.QueryValue(aRet, nMemberId)) { @@ -2772,35 +2787,38 @@ uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, ---------------------------------------------------------------------------*/ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( - const uno::Sequence< OUString > & rPropertyNames ) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) + const uno::Sequence< OUString > & rPropertyNames ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { 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 *pMap = pPropSet->getPropertyMap(); - const OUString* pNames = rPropertyNames.getConstArray(); uno::Sequence< uno::Any > aRet(rPropertyNames.getLength()); uno::Any* pRet = aRet.getArray(); - SwStyleBase_Impl aBase(*m_pDoc, sStyleName); + SwStyleBase_Impl aBase(*m_pDoc, sStyleName, &GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); //UUUU add pDfltTxtFmtColl as parent SfxStyleSheetBase* pBase = 0; + for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( pNames[nProp]); if(!pEntry || (!bIsConditional && pNames[nProp].equalsAsciiL(SW_PROP_NAME(UNO_NAME_PARA_STYLE_CONDITIONS)))) throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + if(pBasePool) { if(!pBase) @@ -2810,6 +2828,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( pBase = pBasePool->Find(sStyleName); pBasePool->SetSearchMask(eFamily, nSaveMask ); } + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, eFamily, GetDoc() ); } else if(bIsDescriptor) @@ -2869,7 +2888,8 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( ---------------------------------------------------------------------------*/ uno::Sequence< uno::Any > SwXStyle::getPropertyValues( - const uno::Sequence< OUString >& rPropertyNames ) throw(uno::RuntimeException) + const uno::Sequence< OUString >& rPropertyNames ) +throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); uno::Sequence< uno::Any > aValues; @@ -2895,7 +2915,7 @@ uno::Sequence< uno::Any > SwXStyle::getPropertyValues( void SwXStyle::addPropertiesChangeListener( const uno::Sequence< OUString >& /*aPropertyNames*/, const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) - throw(uno::RuntimeException) +throw(uno::RuntimeException) { } /*-- 18.04.01 13:07:30--------------------------------------------------- @@ -2903,7 +2923,7 @@ void SwXStyle::addPropertiesChangeListener( -----------------------------------------------------------------------*/ void SwXStyle::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) - throw(uno::RuntimeException) +throw(uno::RuntimeException) { } /*-- 18.04.01 13:07:30--------------------------------------------------- @@ -2912,29 +2932,29 @@ void SwXStyle::removePropertiesChangeListener( void SwXStyle::firePropertiesChangeEvent( const uno::Sequence< OUString >& /*aPropertyNames*/, const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) - throw(uno::RuntimeException) +throw(uno::RuntimeException) { } /*-- 17.12.98 08:26:53--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue) - throw( beans::UnknownPropertyException, - beans::PropertyVetoException, - lang::IllegalArgumentException, - lang::WrappedTargetException, - uno::RuntimeException) +void SwXStyle::setPropertyValue( + const OUString& rPropertyName, + const uno::Any& rValue) +throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); const uno::Sequence<OUString> aProperties(&rPropertyName, 1); const uno::Sequence<uno::Any> aValues(&rValue, 1); + SetPropertyValues_Impl( aProperties, aValues ); } /*-- 17.12.98 08:26:53--------------------------------------------------- -----------------------------------------------------------------------*/ -uno::Any SwXStyle::getPropertyValue(const OUString& rPropertyName) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +uno::Any SwXStyle::getPropertyValue( + const OUString& rPropertyName) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); const uno::Sequence<OUString> aProperties(&rPropertyName, 1); @@ -2944,36 +2964,40 @@ uno::Any SwXStyle::getPropertyValue(const OUString& rPropertyName) /*-- 17.12.98 08:26:53--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXStyle::addPropertyChangeListener(const OUString& /*rPropertyName*/, +void SwXStyle::addPropertyChangeListener( + const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { DBG_WARNING("not implemented"); } /*-- 17.12.98 08:26:54--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXStyle::removePropertyChangeListener(const OUString& /*rPropertyName*/, +void SwXStyle::removePropertyChangeListener( + const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { DBG_WARNING("not implemented"); } /*-- 17.12.98 08:26:54--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXStyle::addVetoableChangeListener(const OUString& /*rPropertyName*/, +void SwXStyle::addVetoableChangeListener( + const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { DBG_WARNING("not implemented"); } /*-- 17.12.98 08:26:54--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXStyle::removeVetoableChangeListener(const OUString& /*rPropertyName*/, +void SwXStyle::removeVetoableChangeListener( + const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { DBG_WARNING("not implemented"); } @@ -2981,11 +3005,11 @@ void SwXStyle::removeVetoableChangeListener(const OUString& /*rPropertyName*/, /*-- 08.03.99 10:50:26--------------------------------------------------- -----------------------------------------------------------------------*/ -beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName) - throw( beans::UnknownPropertyException, uno::RuntimeException ) +beans::PropertyState SwXStyle::getPropertyState( + const OUString& rPropertyName) +throw( beans::UnknownPropertyException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); - uno::Sequence< OUString > aNames(1); OUString* pNames = aNames.getArray(); pNames[0] = rPropertyName; @@ -2995,13 +3019,15 @@ beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName) /*-- 08.03.99 10:50:27--------------------------------------------------- -----------------------------------------------------------------------*/ + uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( const uno::Sequence< OUString >& rPropertyNames) - throw( beans::UnknownPropertyException, uno::RuntimeException ) +throw( beans::UnknownPropertyException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength()); beans::PropertyState* pStates = aRet.getArray(); + if(pBasePool) { pBasePool->SetSearchMask(eFamily ); @@ -3013,75 +3039,110 @@ 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 *pMap = pPropSet->getPropertyMap(); + const SfxItemSet& rSet = xStyle->GetItemSet(); - SfxItemSet aSet = xStyle->GetItemSet(); for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) { const String& rPropName = pNames[i]; const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( rPropName); + bool bDone(false); + if(!pEntry) + { throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, 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( FN_UNO_DEFAULT_OUTLINE_LEVEL == pEntry->nWID ) //#outline level,removed by zahojianwei - // { - // pStates[i] = - // ( xStyle->GetCollection()->GetOutlineLevel() - // == NO_NUMBERING ) - // ? beans::PropertyState_DEFAULT_VALUE - // : beans::PropertyState_DIRECT_VALUE; - // } //<-end,zhaojianwei - else if(SFX_STYLE_FAMILY_PAGE == eFamily && - (rPropName.EqualsAscii("Header", 0, 6) - || rPropName.EqualsAscii("Footer", 0, 6))) + + // 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) { - sal_uInt16 nResId = lcl_ConvertFNToRES(pEntry->nWID); - sal_Bool bFooter = rPropName.EqualsAscii("Footer", 0, 6); - const SvxSetItem* pSetItem; - if(SFX_ITEM_SET == aSet.GetItemState( - bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - sal_False, (const SfxPoolItem**)&pSetItem)) + // check for Header/Footer entry + const bool bHeader(SFX_STYLE_FAMILY_PAGE == eFamily && rPropName.EqualsAscii("Header", 0, 6)); + const bool bFooter(SFX_STYLE_FAMILY_PAGE == eFamily && rPropName.EqualsAscii("Footer", 0, 6)); + + if(bHeader || bFooter) { - const SfxItemSet& rSet = pSetItem->GetItemSet(); - SfxItemState eState = rSet.GetItemState(nResId, sal_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, + sal_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] = pPropSet->getPropertyState(*pEntry, aSet); - if( SFX_STYLE_FAMILY_PAGE == eFamily && - SID_ATTR_PAGE_SIZE == pEntry->nWID && - beans::PropertyState_DIRECT_VALUE == pStates[i] ) + pStates[i] = beans::PropertyState_DIRECT_VALUE; + bDone = true; + } + + if(!bDone) + { + 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 ) ) || - ( LONG_MAX == rSize.GetSize().Height() && - MID_SIZE_HEIGHT == nMemberId ) ) + + if((LONG_MAX == rSize.GetSize().Width() && + (MID_SIZE_WIDTH == nMemberId || + MID_SIZE_SIZE == nMemberId)) || + (LONG_MAX == rSize.GetSize().Height() && + MID_SIZE_HEIGHT == nMemberId)) { pStates[i] = beans::PropertyState_DEFAULT_VALUE; } @@ -3090,24 +3151,31 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( } } else + { throw uno::RuntimeException(); + } } else + { throw uno::RuntimeException(); + } + return aRet; } /*-- 08.03.99 10:50:27--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXStyle::setPropertyToDefault(const OUString& rPropertyName) - throw( beans::UnknownPropertyException, uno::RuntimeException ) +void SwXStyle::setPropertyToDefault( + const OUString& rPropertyName) +throw( beans::UnknownPropertyException, uno::RuntimeException ) { - const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 ); - setPropertiesToDefault ( aSequence ); + const uno::Sequence < OUString > aSequence(&rPropertyName,1); + setPropertiesToDefault(aSequence); } -void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) - throw (beans::UnknownPropertyException, uno::RuntimeException) +void SAL_CALL SwXStyle::setPropertiesToDefault( + const uno::Sequence< OUString >& aPropertyNames ) +throw (beans::UnknownPropertyException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); SwFmt *pTargetFmt = 0; @@ -3120,75 +3188,112 @@ void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& if(pBase) { - rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); + 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: + { + sal_uInt16 nPgDscPos = USHRT_MAX; + SwPageDesc *pDesc = m_pDoc->FindPageDescByName(xStyle->GetPageDesc()->GetName(),&nPgDscPos); + + if(pDesc) { - sal_uInt16 nPgDscPos = USHRT_MAX; - SwPageDesc *pDesc = m_pDoc->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos ); - if( pDesc ) - pTargetFmt = &pDesc->GetMaster(); + 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_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 *pMap = 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 = pMap->getByName( pNames[nProp] ); - if( !pEntry ) - throw beans::UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is unknown: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if ( pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES ) - throw uno::RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Cannot reset: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if ( pEntry->nFlags & beans::PropertyAttribute::READONLY ) - throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertiesToDefault: property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - - //if( pEntry->nWID == FN_UNO_DEFAULT_OUTLINE_LEVEL ) //#outline level, removed by zhaojianwei - // static_cast<SwTxtFmtColl*>(pTargetFmt)->SetOutlineLevel( NO_NUMBERING ); - //else - // pTargetFmt->ResetFmtAttr( pEntry->nWID ); - if( pEntry->nWID == RES_PARATR_OUTLINELEVEL ) //add by zhaojianwei + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pNames[nProp]); + + if(!pEntry) + { + throw beans::UnknownPropertyException(OUString(RTL_CONSTASCII_USTRINGPARAM("Property is unknown: ")) + pNames[nProp],static_cast <cppu::OWeakObject *> (this)); + } + + if(pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES) + { + throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot reset: ")) + pNames[nProp],static_cast <cppu::OWeakObject *> (this)); + } + + if(pEntry->nFlags & beans::PropertyAttribute::READONLY) + { + throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM("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 ); //<-end,zhaojianwei + { + 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]); + } } } -void SAL_CALL SwXStyle::setAllPropertiesToDefault( ) - throw (uno::RuntimeException) +void SAL_CALL SwXStyle::setAllPropertiesToDefault() +throw (uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); + if(pBasePool) { pBasePool->SetSearchMask(eFamily); @@ -3198,78 +3303,82 @@ 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(); - // --> OD 2007-07-25 #132402# - make code robust - if ( xStyle->GetCollection() ) + + if(xStyle->GetCollection()) { - // xStyle->GetCollection()->SetOutlineLevel( NO_NUMBERING ); //#outline level,removed by zhaojianwei + // xStyle->GetCollection()->SetOutlineLevel( NO_NUMBERING ); //#outline level,removed by zhaojianwei xStyle->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); //<-end,add by zhaojianwei } - // <-- + 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->FindPageDescByName( xStyle->GetPageDesc()->GetName(), &nPgDscPos ); - if( pDesc ) + SwPageDesc *pDesc = m_pDoc->FindPageDescByName(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->getPrinter( false ) ) + if(m_pDoc->getPrinter(false)) { - const Size aPhysSize( SvxPaperInfo::GetPaperSize( - static_cast<Printer*>( m_pDoc->getPrinter( false ) )) ); - aFrmSz.SetSize( aPhysSize ); + const Size aPhysSize(SvxPaperInfo::GetPaperSize( + static_cast<Printer*>(m_pDoc->getPrinter(false)))); + aFrmSz.SetSize(aPhysSize); } else { // --> OD 2008-07-25 #i91928# -// aFrmSz.SetWidth( LONG_MAX ); -// aFrmSz.SetHeight( LONG_MAX ); - aFrmSz.SetSize( SvxPaperInfo::GetDefaultPaperSize() ); + // aFrmSz.SetWidth( LONG_MAX ); + // aFrmSz.SetHeight( LONG_MAX ); + aFrmSz.SetSize(SvxPaperInfo::GetDefaultPaperSize()); // <-- } @@ -3278,13 +3387,15 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault( ) { 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 ); + + pTargetFmt->SetFmtAttr(aFrmSz); } else { @@ -3293,86 +3404,106 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault( ) // <-- } - if( USHRT_MAX != nPgDscPos ) - m_pDoc->ChgPageDesc( nPgDscPos, - const_cast<const SwDoc *>(m_pDoc) - ->GetPageDesc(nPgDscPos) ); + if(USHRT_MAX != nPgDscPos) + { + m_pDoc->ChgPageDesc(nPgDscPos, const_cast<const SwDoc *>(m_pDoc)->GetPageDesc(nPgDscPos)); + } } } else + { throw uno::RuntimeException(); + } } - else if ( bIsDescriptor ) + else if(bIsDescriptor) + { pPropImpl->ClearAllProperties(); + } else + { throw uno::RuntimeException(); + } } -uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) - throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( + const uno::Sequence< OUString >& aPropertyNames ) +throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); 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(sStyleName); - DBG_ASSERT(pBase, "Doesn't seem to be a style!"); + DBG_ASSERT(pBase,"Doesn't seem to be a style!"); 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) { - 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_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* pMap = pPropSet->getPropertyMap(); - - const SfxItemSet &rSet = xStyle->GetItemSet(), *pParentSet = rSet.GetParent(); + 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 = pMap->getByName( pNames[i] ); - if ( !pEntry ) - throw beans::UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) ); + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pNames[i]); - if( pParentSet ) - aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(pNames[i], *pParentSet, pRet[i]); - else if( pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID) ) + if(!pEntry) + { + throw beans::UnknownPropertyException(OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: ")) + pNames[i],static_cast <cppu::OWeakObject *> (this)); + } + + if(pParentSet) + { + aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(pNames[i],*pParentSet,pRet[i]); + } + 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; } /*-- 08.03.99 10:50:27--------------------------------------------------- -----------------------------------------------------------------------*/ -uno::Any SwXStyle::getPropertyDefault(const OUString& rPropertyName) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +uno::Any SwXStyle::getPropertyDefault( + const OUString& rPropertyName) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { - const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 ); - return getPropertyDefaults ( aSequence ).getConstArray()[0]; + const uno::Sequence < OUString > aSequence(&rPropertyName,1); + return getPropertyDefaults(aSequence).getConstArray()[0]; } /* -----------------21.01.99 13:08------------------- * @@ -3418,19 +3549,19 @@ void SwXStyle::Invalidate() /*-- 17.12.98 08:43:35--------------------------------------------------- -----------------------------------------------------------------------*/ -SwXPageStyle::SwXPageStyle(SfxStyleSheetBasePool& rPool, - SwDocShell* pDocSh, SfxStyleFamily eFam, - const String& rStyleName)://, const SfxItemPropertyMap* _pMap) : - SwXStyle(rPool, eFam, pDocSh->GetDoc(), rStyleName),//, _pMap), +SwXPageStyle::SwXPageStyle( + SfxStyleSheetBasePool& rPool, + SwDocShell* pDocSh, SfxStyleFamily eFam, + const String& rStyleName) +: SwXStyle(rPool, eFam, pDocSh->GetDoc(), rStyleName), pDocShell(pDocSh) { - } /* -----------------23.08.99 15:52------------------- --------------------------------------------------*/ -SwXPageStyle::SwXPageStyle(SwDocShell* pDocSh) : - SwXStyle(pDocSh->GetDoc(), SFX_STYLE_FAMILY_PAGE), +SwXPageStyle::SwXPageStyle(SwDocShell* pDocSh) +: SwXStyle(pDocSh->GetDoc(), SFX_STYLE_FAMILY_PAGE), pDocShell(pDocSh) { } @@ -3448,8 +3579,7 @@ SwXPageStyle::~SwXPageStyle() void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( const uno::Sequence< OUString >& rPropertyNames, const uno::Sequence< uno::Any >& rValues ) - throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, - lang::WrappedTargetException, uno::RuntimeException) +throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { if(!GetDoc()) throw uno::RuntimeException(); @@ -3461,7 +3591,8 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( const uno::Any* pValues = rValues.getConstArray(); const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); const SfxItemPropertyMap* pMap = pPropSet->getPropertyMap(); - SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName()); + SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrmFmt()->GetAttrSet()); //UUUU add pDfltFrmFmt as parent + if(GetBasePool()) { sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask(); @@ -3469,155 +3600,199 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName()); GetBasePool()->SetSearchMask(GetFamily(), nSaveMask ); DBG_ASSERT(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 = pMap->getByName( pNames[nProp] ); + const String& rPropName = pNames[nProp]; + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( rPropName ); + if (!pEntry) - throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + { + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + } + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) - throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + { + throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropName, 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_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_SIZE: + case RES_HEADER_FOOTER_EAT_SPACING: { - sal_Bool bSetItem = sal_False; - sal_Bool bFooter = sal_False; - sal_uInt16 nItemType = TYPE_BOOL; - sal_uInt16 nRes = 0; - switch(pEntry->nWID) - { - case FN_UNO_FOOTER_ON: bFooter = sal_True; - //kein break; - case FN_UNO_HEADER_ON: nRes = SID_ATTR_PAGE_ON; - break; - case FN_UNO_FOOTER_BACKGROUND: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; nItemType = TYPE_BRUSH; - break; - case FN_UNO_FOOTER_BOX: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_BOX: nRes = RES_BOX; nItemType = TYPE_BOX; - break; - case FN_UNO_FOOTER_LR_SPACE: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE;nItemType = TYPE_LRSPACE; - break; - case FN_UNO_FOOTER_SHADOW: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW;nItemType = TYPE_SHADOW; - break; - case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE;nItemType = TYPE_ULSPACE; - break; - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC; - break; - case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED; - break; - case FN_UNO_FOOTER_HEIGHT: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE;nItemType = TYPE_SIZE; - break; - case FN_UNO_FOOTER_EAT_SPACING: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;nItemType = TYPE_SIZE; - break; - } - const SvxSetItem* pSetItem; - if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState( - bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - sal_False, (const SfxPoolItem**)&pSetItem)) + // these entries are used in Header, Footer and (partially) in the PageStyle itself. + // Check for Header/Footer entry + const bool bHeader(rPropName.EqualsAscii("Header", 0, 6)); + const bool bFooter(rPropName.EqualsAscii("Footer", 0, 6)); + + if(bHeader || bFooter) { - SvxSetItem* pNewSetItem = (SvxSetItem*)pSetItem->Clone(); - SfxItemSet& rSetSet = pNewSetItem->GetItemSet(); - const SfxPoolItem* pItem = 0; - SfxPoolItem* pNewItem = 0; - rSetSet.GetItemState(nRes, sal_True, &pItem); - if(!pItem && nRes != rSetSet.GetPool()->GetSlotId(nRes)) - pItem = &rSetSet.GetPool()->GetDefaultItem(nRes); - if(pItem) + // 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, sal_False, (const SfxPoolItem**)&pSetItem)) { - pNewItem = pItem->Clone(); + // 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 + else if(pEntry->nWID == SID_ATTR_PAGE_ON) { - switch(nItemType) + sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue(); + + if(bVal) { - 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; + // 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 + 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, sal_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, sal_True)); + aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, sal_True)); + + SvxSetItem aNewSetItem(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, aTempSet); + aBaseImpl.GetItemSet().Put(aNewSetItem); } } - bSetItem = pNewItem->PutValue(pValues[nProp], pEntry->nMemberId); - rSetSet.Put(*pNewItem); - aBaseImpl.GetItemSet().Put(*pNewSetItem); - delete pNewItem; - delete pNewSetItem; } - else if(SID_ATTR_PAGE_ON == nRes ) + else { - sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue(); - if(bVal) + switch(pEntry->nWID) { - 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, - 0 ); - aTempSet.Put(SfxBoolItem(nRes, sal_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, sal_True)); - aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, sal_True)); - - SvxSetItem aNewSetItem( bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - aTempSet); - aBaseImpl.GetItemSet().Put(aNewSetItem); + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + 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()); + } } } + + 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.EqualsAscii("Header", 0, 6)); + const bool bFooter(rPropName.EqualsAscii("Footer", 0, 6)); + + if(bHeader || bFooter) + { + 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)) + { + // 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; + } + case FN_PARAM_FTN_INFO : { const SfxPoolItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO); @@ -3627,45 +3802,58 @@ 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 : case FN_UNO_FOOTER : case FN_UNO_FOOTER_LEFT : case FN_UNO_FOOTER_RIGHT : + { 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()); } } void SwXPageStyle::setPropertyValues( const uno::Sequence< OUString >& rPropertyNames, const uno::Sequence< uno::Any >& rValues ) - throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) +throw(beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); @@ -3686,9 +3874,10 @@ void SwXPageStyle::setPropertyValues( /* -----------------------------04.11.03 13:50-------------------------------- ---------------------------------------------------------------------------*/ -static uno::Reference<text::XText> -lcl_makeHeaderFooter( - const sal_uInt16 nRes, const bool bHeader, SwFrmFmt const*const pFrmFmt) +static uno::Reference<text::XText> lcl_makeHeaderFooter( + const sal_uInt16 nRes, + const bool bHeader, + SwFrmFmt const*const pFrmFmt) { if (!pFrmFmt) { return 0; } @@ -3710,8 +3899,8 @@ lcl_makeHeaderFooter( } uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( - const uno::Sequence< OUString >& rPropertyNames ) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) +const uno::Sequence< OUString >& rPropertyNames ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { if(!GetDoc()) throw uno::RuntimeException(); @@ -3719,17 +3908,21 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( sal_Int32 nLength = rPropertyNames.getLength(); const OUString* pNames = rPropertyNames.getConstArray(); uno::Sequence< uno::Any > aRet ( nLength ); - uno::Any* pRet = aRet.getArray(); const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); const SfxItemPropertyMap* pMap = 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 = pMap->getByName( pNames[nProp] ); + const String& rPropName = pNames[nProp]; + const SfxItemPropertySimpleEntry* pEntry = pMap->getByName( rPropName ); + if (!pEntry) - throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + { + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + } if(GetBasePool()) { @@ -3740,130 +3933,150 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( pBase = GetBasePool()->Find(GetStyleName()); GetBasePool()->SetSearchMask(GetFamily(), nSaveMask ); } + sal_uInt16 nRes = 0; - bool bHeader = false; sal_Bool bAll = sal_False, bLeft = sal_False, bRight = sal_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_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_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.EqualsAscii("Header", 0, 6)); + const bool bFooter(rPropName.EqualsAscii("Footer", 0, 6)); + + if(bHeader || bFooter) { + // slot is a Header/Footer slot rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); const SfxItemSet& rSet = xStyle->GetItemSet(); - sal_Bool bFooter = sal_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 = sal_True; - // kein break! - case FN_UNO_HEADER_ON: + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + 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 = sal_True; - // kein break; - case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; - break; - case FN_UNO_FOOTER_BOX: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_BOX: nRes = RES_BOX; - break; - case FN_UNO_FOOTER_LR_SPACE: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE; - break; - case FN_UNO_FOOTER_SHADOW: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW; - break; - case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE; - break; - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC; - break; - case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED; - break; - case FN_UNO_FOOTER_HEIGHT: bFooter = sal_True; - // kein break; - case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE; - break; - case FN_UNO_FOOTER_EAT_SPACING: bFooter = sal_True; - // kein 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.EqualsAscii("Header", 0, 6)); + const bool bFooter(rPropName.EqualsAscii("Footer", 0, 6)); + + 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, - sal_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, sal_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 : - bAll = sal_True; goto Header; - case FN_UNO_HEADER_LEFT : - bLeft = sal_True; goto Header; - case FN_UNO_HEADER_RIGHT : - bRight = sal_True; goto Header; -Header: - bHeader = true; - nRes = RES_HEADER; goto MakeObject; - case FN_UNO_FOOTER : - bAll = sal_True; goto Footer; - case FN_UNO_FOOTER_LEFT : - bLeft = sal_True; goto Footer; - case FN_UNO_FOOTER_RIGHT : - bRight = sal_True; -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; bAll = sal_True; break; + case FN_UNO_HEADER_LEFT: bHeader = true; nRes = RES_HEADER; bLeft = sal_True; break; + case FN_UNO_HEADER_RIGHT: bHeader = true; nRes = RES_HEADER; bRight = sal_True; break; + case FN_UNO_FOOTER: bHeader = false; nRes = RES_FOOTER; bAll = sal_True; break; + case FN_UNO_FOOTER_LEFT: bHeader = false; nRes = RES_FOOTER; bLeft = sal_True; break; + case FN_UNO_FOOTER_RIGHT: bHeader = false; nRes = RES_FOOTER; bRight = sal_True; break; + default: break; + } + const SwPageDesc& rDesc = aBase.GetOldPageDesc(); const SwFrmFmt* pFrmFmt = 0; - sal_Bool bShare = (bHeader && rDesc.IsHeaderShared())|| - (!bHeader && rDesc.IsFooterShared()); + sal_Bool bShare = (bHeader && rDesc.IsHeaderShared()) || (!bHeader && rDesc.IsFooterShared()); // TextLeft returns the left content if there is one, // Text and TextRight return the master content. // TextRight does the same as Text and is for @@ -3882,32 +4095,47 @@ 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; } /* -----------------------------18.04.01 13:50-------------------------------- @@ -3915,7 +4143,7 @@ MakeObject: ---------------------------------------------------------------------------*/ uno::Sequence< uno::Any > SwXPageStyle::getPropertyValues( const uno::Sequence< OUString >& rPropertyNames ) - throw(uno::RuntimeException) +throw(uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); uno::Sequence< uno::Any > aValues; @@ -3939,26 +4167,27 @@ uno::Sequence< uno::Any > SwXPageStyle::getPropertyValues( /*-- 17.12.98 08:43:36--------------------------------------------------- -----------------------------------------------------------------------*/ -uno::Any SwXPageStyle::getPropertyValue(const OUString& rPropertyName) throw( - beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) +uno::Any SwXPageStyle::getPropertyValue( + const OUString& rPropertyName) +throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); const uno::Sequence<OUString> aProperties(&rPropertyName, 1); + return GetPropertyValues_Impl(aProperties).getConstArray()[0]; } /*-- 17.12.98 08:43:36--------------------------------------------------- -----------------------------------------------------------------------*/ -void SwXPageStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue) - throw( beans::UnknownPropertyException, - beans::PropertyVetoException, - lang::IllegalArgumentException, - lang::WrappedTargetException, - uno::RuntimeException) +void SwXPageStyle::setPropertyValue( + const OUString& rPropertyName, + const uno::Any& rValue) +throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); const uno::Sequence<OUString> aProperties(&rPropertyName, 1); const uno::Sequence<uno::Any> aValues(&rValue, 1); + SetPropertyValues_Impl( aProperties, aValues ); } @@ -4156,57 +4385,220 @@ void SwXAutoStyleFamily::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNe -----------------------------------------------------------------------*/ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( const uno::Sequence< beans::PropertyValue >& Values ) - throw (uno::RuntimeException) +throw (uno::RuntimeException) { if( !pDocShell ) + { throw uno::RuntimeException(); + } + const sal_uInt16* pRange = 0; const SfxItemPropertySet* pPropSet = 0; + switch( eFamily ) { case IStyleAccess::AUTO_STYLE_CHAR: { 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: break; } + 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 - { - pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet ); - } - catch (beans::UnknownPropertyException &) + for( sal_Int32 i = 0; i < nLen; ++i ) { - ASSERT( false, "Unknown property" ); + try + { + pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet ); + } + catch (beans::UnknownPropertyException &) + { + ASSERT( false, "Unknown property" ); + } + catch (lang::IllegalArgumentException &) + { + ASSERT( false, "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 *pMap = pPropSet->getPropertyMap(); + + for( sal_Int32 i = 0; i < nLen; ++i ) { - ASSERT( false, "Illegal argument" ); + const OUString& rPropName = pSeq[i].Name; + uno::Any aValue(pSeq[i].Value); + const SfxItemPropertySimpleEntry* pEntry = pMap->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; } /*-- 31.05.2006 11:24:02--------------------------------------------------- @@ -4328,38 +4720,48 @@ uno::Any SwXAutoStylesEnumerator::nextElement( ) } return aRet; } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - -----------------------------------------------------------------------*/ -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); } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ SwXAutoStyle::~SwXAutoStyle() { } -void SwXAutoStyle::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) +void SwXAutoStyle::Modify( + const SfxPoolItem* pOld, + const SfxPoolItem *pNew) { ClientModify(this, pOld, pNew); + if(!GetRegisteredIn()) - pSet.reset(); + { + mpSet.reset(); + } } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( ) - throw (uno::RuntimeException) +uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo() +throw (uno::RuntimeException) { uno::Reference< beans::XPropertySetInfo > xRet; - switch( eFamily ) + switch( meFamily ) { case IStyleAccess::AUTO_STYLE_CHAR: { @@ -4401,140 +4803,202 @@ uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( ) return xRet; } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SwXAutoStyle::setPropertyValue( const OUString& /*rPropertyName*/, const uno::Any& /*rValue*/ ) - throw( beans::UnknownPropertyException, - beans::PropertyVetoException, - lang::IllegalArgumentException, - lang::WrappedTargetException, - uno::RuntimeException) +void SwXAutoStyle::setPropertyValue( + const OUString& /*rPropertyName*/, + const uno::Any& /*rValue*/ ) +throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Any SwXAutoStyle::getPropertyValue( const OUString& rPropertyName ) - throw( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) +uno::Any SwXAutoStyle::getPropertyValue( + const OUString& rPropertyName ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { vos::OGuard aGuard(Application::GetSolarMutex()); const uno::Sequence<OUString> aProperties(&rPropertyName, 1); + return GetPropertyValues_Impl(aProperties).getConstArray()[0]; } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SwXAutoStyle::addPropertyChangeListener( const OUString& /*aPropertyName*/, - const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ ) - throw( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) +void SwXAutoStyle::addPropertyChangeListener( + const OUString& /*aPropertyName*/, + const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SwXAutoStyle::removePropertyChangeListener( const OUString& /*aPropertyName*/, - const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) - throw( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) +void SwXAutoStyle::removePropertyChangeListener( + const OUString& /*aPropertyName*/, + const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SwXAutoStyle::addVetoableChangeListener( const OUString& /*PropertyName*/, - const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) - throw( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) +void SwXAutoStyle::addVetoableChangeListener( + const OUString& /*PropertyName*/, + const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SwXAutoStyle::removeVetoableChangeListener( const OUString& /*PropertyName*/, - const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) - throw( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException ) +void SwXAutoStyle::removeVetoableChangeListener( + const OUString& /*PropertyName*/, + const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ void SwXAutoStyle::setPropertyValues( - const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/, - const uno::Sequence< uno::Any >& /*aValues*/ ) - throw (beans::PropertyVetoException, lang::IllegalArgumentException, - lang::WrappedTargetException, uno::RuntimeException) + const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/, + const uno::Sequence< uno::Any >& /*aValues*/ ) +throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl( - const uno::Sequence< OUString > & rPropertyNames ) - throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) + 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 *pMap = 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 String& rPropName = pNames[i]; + const OUString& rPropName = pNames[i]; const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName); + if(!pEntry) + { throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, 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 ) { - OUString sName(StylePool::nameOf( pSet )); - pValues[i] <<= sName; + OUString sName(StylePool::nameOf( mpSet )); + aTarget <<= sName; + 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->pType && *(pEntry->pType) == ::getCppuType((const sal_Int16*)0) && *(pEntry->pType) != 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; } -/*-- 19.05.2006 11:24:09--------------------------------------------------- - - -----------------------------------------------------------------------*/ uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues ( - const uno::Sequence< ::rtl::OUString >& rPropertyNames ) - throw (uno::RuntimeException) + const uno::Sequence< ::rtl::OUString >& rPropertyNames ) +throw (uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); uno::Sequence< uno::Any > aValues; @@ -4556,41 +5020,29 @@ uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues ( return aValues; } -/*-- 19.05.2006 11:24:10--------------------------------------------------- - - -----------------------------------------------------------------------*/ void SwXAutoStyle::addPropertiesChangeListener( - const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/, - const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) - throw (uno::RuntimeException) + const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/, + const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) +throw (uno::RuntimeException) { } -/*-- 19.05.2006 11:24:10--------------------------------------------------- - - -----------------------------------------------------------------------*/ void SwXAutoStyle::removePropertiesChangeListener( - const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) - throw (uno::RuntimeException) + const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) +throw (uno::RuntimeException) { } -/*-- 19.05.2006 11:24:11--------------------------------------------------- - - -----------------------------------------------------------------------*/ void SwXAutoStyle::firePropertiesChangeEvent( - const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/, - const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) - throw (uno::RuntimeException) + const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/, + const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ ) +throw (uno::RuntimeException) { } -/*-- 19.05.2006 11:24:11--------------------------------------------------- - - -----------------------------------------------------------------------*/ -beans::PropertyState SwXAutoStyle::getPropertyState( const OUString& rPropertyName ) - throw( beans::UnknownPropertyException, - uno::RuntimeException) +beans::PropertyState SwXAutoStyle::getPropertyState( + const OUString& rPropertyName ) +throw( beans::UnknownPropertyException, uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); @@ -4601,106 +5053,179 @@ beans::PropertyState SwXAutoStyle::getPropertyState( const OUString& rPropertyNa return aStates.getConstArray()[0]; } -/*-- 19.05.2006 11:24:11--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SwXAutoStyle::setPropertyToDefault( const OUString& /*PropertyName*/ ) - throw( beans::UnknownPropertyException, - uno::RuntimeException ) +void SwXAutoStyle::setPropertyToDefault( + const OUString& /*PropertyName*/ ) +throw( beans::UnknownPropertyException, uno::RuntimeException ) { } -/*-- 19.05.2006 11:24:11--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Any SwXAutoStyle::getPropertyDefault( const OUString& rPropertyName ) - throw( beans::UnknownPropertyException, - lang::WrappedTargetException, - uno::RuntimeException) +uno::Any SwXAutoStyle::getPropertyDefault( + const OUString& rPropertyName ) +throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { const uno::Sequence < OUString > aSequence ( &rPropertyName, 1 ); + return getPropertyDefaults ( aSequence ).getConstArray()[0]; } -/*-- 19.05.2006 11:24:12--------------------------------------------------- - - -----------------------------------------------------------------------*/ uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates( - const uno::Sequence< ::rtl::OUString >& rPropertyNames ) - throw (beans::UnknownPropertyException, uno::RuntimeException) + const uno::Sequence< ::rtl::OUString >& rPropertyNames ) +throw (beans::UnknownPropertyException, uno::RuntimeException) { - if( !pSet.get() ) + if( !mpSet.get() ) + { throw uno::RuntimeException(); + } + vos::OGuard aGuard(Application::GetSolarMutex()); 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 *pMap = pPropSet->getPropertyMap(); - SfxItemSet& rSet = *pSet.get(); + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily); + for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) { - const String& rPropName = pNames[i]; + const OUString& rPropName = pNames[i]; const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(rPropName); + if(!pEntry) + { throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, 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; } -/*-- 19.05.2006 11:24:12--------------------------------------------------- - - -----------------------------------------------------------------------*/ void SwXAutoStyle::setAllPropertiesToDefault( ) - throw (uno::RuntimeException) +throw (uno::RuntimeException) { } -/*-- 19.05.2006 11:24:13--------------------------------------------------- - - -----------------------------------------------------------------------*/ void SwXAutoStyle::setPropertiesToDefault( - const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/ ) - throw (beans::UnknownPropertyException, uno::RuntimeException) + const uno::Sequence< ::rtl::OUString >& rPropertyNames ) +throw (beans::UnknownPropertyException, uno::RuntimeException) { -} + if( !mpSet.get() ) + { + throw uno::RuntimeException(); + } -/*-- 19.05.2006 11:24:14--------------------------------------------------- + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily); + + if(!bTakeCareOfDrawingLayerFillStyle) + { + return; + } + + //UUUU support DrawingLayer FillStyle slots from here on + vos::OGuard aGuard(Application::GetSolarMutex()); + 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 *pMap = pPropSet->getPropertyMap(); + + for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) + { + const OUString& rPropName = pNames[i]; + const SfxItemPropertySimpleEntry* pEntry = pMap->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( - const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/ ) - throw (beans::UnknownPropertyException, lang::WrappedTargetException, - uno::RuntimeException) + const uno::Sequence< ::rtl::OUString >& /*aPropertyNames*/ ) +throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { uno::Sequence< uno::Any > aRet(0); + return aRet; } -/*-- 19.05.2006 11:24:14--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno::RuntimeException) +uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() +throw (uno::RuntimeException) { - if( !pSet.get() ) + if( !mpSet.get() ) throw uno::RuntimeException(); vos::OGuard aGuard(Application::GetSolarMutex()); 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; @@ -4729,7 +5254,7 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno:: // ++aIt; // } - SfxItemSet& rSet = *pSet.get(); + SfxItemSet& rSet = *mpSet.get(); SfxItemIter aIter(rSet); const SfxPoolItem* pItem = aIter.FirstItem(); @@ -4787,3 +5312,6 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno:: return aRet; } + +////////////////////////////////////////////////////////////////////////////// +//eof diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 2d2d1fd32852..38be49a908e9 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1685,7 +1685,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) { // todo: if the start/end is in a table then insert a paragraph // before/after, move the start/end nodes, then convert and - // remove the addtional paragraphs in the end + // remove the additional paragraphs in the end if (pStartStartNode->GetStartNodeType() == SwTableBoxStartNode) { SwTableNode *const pSartTableNode(pStartStartNode->FindTableNode()); |