diff options
105 files changed, 5294 insertions, 2607 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 55d20b3ccc17..523c6414ddb4 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1309,12 +1309,20 @@ AbstractSvxSearchSimilarityDialog * AbstractDialogFactory_Impl::CreateSvxSearchS return NULL; } -SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg( Window* pParent, - const SfxItemSet& rCoreSet, - bool bEnableSelector) -{ - SfxTabDialog* pDlg = new SvxBorderBackgroundDlg( pParent, rCoreSet, bEnableSelector); - return new CuiAbstractTabDialog_Impl( pDlg ); +//UUUU +SfxAbstractTabDialog* AbstractDialogFactory_Impl::CreateSvxBorderBackgroundDlg( + Window* pParent, + const SfxItemSet& rCoreSet, + bool bEnableSelector, + bool bEnableDrawingLayerFillStyles) +{ + SfxTabDialog* pDlg = new SvxBorderBackgroundDlg( + pParent, + rCoreSet, + bEnableSelector, + bEnableDrawingLayerFillStyles); + + return new CuiAbstractTabDialog_Impl(pDlg); } AbstractSvxTransformTabDialog* AbstractDialogFactory_Impl::CreateSvxTransformTabDialog( Window* pParent, diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 1cf6b4c43f95..df9a0870ff6f 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -571,9 +571,13 @@ public: virtual AbstractFmShowColsDialog * CreateFmShowColsDialog( Window* pParent ) SAL_OVERRIDE; virtual AbstractSvxZoomDialog * CreateSvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet) SAL_OVERRIDE; - virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg( Window* pParent, - const SfxItemSet& rCoreSet, - bool bEnableSelector = false) SAL_OVERRIDE ; + //UUUU add for SvxBorderBackgroundDlg + virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg( + Window* pParent, + const SfxItemSet& rCoreSet, + bool bEnableSelector = false, + bool bEnableDrawingLayerFillStyles = false) SAL_OVERRIDE; + virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr, const SdrView* pView, diff --git a/cui/source/inc/bbdlg.hxx b/cui/source/inc/bbdlg.hxx index c4393bd9e1f7..f5fc9d242f88 100644 --- a/cui/source/inc/bbdlg.hxx +++ b/cui/source/inc/bbdlg.hxx @@ -28,17 +28,22 @@ class SvxBorderBackgroundDlg: public SfxTabDialog { public: - SvxBorderBackgroundDlg(Window *pParent, const SfxItemSet& rCoreSet, - bool bEnableSelector = false); + SvxBorderBackgroundDlg(Window *pParent, + const SfxItemSet& rCoreSet, + bool bEnableSelector = false, + bool bEnableDrawingLayerFillStyles = false); protected: virtual void PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ) SAL_OVERRIDE; private: - bool m_bEnableBackgroundSelector; ///< for Border/Background + /// bitfield + bool mbEnableBackgroundSelector : 1; ///< for Border/Background + bool mbEnableDrawingLayerFillStyles : 1; ///< for full DrawingLayer FillStyles sal_uInt16 m_nBackgroundPageId; + sal_uInt16 m_nAreaPageId; + sal_uInt16 m_nTransparencePageId; }; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx index a64ca325d271..dcbdc212807f 100644 --- a/cui/source/inc/page.hxx +++ b/cui/source/inc/page.hxx @@ -64,7 +64,7 @@ <SvxLRSpaceItem>: <SID_ATTR_LRSPACE> */ -struct SvxPage_Impl; +//UUUU struct SvxPage_Impl; typedef sal_uInt16 MarginPosition; class SvxPageDescPage : public SfxTabPage @@ -72,6 +72,7 @@ class SvxPageDescPage : public SfxTabPage using TabPage::ActivatePage; using TabPage::DeactivatePage; +private: // paper format ListBox* m_pPaperSizeBox; @@ -137,7 +138,14 @@ class SvxPageDescPage : public SfxTabPage Paper ePaperStart; Paper ePaperEnd; - SvxPage_Impl* pImpl; + //UUUU SvxPage_Impl* pImpl; + MarginPosition m_nPos; + Printer* mpDefPrinter; + + bool mbDelPrinter : 1; + + //UUUU + bool mbEnableDrawingLayerFillStyles : 1; void Init_Impl(); DECL_LINK(LayoutHdl_Impl, void *); @@ -172,6 +180,9 @@ class SvxPageDescPage : public SfxTabPage SvxPageDescPage( Window* pParent, const SfxItemSet& rSet ); + //UUUU + void EnableDrawingLayerFillStyles(bool bNew) { mbEnableDrawingLayerFillStyles = bNew; } + protected: virtual void ActivatePage( const SfxItemSet& rSet ) SAL_OVERRIDE; virtual int DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE; diff --git a/cui/source/tabpages/bbdlg.cxx b/cui/source/tabpages/bbdlg.cxx index 30a487c7f12f..d0d7752d4fff 100644 --- a/cui/source/tabpages/bbdlg.cxx +++ b/cui/source/tabpages/bbdlg.cxx @@ -20,24 +20,76 @@ #include "bbdlg.hxx" #include "border.hxx" #include "backgrnd.hxx" +//UUUU +#include "svx/svxids.hrc" +#include "cuitabarea.hxx" SvxBorderBackgroundDlg::SvxBorderBackgroundDlg(Window *pParent, - const SfxItemSet& rCoreSet, bool bEnableSelector) - - : SfxTabDialog(pParent, "BorderBackgroundDialog", - "cui/ui/borderbackgrounddialog.ui", &rCoreSet) - , m_bEnableBackgroundSelector(bEnableSelector) + const SfxItemSet& rCoreSet, + bool bEnableSelector, + bool bEnableDrawingLayerFillStyles) + : SfxTabDialog(pParent, + bEnableDrawingLayerFillStyles + ? OString("BorderAreaTransparencyDialog") + : OString("BorderBackgroundDialog"), + bEnableDrawingLayerFillStyles + ? OUString("cui/ui/borderareatransparencydialog.ui") + : OUString("cui/ui/borderbackgrounddialog.ui"), + &rCoreSet) + , mbEnableBackgroundSelector(bEnableSelector) + , mbEnableDrawingLayerFillStyles(bEnableDrawingLayerFillStyles) , m_nBackgroundPageId(0) + , m_nAreaPageId(0) + , m_nTransparencePageId(0) { AddTabPage("borders", SvxBorderTabPage::Create, 0 ); - m_nBackgroundPageId = AddTabPage("background", SvxBackgroundTabPage::Create, 0 ); + if (mbEnableDrawingLayerFillStyles) + { + //UUUU Here we want full DrawingLayer FillStyle access, so add Area and Transparency TabPages + m_nAreaPageId = AddTabPage("area", SvxAreaTabPage::Create, 0); + m_nTransparencePageId = AddTabPage("transparence", SvxTransparenceTabPage::Create, 0); + } + else + { + m_nBackgroundPageId = AddTabPage("background", SvxBackgroundTabPage::Create, 0 ); + } } void SvxBorderBackgroundDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ) { - // Make it possible to switch between color/graphic: - if ( m_bEnableBackgroundSelector && (nPageId == m_nBackgroundPageId) ) - ((SvxBackgroundTabPage&)rTabPage).ShowSelector( ); + if (nPageId == m_nBackgroundPageId) + { + // allow switching between Color/graphic + if(mbEnableBackgroundSelector) + { + static_cast< SvxBackgroundTabPage& >(rTabPage).ShowSelector(); + } + } + //UUUU inits for Area and Transparency TabPages + // The selection attribute lists (XPropertyList derivates, e.g. XColorList for + // the color table) need to be added as items (e.g. SvxColorTableItem) to make + // these pages find the needed attributes for fill style suggestions. + // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on + // demand, but could also be directly added from the DrawModel. + else if (nPageId == m_nAreaPageId) + { + SfxItemSet aNew( + *GetInputSetImpl()->GetPool(), + SID_COLOR_TABLE, SID_BITMAP_LIST, + SID_OFFER_IMPORT, SID_OFFER_IMPORT, + 0, 0); + + aNew.Put(*GetInputSetImpl()); + + // add flag for direct graphic content selection + aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true)); + + rTabPage.PageCreated(aNew); + } + else if (nPageId == m_nTransparencePageId) + { + rTabPage.PageCreated(*GetInputSetImpl()); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index d9018026ec39..477b4122f3cb 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -55,6 +55,10 @@ #include <svl/aeitem.hxx> #include <sfx2/request.hxx> +//UUUU +#include <svx/xdef.hxx> +#include <svx/unobrushitemhelper.hxx> + #include <numpages.hxx> // static ---------------------------------------------------------------- @@ -141,19 +145,20 @@ bool IsEqualSize_Impl( const SvxSizeItem* pSize, const Size& rSize ) #define MARGIN_TOP ( (MarginPosition)0x0004 ) #define MARGIN_BOTTOM ( (MarginPosition)0x0008 ) -struct SvxPage_Impl -{ - MarginPosition m_nPos; - Printer* mpDefPrinter; - bool mbDelPrinter; - - SvxPage_Impl() : - m_nPos( 0 ), - mpDefPrinter( 0 ), - mbDelPrinter( false ) {} - - ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; } -}; +//UUUU +//struct SvxPage_Impl +//{ +// MarginPosition m_nPos; +// Printer* mpDefPrinter; +// bool mbDelPrinter; +// +// SvxPage_Impl() : +// m_nPos( 0 ), +// mpDefPrinter( 0 ), +// mbDelPrinter( false ) {} +// +// ~SvxPage_Impl() { if ( mbDelPrinter ) delete mpDefPrinter; } +//}; // class SvxPageDescPage -------------------------------------------------- @@ -170,8 +175,6 @@ SfxTabPage* SvxPageDescPage::Create( Window* pParent, const SfxItemSet* rSet ) return new SvxPageDescPage( pParent, *rSet ); } - - SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) : SfxTabPage( pParent, "PageFormatPage", "cui/ui/pageformatpage.ui", &rAttr ), @@ -180,8 +183,17 @@ SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) : eMode ( SVX_PAGE_MODE_STANDARD ), ePaperStart ( PAPER_A3 ), ePaperEnd ( PAPER_ENV_DL ), - pImpl ( new SvxPage_Impl ) + //UUUU + // pImpl ( new SvxPage_Impl ), + + //UUUU + m_nPos( 0 ), + mpDefPrinter( 0 ), + mbDelPrinter( false ), + + //UUUU + mbEnableDrawingLayerFillStyles(false) { get(m_pPaperSizeBox,"comboPageFormat"); get(m_pPaperWidthEdit,"spinWidth"); @@ -281,27 +293,28 @@ SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) : SetFieldUnit( *m_pPaperHeightEdit, eFUnit ); if ( SfxViewShell::Current() && SfxViewShell::Current()->GetPrinter() ) - pImpl->mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter(); + { + mpDefPrinter = (Printer*)SfxViewShell::Current()->GetPrinter(); + } else { - pImpl->mpDefPrinter = new Printer; - pImpl->mbDelPrinter = true; + mpDefPrinter = new Printer; + mbDelPrinter = true; } - MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode(); - pImpl->mpDefPrinter->SetMapMode( MAP_TWIP ); + MapMode aOldMode = mpDefPrinter->GetMapMode(); + mpDefPrinter->SetMapMode( MAP_TWIP ); // set first- and last-values for the margins - Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize(); - Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize(); + Size aPaperSize = mpDefPrinter->GetPaperSize(); + Size aPrintSize = mpDefPrinter->GetOutputSize(); /* * To convert a point ( 0,0 ) into logic coordinates * looks like nonsense; but it makes sense when the * coordinate system's origin has been moved. */ - Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() - - pImpl->mpDefPrinter->PixelToLogic( Point() ); - pImpl->mpDefPrinter->SetMapMode( aOldMode ); + Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() ); + mpDefPrinter->SetMapMode( aOldMode ); long nOffset = !aPrintOffset.X() && !aPrintOffset.Y() ? 0 : PRINT_OFFSET; m_pLeftMarginEdit->SetFirst( m_pLeftMarginEdit->Normalize( aPrintOffset.X() ), FUNIT_TWIP ); @@ -359,7 +372,10 @@ SvxPageDescPage::SvxPageDescPage( Window* pParent, const SfxItemSet& rAttr ) : SvxPageDescPage::~SvxPageDescPage() { - delete pImpl; + if(mbDelPrinter) + { + delete mpDefPrinter; + } } @@ -434,7 +450,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet ) // general page data SvxNumType eNumType = SVX_ARABIC; - bLandscape = ( pImpl->mpDefPrinter->GetOrientation() == ORIENTATION_LANDSCAPE ); + bLandscape = ( mpDefPrinter->GetOrientation() == ORIENTATION_LANDSCAPE ); sal_uInt16 nUse = (sal_uInt16)SVX_PAGE_ALL; pItem = GetItem( *rSet, SID_ATTR_PAGE ); @@ -467,7 +483,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet ) { nPaperBin = ( (const SvxPaperBinItem*)pItem )->GetValue(); - if ( nPaperBin >= pImpl->mpDefPrinter->GetPaperBinCount() ) + if ( nPaperBin >= mpDefPrinter->GetPaperBinCount() ) nPaperBin = PAPERBIN_PRINTER_SETTINGS; } @@ -476,20 +492,20 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet ) if ( PAPERBIN_PRINTER_SETTINGS == nPaperBin ) aBinName = EE_RESSTR( RID_SVXSTR_PAPERBIN_SETTINGS ); else - aBinName = pImpl->mpDefPrinter->GetPaperBinName( (sal_uInt16)nPaperBin ); + aBinName = mpDefPrinter->GetPaperBinName( (sal_uInt16)nPaperBin ); sal_uInt16 nEntryPos = m_pPaperTrayBox->InsertEntry( aBinName ); m_pPaperTrayBox->SetEntryData( nEntryPos, (void*)(sal_uLong)nPaperBin ); m_pPaperTrayBox->SelectEntry( aBinName ); - Size aPaperSize = SvxPaperInfo::GetPaperSize( pImpl->mpDefPrinter ); + Size aPaperSize = SvxPaperInfo::GetPaperSize( mpDefPrinter ); pItem = GetItem( *rSet, SID_ATTR_PAGE_SIZE ); if ( pItem ) aPaperSize = ( (const SvxSizeItem*)pItem )->GetSize(); bool bOrientationSupport = - pImpl->mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION ); + mpDefPrinter->HasSupport( SUPPORT_SET_ORIENTATION ); if ( !bOrientationSupport && aPaperSize.Width() > aPaperSize.Height() ) @@ -923,11 +939,11 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperBinHdl_Impl) m_pPaperTrayBox->SetEntryData( nEntryPos, (void*)(sal_uLong)PAPERBIN_PRINTER_SETTINGS ); OUString aPaperBin( EditResId( RID_SVXSTR_PAPERBIN ) ); - sal_uInt16 nBinCount = pImpl->mpDefPrinter->GetPaperBinCount(); + sal_uInt16 nBinCount = mpDefPrinter->GetPaperBinCount(); for ( sal_uInt16 i = 0; i < nBinCount; ++i ) { - OUString aName = pImpl->mpDefPrinter->GetPaperBinName(i); + OUString aName = mpDefPrinter->GetPaperBinName(i); if ( aName.isEmpty() ) { @@ -1074,27 +1090,26 @@ IMPL_LINK( SvxPageDescPage, SwapOrientation_Impl, RadioButton *, pBtn ) void SvxPageDescPage::SwapFirstValues_Impl( bool bSet ) { - MapMode aOldMode = pImpl->mpDefPrinter->GetMapMode(); + MapMode aOldMode = mpDefPrinter->GetMapMode(); Orientation eOri = ORIENTATION_PORTRAIT; if ( bLandscape ) eOri = ORIENTATION_LANDSCAPE; - Orientation eOldOri = pImpl->mpDefPrinter->GetOrientation(); - pImpl->mpDefPrinter->SetOrientation( eOri ); - pImpl->mpDefPrinter->SetMapMode( MAP_TWIP ); + Orientation eOldOri = mpDefPrinter->GetOrientation(); + mpDefPrinter->SetOrientation( eOri ); + mpDefPrinter->SetMapMode( MAP_TWIP ); // set first- and last-values for margins - Size aPaperSize = pImpl->mpDefPrinter->GetPaperSize(); - Size aPrintSize = pImpl->mpDefPrinter->GetOutputSize(); + Size aPaperSize = mpDefPrinter->GetPaperSize(); + Size aPrintSize = mpDefPrinter->GetOutputSize(); /* * To convert a point ( 0,0 ) into logic coordinates * looks like nonsense; but it makes sense if the * coordinate system's origin has been moved. */ - Point aPrintOffset = pImpl->mpDefPrinter->GetPageOffset() - - pImpl->mpDefPrinter->PixelToLogic( Point() ); - pImpl->mpDefPrinter->SetMapMode( aOldMode ); - pImpl->mpDefPrinter->SetOrientation( eOldOri ); + Point aPrintOffset = mpDefPrinter->GetPageOffset() - mpDefPrinter->PixelToLogic( Point() ); + mpDefPrinter->SetMapMode( aOldMode ); + mpDefPrinter->SetOrientation( eOldOri ); sal_Int64 nSetL = m_pLeftMarginEdit->Denormalize( m_pLeftMarginEdit->GetValue( FUNIT_TWIP ) ); @@ -1175,31 +1190,44 @@ void SvxPageDescPage::UpdateExample_Impl( bool bResetbackground ) -void SvxPageDescPage::ResetBackground_Impl( const SfxItemSet& rSet ) +void SvxPageDescPage::ResetBackground_Impl(const SfxItemSet& rSet) { - sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET ); + sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET)); - if ( rSet.GetItemState( nWhich, false ) == SFX_ITEM_SET ) + if (SFX_ITEM_SET == rSet.GetItemState(nWhich, false)) { - const SvxSetItem& rSetItem = - (const SvxSetItem&)rSet.Get( nWhich, false ); + const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False)); const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); - const SfxBoolItem& rOn = - (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); + const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON))); - if ( rOn.GetValue() ) + if(rOn.GetValue()) { - nWhich = GetWhich( SID_ATTR_BRUSH ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes; - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(mbEnableDrawingLayerFillStyles) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rTmpSet.Get( nWhich ); - m_pBspWin->SetHdColor( rItem.GetColor() ); + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet)); + } + else + { + nWhich = GetWhich(SID_ATTR_BRUSH); + + if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich)) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); + SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + m_pBspWin->setHeaderFillAttributes(aHeaderFillAttributes); + nWhich = GetWhich(SID_ATTR_BORDER_OUTER); + + if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET) { const SvxBoxItem& rItem = (const SvxBoxItem&)rTmpSet.Get( nWhich ); @@ -1208,61 +1236,81 @@ void SvxPageDescPage::ResetBackground_Impl( const SfxItemSet& rSet ) } } - nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET ); + nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET); - if ( rSet.GetItemState( nWhich, false ) == SFX_ITEM_SET ) + if (SFX_ITEM_SET == rSet.GetItemState(nWhich, false)) { - const SvxSetItem& rSetItem = - (const SvxSetItem&)rSet.Get( nWhich, false ); + const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich,sal_False)); const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); - const SfxBoolItem& rOn = - (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); + const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON))); - if ( rOn.GetValue() ) + if(rOn.GetValue()) { - nWhich = GetWhich( SID_ATTR_BRUSH ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes; - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(mbEnableDrawingLayerFillStyles) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rTmpSet.Get( nWhich ); - m_pBspWin->SetFtColor( rItem.GetColor() ); + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet)); } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + else + { + nWhich = GetWhich(SID_ATTR_BRUSH); - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich)) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); + SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } + } + + m_pBspWin->setFooterFillAttributes(aFooterFillAttributes); + nWhich = GetWhich(SID_ATTR_BORDER_OUTER); + + if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET) { - const SvxBoxItem& rItem = - (const SvxBoxItem&)rTmpSet.Get( nWhich ); - m_pBspWin->SetFtBorder( rItem ); + const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich)); + m_pBspWin->SetFtBorder(rItem); } } } - const SfxPoolItem* pItem = GetItem( rSet, SID_ATTR_BRUSH ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes; + const SfxPoolItem* pItem = 0; - if ( pItem ) + if(mbEnableDrawingLayerFillStyles) + { + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet)); + } + else { - m_pBspWin->SetColor( ( (const SvxBrushItem*)pItem )->GetColor() ); - const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic(); + pItem = GetItem(rSet, SID_ATTR_BRUSH); - if ( pGrf ) + if(pItem) { - Bitmap aBitmap = pGrf->GetBitmap(); - m_pBspWin->SetBitmap( &aBitmap ); + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem); + SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); } - else - m_pBspWin->SetBitmap( NULL ); } - pItem = GetItem( rSet, SID_ATTR_BORDER_OUTER ); + m_pBspWin->setPageFillAttributes(aPageFillAttributes); + pItem = GetItem(rSet, SID_ATTR_BORDER_OUTER); - if ( pItem ) - m_pBspWin->SetBorder( (SvxBoxItem&)*pItem ); + if(pItem) + { + m_pBspWin->SetBorder(static_cast< const SvxBoxItem& >(*pItem)); + } } - - void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet ) { bLandscape = m_pLandscapeBtn->IsChecked(); @@ -1302,15 +1350,30 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet ) m_pBspWin->SetHeader( false ); // show background and border in the example - sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes; - if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + if(mbEnableDrawingLayerFillStyles) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rHeaderSet.Get( nWhich ); - m_pBspWin->SetHdColor( rItem.GetColor() ); + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rHeaderSet)); + } + else + { + const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH)); + + if(rHeaderSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE) + { + //UUUU aBspWin.SetHdColor(rItem.GetColor()); + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(nWhich)); + SfxItemSet aTempSet(*rHeaderSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + + m_pBspWin->setHeaderFillAttributes(aHeaderFillAttributes); + const sal_uInt16 nWhich(GetWhich(SID_ATTR_BORDER_OUTER)); if ( rHeaderSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) { @@ -1349,15 +1412,30 @@ void SvxPageDescPage::InitHeadFoot_Impl( const SfxItemSet& rSet ) m_pBspWin->SetFooter( false ); // show background and border in the example - sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes; - if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + if(mbEnableDrawingLayerFillStyles) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rFooterSet.Get( nWhich ); - m_pBspWin->SetFtColor( rItem.GetColor() ); + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rFooterSet)); } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + else + { + const sal_uInt16 nWhich(GetWhich(SID_ATTR_BRUSH)); + + if(rFooterSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE) + { + //UUUU aBspWin.SetFtColor(rItem.GetColor()); + const SvxBrushItem& rItem = (const SvxBrushItem&)rFooterSet.Get(nWhich); + SfxItemSet aTempSet(*rFooterSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } + } + + m_pBspWin->setFooterFillAttributes(aFooterFillAttributes); + const sal_uInt16 nWhich(GetWhich(SID_ATTR_BORDER_OUTER)); if ( rFooterSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) { @@ -1612,7 +1690,7 @@ bool SvxPageDescPage::IsPrinterRangeOverflow( MetricField& rField, long nFirstMargin, long nLastMargin, MarginPosition nPos ) { bool bRet = false; - bool bCheck = ( ( pImpl->m_nPos & nPos ) == 0 ); + bool bCheck = ( ( m_nPos & nPos ) == 0 ); long nValue = static_cast<long>(rField.GetValue()); if ( bCheck && ( nValue < nFirstMargin || nValue > nLastMargin ) && @@ -1631,37 +1709,37 @@ bool SvxPageDescPage::IsPrinterRangeOverflow( void SvxPageDescPage::CheckMarginEdits( bool _bClear ) { if ( _bClear ) - pImpl->m_nPos = 0; + m_nPos = 0; sal_Int64 nValue = m_pLeftMarginEdit->GetValue(); if ( nValue < nFirstLeftMargin || nValue > nLastLeftMargin ) - pImpl->m_nPos |= MARGIN_LEFT; + m_nPos |= MARGIN_LEFT; nValue = m_pRightMarginEdit->GetValue(); if ( nValue < nFirstRightMargin || nValue > nLastRightMargin ) - pImpl->m_nPos |= MARGIN_RIGHT; + m_nPos |= MARGIN_RIGHT; nValue = m_pTopMarginEdit->GetValue(); if ( nValue < nFirstTopMargin || nValue > nLastTopMargin ) - pImpl->m_nPos |= MARGIN_TOP; + m_nPos |= MARGIN_TOP; nValue = m_pBottomMarginEdit->GetValue(); if ( nValue < nFirstBottomMargin || nValue > nLastBottomMargin ) - pImpl->m_nPos |= MARGIN_BOTTOM; + m_nPos |= MARGIN_BOTTOM; } bool SvxPageDescPage::IsMarginOutOfRange() { - bool bRet = ( ( ( !( pImpl->m_nPos & MARGIN_LEFT ) && + bool bRet = ( ( ( !( m_nPos & MARGIN_LEFT ) && m_pLeftMarginEdit->IsValueChangedFromSaved() ) && ( m_pLeftMarginEdit->GetValue() < nFirstLeftMargin || m_pLeftMarginEdit->GetValue() > nLastLeftMargin ) ) || - ( ( !( pImpl->m_nPos & MARGIN_RIGHT ) && + ( ( !( m_nPos & MARGIN_RIGHT ) && m_pRightMarginEdit->IsValueChangedFromSaved() ) && ( m_pRightMarginEdit->GetValue() < nFirstRightMargin || m_pRightMarginEdit->GetValue() > nLastRightMargin ) ) || - ( ( !( pImpl->m_nPos & MARGIN_TOP ) && + ( ( !( m_nPos & MARGIN_TOP ) && m_pTopMarginEdit->IsValueChangedFromSaved() ) && ( m_pTopMarginEdit->GetValue() < nFirstTopMargin || m_pTopMarginEdit->GetValue() > nLastTopMargin ) ) || - ( ( !( pImpl->m_nPos & MARGIN_BOTTOM ) && + ( ( !( m_nPos & MARGIN_BOTTOM ) && m_pBottomMarginEdit->IsValueChangedFromSaved() ) && ( m_pBottomMarginEdit->GetValue() < nFirstBottomMargin || m_pBottomMarginEdit->GetValue() > nLastBottomMargin ) ) ); @@ -1674,12 +1752,31 @@ void SvxPageDescPage::PageCreated(const SfxAllItemSet& aSet) SFX_ITEMSET_ARG (&aSet,pPaperStartItem,SfxAllEnumItem,SID_PAPER_START,false); SFX_ITEMSET_ARG (&aSet,pPaperEndItem,SfxAllEnumItem,SID_PAPER_END,false); SFX_ITEMSET_ARG (&aSet,pCollectListItem,SfxStringListItem,SID_COLLECT_LIST,false); + + //UUUU + SFX_ITEMSET_ARG (&aSet, pSupportDrawingLayerFillStyleItem, SfxBoolItem, SID_DRAWINGLAYER_FILLSTYLES, false); + if (pModeItem) + { SetMode((SvxModeType)pModeItem->GetEnumValue()); - if (pPaperStartItem && pPaperEndItem) - SetPaperFormatRanges( (Paper)pPaperStartItem->GetEnumValue(), (Paper)pPaperEndItem->GetEnumValue() ); - if (pCollectListItem) + } + + if(pPaperStartItem && pPaperEndItem) + { + SetPaperFormatRanges((Paper)pPaperStartItem->GetEnumValue(),(Paper)pPaperEndItem->GetEnumValue()); + } + + if(pCollectListItem) + { SetCollectionList(pCollectListItem->GetList()); + } + + if(pSupportDrawingLayerFillStyleItem) + { + const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue()); + + EnableDrawingLayerFillStyles(bNew); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index 20924d00bbf7..1fdcbe5a7404 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -790,7 +790,7 @@ void SvxAreaTabPage::Construct() void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) { - sal_Int32 nCount; + sal_Int32 nCount(0); SFX_ITEMSET_ARG (&rSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false); SFX_ITEMSET_ARG (&rSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,false); if (pPageTypeItem) @@ -803,7 +803,9 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) if( pColorList.is() ) { - sal_Int32 _nPos = 0; + //UUUU use evtl. previously selected entry to avoid changing values just by + // switching TabPages in dialogs using this TabPage + sal_Int32 _nPos(nPos); if( *pnBitmapListState ) { @@ -2383,6 +2385,7 @@ void SvxAreaTabPage::PageCreated(const SfxAllItemSet& aSet) SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,false); SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,false); SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,false); + //UUUU SFX_ITEMSET_ARG (&aSet, pOfferImportItem, SfxBoolItem, SID_OFFER_IMPORT, false); diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx index fcf59b5439be..1569f9ed73d9 100644 --- a/include/svx/hdft.hxx +++ b/include/svx/hdft.hxx @@ -37,11 +37,15 @@ namespace svx // class SvxHFPage ------------------------------------------------------ -class SVX_DLLPUBLIC SvxHFPage: public SfxTabPage +class SVX_DLLPUBLIC SvxHFPage : public SfxTabPage { using TabPage::ActivatePage; using TabPage::DeactivatePage; +private: + //UUUU + void EnableDrawingLayerFillStyles(bool bNew) { mbEnableDrawingLayerFillStyles = bNew; } + public: virtual bool FillItemSet( SfxItemSet* rOutSet ) SAL_OVERRIDE; @@ -49,8 +53,12 @@ public: virtual ~SvxHFPage(); - void DisableDeleteQueryBox() { bDisableQueryBox = true; } - void EnableBackgroundSelector( bool bNew ) { bEnableBackgroundSelector = bNew; } + void DisableDeleteQueryBox() { mbDisableQueryBox = true; } + void EnableBackgroundSelector(bool bNew) { mbEnableBackgroundSelector = bNew; } + + //UUUU + virtual void PageCreated(const SfxAllItemSet&) SAL_OVERRIDE; + void EnableDynamicSpacing(); protected: @@ -78,8 +86,10 @@ protected: sal_uInt16 nId; SfxItemSet* pBBSet; - bool bDisableQueryBox; - bool bEnableBackgroundSelector; + /// bitfield + bool mbDisableQueryBox : 1; + bool mbEnableBackgroundSelector : 1; + bool mbEnableDrawingLayerFillStyles : 1; void InitHandler(); DECL_LINK( TurnOnHdl, CheckBox*); diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx index e91281803158..eb83db630c02 100644 --- a/include/svx/pagectrl.hxx +++ b/include/svx/pagectrl.hxx @@ -21,14 +21,12 @@ #include <vcl/window.hxx> #include <svx/svxdllapi.h> +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> // forward --------------------------------------------------------------- - class SvxBoxItem; -struct PageWindow_Impl; // class SvxPageWindow --------------------------------------------------- - class SVX_DLLPUBLIC SvxPageWindow : public Window { using Window::GetBorder; @@ -41,24 +39,29 @@ private: long nBottom; long nLeft; long nRight; - Color aColor; - PageWindow_Impl* pImpl; + SvxBoxItem* pBorder; + sal_Bool bResetBackground; + sal_Bool bFrameDirection; + sal_Int32 nFrameDirection; long nHdLeft; long nHdRight; long nHdDist; long nHdHeight; - Color aHdColor; SvxBoxItem* pHdBorder; long nFtLeft; long nFtRight; long nFtDist; long nFtHeight; - Color aFtColor; SvxBoxItem* pFtBorder; + //UUUU + drawinglayer::attribute::SdrAllFillAttributesHelperPtr maHeaderFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFooterFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr maPageFillAttributes; + bool bFooter :1; bool bHeader :1; bool bTable :1; @@ -77,64 +80,69 @@ protected: const bool bSecond, const bool bEnabled ); + //UUUU + void drawFillAttributes( + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, + const Rectangle& rPaintRange, + const Rectangle& rDefineRange); + public: SvxPageWindow( Window* pParent ); virtual ~SvxPageWindow(); - void SetWidth( long nW ) { aSize.Width() = nW; } - void SetHeight( long nH ) { aSize.Height() = nH; } + //UUUU + void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maHeaderFillAttributes = rFillAttributes; } + void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maFooterFillAttributes = rFillAttributes; } + void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maPageFillAttributes = rFillAttributes; } + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const { return maPageFillAttributes; } - void SetSize( const Size& rSz ) { aSize = rSz; } + void SetWidth(long nW) { aSize.Width() = nW; } + void SetHeight(long nH) { aSize.Height() = nH; } + + void SetSize(const Size& rSz) { aSize = rSz; } const Size& GetSize() const { return aSize; } - void SetTop( long nNew ) { nTop = nNew; } - void SetBottom( long nNew ) { nBottom = nNew; } - void SetLeft( long nNew ) { nLeft = nNew; } - void SetRight( long nNew ) { nRight = nNew; } - void SetColor( const Color& rNew ) { aColor = rNew; } - void SetBorder( const SvxBoxItem& rNew ); - void SetBitmap( Bitmap* pBmp ); - - long GetTop() const { return nTop; } - long GetBottom() const { return nBottom;} - long GetLeft() const { return nLeft; } + void SetTop(long nNew) { nTop = nNew; } + void SetBottom(long nNew) { nBottom = nNew; } + void SetLeft(long nNew) { nLeft = nNew; } + void SetRight(long nNew) { nRight = nNew; } + void SetBorder(const SvxBoxItem& rNew); + + long GetTop() const { return nTop; } + long GetBottom() const { return nBottom; } + long GetLeft() const { return nLeft; } long GetRight() const { return nRight; } - const Color& GetColor() const { return aColor; } const SvxBoxItem& GetBorder() const; - void SetHdLeft( long nNew ) { nHdLeft = nNew; } - void SetHdRight( long nNew ) { nHdRight = nNew; } - void SetHdDist( long nNew ) { nHdDist = nNew; } - void SetHdHeight( long nNew ) { nHdHeight = nNew; } - void SetHdColor( const Color& aNew ) { aHdColor = aNew; } - void SetHdBorder( const SvxBoxItem& rNew ); + void SetHdLeft(long nNew) { nHdLeft = nNew; } + void SetHdRight(long nNew) { nHdRight = nNew; } + void SetHdDist(long nNew) { nHdDist = nNew; } + void SetHdHeight(long nNew) { nHdHeight = nNew; } + void SetHdBorder(const SvxBoxItem& rNew); - long GetHdLeft() const { return nHdLeft; } + long GetHdLeft() const { return nHdLeft; } long GetHdRight() const { return nHdRight; } - long GetHdDist() const { return nHdDist; } - long GetHdHeight() const { return nHdHeight;} + long GetHdDist() const { return nHdDist; } + long GetHdHeight() const { return nHdHeight; } - const Color& GetHdColor() const { return aHdColor; } const SvxBoxItem& GetHdBorder() const { return *pHdBorder; } - void SetFtLeft( long nNew ) { nFtLeft = nNew; } - void SetFtRight( long nNew ) { nFtRight = nNew; } - void SetFtDist( long nNew ) { nFtDist = nNew; } - void SetFtHeight( long nNew ) { nFtHeight = nNew; } - void SetFtColor( const Color& aNew ) { aFtColor = aNew; } - void SetFtBorder( const SvxBoxItem& rNew ); + void SetFtLeft(long nNew) { nFtLeft = nNew; } + void SetFtRight(long nNew) { nFtRight = nNew; } + void SetFtDist(long nNew) { nFtDist = nNew; } + void SetFtHeight(long nNew) { nFtHeight = nNew; } + void SetFtBorder(const SvxBoxItem& rNew); - long GetFtLeft() const { return nFtLeft; } + long GetFtLeft() const { return nFtLeft; } long GetFtRight() const { return nFtRight; } - long GetFtDist() const { return nFtDist; } - long GetFtHeight() const { return nFtHeight;} + long GetFtDist() const { return nFtDist; } + long GetFtHeight() const { return nFtHeight; } - const Color& GetFtColor() const { return aFtColor; } const SvxBoxItem& GetFtBorder() const { return *pFtBorder; } - void SetUsage( sal_uInt16 eU ) { eUsage = eU; } - sal_uInt16 GetUsage() const { return eUsage;} + void SetUsage(sal_uInt16 eU) { eUsage = eU; } + sal_uInt16 GetUsage() const { return eUsage; } void SetHeader( bool bNew ) { bHeader = bNew; } bool GetHeader() const { return bHeader;} @@ -150,7 +158,7 @@ public: void EnableFrameDirection(bool bEnable); //uses enum SvxFrameDirection - void SetFrameDirection(sal_Int32 nFrameDirection); + void SetFrameDirection(sal_Int32 nDirection); void ResetBackground(); @@ -159,5 +167,4 @@ public: #endif // INCLUDED_SVX_PAGECTRL_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx b/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx new file mode 100644 index 000000000000..f58f509e167c --- /dev/null +++ b/include/svx/sdr/attribute/sdrallfillattributeshelper.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX +#define _SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX + +#include "svx/svxdllapi.h" +#include <drawinglayer/attribute/fillgradientattribute.hxx> +#include <drawinglayer/attribute/sdrfillattribute.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <boost/shared_ptr.hpp> +#include <tools/color.hxx> +#include <svl/itemset.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class SVX_DLLPUBLIC SdrAllFillAttributesHelper + { + private: + basegfx::B2DRange maLastPaintRange; + basegfx::B2DRange maLastDefineRange; + boost::shared_ptr< drawinglayer::attribute::SdrFillAttribute > maFillAttribute; + boost::shared_ptr< drawinglayer::attribute::FillGradientAttribute > maFillGradientAttribute; + drawinglayer::primitive2d::Primitive2DSequence maPrimitives; + + void createPrimitive2DSequence( + const basegfx::B2DRange& rPaintRange, + const basegfx::B2DRange& rDefineRange); + + protected: + public: + SdrAllFillAttributesHelper(); + SdrAllFillAttributesHelper(const Color& rColor); + SdrAllFillAttributesHelper(const SfxItemSet& rSet); + ~SdrAllFillAttributesHelper(); + + bool isUsed() const; + bool hasSdrFillAttribute() const { return maFillAttribute.get(); } + bool hasFillGradientAttribute() const { return maFillGradientAttribute.get(); } + bool isTransparent() const; + + const drawinglayer::attribute::SdrFillAttribute& getFillAttribute() const; + const drawinglayer::attribute::FillGradientAttribute& getFillGradientAttribute() const; + const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence( + const basegfx::B2DRange& rPaintRange, + const basegfx::B2DRange& rDefineRange) const; + + // get average fill color; tries to calculate a 'medium' color + // which e.g. may be used as comparison to decide if other + // colors are visible + basegfx::BColor getAverageColor(const basegfx::BColor& rFallback) const; + + // return if a repaint of this content needs a complete repaint. This + // is e.g. not needed for no fill or color fill (a partial repaint + // will do the trick), but necessary for everything that is not top-left + // oriented + bool needCompleteRepaint() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif // _SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index facf6cbaadef..06376c51711a 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -348,9 +348,13 @@ public: sal_uInt16 nOther, sal_uInt16 nShorter, sal_uInt16 nLonger ) = 0; - virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg( Window* pParent, - const SfxItemSet& rCoreSet, - bool bEnableSelector = false) = 0; + //UUUU add for SvxBorderBackgroundDlg + virtual SfxAbstractTabDialog* CreateSvxBorderBackgroundDlg( + Window* pParent, + const SfxItemSet& rCoreSet, + bool bEnableSelector = false, + bool bEnableDrawingLayerFillStyles = false) = 0; + virtual AbstractSvxTransformTabDialog* CreateSvxTransformTabDialog( Window* pParent, const SfxItemSet* pAttr, const SdrView* pView, diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index cec1a0ee9f14..23a9df59f6f9 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -1001,9 +1001,10 @@ //UUUU #define SID_OFFER_IMPORT ( SID_SVX_START + 1143 ) +#define SID_DRAWINGLAYER_FILLSTYLES ( SID_SVX_START + 1144) // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE (SID_OFFER_IMPORT + 1) +#define SID_SVX_FIRSTFREE (SID_DRAWINGLAYER_FILLSTYLES + 1) // Overflow check for slot IDs diff --git a/include/svx/unobrushitemhelper.hxx b/include/svx/unobrushitemhelper.hxx new file mode 100644 index 000000000000..eea95b60e6d6 --- /dev/null +++ b/include/svx/unobrushitemhelper.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _UNOBRUSHITEMHELPER_HXX +#define _UNOBRUSHITEMHELPER_HXX + +#include "svx/svxdllapi.h" +#include <editeng/brushitem.hxx> + +//UUUU Helper function definintions for UNO API fallbacks to replace SvxBrushItem. The +// idea is to have fallbacks to create a SvxBrushItem if needed for backwards compatibility +// if needed from the SfxItemSet and vice versa. This is used in cases where e.g. UNO API +// accesses to slots in the SvxBrushItem are used (see cases in SvxBrushItem::QueryValue +// and SvxBrushItem::PutValue as MID_BACK_COLOR and similar). +// To make this work, a cycle of creating a SvxBrushItem from a SfxItemSet, changing a value +// using PutValue, putting back to the SfxItemSet should create the *same* SvxBrushItem +// the next time this will be created using getSvxBrushItemFromSourceSet. For more details, +// see comments at the implementations of that two methods. + +// Set the equivalent in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST] in the given +// SfxItemSet to create the same FillStyle as is expressed by the given SvxBrushItem. +// This method will reset all items in the XATTR_FILL_* range first. +SVX_DLLPUBLIC void setSvxBrushItemAsFillAttributesToTargetSet( + const SvxBrushItem& rBrush, + SfxItemSet& rToSet); + +// Create a SvxBrushItem as close as possible to the settings in the DrawingLayer +// items in the range [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Since this is not 100% +// representable this may lead to reduced data. With nBackgroundID a Which-ID for the +// to-be-created SvxBrushItem has to be given (default should be 99 as in RES_BACKGROUND). +SVX_DLLPUBLIC SvxBrushItem getSvxBrushItemFromSourceSet( + const SfxItemSet& rSourceSet, + sal_uInt16 nBackgroundID, + bool bSearchInParents = true); + +#endif // _UNOBRUSHITEMHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/bmpacc.hxx b/include/vcl/bmpacc.hxx index b64b91be9041..359c16829031 100644 --- a/include/vcl/bmpacc.hxx +++ b/include/vcl/bmpacc.hxx @@ -182,6 +182,7 @@ public: void SetLineColor( const Color& rColor ); + void SetFillColor(); void SetFillColor( const Color& rColor ); void Erase( const Color& rColor ); diff --git a/include/xmloff/PageMasterStyleMap.hxx b/include/xmloff/PageMasterStyleMap.hxx index a4bd011fb229..a4007bd012f5 100644 --- a/include/xmloff/PageMasterStyleMap.hxx +++ b/include/xmloff/PageMasterStyleMap.hxx @@ -86,6 +86,17 @@ #define CTF_PM_GRAPHICFILTER (XML_PM_CTF_START + 0x0033) #define CTF_PM_GRAPHICURL (XML_PM_CTF_START + 0x0034) +//UUUUNeed own entries for PageMasterStyleMap since these get *filtered* +// at export time using CTF_PM_FLAGMASK and XML_PM_CTF_START as detector +// to find the first entry for header/footer (!), see +// SvXMLAutoStylePoolP_Impl::exportXML, look for XML_STYLE_FAMILY_PAGE_MASTER +#define CTF_PM_REPEAT_OFFSET_X (XML_PM_CTF_START + 0x0035) +#define CTF_PM_REPEAT_OFFSET_Y (XML_PM_CTF_START + 0x0036) +#define CTF_PM_FILLGRADIENTNAME (XML_PM_CTF_START + 0x0037) +#define CTF_PM_FILLHATCHNAME (XML_PM_CTF_START + 0x0038) +#define CTF_PM_FILLBITMAPNAME (XML_PM_CTF_START + 0x0039) +#define CTF_PM_FILLTRANSNAME (XML_PM_CTF_START + 0x0040) + #define CTF_PM_SCALETO (XML_PM_CTF_START + 0x0051) // calc specific #define CTF_PM_SCALETOPAGES (XML_PM_CTF_START + 0x0052) #define CTF_PM_SCALETOX (XML_PM_CTF_START + 0x0053) @@ -122,6 +133,14 @@ #define CTF_PM_HEADERMARGINLEFT (CTF_PM_HEADERFLAG|CTF_PM_MARGINLEFT) #define CTF_PM_HEADERMARGINRIGHT (CTF_PM_HEADERFLAG|CTF_PM_MARGINRIGHT) +//UUUUNeed own entries for PageMasterStyleMap ORed with the CTF_PM_HEADERFLAG +#define CTF_PM_HEADERREPEAT_OFFSET_X (CTF_PM_HEADERFLAG|CTF_PM_REPEAT_OFFSET_X) +#define CTF_PM_HEADERREPEAT_OFFSET_Y (CTF_PM_HEADERFLAG|CTF_PM_REPEAT_OFFSET_Y) +#define CTF_PM_HEADERFILLGRADIENTNAME (CTF_PM_HEADERFLAG|CTF_PM_FILLGRADIENTNAME) +#define CTF_PM_HEADERFILLHATCHNAME (CTF_PM_HEADERFLAG|CTF_PM_FILLHATCHNAME) +#define CTF_PM_HEADERFILLBITMAPNAME (CTF_PM_HEADERFLAG|CTF_PM_FILLBITMAPNAME) +#define CTF_PM_HEADERFILLTRANSNAME (CTF_PM_HEADERFLAG|CTF_PM_FILLTRANSNAME) + // footer #define CTF_PM_FOOTERBORDERALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERALL) #define CTF_PM_FOOTERBORDERTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERTOP) @@ -150,6 +169,14 @@ #define CTF_PM_FOOTERMARGINLEFT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINLEFT) #define CTF_PM_FOOTERMARGINRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINRIGHT) +//UUUUNeed own entries for PageMasterStyleMap ORed with the CTF_PM_FOOTERFLAG +#define CTF_PM_FOOTERREPEAT_OFFSET_X (CTF_PM_FOOTERFLAG|CTF_PM_REPEAT_OFFSET_X) +#define CTF_PM_FOOTERREPEAT_OFFSET_Y (CTF_PM_FOOTERFLAG|CTF_PM_REPEAT_OFFSET_Y) +#define CTF_PM_FOOTERFILLGRADIENTNAME (CTF_PM_FOOTERFLAG|CTF_PM_FILLGRADIENTNAME) +#define CTF_PM_FOOTERFILLHATCHNAME (CTF_PM_FOOTERFLAG|CTF_PM_FILLHATCHNAME) +#define CTF_PM_FOOTERFILLBITMAPNAME (CTF_PM_FOOTERFLAG|CTF_PM_FILLBITMAPNAME) +#define CTF_PM_FOOTERFILLTRANSNAME (CTF_PM_FOOTERFLAG|CTF_PM_FILLTRANSNAME) + #define CTF_PM_FTN_HEIGHT (XML_PM_CTF_START + 0x0060) #define CTF_PM_FTN_LINE_WEIGHT (XML_PM_CTF_START + 0x0061) #define CTF_PM_FTN_LINE_COLOR (XML_PM_CTF_START + 0x0062) diff --git a/include/xmloff/XMLShapeStyleContext.hxx b/include/xmloff/XMLShapeStyleContext.hxx index a93181a5d71a..b0f7a3aef24d 100644 --- a/include/xmloff/XMLShapeStyleContext.hxx +++ b/include/xmloff/XMLShapeStyleContext.hxx @@ -36,8 +36,9 @@ protected: OUString m_sControlDataStyleName; OUString m_sListStyleName; bool m_bIsNumRuleAlreadyConverted; + //UUUU - bool m_bIsFillStyleAlreadyConverted; + bool m_bIsFillStyleAlreadyConverted : 1; protected: virtual void SetAttribute( sal_uInt16 nPrefixKey, diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx index 4668668cf6de..76dab711104d 100644 --- a/include/xmloff/prstylei.hxx +++ b/include/xmloff/prstylei.hxx @@ -26,6 +26,9 @@ #include <vector> #include <xmloff/xmlstyle.hxx> +//UUUU +#include <boost/unordered_set.hpp> + struct XMLPropertyState; class SvXMLStylesContext; @@ -33,19 +36,53 @@ namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } } +//UUUU +typedef boost::unordered_set<OUString, OUStringHash> OldFillStyleDefinitionSet; + class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext { +private: const OUString msIsPhysical; const OUString msFollowStyle; ::std::vector< XMLPropertyState > maProperties; ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > mxStyle; SvXMLImportContextRef mxStyles; + //UUUU + static OldFillStyleDefinitionSet maStandardSet; + static OldFillStyleDefinitionSet maHeaderSet; + static OldFillStyleDefinitionSet maFooterSet; + static OldFillStyleDefinitionSet maParaSet; + SAL_DLLPRIVATE XMLPropStyleContext(XMLPropStyleContext &); // not defined SAL_DLLPRIVATE void operator =(XMLPropStyleContext &); // not defined protected: + //UUUU Helper to check if the local maProperties contzains the given + // FillStyle tag and if the FillStyle there is different from FillStyle_NONE + bool doNewDrawingLayerFillStyleDefinitionsExist( + const ::rtl::OUString& rFillStyleTag) const; + + //UUUU Helper which will deactivate all old fill definitions (identified by + // the given OldFillStyleDefinitionSet) in the local maProperties. Deactivation + // is done setting theindex to -1. It returns true when actually old fill + // definitions existed and were deactivated + bool deactivateOldFillStyleDefinitions( + const OldFillStyleDefinitionSet& rHashSetOfTags); + + //UUUU Helper to translate new DrawingLayer FillStyle values which are name-based + // from ODF internal name to style display names which can be found in the current + // document model (using NameOrIndex Items). The change is executed on the internal + // maProperties. The return value is true when actually names were changed + bool translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames(); + + //UUUU provider for often used sets + const OldFillStyleDefinitionSet& getStandardSet(); + const OldFillStyleDefinitionSet& getHeaderSet(); + const OldFillStyleDefinitionSet& getFooterSet(); + const OldFillStyleDefinitionSet& getParaSet(); + virtual void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName, const OUString& rValue ) SAL_OVERRIDE; diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx index 2de9987d5c92..dc8de7026395 100644 --- a/include/xmloff/txtprmap.hxx +++ b/include/xmloff/txtprmap.hxx @@ -198,14 +198,6 @@ #define CTF_RELHEIGHTREL (XML_TEXT_CTF_START + 169) -//UUUU -#define CTF_SW_REPEAT_OFFSET_X (XML_TEXT_CTF_START + 170) -#define CTF_SW_REPEAT_OFFSET_Y (XML_TEXT_CTF_START + 171) -#define CTF_SW_FILLGRADIENTNAME (XML_TEXT_CTF_START + 172) -#define CTF_SW_FILLHATCHNAME (XML_TEXT_CTF_START + 173) -#define CTF_SW_FILLBITMAPNAME (XML_TEXT_CTF_START + 174) -#define CTF_SW_FILLTRANSNAME (XML_TEXT_CTF_START + 175) - #define TEXT_PROP_MAP_TEXT 0 #define TEXT_PROP_MAP_PARA 1 #define TEXT_PROP_MAP_FRAME 2 diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index b1ccc46de75f..3b1e6572305e 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -134,6 +134,22 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell ) if (pMgr) pDrawLayer->SetLinkManager(pMgr); + //UUUU set DrawingLayer's SfxItemPool at Calc's SfxItemPool as + // secondary pool to support DrawingLayer FillStyle ranges (and similar) + // in SfxItemSets using the Calc SfxItemPool. This is e.g. needed when + // the PageStyle using SvxBrushItem is visualized and will be potentially + // used more intense in the future + if(xPoolHelper.is()) + { + ScDocumentPool* pLocalPool = xPoolHelper->GetDocPool(); + + if(pLocalPool) + { + OSL_ENSURE(!pLocalPool->GetSecondaryPool(), "OOps, already a secondary pool set where the DrawingLayer ItemPool is to be placed (!)"); + pLocalPool->SetSecondaryPool(&pDrawLayer->GetItemPool()); + } + } + // Drawing pages are accessed by table number, so they must also be present // for preceding table numbers, even if the tables aren't allocated // (important for clipboard documents). @@ -224,7 +240,20 @@ IMPL_LINK_INLINE_END( ScDocument, GetUserDefinedColor, sal_uInt16 *, pColorIndex void ScDocument::DeleteDrawLayer() { + //UUUU remove DrawingLayer's SfxItemPool from Calc's SfxItemPool where + // it is registered as secondary pool + if(xPoolHelper.is()) + { + ScDocumentPool* pLocalPool = xPoolHelper->GetDocPool(); + + if(pLocalPool && pLocalPool->GetSecondaryPool()) + { + pLocalPool->SetSecondaryPool(0); + } + } + delete pDrawLayer; + pDrawLayer = 0; } bool ScDocument::DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) const diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 7ed776f80eac..960650b431c0 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -145,6 +145,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/sdr/animation/scheduler \ svx/source/sdr/animation/objectanimator \ svx/source/sdr/animation/animationstate \ + svx/source/sdr/attribute/sdrallfillattributeshelper \ svx/source/sdr/attribute/sdrlinefillshadowtextattribute \ svx/source/sdr/attribute/sdrfilltextattribute \ svx/source/sdr/attribute/sdrshadowtextattribute \ @@ -350,6 +351,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/unodraw/gluepts \ svx/source/unodraw/shapepropertynotifier \ svx/source/unodraw/tableshape \ + svx/source/unodraw/unobrushitemhelper \ svx/source/unodraw/unobtabl \ svx/source/unodraw/unodtabl \ svx/source/unodraw/UnoGraphicExporter \ diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index 4e8b647fa87a..749f68bb0122 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -24,7 +24,6 @@ #include <sfx2/module.hxx> #include <vcl/msgbox.hxx> #include <vcl/graph.hxx> - #include <sfx2/sfxsids.hrc> #include <svx/svxids.hrc> #include <svx/dialogs.hrc> @@ -47,6 +46,14 @@ #include <svx/svxdlg.hxx> #include <boost/scoped_ptr.hpp> + +//UUUU +#include <svx/xdef.hxx> +#include <svx/xenum.hxx> +#include <svx/xfillit0.hxx> +#include <svx/unobrushitemhelper.hxx> +#include <sfx2/request.hxx> + // static ---------------------------------------------------------------- // Word 97 incompatibility (#i19922#) @@ -59,6 +66,11 @@ static const long DEF_DIST_CALC = 250; // 2.5mm (Calc) static const sal_uInt16 pRanges[] = { SID_ATTR_BRUSH, SID_ATTR_BRUSH, + + //UUUU Support DrawingLayer FillStyles (no real call to below GetRanges() + // detected, still do the complete transition) + XATTR_FILL_FIRST, XATTR_FILL_LAST, + SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW, @@ -152,15 +164,14 @@ SvxFooterPage::SvxFooterPage( Window* pParent, const SfxItemSet& rAttr ) : } - SvxHFPage::SvxHFPage( Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId ) : - - SfxTabPage( pParent, "HFFormatPage", "svx/ui/headfootformatpage.ui", &rSet ), - nId ( nSetId ), - pBBSet ( NULL ), - bDisableQueryBox ( false ), - bEnableBackgroundSelector ( true ) - + SfxTabPage(pParent, "HFFormatPage", "svx/ui/headfootformatpage.ui", &rSet), + nId(nSetId), + pBBSet(NULL), + // bitfield + mbDisableQueryBox(false), + mbEnableBackgroundSelector(true), + mbEnableDrawingLayerFillStyles(false) { get(m_pCntSharedBox,"checkSameLR"); get(m_pCntSharedFirstBox,"checkSameFP"); @@ -217,38 +228,51 @@ SvxHFPage::~SvxHFPage() bool SvxHFPage::FillItemSet( SfxItemSet* rSet ) { - const sal_uInt16 nWSize = GetWhich( SID_ATTR_PAGE_SIZE ); - const sal_uInt16 nWLRSpace = GetWhich( SID_ATTR_LRSPACE ); - const sal_uInt16 nWULSpace = GetWhich( SID_ATTR_ULSPACE ); - const sal_uInt16 nWOn = GetWhich( SID_ATTR_PAGE_ON ); - const sal_uInt16 nWDynamic = GetWhich( SID_ATTR_PAGE_DYNAMIC ); - const sal_uInt16 nWDynSpacing = GetWhich( SID_ATTR_HDFT_DYNAMIC_SPACING ); - const sal_uInt16 nWShared = GetWhich( SID_ATTR_PAGE_SHARED ); - const sal_uInt16 nWSharedFirst = GetWhich( SID_ATTR_PAGE_SHARED_FIRST ); - const sal_uInt16 nWBrush = GetWhich( SID_ATTR_BRUSH ); - const sal_uInt16 nWBox = GetWhich( SID_ATTR_BORDER_OUTER ); - const sal_uInt16 nWBoxInfo = GetWhich( SID_ATTR_BORDER_INNER ); - const sal_uInt16 nWShadow = GetWhich( SID_ATTR_BORDER_SHADOW ); - const sal_uInt16 aWhichTab[] = { nWSize, nWSize, - nWLRSpace, nWLRSpace, - nWULSpace, nWULSpace, - nWOn, nWOn, - nWDynamic, nWDynamic, - nWShared, nWShared, - nWSharedFirst, nWSharedFirst, - nWBrush, nWBrush, - nWBoxInfo, nWBoxInfo, - nWBox, nWBox, - nWShadow, nWShadow, - nWDynSpacing, nWDynSpacing, - 0 }; - const SfxItemSet& rOldSet = GetItemSet(); - SfxItemPool* pPool = rOldSet.GetPool(); - DBG_ASSERT( pPool, "no pool :-(" ); - SfxMapUnit eUnit = pPool->GetMetric( nWSize ); - SfxItemSet aSet ( *pPool, aWhichTab ); - - + const sal_uInt16 nWSize = GetWhich(SID_ATTR_PAGE_SIZE); + const sal_uInt16 nWLRSpace = GetWhich(SID_ATTR_LRSPACE); + const sal_uInt16 nWULSpace = GetWhich(SID_ATTR_ULSPACE); + const sal_uInt16 nWOn = GetWhich(SID_ATTR_PAGE_ON); + const sal_uInt16 nWDynamic = GetWhich(SID_ATTR_PAGE_DYNAMIC); + const sal_uInt16 nWDynSpacing = GetWhich(SID_ATTR_HDFT_DYNAMIC_SPACING); + const sal_uInt16 nWShared = GetWhich(SID_ATTR_PAGE_SHARED); + const sal_uInt16 nWSharedFirst = GetWhich( SID_ATTR_PAGE_SHARED_FIRST ); + const sal_uInt16 nWBrush = GetWhich(SID_ATTR_BRUSH); + const sal_uInt16 nWBox = GetWhich(SID_ATTR_BORDER_OUTER); + const sal_uInt16 nWBoxInfo = GetWhich(SID_ATTR_BORDER_INNER); + const sal_uInt16 nWShadow = GetWhich(SID_ATTR_BORDER_SHADOW); + + const sal_uInt16 aWhichTab[] = { + nWSize, nWSize, + nWLRSpace, nWLRSpace, + nWULSpace, nWULSpace, + nWOn, nWOn, + nWDynamic, nWDynamic, + nWShared, nWShared, + nWSharedFirst, nWSharedFirst, + nWBrush, nWBrush, + nWBoxInfo, nWBoxInfo, + nWBox, nWBox, + nWShadow, nWShadow, + nWDynSpacing, nWDynSpacing, + + //UUUU take over DrawingLayer FillStyles + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + 0, 0}; + + const SfxItemSet& rOldSet = GetItemSet(); + SfxItemPool* pPool = rOldSet.GetPool(); + DBG_ASSERT(pPool,"no pool :-("); + SfxMapUnit eUnit = pPool->GetMetric(nWSize); + SfxItemSet aSet(*pPool,aWhichTab); + + if(mbEnableDrawingLayerFillStyles) + { + //UUUU When using the XATTR_FILLSTYLE DrawingLayer FillStyle definition + // extra action has to be done here since the pool default is XFILL_SOLID + // instead of XFILL_NONE (to have the default blue fill color at start). + aSet.Put(XFillStyleItem(XFILL_NONE)); + } aSet.Put( SfxBoolItem( nWOn, m_pTurnOnBox->IsChecked() ) ); aSet.Put( SfxBoolItem( nWDynamic, m_pHeightDynBtn->IsChecked() ) ); @@ -287,26 +311,46 @@ bool SvxHFPage::FillItemSet( SfxItemSet* rSet ) aSet.Put( aUL ); // Background and border? - if ( pBBSet ) - aSet.Put( *pBBSet ); + if (pBBSet) + { + aSet.Put(*pBBSet); + } else { const SfxPoolItem* pItem; - if ( SFX_ITEM_SET == - GetItemSet().GetItemState( GetWhich( nId ), false, &pItem ) ) + if(SFX_ITEM_SET == GetItemSet().GetItemState(GetWhich(nId), false, &pItem)) { - const SfxItemSet* _pSet; - _pSet = &( (SvxSetItem*)pItem )->GetItemSet(); - - if ( _pSet->GetItemState( nWBrush ) == SFX_ITEM_SET ) - aSet.Put( (const SvxBrushItem&)_pSet->Get( nWBrush ) ); - if ( _pSet->GetItemState( nWBoxInfo ) == SFX_ITEM_SET ) - aSet.Put( (const SvxBoxInfoItem&)_pSet->Get( nWBoxInfo ) ); - if ( _pSet->GetItemState( nWBox ) == SFX_ITEM_SET ) - aSet.Put( (const SvxBoxItem&)_pSet->Get( nWBox ) ); - if ( _pSet->GetItemState( nWShadow ) == SFX_ITEM_SET ) - aSet.Put( (const SvxShadowItem&)_pSet->Get( nWShadow ) ); + const SfxItemSet* _pSet = &(static_cast< const SvxSetItem* >(pItem)->GetItemSet()); + + if(_pSet->GetItemState(nWBrush) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nWBrush)); + } + + if(_pSet->GetItemState(nWBoxInfo) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nWBoxInfo)); + } + + if(_pSet->GetItemState(nWBox) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nWBox)); + } + + if(_pSet->GetItemState(nWShadow) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nWShadow)); + } + + //UUUU take care of [XATTR_XATTR_FILL_FIRST .. XATTR_FILL_LAST] + for(sal_uInt16 nFillStyleId(XATTR_FILL_FIRST); nFillStyleId <= XATTR_FILL_LAST; nFillStyleId++) + { + if(_pSet->GetItemState(nFillStyleId) == SFX_ITEM_SET) + { + aSet.Put(_pSet->Get(nFillStyleId)); + } + } } } @@ -483,7 +527,7 @@ IMPL_LINK( SvxHFPage, TurnOnHdl, CheckBox *, pBox ) { bool bDelete = true; - if ( !bDisableQueryBox && pBox && m_pTurnOnBox->GetSavedValue() == sal_True ) + if ( !mbDisableQueryBox && pBox && m_pTurnOnBox->GetSavedValue() == sal_True ) { short nResult; if (nId == SID_ATTR_PAGE_HEADERSET) @@ -542,58 +586,166 @@ IMPL_LINK_NOARG_INLINE_END(SvxHFPage, BorderModify) IMPL_LINK_NOARG(SvxHFPage, BackgroundHdl) { - if ( !pBBSet ) + if(!pBBSet) { // Use only the necessary items for border and background - sal_uInt16 nBrush = GetWhich( SID_ATTR_BRUSH ); - sal_uInt16 nOuter = GetWhich( SID_ATTR_BORDER_OUTER ); - sal_uInt16 nInner = GetWhich( SID_ATTR_BORDER_INNER, false ); - sal_uInt16 nShadow = GetWhich( SID_ATTR_BORDER_SHADOW ); - - // Create an empty set - pBBSet = new SfxItemSet( *GetItemSet().GetPool(), nBrush, nBrush, - nOuter, nOuter, nInner, nInner, - nShadow, nShadow, 0 ); + const sal_uInt16 nOuter(GetWhich(SID_ATTR_BORDER_OUTER)); + const sal_uInt16 nInner(GetWhich(SID_ATTR_BORDER_INNER, sal_False)); + const sal_uInt16 nShadow(GetWhich(SID_ATTR_BORDER_SHADOW)); + + if(mbEnableDrawingLayerFillStyles) + { + pBBSet = new SfxItemSet( + *GetItemSet().GetPool(), + XATTR_FILL_FIRST, XATTR_FILL_LAST, // DrawingLayer FillStyle definitions + SID_COLOR_TABLE, SID_BITMAP_LIST, // XPropertyLists for Color, Gradient, Hatch and Graphic fills + nOuter, nOuter, + nInner, nInner, + nShadow, nShadow, + 0, 0); + + //UUUU copy items for XPropertyList entries from the DrawModel so that + // the Area TabPage can access them + static const sal_uInt16 nCopyFlags[] = { + SID_COLOR_TABLE, + SID_GRADIENT_LIST, + SID_HATCH_LIST, + SID_BITMAP_LIST, + 0 + }; + + for(sal_uInt16 a(0); nCopyFlags[a]; a++) + { + const SfxPoolItem* pItem = GetItemSet().GetItem(nCopyFlags[a]); + + if(pItem) + { + pBBSet->Put(*pItem); + } + else + { + OSL_ENSURE(false, "XPropertyList missing (!)"); + } + } + } + else + { + const sal_uInt16 nBrush(GetWhich(SID_ATTR_BRUSH)); + + pBBSet = new SfxItemSet( + *GetItemSet().GetPool(), + nBrush, nBrush, + nOuter, nOuter, + nInner, nInner, + nShadow, nShadow, + 0, 0); + } + const SfxPoolItem* pItem; - if ( SFX_ITEM_SET == - GetItemSet().GetItemState( GetWhich( nId ), false, &pItem ) ) - // if there is one that is already set, then use this - pBBSet->Put( ( (SvxSetItem*)pItem)->GetItemSet() ); + if(SFX_ITEM_SET == GetItemSet().GetItemState(GetWhich(nId), sal_False, &pItem)) + { + // If a SfxItemSet from the SetItem for SID_ATTR_PAGE_HEADERSET or + // SID_ATTR_PAGE_FOOTERSET exists, use it's content + pBBSet->Put(((SvxSetItem*)pItem)->GetItemSet()); + } + else + { + if(mbEnableDrawingLayerFillStyles) + { + //UUUU The style for header/footer is not yet created, need to reset + // XFillStyleItem to XFILL_NONE which is the same as in the style + // initialization. This needs to be done since the pool default for + // XFillStyleItem is XFILL_SOLID + pBBSet->Put(XFillStyleItem(XFILL_NONE)); + } + } - if ( SFX_ITEM_SET == - GetItemSet().GetItemState( nInner, false, &pItem ) ) + if(SFX_ITEM_SET == GetItemSet().GetItemState(nInner, sal_False, &pItem)) + { // The set InfoItem is always required - pBBSet->Put( *pItem ); + pBBSet->Put(*pItem); + } } - if ( svx::ShowBorderBackgroundDlg( this, pBBSet, bEnableBackgroundSelector ) ) + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + + if(pFact) { + //UUUU + SfxAbstractTabDialog* pDlg = pFact->CreateSvxBorderBackgroundDlg( + this, + *pBBSet, + mbEnableBackgroundSelector, + mbEnableDrawingLayerFillStyles); + + DBG_ASSERT(pDlg,"Dialogdiet fail!"); + if(RET_OK == pDlg->Execute() && pDlg->GetOutputItemSet()) + { + SfxItemIter aIter(*pDlg->GetOutputItemSet()); + const SfxPoolItem* pItem = aIter.FirstItem(); + + while(pItem) + { + if(!IsInvalidItem(pItem)) + { + pBBSet->Put(*pItem); + } + pItem = aIter.NextItem(); + } - sal_uInt16 nWhich = GetWhich( SID_ATTR_BRUSH ); + //---------------------------------------------------------------- + { + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; - if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET ) - { - const SvxBrushItem& rItem = (const SvxBrushItem&)pBBSet->Get( nWhich ); - if ( nId == SID_ATTR_PAGE_HEADERSET ) - m_pBspWin->SetHdColor( rItem.GetColor() ); - else - m_pBspWin->SetFtColor( rItem.GetColor() ); - } + if(mbEnableDrawingLayerFillStyles) + { + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pBBSet)); + } + else + { + const sal_uInt16 nWhich = GetWhich(SID_ATTR_BRUSH); + if(pBBSet->GetItemState(nWhich) == SFX_ITEM_SET) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(pBBSet->Get(nWhich)); + SfxItemSet aTempSet(*pBBSet->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } + } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + if(SID_ATTR_PAGE_HEADERSET == nId) + { + //m_pBspWin->SetHdColor(rItem.GetColor()); + m_pBspWin->setHeaderFillAttributes(aFillAttributes); + } + else + { + //m_pBspWin->SetFtColor(rItem.GetColor()); + m_pBspWin->setFooterFillAttributes(aFillAttributes); + } + } - if ( pBBSet->GetItemState( nWhich ) == SFX_ITEM_SET ) - { - const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get( nWhich ); + //---------------------------------------------------------------- + { + const sal_uInt16 nWhich = GetWhich(SID_ATTR_BORDER_OUTER); + + if(pBBSet->GetItemState(nWhich) == SFX_ITEM_SET) + { + const SvxBoxItem& rItem = (const SvxBoxItem&)pBBSet->Get(nWhich); + + if(nId == SID_ATTR_PAGE_HEADERSET) + m_pBspWin->SetHdBorder(rItem); + else + m_pBspWin->SetFtBorder(rItem); + } + } - if ( nId == SID_ATTR_PAGE_HEADERSET ) - m_pBspWin->SetHdBorder( rItem ); - else - m_pBspWin->SetFtBorder( rItem ); } UpdateExample(); @@ -625,87 +777,122 @@ void SvxHFPage::UpdateExample() void SvxHFPage::ResetBackground_Impl( const SfxItemSet& rSet ) { - sal_uInt16 nWhich = GetWhich( SID_ATTR_PAGE_HEADERSET ); + sal_uInt16 nWhich(GetWhich(SID_ATTR_PAGE_HEADERSET)); - if ( rSet.GetItemState( nWhich, false ) == SFX_ITEM_SET ) + if (SFX_ITEM_SET == rSet.GetItemState(nWhich, false)) { - const SvxSetItem& rSetItem = - (const SvxSetItem&)rSet.Get( nWhich, false ); + const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False)); const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); - const SfxBoolItem& rOn = - (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); + const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON))); - if ( rOn.GetValue() ) + if(rOn.GetValue()) { - nWhich = GetWhich( SID_ATTR_BRUSH ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aHeaderFillAttributes; - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(mbEnableDrawingLayerFillStyles) + { + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet)); + } + else { - const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich ); - m_pBspWin->SetHdColor( rItem.GetColor() ); + nWhich = GetWhich(SID_ATTR_BRUSH); + + if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich)) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); + SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aHeaderFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + m_pBspWin->setHeaderFillAttributes(aHeaderFillAttributes); + nWhich = GetWhich(SID_ATTR_BORDER_OUTER); + + if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET) { const SvxBoxItem& rItem = - (const SvxBoxItem&)rTmpSet.Get( nWhich ); - m_pBspWin->SetHdBorder( rItem ); + (const SvxBoxItem&)rTmpSet.Get(nWhich); + m_pBspWin->SetHdBorder(rItem); } } } - nWhich = GetWhich( SID_ATTR_PAGE_FOOTERSET ); + nWhich = GetWhich(SID_ATTR_PAGE_FOOTERSET); - if ( rSet.GetItemState( nWhich, false ) == SFX_ITEM_SET ) + if (SFX_ITEM_SET == rSet.GetItemState(nWhich, false)) { - const SvxSetItem& rSetItem = - (const SvxSetItem&)rSet.Get( nWhich, false ); + const SvxSetItem& rSetItem = static_cast< const SvxSetItem& >(rSet.Get(nWhich, sal_False)); const SfxItemSet& rTmpSet = rSetItem.GetItemSet(); - const SfxBoolItem& rOn = - (const SfxBoolItem&)rTmpSet.Get( GetWhich( SID_ATTR_PAGE_ON ) ); + const SfxBoolItem& rOn = static_cast< const SfxBoolItem& >(rTmpSet.Get(GetWhich(SID_ATTR_PAGE_ON))); - if ( rOn.GetValue() ) + if(rOn.GetValue()) { - nWhich = GetWhich( SID_ATTR_BRUSH ); + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFooterFillAttributes; - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(mbEnableDrawingLayerFillStyles) { - const SvxBrushItem& rItem = (const SvxBrushItem&)rTmpSet.Get( nWhich ); - m_pBspWin->SetFtColor( rItem.GetColor() ); + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rTmpSet)); } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); + else + { + nWhich = GetWhich(SID_ATTR_BRUSH); - if ( rTmpSet.GetItemState( nWhich ) == SFX_ITEM_SET ) + if(SFX_ITEM_SET == rTmpSet.GetItemState(nWhich)) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rTmpSet.Get(nWhich)); + SfxItemSet aTempSet(*rTmpSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aFooterFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); + } + } + + m_pBspWin->setFooterFillAttributes(aFooterFillAttributes); + nWhich = GetWhich(SID_ATTR_BORDER_OUTER); + + if(rTmpSet.GetItemState(nWhich) == SFX_ITEM_SET) { - const SvxBoxItem& rItem = - (const SvxBoxItem&)rTmpSet.Get( nWhich ); - m_pBspWin->SetFtBorder( rItem ); + const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rTmpSet.Get(nWhich)); + m_pBspWin->SetFtBorder(rItem); } } } - nWhich = GetWhich( SID_ATTR_BRUSH ); - if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aPageFillAttributes; + + if(mbEnableDrawingLayerFillStyles) { - const SvxBrushItem& rItem = (const SvxBrushItem&)rSet.Get( nWhich ); - m_pBspWin->SetColor( rItem.GetColor() ); - const Graphic* pGrf = rItem.GetGraphic(); + //UUUU create FillAttributes directly from DrawingLayer FillStyle entries + aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(rSet)); + } + else + { + nWhich = GetWhich(SID_ATTR_BRUSH); - if ( pGrf ) + if(rSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE) { - Bitmap aBitmap = pGrf->GetBitmap(); - m_pBspWin->SetBitmap( &aBitmap ); + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rSet.Get(nWhich)); + SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + aPageFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aTempSet)); } - else - m_pBspWin->SetBitmap( NULL ); } - nWhich = GetWhich( SID_ATTR_BORDER_OUTER ); - if ( rSet.GetItemState( nWhich ) >= SFX_ITEM_AVAILABLE ) + m_pBspWin->setPageFillAttributes(aPageFillAttributes); + nWhich = GetWhich(SID_ATTR_BORDER_OUTER); + + if(rSet.GetItemState(nWhich) >= SFX_ITEM_AVAILABLE) { - const SvxBoxItem& rItem = (const SvxBoxItem&)rSet.Get( nWhich ); - m_pBspWin->SetBorder( rItem ); + const SvxBoxItem& rItem = static_cast< const SvxBoxItem& >(rSet.Get(nWhich)); + m_pBspWin->SetBorder(rItem); } } @@ -955,6 +1142,7 @@ static void lcl_Move(Window& rWin, sal_Int32 nDiff) aPos.Y() -= nDiff; rWin.SetPosPixel(aPos); } + void SvxHFPage::EnableDynamicSpacing() { m_pDynSpacingCB->Show(); @@ -973,4 +1161,17 @@ void SvxHFPage::EnableDynamicSpacing() lcl_Move(*aMoveWindows[nIdx++], nOffset); } +void SvxHFPage::PageCreated(const SfxAllItemSet &rSet) +{ + //UUUU + SFX_ITEMSET_ARG (&rSet, pSupportDrawingLayerFillStyleItem, SfxBoolItem, SID_DRAWINGLAYER_FILLSTYLES, false); + + if(pSupportDrawingLayerFillStyleItem) + { + const bool bNew(pSupportDrawingLayerFillStyleItem->GetValue()); + + EnableDrawingLayerFillStyles(bNew); + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index c0f76c609ec9..02bf69302236 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -24,32 +24,12 @@ #include <svx/pageitem.hxx> #include <svx/pagectrl.hxx> #include <editeng/boxitem.hxx> - #include <algorithm> - -// struct PageWindow_Impl ------------------------------------------------ - -struct PageWindow_Impl -{ - SvxBoxItem* pBorder; - Bitmap aBitmap; - bool bBitmap; - bool bResetBackground; - bool bFrameDirection; - sal_Int32 nFrameDirection; - - - PageWindow_Impl() : - pBorder(0), - bBitmap(false), - bResetBackground(false), - bFrameDirection(false), - nFrameDirection(0) {} - - void EnableFrameDirection(bool bEnable){bFrameDirection = bEnable;} - void SetFrameDirection(sal_Int32 nDirection){nFrameDirection = nDirection;} - -}; +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> // STATIC DATA ----------------------------------------------------------- @@ -58,43 +38,56 @@ struct PageWindow_Impl // class SvxPageWindow --------------------------------------------------- -SvxPageWindow::SvxPageWindow( Window* pParent ) : - - Window( pParent ), - - nTop ( 0 ), - nBottom ( 0 ), - nLeft ( 0 ), - nRight ( 0 ), - aColor ( COL_TRANSPARENT ), - nHdLeft ( 0 ), - nHdRight ( 0 ), - nHdDist ( 0 ), - nHdHeight ( 0 ), - aHdColor ( COL_TRANSPARENT ), - pHdBorder ( 0 ), - nFtLeft ( 0 ), - nFtRight ( 0 ), - nFtDist ( 0 ), - nFtHeight ( 0 ), - aFtColor ( COL_TRANSPARENT ), - pFtBorder ( 0 ), - bFooter ( false ), - bHeader ( false ), - bTable ( false ), - bHorz ( false ), - bVert ( false ), - eUsage ( SVX_PAGE_ALL ) +SvxPageWindow::SvxPageWindow(Window* pParent) +: Window(pParent), + aWinSize(), + aSize(), + + nTop(0), + nBottom(0), + nLeft(0), + nRight(0), + + //UUUU + pBorder(0), + bResetBackground(sal_False), + bFrameDirection(sal_False), + nFrameDirection(0), + + nHdLeft(0), + nHdRight(0), + nHdDist(0), + nHdHeight(0), + + pHdBorder(0), + nFtLeft(0), + nFtRight(0), + nFtDist(0), + nFtHeight(0), + + pFtBorder(0), + + maHeaderFillAttributes(), + maFooterFillAttributes(), + maPageFillAttributes(), + + bFooter(false), + bHeader(false), + bTable(false), + bHorz(false), + bVert(false), + eUsage(SVX_PAGE_ALL), + + aLeftText(), + aRightText() { - pImpl = new PageWindow_Impl; - // Count in Twips by default - SetMapMode( MapMode( MAP_TWIP ) ); - aWinSize = GetOptimalSize(); + SetMapMode(MapMode(MAP_TWIP)); + aWinSize = GetOutputSizePixel(); aWinSize.Height() -= 4; aWinSize.Width() -= 4; - aWinSize = PixelToLogic( aWinSize ); + aWinSize = PixelToLogic(aWinSize); SetBackground(); } @@ -102,7 +95,6 @@ SvxPageWindow::SvxPageWindow( Window* pParent ) : SvxPageWindow::~SvxPageWindow() { - delete pImpl; delete pHdBorder; delete pFtBorder; } @@ -114,61 +106,59 @@ extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxPageWindow(Window *pPare - -void SvxPageWindow::Paint( const Rectangle& ) +void SvxPageWindow::Paint(const Rectangle&) { - Fraction aXScale( aWinSize.Width(), std::max( (long) (aSize.Width() * 2 + aSize.Width() / 8), 1L ) ); - Fraction aYScale( aWinSize.Height(), std::max( aSize.Height(), 1L ) ); - MapMode aMapMode( GetMapMode() ); + Fraction aXScale(aWinSize.Width(),std::max((long)(aSize.Width() * 2 + aSize.Width() / 8),1L)); + Fraction aYScale(aWinSize.Height(),std::max(aSize.Height(),1L)); + MapMode aMapMode(GetMapMode()); - if ( aYScale < aXScale ) + if(aYScale < aXScale) { - aMapMode.SetScaleX( aYScale ); - aMapMode.SetScaleY( aYScale ); + aMapMode.SetScaleX(aYScale); + aMapMode.SetScaleY(aYScale); } else { - aMapMode.SetScaleX( aXScale ); - aMapMode.SetScaleY( aXScale ); + aMapMode.SetScaleX(aXScale); + aMapMode.SetScaleY(aXScale); } - SetMapMode( aMapMode ); - Size aSz( PixelToLogic( GetSizePixel() ) ); - long nYPos = ( aSz.Height() - aSize.Height() ) / 2; + SetMapMode(aMapMode); + Size aSz(PixelToLogic(GetSizePixel())); + long nYPos = (aSz.Height() - aSize.Height()) / 2; - if ( eUsage == SVX_PAGE_ALL ) + if(eUsage == SVX_PAGE_ALL) { // all pages are equal -> draw one page - if ( aSize.Width() > aSize.Height() ) + if (aSize.Width() > aSize.Height()) { // Draw Landscape page of the same size Fraction aX = aMapMode.GetScaleX(); Fraction aY = aMapMode.GetScaleY(); - Fraction a2( 1.5 ); + Fraction a2(1.5); aX *= a2; aY *= a2; - aMapMode.SetScaleX( aX ); - aMapMode.SetScaleY( aY ); - SetMapMode( aMapMode ); - aSz = PixelToLogic( GetSizePixel() ); - nYPos = ( aSz.Height() - aSize.Height() ) / 2; - long nXPos = ( aSz.Width() - aSize.Width() ) / 2; - DrawPage( Point( nXPos, nYPos ), true, true ); + aMapMode.SetScaleX(aX); + aMapMode.SetScaleY(aY); + SetMapMode(aMapMode); + aSz = PixelToLogic(GetSizePixel()); + nYPos = (aSz.Height() - aSize.Height()) / 2; + long nXPos = (aSz.Width() - aSize.Width()) / 2; + DrawPage(Point(nXPos,nYPos),sal_True,sal_True); } else // Portrait - DrawPage( Point( ( aSz.Width() - aSize.Width() ) / 2, nYPos ), true, true ); + DrawPage(Point((aSz.Width() - aSize.Width()) / 2,nYPos),sal_True,sal_True); } else { // Left and right page are different -> draw two pages if possible - DrawPage( Point( 0, nYPos ), false, eUsage & SVX_PAGE_LEFT ); - DrawPage( Point( aSize.Width() + aSize.Width() / 8, nYPos ), true, - eUsage & SVX_PAGE_RIGHT ); + DrawPage(Point(0,nYPos),sal_False,(sal_Bool)(eUsage & SVX_PAGE_LEFT)); + DrawPage(Point(aSize.Width() + aSize.Width() / 8,nYPos),sal_True, + (sal_Bool)(eUsage & SVX_PAGE_RIGHT)); } } - -void SvxPageWindow::DrawPage( const Point& rOrg, const bool bSecond, const bool bEnabled ) +void SvxPageWindow::DrawPage(const Point& rOrg, const bool bSecond, const bool bEnabled) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); const Color& rFieldColor = rStyleSettings.GetFieldColor(); @@ -177,33 +167,33 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const bool bSecond, const bool const Color& rDlgColor = rStyleSettings.GetDialogColor(); // background - if(!bSecond || pImpl->bResetBackground) + if(!bSecond || bResetBackground) { - SetLineColor( Color(COL_TRANSPARENT) ); - SetFillColor( rDlgColor ); + SetLineColor(Color(COL_TRANSPARENT)); + SetFillColor(rDlgColor); Size winSize(GetOutputSize()); - DrawRect( Rectangle( Point(0,0), winSize ) ); + DrawRect(Rectangle(Point(0,0),winSize)); - if ( pImpl->bResetBackground ) - pImpl->bResetBackground = false; + if(bResetBackground) + bResetBackground = sal_False; } - SetLineColor( rFieldTextColor ); + SetLineColor(rFieldTextColor); // Shadow Size aTempSize = aSize; // Page - if ( !bEnabled ) + if(!bEnabled) { - SetFillColor( rDisableColor ); - DrawRect( Rectangle( rOrg, aTempSize ) ); + SetFillColor(rDisableColor); + DrawRect(Rectangle(rOrg,aTempSize)); return; } - SetFillColor( rFieldColor ); - DrawRect( Rectangle( rOrg, aTempSize ) ); + SetFillColor(rFieldColor); + DrawRect(Rectangle(rOrg,aTempSize)); long nL = nLeft; long nR = nRight; - if ( eUsage == SVX_PAGE_MIRROR && !bSecond ) + if(eUsage == SVX_PAGE_MIRROR && !bSecond) { // turn for mirrored nL = nRight; @@ -212,90 +202,93 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const bool bSecond, const bool Rectangle aRect; - aRect.Left() = rOrg.X() + nL; + aRect.Left() = rOrg.X() + nL; aRect.Right() = rOrg.X() + aTempSize.Width() - nR; - aRect.Top() = rOrg.Y() + nTop; - aRect.Bottom()= rOrg.Y() + aTempSize.Height() - nBottom; + aRect.Top() = rOrg.Y() + nTop; + aRect.Bottom() = rOrg.Y() + aTempSize.Height() - nBottom; - Rectangle aHdRect( aRect ); - Rectangle aFtRect( aRect ); + Rectangle aHdRect(aRect); + Rectangle aFtRect(aRect); - if ( bHeader ) + if(bHeader || bFooter) { - // show headers if possible - aHdRect.Left() += nHdLeft; - aHdRect.Right() -= nHdRight; - aHdRect.Bottom() = aRect.Top() + nHdHeight; - aRect.Top() += nHdHeight + nHdDist; - SetFillColor( aHdColor ); - DrawRect( aHdRect ); - } + //UUUU Header and/or footer used + const Color aLineColor(GetLineColor()); - if ( bFooter ) - { - // show footer if possible - aFtRect.Left() += nFtLeft; - aFtRect.Right() -= nFtRight; - aFtRect.Top() = aRect.Bottom() - nFtHeight; - aRect.Bottom() -= nFtHeight + nFtDist; - SetFillColor( aFtColor ); - DrawRect( aFtRect ); - } + //UUUU draw PageFill first and on the whole page, no outline + SetLineColor(); + drawFillAttributes(maPageFillAttributes, aRect, aRect); + SetLineColor(aLineColor); - // Paint Body - SetFillColor( aColor ); - if ( pImpl->bBitmap ) - { - DrawRect( aRect ); - Point aBmpPnt = aRect.TopLeft(); - Size aBmpSiz = aRect.GetSize(); - long nDeltaX = aBmpSiz.Width() / 15; - long nDeltaY = aBmpSiz.Height() / 15; - aBmpPnt.X() += nDeltaX; - aBmpPnt.Y() += nDeltaY; - aBmpSiz.Width() -= nDeltaX * 2; - aBmpSiz.Height() -= nDeltaY * 2; - DrawBitmap( aBmpPnt, aBmpSiz, pImpl->aBitmap ); + if(bHeader) + { + // show headers if possible + aHdRect.Left() += nHdLeft; + aHdRect.Right() -= nHdRight; + aHdRect.Bottom() = aRect.Top() + nHdHeight; + aRect.Top() += nHdHeight + nHdDist; + + // draw header over PageFill, plus outline + drawFillAttributes(maHeaderFillAttributes, aHdRect, aHdRect); + } + + if(bFooter) + { + // show footer if possible + aFtRect.Left() += nFtLeft; + aFtRect.Right() -= nFtRight; + aFtRect.Top() = aRect.Bottom() - nFtHeight; + aRect.Bottom() -= nFtHeight + nFtDist; + + // draw footer over PageFill, plus outline + drawFillAttributes(maFooterFillAttributes, aFtRect, aFtRect); + } + + // draw page's reduced outline, only outline + drawFillAttributes(drawinglayer::attribute::SdrAllFillAttributesHelperPtr(), aRect, aRect); } else - DrawRect( aRect ); + { + //UUUU draw PageFill and outline + drawFillAttributes(maPageFillAttributes, aRect, aRect); + } - if(pImpl->bFrameDirection && !bTable) + if(bFrameDirection && !bTable) { Point aPos; Font aFont(GetFont()); const Size aSaveSize = aFont.GetSize(); - Size aDrawSize( 0, aRect.GetHeight() / 6); + Size aDrawSize(0,aRect.GetHeight() / 6); aFont.SetSize(aDrawSize); SetFont(aFont); OUString sText("ABC"); Point aMove(1, GetTextHeight()); sal_Unicode cArrow = 0x2193; long nAWidth = GetTextWidth(sText.copy(0,1)); - switch(pImpl->nFrameDirection) + switch(nFrameDirection) { - case FRMDIR_HORI_LEFT_TOP: - aPos = aRect.TopLeft(); - aPos.X() += PixelToLogic(Point(1,1)).X(); - aMove.Y() = 0; - cArrow = 0x2192; + case FRMDIR_HORI_LEFT_TOP: + aPos = aRect.TopLeft(); + aPos.X() += PixelToLogic(Point(1,1)).X(); + aMove.Y() = 0; + cArrow = 0x2192; break; - case FRMDIR_HORI_RIGHT_TOP: - aPos = aRect.TopRight(); - aPos.X() -= nAWidth; - aMove.Y() = 0; - aMove.X() *= -1; - cArrow = 0x2190; + case FRMDIR_HORI_RIGHT_TOP: + aPos = aRect.TopRight(); + aPos.X() -= nAWidth; + aMove.Y() = 0; + aMove.X() *= -1; + cArrow = 0x2190; break; - case FRMDIR_VERT_TOP_LEFT: - aPos = aRect.TopLeft(); - aPos.X() += PixelToLogic(Point(1,1)).X(); - aMove.X() = 0; + case FRMDIR_VERT_TOP_LEFT: + aPos = aRect.TopLeft(); + aPos.X() += PixelToLogic(Point(1,1)).X(); + aMove.X() = 0; break; - case FRMDIR_VERT_TOP_RIGHT: - aPos = aRect.TopRight(); - aPos.X() -= nAWidth; - aMove.X() = 0; + case FRMDIR_VERT_TOP_RIGHT: + aPos = aRect.TopRight(); + aPos.X() -= nAWidth; + aMove.X() = 0; break; } sText += OUString(cArrow); @@ -307,13 +300,13 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const bool bSecond, const bool bool bHorizontal = 0 == aMove.Y(); if(!bHorizontal) { - nHDiff = (nAWidth - nCharWidth)/2; + nHDiff = (nAWidth - nCharWidth) / 2; aPos.X() += nHDiff; } - DrawText(aPos, sDraw); + DrawText(aPos,sDraw); if(bHorizontal) { - aPos.X() += aMove.X() < 0 ? - nCharWidth : nCharWidth; + aPos.X() += aMove.X() < 0 ? -nCharWidth : nCharWidth; } else { @@ -325,83 +318,140 @@ void SvxPageWindow::DrawPage( const Point& rOrg, const bool bSecond, const bool SetFont(aFont); } - if ( bTable ) + if(bTable) { // Paint Table, if necessary center it - SetLineColor( Color(COL_LIGHTGRAY) ); + SetLineColor(Color(COL_LIGHTGRAY)); - long nW = aRect.GetWidth(), nH = aRect.GetHeight(); - long nTW = CELL_WIDTH * 3, nTH = CELL_HEIGHT * 3; + long nW = aRect.GetWidth(),nH = aRect.GetHeight(); + long nTW = CELL_WIDTH * 3,nTH = CELL_HEIGHT * 3; long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left(); long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top(); - Rectangle aCellRect( Point( _nLeft, _nTop ), Size( CELL_WIDTH, CELL_HEIGHT ) ); + Rectangle aCellRect(Point(_nLeft,_nTop),Size(CELL_WIDTH,CELL_HEIGHT)); - for ( sal_uInt16 i = 0; i < 3; ++i ) + for(sal_uInt16 i = 0; i < 3; ++i) { aCellRect.Left() = _nLeft; aCellRect.Right() = _nLeft + CELL_WIDTH; - if ( i > 0 ) - aCellRect.Move( 0, CELL_HEIGHT ); + if(i > 0) + aCellRect.Move(0,CELL_HEIGHT); - for ( sal_uInt16 j = 0; j < 3; ++j ) + for(sal_uInt16 j = 0; j < 3; ++j) { - if ( j > 0 ) - aCellRect.Move( CELL_WIDTH, 0 ); - DrawRect( aCellRect ); + if(j > 0) + aCellRect.Move(CELL_WIDTH,0); + DrawRect(aCellRect); } } } } +//UUUU +void SvxPageWindow::drawFillAttributes( + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, + const Rectangle& rPaintRange, + const Rectangle& rDefineRange) +{ + const basegfx::B2DRange aPaintRange( + rPaintRange.Left(), + rPaintRange.Top(), + rPaintRange.Right(), + rPaintRange.Bottom()); + + if(!aPaintRange.isEmpty() && + !basegfx::fTools::equalZero(aPaintRange.getWidth()) && + !basegfx::fTools::equalZero(aPaintRange.getHeight())) + { + const basegfx::B2DRange aDefineRange( + rDefineRange.Left(), + rDefineRange.Top(), + rDefineRange.Right(), + rDefineRange.Bottom()); + // prepare primitive sequence + drawinglayer::primitive2d::Primitive2DSequence aSequence; -void SvxPageWindow::SetBorder( const SvxBoxItem& rNew ) -{ - delete pImpl->pBorder; - pImpl->pBorder = new SvxBoxItem( rNew ); + // create fill geometry if there is something to fill + if(rFillAttributes.get() && rFillAttributes->isUsed()) + { + aSequence = rFillAttributes->getPrimitive2DSequence( + aPaintRange, + aDefineRange); + } + + // create line geometry if a LineColor is set at the target device + if(IsLineColor()) + { + const drawinglayer::primitive2d::Primitive2DReference xOutline( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + basegfx::tools::createPolygonFromRect(aPaintRange), + GetLineColor().getBColor())); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( + aSequence, + xOutline); + } + + // draw that if we have something to draw + if(aSequence.getLength()) + { + const drawinglayer::geometry::ViewInformation2D aViewInformation2D( + basegfx::B2DHomMatrix(), + GetViewTransformation(), + aPaintRange, + 0, + 0.0, + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()); + drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createProcessor2DFromOutputDevice( + *this, + aViewInformation2D); + + if(pProcessor) + { + pProcessor->process(aSequence); + + delete pProcessor; + } + } + } } -void SvxPageWindow::SetBitmap( Bitmap* pBmp ) +void SvxPageWindow::SetBorder(const SvxBoxItem& rNew) { - if ( pBmp ) - { - pImpl->aBitmap = *pBmp; - pImpl->bBitmap = true; - } - else - pImpl->bBitmap = false; + delete pBorder; + pBorder = new SvxBoxItem(rNew); } -void SvxPageWindow::SetHdBorder( const SvxBoxItem& rNew ) +void SvxPageWindow::SetHdBorder(const SvxBoxItem& rNew) { delete pHdBorder; - pHdBorder = new SvxBoxItem( rNew ); + pHdBorder = new SvxBoxItem(rNew); } -void SvxPageWindow::SetFtBorder( const SvxBoxItem& rNew ) +void SvxPageWindow::SetFtBorder(const SvxBoxItem& rNew) { delete pFtBorder; - pFtBorder = new SvxBoxItem( rNew ); + pFtBorder = new SvxBoxItem(rNew); } -void SvxPageWindow::EnableFrameDirection(bool bEnable) +void SvxPageWindow::EnableFrameDirection(bool bEnable) { - pImpl->EnableFrameDirection(bEnable); + bFrameDirection = bEnable; } -void SvxPageWindow::SetFrameDirection(sal_Int32 nFrameDirection) +void SvxPageWindow::SetFrameDirection(sal_Int32 nDirection) { - pImpl->SetFrameDirection(nFrameDirection); + nFrameDirection = nDirection; } void SvxPageWindow::ResetBackground() { - pImpl->bResetBackground = true; + bResetBackground = true; } Size SvxPageWindow::GetOptimalSize() const diff --git a/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx new file mode 100644 index 000000000000..31291b974b9e --- /dev/null +++ b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx @@ -0,0 +1,268 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> +#include <svx/sdr/primitive2d/sdrattributecreator.hxx> +#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/attribute/fillhatchattribute.hxx> +#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx> +#include <svx/xfillit0.hxx> +#include <vcl/graph.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + void SdrAllFillAttributesHelper::createPrimitive2DSequence( + const basegfx::B2DRange& rPaintRange, + const basegfx::B2DRange& rDefineRange) + { + // reset and remember new target range for object geometry + maLastPaintRange = rPaintRange; + maLastDefineRange = rDefineRange; + + if(isUsed()) + { + maPrimitives.realloc(1); + maPrimitives[0] = drawinglayer::primitive2d::createPolyPolygonFillPrimitive( + basegfx::B2DPolyPolygon( + basegfx::tools::createPolygonFromRect( + maLastPaintRange)), + maLastDefineRange, + maFillAttribute.get() ? *maFillAttribute.get() : drawinglayer::attribute::SdrFillAttribute(), + maFillGradientAttribute.get() ? *maFillGradientAttribute.get() : drawinglayer::attribute::FillGradientAttribute()); + } + } + + SdrAllFillAttributesHelper::SdrAllFillAttributesHelper() + : maLastPaintRange(), + maLastDefineRange(), + maFillAttribute(), + maFillGradientAttribute(), + maPrimitives() + { + } + + SdrAllFillAttributesHelper::SdrAllFillAttributesHelper(const Color& rColor) + : maLastPaintRange(), + maLastDefineRange(), + maFillAttribute(), + maFillGradientAttribute(), + maPrimitives() + { + maFillAttribute.reset( + new drawinglayer::attribute::SdrFillAttribute( + 0.0, + Color(rColor.GetRGBColor()).getBColor(), + drawinglayer::attribute::FillGradientAttribute(), + drawinglayer::attribute::FillHatchAttribute(), + drawinglayer::attribute::SdrFillGraphicAttribute())); + } + + SdrAllFillAttributesHelper::SdrAllFillAttributesHelper(const SfxItemSet& rSet) + : maLastPaintRange(), + maLastDefineRange(), + maFillAttribute( + new drawinglayer::attribute::SdrFillAttribute( + drawinglayer::primitive2d::createNewSdrFillAttribute(rSet))), + maFillGradientAttribute( + new drawinglayer::attribute::FillGradientAttribute( + drawinglayer::primitive2d::createNewTransparenceGradientAttribute(rSet))), + maPrimitives() + { + } + + SdrAllFillAttributesHelper::~SdrAllFillAttributesHelper() + { + } + + bool SdrAllFillAttributesHelper::isUsed() const + { + // only depends on fill, FillGradientAttribute alone defines no fill + return maFillAttribute.get() && !maFillAttribute->isDefault(); + } + + bool SdrAllFillAttributesHelper::isTransparent() const + { + if(hasSdrFillAttribute() && 0.0 != maFillAttribute->getTransparence()) + { + return true; + } + + if(hasFillGradientAttribute() && !maFillGradientAttribute->isDefault()) + { + return true; + } + + if(hasSdrFillAttribute()) + { + const Graphic& rGraphic = getFillAttribute().getFillGraphic().getFillGraphic(); + + return rGraphic.IsSupportedGraphic() && rGraphic.IsTransparent(); + } + + return false; + } + + const drawinglayer::attribute::SdrFillAttribute& SdrAllFillAttributesHelper::getFillAttribute() const + { + if(!maFillAttribute.get()) + { + const_cast< SdrAllFillAttributesHelper* >(this)->maFillAttribute.reset(new drawinglayer::attribute::SdrFillAttribute()); + } + + return *maFillAttribute.get(); + } + + const drawinglayer::attribute::FillGradientAttribute& SdrAllFillAttributesHelper::getFillGradientAttribute() const + { + if(!maFillGradientAttribute.get()) + { + const_cast< SdrAllFillAttributesHelper* >(this)->maFillGradientAttribute.reset(new drawinglayer::attribute::FillGradientAttribute()); + } + + return *maFillGradientAttribute.get(); + } + + const drawinglayer::primitive2d::Primitive2DSequence& SdrAllFillAttributesHelper::getPrimitive2DSequence( + const basegfx::B2DRange& rPaintRange, + const basegfx::B2DRange& rDefineRange) const + { + if(maPrimitives.getLength() && (maLastPaintRange != rPaintRange || maLastDefineRange != rDefineRange)) + { + const_cast< SdrAllFillAttributesHelper* >(this)->maPrimitives.realloc(0); + } + + if(!maPrimitives.getLength()) + { + const_cast< SdrAllFillAttributesHelper* >(this)->createPrimitive2DSequence(rPaintRange, rDefineRange); + } + + return maPrimitives; + } + + basegfx::BColor SdrAllFillAttributesHelper::getAverageColor(const basegfx::BColor& rFallback) const + { + basegfx::BColor aRetval(rFallback); + + if(maFillAttribute.get() && !maFillAttribute->isDefault()) + { + const drawinglayer::attribute::FillGradientAttribute& rFillGradientAttribute = maFillAttribute->getGradient(); + const drawinglayer::attribute::FillHatchAttribute& rFillHatchAttribute = maFillAttribute->getHatch(); + const drawinglayer::attribute::SdrFillGraphicAttribute& rSdrFillGraphicAttribute = maFillAttribute->getFillGraphic(); + const drawinglayer::attribute::FillGradientAttribute& rFillTransparenceGradientAttribute = getFillGradientAttribute(); + double fTransparence(maFillAttribute->getTransparence()); + + if(!rFillTransparenceGradientAttribute.isDefault()) + { + const double fTransA = rFillTransparenceGradientAttribute.getStartColor().luminance(); + const double fTransB = rFillTransparenceGradientAttribute.getEndColor().luminance(); + + fTransparence = (fTransA + fTransB) * 0.5; + } + + if(!rFillGradientAttribute.isDefault()) + { + // gradient fill + const basegfx::BColor& rStart = rFillGradientAttribute.getStartColor(); + const basegfx::BColor& rEnd = rFillGradientAttribute.getEndColor(); + + aRetval = basegfx::interpolate(rStart, rEnd, 0.5); + } + else if(!rFillHatchAttribute.isDefault()) + { + // hatch fill + const basegfx::BColor& rColor = rFillHatchAttribute.getColor(); + + if(rFillHatchAttribute.isFillBackground()) + { + const basegfx::BColor& rBackgroundColor = maFillAttribute->getColor(); + + // mix colors 50%/50% + aRetval = basegfx::interpolate(rColor, rBackgroundColor, 0.5); + } + else + { + // mix color with fallback color + aRetval = basegfx::interpolate(rColor, rFallback, 0.5); + } + } + else if(!rSdrFillGraphicAttribute.isDefault()) + { + // graphic fill + + // not used yet by purpose (see SwPageFrm::GetDrawBackgrdColor()), + // use fallback (already set) + } + else + { + // color fill + aRetval = maFillAttribute->getColor(); + } + + if(!basegfx::fTools::equalZero(fTransparence)) + { + // blend into transparency + aRetval = basegfx::interpolate(aRetval, rFallback, fTransparence); + } + } + + return aRetval.clamp(); + } + + bool SdrAllFillAttributesHelper::needCompleteRepaint() const + { + if(!isUsed() || !hasSdrFillAttribute()) + { + // not used or no fill + return false; + } + + const drawinglayer::attribute::SdrFillAttribute& rSdrFillAttribute = getFillAttribute(); + + if(!rSdrFillAttribute.getHatch().isDefault()) + { + // hatch is always top-left aligned, needs no full refreshes + return false; + } + + if(!rSdrFillAttribute.getGradient().isDefault()) + { + // gradients always scale with the object + return true; + } + + if(!rSdrFillAttribute.getFillGraphic().isDefault()) + { + // some graphic constellations may not need this, but since most do + // (stretch to fill, all but top-left aligned, ...) claim to do by default + return true; + } + + // color fill + return false; + } + } // end of namespace attribute +} // end of namespace drawinglayer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index a12ff99bd98b..a961f28e0c14 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -130,7 +130,11 @@ namespace drawinglayer // create FillGradientPrimitive2D for transparence and add to new sequence // fillGradientPrimitive is enough here (compared to PolyPolygonGradientPrimitive2D) since float transparence will be masked anyways const basegfx::B2DRange aRange(basegfx::tools::getRange(rPolyPolygon)); - const Primitive2DReference xRefB(new FillGradientPrimitive2D(aRange, rFillGradient)); + const Primitive2DReference xRefB( + new FillGradientPrimitive2D( + aRange, + rDefinitionRange, + rFillGradient)); const Primitive2DSequence aAlpha(&xRefB, 1L); // create TransparencePrimitive2D using alpha and content diff --git a/svx/source/sidebar/tools/ColorControl.cxx b/svx/source/sidebar/tools/ColorControl.cxx index d94db5d29cdd..bece0cf8ab5c 100644 --- a/svx/source/sidebar/tools/ColorControl.cxx +++ b/svx/source/sidebar/tools/ColorControl.cxx @@ -166,18 +166,20 @@ void ColorControl::GetFocus (void) -void ColorControl::SetCurColorSelect (Color aCol, bool bAvailable) +void ColorControl::SetCurColorSelect(Color aCol,bool bAvailable) { -// FillColors(); - short nCol = GetItemId_Imp( maVSColor, aCol ); - if(! bAvailable) + //UUUU When transparent use transparent entry (entry 0) + const bool bIsTransparent(0xff == aCol.GetTransparency()); + short nCol = bIsTransparent ? 0 : GetItemId_Imp(maVSColor,aCol); + + if(!bAvailable) { maVSColor.SetNoSelection(); return; } //if not found - if( nCol == -1) + if(nCol == -1) { maVSColor.SetNoSelection(); } diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx index f05d690c5a5b..d7447aa199a9 100644 --- a/svx/source/tbxctrls/tbxcolorupdate.cxx +++ b/svx/source/tbxctrls/tbxcolorupdate.cxx @@ -137,7 +137,19 @@ namespace svx else pBmpAcc->SetLineColor( Color( COL_BLACK ) ); - pBmpAcc->SetFillColor( maCurColor = aColor ); + // use not only COL_TRANSPARENT for detection of transparence, + // but the method/way which is designed to do that + const bool bIsTransparent(0xff == aColor.GetTransparency()); + maCurColor = aColor; + + if(bIsTransparent) + { + pBmpAcc->SetFillColor(); + } + else + { + pBmpAcc->SetFillColor(maCurColor); + } if( maBmpSize.Width() == maBmpSize.Height() ) maUpdRect = Rectangle( Point( 0, maBmpSize.Height() * 3 / 4 ), Size( maBmpSize.Width(), maBmpSize.Height() / 4 ) ); @@ -148,7 +160,7 @@ namespace svx if( pMskAcc ) { - if( COL_TRANSPARENT == aColor.GetColor() ) + if( bIsTransparent ) { pMskAcc->SetLineColor( COL_BLACK ); pMskAcc->SetFillColor( COL_WHITE ); diff --git a/sw/source/core/unocore/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx index fe1a4962b62d..5ce03ac02c40 100644 --- a/sw/source/core/unocore/unobrushitemhelper.cxx +++ b/svx/source/unodraw/unobrushitemhelper.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <unobrushitemhelper.hxx> +#include <svx/unobrushitemhelper.hxx> #include <svx/xfillit0.hxx> #include <svx/xbtmpit.hxx> #include <svx/xgrscit.hxx> @@ -32,102 +32,101 @@ #include <svx/xflbstit.hxx> #include <svx/xflboxy.hxx> #include <svx/xflbckit.hxx> -#include <svx/unoshape.hxx> -#include <hintids.hxx> +#include <svx/xflhtit.hxx> #include <svx/xflclit.hxx> #include <svx/xfltrit.hxx> -#include <svx/xflhtit.hxx> - -namespace sw { +#include <svx/unoshape.hxx> //UUUU void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet) { - if(0xff != rBrush.GetColor().GetTransparency()) + // Clear all items from the DrawingLayer FillStyle range (if we have any). All + // items that need to be set will be set as hard attributes + for(sal_uInt16 a(XATTR_FILL_FIRST); rToSet.Count() && a < XATTR_FILL_LAST; a++) { + rToSet.ClearItem(a); + } + + const sal_uInt8 nTransparency(rBrush.GetColor().GetTransparency()); + + if(0xff != nTransparency) + { + // we have a color fill const Color aColor(rBrush.GetColor().GetRGBColor()); - const sal_uInt8 nTransparency(rBrush.GetColor().GetTransparency()); rToSet.Put(XFillStyleItem(XFILL_SOLID)); rToSet.Put(XFillColorItem(OUString(), aColor)); - if(0xff != nTransparency) - { - // nTransparency is in range [0..255] - rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 255)); - } + // nTransparency is in range [0..255], convert to [0..100] which is used in XFillTransparenceItem + rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 255)); } else if(GPOS_NONE != rBrush.GetGraphicPos()) { + // we have a graphic fill, set fill style + rToSet.Put(XFillStyleItem(XFILL_BITMAP)); + + // set graphic (if available) const Graphic* pGraphic = rBrush.GetGraphic(); if(pGraphic) { - // set fill style and graphic itself - rToSet.Put(XFillStyleItem(XFILL_BITMAP)); rToSet.Put(XFillBitmapItem(OUString(), *pGraphic)); + } + else + { + OSL_ENSURE(false, "Could not get Graphic from SvxBrushItem (!)"); + } - // set defaults - // already pool default rToSet.Put(XFillBmpPosItem(RP_MM)); - // already pool default rToSet.Put(XFillBmpTileOffsetXItem(0)); - // already pool default rToSet.Put(XFillBmpTileOffsetYItem(0)); - // already pool default rToSet.Put(XFillBmpPosOffsetXItem(0)); - // already pool default rToSet.Put(XFillBmpPosOffsetYItem(0)); - // already pool default rToSet.Put(XFillBmpSizeLogItem(true)); - // already pool default rToSet.Put(XFillBmpSizeXItem(0)); - // already pool default rToSet.Put(XFillBmpSizeYItem(0)); - - if(GPOS_AREA == rBrush.GetGraphicPos()) - { - // stretch, also means no tile (both items are defaulted to true) - // rToSet.Put(XFillBmpStretchItem(true)); - rToSet.Put(XFillBmpTileItem(false)); - - // default for strech is also top-left, but this will not be visible - // rToSet.Put(XFillBmpPosItem(RP_LT)); - } - else if(GPOS_TILED == rBrush.GetGraphicPos()) - { - // tiled, also means no stretch (both items are defaulted to true) - rToSet.Put(XFillBmpStretchItem(false)); - //rToSet.Put(XFillBmpTileItem(true)); + if(GPOS_AREA == rBrush.GetGraphicPos()) + { + // stretch, also means no tile (both items are defaulted to true) + rToSet.Put(XFillBmpStretchItem(true)); + rToSet.Put(XFillBmpTileItem(false)); - // default for tiled is top-left - rToSet.Put(XFillBmpPosItem(RP_LT)); - } - else - { - // everything else means no tile and no stretch - rToSet.Put(XFillBmpStretchItem(false)); - rToSet.Put(XFillBmpTileItem(false)); + // default for strech is also top-left, but this will not be visible + rToSet.Put(XFillBmpPosItem(RP_LT)); + } + else if(GPOS_TILED == rBrush.GetGraphicPos()) + { + // tiled, also means no stretch (both items are defaulted to true) + rToSet.Put(XFillBmpStretchItem(false)); + rToSet.Put(XFillBmpTileItem(true)); - switch(rBrush.GetGraphicPos()) - { - case GPOS_LT: rToSet.Put(XFillBmpPosItem(RP_LT)); break; - case GPOS_MT: rToSet.Put(XFillBmpPosItem(RP_MT)); break; - case GPOS_RT: rToSet.Put(XFillBmpPosItem(RP_RT)); break; - case GPOS_LM: rToSet.Put(XFillBmpPosItem(RP_LM)); break; - case GPOS_MM: rToSet.Put(XFillBmpPosItem(RP_MM)); break; - case GPOS_RM: rToSet.Put(XFillBmpPosItem(RP_RM)); break; - case GPOS_LB: rToSet.Put(XFillBmpPosItem(RP_LB)); break; - case GPOS_MB: rToSet.Put(XFillBmpPosItem(RP_MB)); break; - case GPOS_RB: rToSet.Put(XFillBmpPosItem(RP_RB)); break; - default: break; // already handled GPOS_AREA, GPOS_TILED and GPOS_NONE - } - } + // default for tiled is top-left + rToSet.Put(XFillBmpPosItem(RP_LT)); + } + else + { + // everything else means no tile and no stretch + rToSet.Put(XFillBmpStretchItem(false)); + rToSet.Put(XFillBmpTileItem(false)); - // check for transparency - const sal_Int8 nTransparency(rBrush.getGraphicTransparency()); + RECT_POINT aRectPoint(RP_MM); - if(0 != nTransparency) + switch(rBrush.GetGraphicPos()) { - // nTransparency is in range [0..100] - rToSet.Put(XFillTransparenceItem(nTransparency)); + case GPOS_LT: aRectPoint = RP_LT; break; + case GPOS_MT: aRectPoint = RP_MT; break; + case GPOS_RT: aRectPoint = RP_RT; break; + case GPOS_LM: aRectPoint = RP_LM; break; + case GPOS_MM: aRectPoint = RP_MM; break; + case GPOS_RM: aRectPoint = RP_RM; break; + case GPOS_LB: aRectPoint = RP_LB; break; + case GPOS_MB: aRectPoint = RP_MB; break; + case GPOS_RB: aRectPoint = RP_RB; break; + default: break; // GPOS_NONE, GPOS_AREA and GPOS_TILED already handled } + + rToSet.Put(XFillBmpPosItem(aRectPoint)); } - else + + // check for graphic's transparency + const sal_Int8 nGraphicTransparency(rBrush.getGraphicTransparency()); + + if(0 != nGraphicTransparency) { - OSL_ENSURE(false, "Could not get Graphic from SvxBrushItem (!)"); + // nGraphicTransparency is in range [0..100] + rToSet.Put(XFillTransparenceItem(nGraphicTransparency)); } } else @@ -136,10 +135,14 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI // still need to rescue the color used. There are sequences used on the UNO API at // import time (OLE. e.g. chart) which first set RGB color (MID_BACK_COLOR_R_G_B, // color stays transparent) and then set transparency (MID_BACK_COLOR_TRANSPARENCY) - // to zero later. When not saving the color, it will be lost + // to zero later. When not saving the color, it will be lost. + // Also need to set the FillStyle to NONE to express the 0xff transparency flag; this + // is needed when e.g. first transparency is set to 0xff and then a Graphic gets set. + // When not changing the FillStyle, the next getSvxBrushItemFromSourceSet *will* return + // to XFILL_SOLID with the rescued color. const Color aColor(rBrush.GetColor().GetRGBColor()); - // rToSet.Put(XFillStyleItem(XFILL_NONE)); + rToSet.Put(XFillStyleItem(XFILL_NONE)); rToSet.Put(XFillColorItem(OUString(), aColor)); } } @@ -165,7 +168,7 @@ sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, bool bSe } //UUUU -SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents) +SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents, sal_uInt16 nBackgroundID) { Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue()); @@ -178,24 +181,24 @@ SvxBrushItem getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchI aFillColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100)); } - return SvxBrushItem(aFillColor, RES_BACKGROUND); + return SvxBrushItem(aFillColor, nBackgroundID); } //UUUU -SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSearchInParents) +SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents) { const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rSourceSet.GetItem(XATTR_FILLSTYLE, bSearchInParents))); if(!pXFillStyleItem || XFILL_NONE == pXFillStyleItem->GetValue()) { - // need to rescue the evtl. set RGB color, but use as transparent color (we have XFILL_NONE) + // no fill, still need to rescue the evtl. set RGB color, but use as transparent color (we have XFILL_NONE) Color aFillColor(static_cast< const XFillColorItem& >(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents)).GetColorValue()); aFillColor.SetTransparency(0xff); - return SvxBrushItem(aFillColor, RES_BACKGROUND); + return SvxBrushItem(aFillColor, nBackgroundID); } - SvxBrushItem aRetval(RES_BACKGROUND); + SvxBrushItem aRetval(nBackgroundID); switch(pXFillStyleItem->GetValue()) { @@ -207,7 +210,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSe case XFILL_SOLID: { // create SvxBrushItem with fill color - aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents); + aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents, nBackgroundID); break; } case XFILL_GRADIENT: @@ -229,7 +232,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSe aMixedColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100)); } - aRetval = SvxBrushItem(aMixedColor, RES_BACKGROUND); + aRetval = SvxBrushItem(aMixedColor, nBackgroundID); break; } case XFILL_HATCH: @@ -241,7 +244,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSe if(bFillBackground) { // hatch is background-filled, use FillColor as if XFILL_SOLID - aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents); + aRetval = getSvxBrushItemForSolid(rSourceSet, bSearchInParents, nBackgroundID); } else { @@ -258,7 +261,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSe // nFillTransparence is in range [0..100] and needs to be in [0..255] unsigned aHatchColor.SetTransparency(static_cast< sal_uInt8 >((nFillTransparence * 255) / 100)); - aRetval = SvxBrushItem(aHatchColor, RES_BACKGROUND); + aRetval = SvxBrushItem(aHatchColor, nBackgroundID); } break; @@ -269,50 +272,47 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSe const XFillBitmapItem& rBmpItm = static_cast< const XFillBitmapItem& >(rSourceSet.Get(XATTR_FILLBITMAP, bSearchInParents)); const Graphic aGraphic(rBmpItm.GetGraphicObject().GetGraphic()); - if(GRAPHIC_NONE != aGraphic.GetType()) + // continue idependent of evtl. GRAPHIC_NONE as aGraphic.GetType(), we still need to rescue positions + SvxGraphicPosition aSvxGraphicPosition(GPOS_NONE); + const XFillBmpStretchItem& rStretchItem = static_cast< const XFillBmpStretchItem& >(rSourceSet.Get(XATTR_FILLBMP_STRETCH, bSearchInParents)); + const XFillBmpTileItem& rTileItem = static_cast< const XFillBmpTileItem& >(rSourceSet.Get(XATTR_FILLBMP_TILE, bSearchInParents)); + + if(rTileItem.GetValue()) + { + aSvxGraphicPosition = GPOS_TILED; + } + else if(rStretchItem.GetValue()) + { + aSvxGraphicPosition = GPOS_AREA; + } + else { - // get graphic position - SvxGraphicPosition aSvxGraphicPosition(GPOS_NONE); - const XFillBmpStretchItem& rStretchItem = static_cast< const XFillBmpStretchItem& >(rSourceSet.Get(XATTR_FILLBMP_STRETCH, bSearchInParents)); - const XFillBmpTileItem& rTileItem = static_cast< const XFillBmpTileItem& >(rSourceSet.Get(XATTR_FILLBMP_TILE, bSearchInParents)); + const XFillBmpPosItem& rPosItem = static_cast< const XFillBmpPosItem& >(rSourceSet.Get(XATTR_FILLBMP_POS, bSearchInParents)); - if(rTileItem.GetValue()) - { - aSvxGraphicPosition = GPOS_TILED; - } - else if(rStretchItem.GetValue()) + switch(rPosItem.GetValue()) { - aSvxGraphicPosition = GPOS_AREA; - } - else - { - const XFillBmpPosItem& rPosItem = static_cast< const XFillBmpPosItem& >(rSourceSet.Get(XATTR_FILLBMP_POS, bSearchInParents)); - - switch(rPosItem.GetValue()) - { - case RP_LT: aSvxGraphicPosition = GPOS_LT; break; - case RP_MT: aSvxGraphicPosition = GPOS_MT; break; - case RP_RT: aSvxGraphicPosition = GPOS_RT; break; - case RP_LM: aSvxGraphicPosition = GPOS_LM; break; - case RP_MM: aSvxGraphicPosition = GPOS_MM; break; - case RP_RM: aSvxGraphicPosition = GPOS_RM; break; - case RP_LB: aSvxGraphicPosition = GPOS_LB; break; - case RP_MB: aSvxGraphicPosition = GPOS_MB; break; - case RP_RB: aSvxGraphicPosition = GPOS_RB; break; - } + case RP_LT: aSvxGraphicPosition = GPOS_LT; break; + case RP_MT: aSvxGraphicPosition = GPOS_MT; break; + case RP_RT: aSvxGraphicPosition = GPOS_RT; break; + case RP_LM: aSvxGraphicPosition = GPOS_LM; break; + case RP_MM: aSvxGraphicPosition = GPOS_MM; break; + case RP_RM: aSvxGraphicPosition = GPOS_RM; break; + case RP_LB: aSvxGraphicPosition = GPOS_LB; break; + case RP_MB: aSvxGraphicPosition = GPOS_MB; break; + case RP_RB: aSvxGraphicPosition = GPOS_RB; break; } + } - // create with given graphic and position - aRetval = SvxBrushItem(aGraphic, aSvxGraphicPosition, RES_BACKGROUND); + // create with given graphic and position + aRetval = SvxBrushItem(aGraphic, aSvxGraphicPosition, nBackgroundID); - // get evtl. mixed transparence - const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); + // get evtl. mixed transparence + const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); - if(0 != nFillTransparence) - { - // nFillTransparence is in range [0..100] and needs to be in [0..100] signed - aRetval.setGraphicTransparency(static_cast< sal_Int8 >(nFillTransparence)); - } + if(0 != nFillTransparence) + { + // nFillTransparence is in range [0..100] and needs to be in [0..100] signed + aRetval.setGraphicTransparency(static_cast< sal_Int8 >(nFillTransparence)); } break; @@ -322,6 +322,4 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSe return aRetval; } -} // namespace sw - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 4732226d5ca1..cef9a2c0f1e6 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -288,7 +288,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/layout/anchoreddrawobject \ sw/source/core/layout/anchoredobject \ sw/source/core/layout/atrfrm \ - sw/source/core/layout/fillattributes \ sw/source/core/layout/calcmove \ sw/source/core/layout/colfrm \ sw/source/core/layout/dbg_lay \ @@ -460,7 +459,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/unocore/unoparagraph \ sw/source/core/unocore/unoport \ sw/source/core/unocore/unoportenum \ - sw/source/core/unocore/unobrushitemhelper \ sw/source/core/unocore/unoredline \ sw/source/core/unocore/unoredlines \ sw/source/core/unocore/unorefmk \ diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 46c84b19ee50..fd119ce570ac 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -528,24 +528,6 @@ #define FN_UNO_FOOTER (FN_EXTRA2 + 38) #define FN_UNO_FOOTER_LEFT (FN_EXTRA2 + 39) #define FN_UNO_FOOTER_RIGHT (FN_EXTRA2 + 40) -#define FN_UNO_HEADER_BACKGROUND (FN_EXTRA2 + 41) -#define FN_UNO_HEADER_BOX (FN_EXTRA2 + 42) -#define FN_UNO_HEADER_LR_SPACE (FN_EXTRA2 + 43) -#define FN_UNO_HEADER_SHADOW (FN_EXTRA2 + 44) -#define FN_UNO_FOOTER_BACKGROUND (FN_EXTRA2 + 45) -#define FN_UNO_FOOTER_BOX (FN_EXTRA2 + 46) -#define FN_UNO_FOOTER_LR_SPACE (FN_EXTRA2 + 47) -#define FN_UNO_FOOTER_SHADOW (FN_EXTRA2 + 48) -#define FN_UNO_HEADER_BODY_DISTANCE (FN_EXTRA2 + 49) -#define FN_UNO_HEADER_IS_DYNAMIC_DISTANCE (FN_EXTRA2 + 50) -#define FN_UNO_FOOTER_BODY_DISTANCE (FN_EXTRA2 + 51) -#define FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE (FN_EXTRA2 + 52) -#define FN_UNO_HEADER_SHARE_CONTENT (FN_EXTRA2 + 53) -#define FN_UNO_FOOTER_SHARE_CONTENT (FN_EXTRA2 + 54) -#define FN_UNO_HEADER_HEIGHT (FN_EXTRA2 + 55) -#define FN_UNO_FOOTER_HEIGHT (FN_EXTRA2 + 56) -#define FN_UNO_HEADER_ON (FN_EXTRA2 + 57) -#define FN_UNO_FOOTER_ON (FN_EXTRA2 + 58) #define FN_UNO_FOLLOW_STYLE (FN_EXTRA2 + 59) #define FN_API_CALL (FN_EXTRA2 + 60) @@ -584,8 +566,6 @@ #define FN_NEW_GLOSSARY (FN_EXTRA2 + 90) #define FN_SET_ACT_GLOSSARY (FN_EXTRA2 + 91) -#define FN_UNO_HEADER_EAT_SPACING (FN_EXTRA2 + 92) -#define FN_UNO_FOOTER_EAT_SPACING (FN_EXTRA2 + 93) #define FN_UNO_CHARFMT_SEQUENCE (FN_EXTRA2 + 94) #define FN_UNO_CLSID (FN_EXTRA2 + 95) #define FN_UNO_MODEL (FN_EXTRA2 + 96) diff --git a/sw/inc/fillattributes.hxx b/sw/inc/fillattributes.hxx deleted file mode 100644 index 05624c4a8de5..000000000000 --- a/sw/inc/fillattributes.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SW_INC_FILLATTRIBUTES_HXX -#define INCLUDED_SW_INC_FILLATTRIBUTES_HXX - -#include <drawinglayer/attribute/fillgradientattribute.hxx> -#include <drawinglayer/attribute/sdrfillattribute.hxx> -#include <drawinglayer/primitive2d/baseprimitive2d.hxx> -#include <boost/shared_ptr.hpp> - -////////////////////////////////////////////////////////////////////////////// - -class Color; -class SfxItemSet; -class FillAttributes -{ -private: - basegfx::B2DRange maLastPaintRange; - basegfx::B2DRange maLastDefineRange; - boost::shared_ptr< drawinglayer::attribute::SdrFillAttribute > maFillAttribute; - boost::shared_ptr< drawinglayer::attribute::FillGradientAttribute > maFillGradientAttribute; - drawinglayer::primitive2d::Primitive2DSequence maPrimitives; - - void createPrimitive2DSequence( - const basegfx::B2DRange& rPaintRange, - const basegfx::B2DRange& rDefineRange); - -protected: -public: - FillAttributes(const Color& rColor); - FillAttributes(const SfxItemSet& rSet); - ~FillAttributes(); - - bool isUsed() const; - bool hasSdrFillAttribute() const { return maFillAttribute.get(); } - bool hasFillGradientAttribute() const { return maFillGradientAttribute.get(); } - bool isTransparent() const; - - const drawinglayer::attribute::SdrFillAttribute& getFillAttribute() const; - const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence( - const basegfx::B2DRange& rPaintRange, - const basegfx::B2DRange& rDefineRange) const; -}; - -////////////////////////////////////////////////////////////////////////////// - -typedef boost::shared_ptr< FillAttributes > FillAttributesPtr; - -////////////////////////////////////////////////////////////////////////////// - -#endif // INCLUDED_SW_INC_FILLATTRIBUTES_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index 325893105c0f..191a755dc740 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -25,8 +25,6 @@ #include <calbck.hxx> #include <hintids.hxx> #include <boost/shared_ptr.hpp> -//UUUU -#include <fillattributes.hxx> class IDocumentSettingAccess; class IDocumentDrawModelAccess; @@ -37,6 +35,11 @@ class IDocumentChartDataProviderAccess; class SwDoc; class SfxGrabBagItem; +namespace drawinglayer { namespace attribute { + class SdrAllFillAttributesHelper; + typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; +}} + /// Base class for various Writer styles. class SW_DLLPUBLIC SwFmt : public SwModify { @@ -241,7 +244,7 @@ public: inline const SvxBoxItem &GetBox( bool = true ) const; inline const SvxFmtKeepItem &GetKeep( bool = true ) const; - //UUUU + //UUUU Get SvxBrushItem for Background fill (partially for backwards compatibility) const SvxBrushItem& GetBackground( bool = true ) const; inline const SvxShadowItem &GetShadow( bool = true ) const; @@ -327,28 +330,16 @@ public: */ virtual bool IsShadowTransparent() const; - //UUUU - virtual FillAttributesPtr getFillAttributes() const; + //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; }; -//UUUUinline const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, -//UUUU bool bInParents ) const -//UUUU{ -//UUUU return aSet.Get( nWhich, bInParents ); -//UUUU} - inline void SwFmt::SetName( const sal_Char* pNewName, bool bBroadcast ) { SetName(OUString::createFromAscii(pNewName), bBroadcast); } -//UUUUinline SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, -//UUUU const SfxPoolItem **ppItem ) const -//UUUU{ -//UUUU return aSet.GetItemState( nWhich, bSrchInParent, ppItem ); -//UUUU} - #endif // INCLUDED_SW_INC_FORMAT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/frmatr.hxx b/sw/inc/frmatr.hxx index adde000b9c84..c3937dff459b 100644 --- a/sw/inc/frmatr.hxx +++ b/sw/inc/frmatr.hxx @@ -71,8 +71,6 @@ inline const SvxBoxItem &SwFmt::GetBox(bool bInP) const { return aSet.GetBox(bInP); } inline const SvxFmtKeepItem &SwFmt::GetKeep(bool bInP) const { return aSet.GetKeep(bInP); } -//UUUUinline const SvxBrushItem &SwFmt::GetBackground(sal_Bool bInP) const -//UUUU { return aSet.GetBackground(bInP); } inline const SvxShadowItem &SwFmt::GetShadow(bool bInP) const { return aSet.GetShadow(bInP); } inline const SvxFmtBreakItem &SwFmt::GetBreak(bool bInP) const diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index 1b063ff4a077..ebf23173387e 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -43,8 +43,8 @@ class SW_DLLPUBLIC SwFrmFmt: public SwFmt ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface> m_wXObject; - //UUUU - FillAttributesPtr maFillAttributes; + //UUUU DrawingLayer FillAttributes in a preprocessed form for primitive usage + drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes; protected: SwFrmFmt( @@ -134,8 +134,8 @@ public: DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt) void RegisterToFormat( SwFmt& rFmt ); - //UUUU - virtual FillAttributesPtr getFillAttributes() const SAL_OVERRIDE; + //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const SAL_OVERRIDE; }; // The FlyFrame-Format diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 4a0840d52e0b..4e481936bfc6 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -21,6 +21,7 @@ #include <tools/solar.h> #include <sal/types.h> +#include <svx/xdef.hxx> #include "swdllapi.h" // For SwTxtHints without end index the following char is added: @@ -398,11 +399,16 @@ inline bool isPARATR(const sal_uInt16 nWhich) } inline bool isPARATR_LIST(const sal_uInt16 nWhich) { - return (RES_PARATR_LIST_BEGIN <= nWhich) && (RES_PARATR_LIST_END > nWhich); } + return (RES_PARATR_LIST_BEGIN <= nWhich) && (RES_PARATR_LIST_END > nWhich); +} inline bool isFRMATR(const sal_uInt16 nWhich) { return (RES_FRMATR_BEGIN <= nWhich) && (RES_FRMATR_END > nWhich); } +inline bool isDrawingLayerAttribute(const sal_uInt16 nWhich) //UUUU +{ + return (XATTR_FILL_FIRST <= nWhich) && (XATTR_FILL_LAST >= nWhich); +} inline bool isGRFATR(const sal_uInt16 nWhich) { return (RES_GRFATR_BEGIN <= nWhich) && (RES_GRFATR_END > nWhich); diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index be1f1ac2fad7..a971b15f2928 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -93,15 +93,37 @@ public: SwDelTxt( sal_Int32 nS, sal_Int32 nL ); }; -class SwUpdateAttr: public SwMsgPoolItem +class SwUpdateAttr : public SwMsgPoolItem { -public: +private: sal_Int32 nStart; sal_Int32 nEnd; sal_uInt16 nWhichAttr; std::vector<sal_uInt16> aWhichFmtAttr; // attributes changed inside RES_TXTATR_AUTOFMT + +public: SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW ); SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW ); + + sal_Int32 getStart() const + { + return nStart; + } + + sal_Int32 getEnd() const + { + return nEnd; + } + + sal_uInt16 getWhichAttr() const + { + return nWhichAttr; + } + + const std::vector<sal_uInt16>& getFmtAttr() const + { + return aWhichFmtAttr; + } }; /** SwRefMarkFldUpdate is sent when the referencemarks should be updated. diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 46ef40180a5f..113ff62c021d 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -115,6 +115,9 @@ class SW_DLLPUBLIC SwTxtNode: public SwCntntNode, public ::sfx2::Metadatable ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XTextContent> m_wXParagraph; + //UUUU DrawingLayer FillAttributes in a preprocessed form for primitive usage + drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFillAttributes; + SAL_DLLPRIVATE SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl, const SfxItemSet* pAutoAttr = 0 ); @@ -797,6 +800,9 @@ public: bool CompareParRsid( const SwTxtNode &rTxtNode ) const; DECL_FIXEDMEMPOOL_NEWDEL(SwTxtNode) + + //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; }; inline SwpHints & SwTxtNode::GetSwpHints() diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index be64d454d690..4de9d182c952 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -75,6 +75,12 @@ class IDocumentListItems; class SwOLENodes; class Point; +//UUUU +namespace drawinglayer { namespace attribute { + class SdrAllFillAttributesHelper; + typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; +}} + /// Base class of the Writer document model elements. class SW_DLLPUBLIC SwNode : private BigPtrEntry @@ -479,6 +485,9 @@ public: static SwOLENodes* CreateOLENodesArray( const SwFmtColl& rColl, bool bOnlyWithInvalidSize ); + //UUUU Access to DrawingLayer FillAttributes in a preprocessed form for primitive usage + virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; + private: /// Private constructor because copying is never allowed!! SwCntntNode( const SwCntntNode & rNode ); diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx index fbd6c6d2e23b..b60bc45c02cc 100644 --- a/sw/inc/swatrset.hxx +++ b/sw/inc/swatrset.hxx @@ -138,8 +138,10 @@ class SwTblBoxValue; class SwAttrPool : public SfxItemPool { private: - ///UUUU helpers to add/rmove DrawingLayer ItemPool, used in constructor - /// and destructor; still isolated to evtl. allow other use later + //UUUU helpers to add/rmove DrawingLayer ItemPool, used in constructor + // and destructor; still isolated to evtl. allow other use later, but + // used bz default now to have it instantly as needed for DrawingLayer + // FillStyle support void createAndAddSecondaryPools(); void removeAndDeleteSecondaryPools(); diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx index 7856360130b8..6ebc335b2ae4 100644 --- a/sw/inc/swunohelper.hxx +++ b/sw/inc/swunohelper.hxx @@ -35,6 +35,9 @@ namespace rtl {class OUString;} class DateTime; +//UUUU +class SfxItemSet; + namespace SWUnoHelper { // calls over the compherl the getEnumAsInt32 function and handle the @@ -70,6 +73,12 @@ SW_DLLPUBLIC bool UCB_IsFile( const OUString& rURL ); // is the URL a existing directory? bool UCB_IsDirectory( const OUString& rURL ); + +///UUUU helper to check if fill style is set to color or bitmap +/// and thus formally used SvxBrushItem parts need to be mapped +/// for backwards compatibility +bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet); + } #endif diff --git a/sw/inc/unobrushitemhelper.hxx b/sw/inc/unobrushitemhelper.hxx deleted file mode 100644 index fd141e51d248..000000000000 --- a/sw/inc/unobrushitemhelper.hxx +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SW_INC_UNOBRUSHITEMHELPER_HXX -#define INCLUDED_SW_INC_UNOBRUSHITEMHELPER_HXX - -#include <swdllapi.h> -#include <editeng/brushitem.hxx> - -namespace sw { - -//UUUU helper function definintions for UNO API fallbacks to replace SvxBrushItem -void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxItemSet& rToSet); -SW_DLLPUBLIC SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, bool bSearchInParents = true); - -} // namespace sw - -#endif // INCLUDED_SW_INC_UNOBRUSHITEMHELPER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index 0d9c761a8ce7..afd243736a44 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -72,11 +72,6 @@ private: SwPaM* m_pCopySource; - ///UUUU helper to check if fill style is set to color or bitmap - /// and thus formally used SvxBrushItem parts need to be mapped - /// for backwards compatibility - bool needToMapFillItemsToSvxBrushItemTypes() const; - protected: com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxStyleData; com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxStyleFamily; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 9f0267e872e2..197430400f7d 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -663,6 +663,60 @@ #define UNO_NAME_SW_FILLTRANSPARENCEGRADIENTNAME UNO_NAME_FILLTRANSPARENCEGRADIENTNAME #define UNO_NAME_SW_FILLCOLOR_2 UNO_NAME_FILLCOLOR_2 +#define UNO_NAME_HEADER_FILLBMP_LOGICAL_SIZE "Header" UNO_NAME_FILLBMP_LOGICAL_SIZE +#define UNO_NAME_HEADER_FILLBMP_OFFSET_X "Header" UNO_NAME_FILLBMP_OFFSET_X +#define UNO_NAME_HEADER_FILLBMP_OFFSET_Y "Header" UNO_NAME_FILLBMP_OFFSET_Y +#define UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_X "Header" UNO_NAME_FILLBMP_POSITION_OFFSET_X +#define UNO_NAME_HEADER_FILLBMP_POSITION_OFFSET_Y "Header" UNO_NAME_FILLBMP_POSITION_OFFSET_Y +#define UNO_NAME_HEADER_FILLBMP_RECTANGLE_POINT "Header" UNO_NAME_FILLBMP_RECTANGLE_POINT +#define UNO_NAME_HEADER_FILLBMP_SIZE_X "Header" UNO_NAME_FILLBMP_SIZE_X +#define UNO_NAME_HEADER_FILLBMP_SIZE_Y "Header" UNO_NAME_FILLBMP_SIZE_Y +#define UNO_NAME_HEADER_FILLBMP_STRETCH "Header" UNO_NAME_FILLBMP_STRETCH +#define UNO_NAME_HEADER_FILLBMP_TILE "Header" UNO_NAME_FILLBMP_TILE +#define UNO_NAME_HEADER_FILLBMP_MODE "Header" UNO_NAME_FILLBMP_MODE +#define UNO_NAME_HEADER_FILLCOLOR "Header" UNO_NAME_FILLCOLOR +#define UNO_NAME_HEADER_FILLBACKGROUND "Header" UNO_NAME_FILLBACKGROUND +#define UNO_NAME_HEADER_FILLBITMAP "Header" UNO_NAME_FILLBITMAP +#define UNO_NAME_HEADER_FILLBITMAPNAME "Header" UNO_NAME_FILLBITMAPNAME +#define UNO_NAME_HEADER_FILLBITMAPURL "Header" UNO_NAME_FILLBITMAPURL +#define UNO_NAME_HEADER_FILLGRADIENTSTEPCOUNT "Header" UNO_NAME_FILLGRADIENTSTEPCOUNT +#define UNO_NAME_HEADER_FILLGRADIENT "Header" UNO_NAME_FILLGRADIENT +#define UNO_NAME_HEADER_FILLGRADIENTNAME "Header" UNO_NAME_FILLGRADIENTNAME +#define UNO_NAME_HEADER_FILLHATCH "Header" UNO_NAME_FILLHATCH +#define UNO_NAME_HEADER_FILLHATCHNAME "Header" UNO_NAME_FILLHATCHNAME +#define UNO_NAME_HEADER_FILLSTYLE "Header" UNO_NAME_FILLSTYLE +#define UNO_NAME_HEADER_FILL_TRANSPARENCE "Header" UNO_NAME_FILL_TRANSPARENCE +#define UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENT "Header" UNO_NAME_FILLTRANSPARENCEGRADIENT +#define UNO_NAME_HEADER_FILLTRANSPARENCEGRADIENTNAME "Header" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME +#define UNO_NAME_HEADER_FILLCOLOR_2 "Header" UNO_NAME_FILLCOLOR_2 + +#define UNO_NAME_FOOTER_FILLBMP_LOGICAL_SIZE "Footer" UNO_NAME_FILLBMP_LOGICAL_SIZE +#define UNO_NAME_FOOTER_FILLBMP_OFFSET_X "Footer" UNO_NAME_FILLBMP_OFFSET_X +#define UNO_NAME_FOOTER_FILLBMP_OFFSET_Y "Footer" UNO_NAME_FILLBMP_OFFSET_Y +#define UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_X "Footer" UNO_NAME_FILLBMP_POSITION_OFFSET_X +#define UNO_NAME_FOOTER_FILLBMP_POSITION_OFFSET_Y "Footer" UNO_NAME_FILLBMP_POSITION_OFFSET_Y +#define UNO_NAME_FOOTER_FILLBMP_RECTANGLE_POINT "Footer" UNO_NAME_FILLBMP_RECTANGLE_POINT +#define UNO_NAME_FOOTER_FILLBMP_SIZE_X "Footer" UNO_NAME_FILLBMP_SIZE_X +#define UNO_NAME_FOOTER_FILLBMP_SIZE_Y "Footer" UNO_NAME_FILLBMP_SIZE_Y +#define UNO_NAME_FOOTER_FILLBMP_STRETCH "Footer" UNO_NAME_FILLBMP_STRETCH +#define UNO_NAME_FOOTER_FILLBMP_TILE "Footer" UNO_NAME_FILLBMP_TILE +#define UNO_NAME_FOOTER_FILLBMP_MODE "Footer" UNO_NAME_FILLBMP_MODE +#define UNO_NAME_FOOTER_FILLCOLOR "Footer" UNO_NAME_FILLCOLOR +#define UNO_NAME_FOOTER_FILLBACKGROUND "Footer" UNO_NAME_FILLBACKGROUND +#define UNO_NAME_FOOTER_FILLBITMAP "Footer" UNO_NAME_FILLBITMAP +#define UNO_NAME_FOOTER_FILLBITMAPNAME "Footer" UNO_NAME_FILLBITMAPNAME +#define UNO_NAME_FOOTER_FILLBITMAPURL "Footer" UNO_NAME_FILLBITMAPURL +#define UNO_NAME_FOOTER_FILLGRADIENTSTEPCOUNT "Footer" UNO_NAME_FILLGRADIENTSTEPCOUNT +#define UNO_NAME_FOOTER_FILLGRADIENT "Footer" UNO_NAME_FILLGRADIENT +#define UNO_NAME_FOOTER_FILLGRADIENTNAME "Footer" UNO_NAME_FILLGRADIENTNAME +#define UNO_NAME_FOOTER_FILLHATCH "Footer" UNO_NAME_FILLHATCH +#define UNO_NAME_FOOTER_FILLHATCHNAME "Footer" UNO_NAME_FILLHATCHNAME +#define UNO_NAME_FOOTER_FILLSTYLE "Footer" UNO_NAME_FILLSTYLE +#define UNO_NAME_FOOTER_FILL_TRANSPARENCE "Footer" UNO_NAME_FILL_TRANSPARENCE +#define UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENT "Footer" UNO_NAME_FILLTRANSPARENCEGRADIENT +#define UNO_NAME_FOOTER_FILLTRANSPARENCEGRADIENTNAME "Footer" UNO_NAME_FILLTRANSPARENCEGRADIENTNAME +#define UNO_NAME_FOOTER_FILLCOLOR_2 "Footer" UNO_NAME_FILLCOLOR_2 + #define UNO_NAME_PARA_STYLEHEADING "ParaStyleHeading" #define UNO_NAME_PARA_STYLELEVEL1 "ParaStyleLevel1" #define UNO_NAME_PARA_STYLELEVEL10 "ParaStyleLevel10" diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx index 0a661b4e75fd..7d210402e5d9 100644 --- a/sw/inc/unostyle.hxx +++ b/sw/inc/unostyle.hxx @@ -376,6 +376,7 @@ public: virtual sal_Bool SAL_CALL SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; }; + class SwXAutoStylesEnumerator : public cppu::WeakImplHelper1< ::com::sun::star::container::XEnumeration >, public SwClient { @@ -400,8 +401,10 @@ class SwXAutoStyle : public cppu::WeakImplHelper3 >, public SwClient { - SfxItemSet_Pointer_t pSet; - IStyleAccess::SwAutoStyleFamily eFamily; +private: + SfxItemSet_Pointer_t mpSet; + IStyleAccess::SwAutoStyleFamily meFamily; + SwDoc& mrDoc; ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 9c70eb15c652..a48455662e4e 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1042,7 +1042,7 @@ static bool lcl_GetBackgroundColor( Color & rColor, SwRect aDummyRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; if ( pFrm && pFrm->GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false ) ) diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx index e9bfb33504dc..a497e6b7dc05 100644 --- a/sw/source/core/attr/cellatr.cxx +++ b/sw/source/core/attr/cellatr.cxx @@ -162,8 +162,10 @@ void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem ) { // external rendering aCopy.PtrToBoxNm( &pTblNd->GetTable() ); - pUpdtFld->pHistory->Add( &aCopy, &aCopy, - pNd->FindTableBoxStartNode()->GetIndex() ); + pUpdtFld->pHistory->Add( + &aCopy, + &aCopy, + pNd->FindTableBoxStartNode()->GetIndex()); } } else diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index a99d7360bae8..e0be94b6e6ae 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -28,8 +28,10 @@ #include <swcache.hxx> #include <svl/grabbagitem.hxx> #include <com/sun/star/beans/PropertyValues.hpp> + //UUUU -#include <unobrushitemhelper.hxx> +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> +#include <svx/unobrushitemhelper.hxx> #include <svx/xdef.hxx> using namespace com::sun::star; @@ -388,7 +390,7 @@ bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom) const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const { - if(RES_BACKGROUND == nWhich && RES_FLYFRMFMT == Which()) + if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())) { //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)"); @@ -397,7 +399,7 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const // fill the local static SvxBrushItem from the current ItemSet so that // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used // as good as possible to create a fallback representation and return that - aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, bInParents); + aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInParents); return aSvxBrushItem; } @@ -408,11 +410,11 @@ const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, bool bInParents ) const SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const SfxPoolItem **ppItem ) const { - if(RES_BACKGROUND == nWhich && RES_FLYFRMFMT == Which()) + if(RES_BACKGROUND == nWhich && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())) { //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)"); - const FillAttributesPtr aFill = getFillAttributes(); + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper(); // check if the new fill attributes are used if(aFill.get() && aFill->isUsed()) @@ -422,7 +424,7 @@ SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, bool bSrchInParent, const S // to and return as state that it is set static SvxBrushItem aSvxBrushItem(RES_BACKGROUND); - aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, bSrchInParent); + aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bSrchInParent); if( ppItem ) *ppItem = &aSvxBrushItem; @@ -452,7 +454,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr ) bool bRet = false; //UUUU - if(RES_BACKGROUND == rAttr.Which() && RES_FLYFRMFMT == Which()) + if(RES_BACKGROUND == rAttr.Which() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())) { //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)"); @@ -462,7 +464,7 @@ bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr ) // fill a local ItemSet with the attributes corresponding as good as possible // to the new fill properties [XATTR_FILL_FIRST .. XATTR_FILL_LAST] and set these // as ItemSet - sw::setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet); + setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet); if(IsModifyLocked()) { @@ -541,7 +543,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) bool bRet = false; - //UUUU Usel local copy to be able to apply needed changes, e.g. call + //UUUU Use local copy to be able to apply needed changes, e.g. call // CheckForUniqueItemForLineFillNameOrIndex which is needed for NameOrIndex stuff SfxItemSet aTempSet(rSet); @@ -553,8 +555,8 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aTempSet); } - //UUUU - if(RES_FLYFRMFMT == Which()) + //UUUU FlyFrame PageStyle + if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) { const SfxPoolItem* pSource = 0; @@ -567,7 +569,7 @@ bool SwFmt::SetFmtAttr( const SfxItemSet& rSet ) // fill attribute ranges [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Add the attributes // corresponding as good as possible to the new fill properties and set the whole ItemSet const SvxBrushItem& rSource(static_cast< const SvxBrushItem& >(*pSource)); - sw::setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet); + setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet); if(IsModifyLocked()) { @@ -787,7 +789,8 @@ void SwFmt::SetGrabBagItem(const uno::Any& rVal) //UUUU const SvxBrushItem& SwFmt::GetBackground(bool bInP) const { - if(RES_FLYFRMFMT == Which()) + //UUUU FlyFrame PageStyle + if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) { //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)"); @@ -796,7 +799,7 @@ const SvxBrushItem& SwFmt::GetBackground(bool bInP) const // fill the local static SvxBrushItem from the current ItemSet so that // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used // as good as possible to create a fallback representation and return that - aSvxBrushItem = sw::getSvxBrushItemFromSourceSet(aSet, bInP); + aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInP); return aSvxBrushItem; } @@ -805,12 +808,9 @@ const SvxBrushItem& SwFmt::GetBackground(bool bInP) const } //UUUU -FillAttributesPtr SwFmt::getFillAttributes() const +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFmt::getSdrAllFillAttributesHelper() const { - // FALLBACKBREAKHERE return empty pointer - OSL_ENSURE(false, "getFillAttributes() call only valid for RES_FLYFRMFMT currently (!)"); - - return FillAttributesPtr(); + return drawinglayer::attribute::SdrAllFillAttributesHelperPtr(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index a42044306506..b2fb6051d64c 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -170,6 +170,10 @@ sal_uInt16 aTxtNodeSetRange[] = { RES_PARATR_BEGIN, RES_PARATR_END-1, RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, + + //UUUU FillAttribute support (paragraph FillStyle) + XATTR_FILL_FIRST, XATTR_FILL_LAST, + 0 }; @@ -226,7 +230,7 @@ sal_uInt16 aFrmFmtSetRange[] = { RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, - //UUUU FillAttribute support + //UUUU FillAttribute support (TextFrame, OLE, Writer GraphicObject) XATTR_FILL_FIRST, XATTR_FILL_LAST, 0 diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 108dae512080..0ab73e7512cb 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -131,17 +131,19 @@ static void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, // correctly if we have different WhichRanges. // Take over the attributes which are of interest. - sal_uInt16 const aIdArr[] = { RES_FRM_SIZE, RES_UL_SPACE, - RES_BACKGROUND, RES_SHADOW, - RES_COL, RES_COL, - RES_FRAMEDIR, RES_FRAMEDIR, - RES_TEXTGRID, RES_TEXTGRID, - // #i45539# - RES_HEADER_FOOTER_EAT_SPACING, - RES_HEADER_FOOTER_EAT_SPACING, - RES_UNKNOWNATR_CONTAINER, - RES_UNKNOWNATR_CONTAINER, - 0 }; + sal_uInt16 const aIdArr[] = { + RES_FRM_SIZE, RES_UL_SPACE, // [83..86 + RES_BACKGROUND, RES_SHADOW, // [99..101 + RES_COL, RES_COL, // [103 + RES_TEXTGRID, RES_TEXTGRID, // [109 + RES_FRAMEDIR, RES_FRAMEDIR, // [114 + RES_HEADER_FOOTER_EAT_SPACING, RES_HEADER_FOOTER_EAT_SPACING, // [115 + RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER, // [143 + + //UUUU take over DrawingLayer FillStyles + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + 0}; const SfxPoolItem* pItem; for( sal_uInt16 n = 0; aIdArr[ n ]; n += 2 ) @@ -153,13 +155,49 @@ static void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest, // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING // bPage == false: // All in aIdArr except from RES_COL and RES_PAPER_BIN: - if( ( bPage && RES_HEADER_FOOTER_EAT_SPACING != nId ) || - ( !bPage && RES_COL != nId && RES_PAPER_BIN != nId )) + bool bExecuteId(true); + + if(bPage) { - if( SFX_ITEM_SET == rSource.GetItemState( nId, false, &pItem )) - rDest.SetFmtAttr( *pItem ); + // When Page + switch(nId) + { + // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING + case RES_HEADER_FOOTER_EAT_SPACING: + //UUUU take out SvxBrushItem; it's the result of the fallback + // at SwFmt::GetItemState and not really in state SFX_ITEM_SET + case RES_BACKGROUND: + bExecuteId = false; + break; + default: + break; + } + } + else + { + // When not Page + switch(nId) + { + // When not Page: All in aIdArr except from RES_COL and RES_PAPER_BIN: + case RES_COL: + case RES_PAPER_BIN: + bExecuteId = false; + break; + default: + break; + } + } + + if(bExecuteId) + { + if (SFX_ITEM_SET == rSource.GetItemState(nId, false, &pItem)) + { + rDest.SetFmtAttr(*pItem); + } else - rDest.ResetFmtAttr( nId ); + { + rDest.ResetFmtAttr(nId); + } } } } diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 8e357b7ac7ef..9d552ef5892f 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -787,7 +787,11 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const OUString &rStr ) ? pNode->GetpSwpHints()->Count() : 0; if( nOldAttrCnt != nNewAttrCnt ) { - SwUpdateAttr aHint( 0, 0, 0 ); + SwUpdateAttr aHint( + 0, + 0, + 0); + pNode->ModifyBroadcast( 0, &aHint, TYPE( SwCrsrShell ) ); } diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 0e45f7a4a1a2..31c9fe217ac9 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -516,13 +516,7 @@ bool SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) ); } - //UUUU Need to check for unique item for DrawingLayer items of type NameOrIndex - // and evtl. correct that item to ensure unique names for that type. This call may - // modify/correct entries inside of the given SfxItemSet - CheckForUniqueItemForLineFillNameOrIndex(rSet); - - bool const bRet = - lcl_SetFlyFrmAttr(*this, &SwDoc::SetFlyFrmAnchor, rFlyFmt, rSet); + bool const bRet = lcl_SetFlyFrmAttr(*this, &SwDoc::SetFlyFrmAnchor, rFlyFmt, rSet); if ( pSaveUndo.get() ) { diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 6e3d5d975efa..4795e1e895ca 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -505,7 +505,8 @@ static bool lcl_InsAttr( || isPARATR_LIST(nWhich) || isFRMATR(nWhich) || isGRFATR(nWhich) - || isUNKNOWNATR(nWhich) ) + || isUNKNOWNATR(nWhich) + || isDrawingLayerAttribute(nWhich) ) //UUUU { pOtherSet = &rChgSet; bOtherAttr = true; @@ -532,6 +533,10 @@ static bool lcl_InsAttr( RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_GRFATR_BEGIN, RES_GRFATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, + 0 ); pTmpCharItemSet->Put( rChgSet ); @@ -837,7 +842,14 @@ static bool lcl_InsAttr( if( pOtherSet && pOtherSet->Count() ) { SwRegHistory aRegH( pNode, *pNode, pHistory ); - bRet = pNode->SetAttr( *pOtherSet ) || bRet; + + //UUUU Need to check for unique item for DrawingLayer items of type NameOrIndex + // and evtl. correct that item to ensure unique names for that type. This call may + // modify/correct entries inside of the given SfxItemSet + SfxItemSet aTempLocalCopy(*pOtherSet); + + pDoc->CheckForUniqueItemForLineFillNameOrIndex(aTempLocalCopy); + bRet = pNode->SetAttr(aTempLocalCopy) || bRet; } DELETECHARSETS @@ -1252,7 +1264,7 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) { aCallMod.Add( mpDfltGrfFmtColl ); } - else if (isFRMATR(nWhich)) + else if (isFRMATR(nWhich) || isDrawingLayerAttribute(nWhich) ) //UUUU { aCallMod.Add( mpDfltGrfFmtColl ); aCallMod.Add( mpDfltTxtFmtColl ); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index b32744938215..882719e4060b 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -104,6 +104,9 @@ #include <fmtmeta.hxx> #include <boost/foreach.hpp> +//UUUU +#include <svx/xfillit0.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::document; @@ -281,6 +284,21 @@ SwDoc::SwDoc() mbReadOnly(false), meDocType(DOCTYPE_NATIVE) { + //UUUU The DrawingLayer ItemPool which is used as 2nd pool for Writer documents' pool + // has a default for the XFillStyleItem of XFILL_SOLID and the color for it is the default + // fill color (blue7 or similar). This is a problem, in Writer we want the default fill + // style to be XFILL_NONE. This cannot simply be done by changing it in the 2nd pool at the + // pool defaults when the DrawingLayer ItemPool is used for Writer, that would lead to + // countless problems like DrawObjects initial fill and others. + // It is also hard to find all places where the initial ItemSets for Writer (including + // style hierarchies) are created and to always set (but only at the root) the FillStyle + // to NONE fixed; that will add that attribute to the file format. It will be hard to reset + // attribbute sets (which is done at import and using UI). Also not a good solution. + // Luckily Writer uses pDfltTxtFmtColl as default parent for all paragraphs and similar, thus + // it is possible to set this attribute here. It will be not reset when importing. + mpDfltTxtFmtColl->SetFmtAttr(XFillStyleItem(XFILL_NONE)); + mpDfltFrmFmt->SetFmtAttr(XFillStyleItem(XFILL_NONE)); + /* * DefaultFormats and DefaultFormatCollections (FmtColl) * are inserted at position 0 at the respective array. diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index ab47e58d0965..d3fae50bb22d 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -3516,18 +3516,20 @@ void SwRangeRedline::InvalidateRange() // trigger the Layout sal_Int32 nTmp2 = nSttCnt; nSttCnt = nEndCnt; nEndCnt = nTmp2; } - SwUpdateAttr aHt( 0, 0, RES_FMT_CHG ); SwNodes& rNds = GetDoc()->GetNodes(); - for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) + for (sal_uLong n(nSttNd); n <= nEndNd; ++n) { - SwNode* pNd = rNds[n]; - if( pNd->IsTxtNode() ) + SwNode* pNode = rNds[n]; + + if (pNode && pNode->IsTxtNode()) { - aHt.nStart = n == nSttNd ? nSttCnt : 0; - aHt.nEnd = (n == nEndNd) - ? nEndCnt - : static_cast<SwTxtNode*>(pNd)->GetTxt().getLength(); - ((SwTxtNode*)pNd)->ModifyNotification( &aHt, &aHt ); + SwTxtNode* pNd = static_cast< SwTxtNode* >(pNode); + SwUpdateAttr aHt( + n == nSttNd ? nSttCnt : 0, + n == nEndNd ? nEndCnt : pNd->GetTxt().getLength(), + RES_FMT_CHG); + + pNd->ModifyNotification(&aHt, &aHt); } } } diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index b787b4f20bc6..e2cd1fcddca7 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -183,7 +183,7 @@ static void lcl_ClearArea( const SwFrm &rFrm, const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; if ( rFrm.GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigRect, false ) ) { diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index c3d6b30a206a..da5151e5a8f9 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -65,6 +65,9 @@ #include <numrule.hxx> #include <svx/xdef.hxx> +//UUUU +#include <svx/xfillit0.hxx> + using namespace ::editeng; using namespace ::com::sun::star; diff --git a/sw/source/core/doc/visiturl.cxx b/sw/source/core/doc/visiturl.cxx index db255aee7805..a574e4ff44d8 100644 --- a/sw/source/core/doc/visiturl.cxx +++ b/sw/source/core/doc/visiturl.cxx @@ -75,12 +75,14 @@ void SwURLStateChanged::Notify( SfxBroadcaster& , const SfxHint& rHint ) bUnLockView = !pESh->IsViewLocked(); pESh->LockView( true ); } - const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( false ); + const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid(false); const SwTxtAttr* pAttr = pTxtAttr; - SwUpdateAttr aUpdateAttr( pAttr->GetStart(), - *pAttr->End(), - RES_FMT_CHG ); - ((SwTxtNode*)pTxtNd)->ModifyNotification( &aUpdateAttr, &aUpdateAttr ); + SwUpdateAttr aUpdateAttr( + pAttr->GetStart(), + *pAttr->End(), + RES_FMT_CHG); + + const_cast< SwTxtNode* >(pTxtNd)->ModifyNotification(&aUpdateAttr, &aUpdateAttr); } } } diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 5cb751e91a83..37242a7cf126 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -987,7 +987,7 @@ void SwCntntNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewV case RES_UPDATE_ATTR: if( GetNodes().IsDocNodes() && IsTxtNode() ) { - const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->nWhichAttr; + const sal_uInt16 nTmp = ((SwUpdateAttr*)pNewValue)->getWhichAttr(); if ( RES_ATTRSET_CHG == nTmp ) { // TODO: anybody wants to do some optimization here? @@ -1910,6 +1910,12 @@ SwOLENodes* SwCntntNode::CreateOLENodesArray( const SwFmtColl& rColl, bool bOnly return pNodes; } +//UUUU +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwCntntNode::getSdrAllFillAttributesHelper() const +{ + return drawinglayer::attribute::SdrAllFillAttributesHelperPtr(); +} + /* * Document Interface Access */ diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index a839716e42f4..058e64c13d8e 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -20,6 +20,7 @@ #ifndef INCLUDED_SW_SOURCE_CORE_INC_DFLYOBJ_HXX #define INCLUDED_SW_SOURCE_CORE_INC_DFLYOBJ_HXX +#include <drawinglayer/geometry/viewinformation2d.hxx> #include <svx/svdovirt.hxx> class SwFlyFrm; diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 136244213d9c..1a8e33e08731 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -60,8 +60,6 @@ class SwPrintData; class SwSortedObjs; class SwAnchoredObject; typedef struct _xmlTextWriter *xmlTextWriterPtr; -//UUUU -class FillAttributes; // Each FrmType is represented here as a bit. // The bits must be set in a way that it can be determined with masking of @@ -222,6 +220,12 @@ enum MakePageType MAKEPAGE_NOSECTION // Don't create section frames }; +//UUUU +namespace drawinglayer { namespace attribute { + class SdrAllFillAttributesHelper; + typedef boost::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr; +}} + /** * Base class of the Writer layout elements. * @@ -512,7 +516,7 @@ public: void Retouche( const SwPageFrm *pPage, const SwRect &rRect ) const; bool GetBackgroundBrush( - boost::shared_ptr< FillAttributes >& rFillAttributes, + drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, const SvxBrushItem*& rpBrush, const Color*& rpColor, SwRect &rOrigRect, @@ -886,6 +890,9 @@ public: void RegisterToFormat( SwFmt& rFmt ); void ValidateThisAndAllLowers( const sal_uInt16 nStage ); + //UUUU + drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const; + public: // if writer is NULL, dumps the layout structure as XML in layout.xml virtual void dumpAsXml(xmlTextWriterPtr writer = NULL); diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index c7e32b9dab1e..00cdf28b43d6 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -61,7 +61,7 @@ void DrawGraphic( const sal_uInt8 nGrfNum = GRFNUM_NO, const bool bConsiderBackgroundTransparency = false ); bool DrawFillAttributes( - const boost::shared_ptr< FillAttributes >& rFillAttributes, + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, const SwRect& rOriginalLayoutRect, const SwRect& rPaintRect, OutputDevice& rOut); diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 24ac07e45ed9..63ca034bb8ae 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -77,7 +77,7 @@ #endif //UUUU -#include <fillattributes.hxx> +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> #include <svx/xfillit0.hxx> #include <svl/itemiter.hxx> @@ -2378,20 +2378,6 @@ SwFrmFmt::SwFrmFmt( m_wXObject(), maFillAttributes() { - //UUUU - if(RES_FLYFRMFMT == nFmtWhich) - { - // when its a SwFlyFrmFmt do not do this, this setting - // will be derived from the parent style. In the future this - // may be needed for more formats; all which use the - // XATTR_FILL_FIRST, XATTR_FILL_LAST range as fill attributes - } - else - { - // set FillStyle to none; this is necessary since the pool default is - // to fill objects by color (blue8) - SetFmtAttr(XFillStyleItem(XFILL_NONE)); - } } SwFrmFmt::SwFrmFmt( @@ -2404,20 +2390,6 @@ SwFrmFmt::SwFrmFmt( m_wXObject(), maFillAttributes() { - //UUUU - if(RES_FLYFRMFMT == nFmtWhich) - { - // when its a SwFlyFrmFmt do not do this, this setting - // will be derived from the parent style. In the future this - // may be needed for more formats; all which use the - // XATTR_FILL_FIRST, XATTR_FILL_LAST range as fill attributes - } - else - { - // set FillStyle to none; this is necessary since the pool default is - // to fill objects by color (blue8) - SetFmtAttr(XFillStyleItem(XFILL_NONE)); - } } void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) @@ -2435,7 +2407,7 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) RES_FOOTER, false, (const SfxPoolItem**)&pF ); //UUUU reset fill information - if(RES_FLYFRMFMT == Which() && maFillAttributes.get()) + if(maFillAttributes.get() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())) { SfxItemIter aIter(*((SwAttrSetChg*)pNew)->GetChgSet()); bool bReset(false); @@ -2451,10 +2423,10 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) } } } - else if(RES_FMT_CHG == nWhich) //UUUU + else if(RES_FMT_CHG == nWhich) { //UUUU reset fill information on format change (e.g. style changed) - if(RES_FLYFRMFMT == Which() && maFillAttributes.get()) + if(maFillAttributes.get() && (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which())) { maFillAttributes.reset(); } @@ -2975,9 +2947,9 @@ OUString SwFlyFrmFmt::GetObjDescription() const bool SwFlyFrmFmt::IsBackgroundTransparent() const { //UUUU - if(RES_FLYFRMFMT == Which() && getFillAttributes()) + if((RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) && getSdrAllFillAttributesHelper()) { - return getFillAttributes()->isTransparent(); + return getSdrAllFillAttributesHelper()->isTransparent(); } // NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT) @@ -3017,9 +2989,9 @@ bool SwFlyFrmFmt::IsBackgroundTransparent() const bool SwFlyFrmFmt::IsBackgroundBrushInherited() const { //UUUU - if(RES_FLYFRMFMT == Which() && getFillAttributes()) + if((RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) && getSdrAllFillAttributesHelper()) { - return !getFillAttributes()->isUsed(); + return !getSdrAllFillAttributesHelper()->isUsed(); } else if ( (GetBackground().GetColor() == COL_TRANSPARENT) && !(GetBackground().GetGraphicObject()) ) @@ -3242,20 +3214,20 @@ IMapObject* SwFrmFmt::GetIMapObject( const Point& rPoint, } //UUUU -FillAttributesPtr SwFrmFmt::getFillAttributes() const +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrmFmt::getSdrAllFillAttributesHelper() const { - if(RES_FLYFRMFMT == Which()) + if(RES_FLYFRMFMT == Which() || RES_FRMFMT == Which()) { // create FillAttributes on demand if(!maFillAttributes.get()) { - const_cast< SwFrmFmt* >(this)->maFillAttributes.reset(new FillAttributes(GetAttrSet())); + const_cast< SwFrmFmt* >(this)->maFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(GetAttrSet())); } } else { // FALLBACKBREAKHERE assert wrong usage - OSL_ENSURE(false, "getFillAttributes() call only valid for RES_FLYFRMFMT currently (!)"); + OSL_ENSURE(false, "getSdrAllFillAttributesHelper() call only valid for RES_FLYFRMFMT and RES_FRMFMT (!)"); } return maFillAttributes; diff --git a/sw/source/core/layout/fillattributes.cxx b/sw/source/core/layout/fillattributes.cxx deleted file mode 100644 index 8666c27ab092..000000000000 --- a/sw/source/core/layout/fillattributes.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <fillattributes.hxx> -#include <svx/sdr/primitive2d/sdrattributecreator.hxx> -#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> -#include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <drawinglayer/attribute/fillhatchattribute.hxx> -#include <drawinglayer/attribute/sdrfillgraphicattribute.hxx> -#include <svx/xfillit0.hxx> -#include <tools/color.hxx> -#include <vcl/graph.hxx> - -void FillAttributes::createPrimitive2DSequence( - const basegfx::B2DRange& rPaintRange, - const basegfx::B2DRange& rDefineRange) -{ - // reset and remember new target range for object geometry - maLastPaintRange = rPaintRange; - maLastDefineRange = rDefineRange; - - if(isUsed()) - { - maPrimitives.realloc(1); - maPrimitives[0] = drawinglayer::primitive2d::createPolyPolygonFillPrimitive( - basegfx::B2DPolyPolygon( - basegfx::tools::createPolygonFromRect( - maLastPaintRange)), - maLastDefineRange, - maFillAttribute.get() ? *maFillAttribute.get() : drawinglayer::attribute::SdrFillAttribute(), - maFillGradientAttribute.get() ? *maFillGradientAttribute.get() : drawinglayer::attribute::FillGradientAttribute()); - } -} - -FillAttributes::FillAttributes(const Color& rColor) -: maLastPaintRange(), - maLastDefineRange(), - maFillAttribute(), - maFillGradientAttribute(), - maPrimitives() -{ - maFillAttribute.reset( - new drawinglayer::attribute::SdrFillAttribute( - 0.0, - Color(rColor.GetRGBColor()).getBColor(), - drawinglayer::attribute::FillGradientAttribute(), - drawinglayer::attribute::FillHatchAttribute(), - drawinglayer::attribute::SdrFillGraphicAttribute())); -} - -FillAttributes::FillAttributes(const SfxItemSet& rSet) -: maLastPaintRange(), - maLastDefineRange(), - maFillAttribute( - new drawinglayer::attribute::SdrFillAttribute( - drawinglayer::primitive2d::createNewSdrFillAttribute(rSet))), - maFillGradientAttribute( - new drawinglayer::attribute::FillGradientAttribute( - drawinglayer::primitive2d::createNewTransparenceGradientAttribute(rSet))), - maPrimitives() -{ -} - -FillAttributes::~FillAttributes() -{ -} - -bool FillAttributes::isUsed() const -{ - // only depends on fill, FillGradientAttribute alone defines no fill - return maFillAttribute.get() && !maFillAttribute->isDefault(); -} - -bool FillAttributes::isTransparent() const -{ - if(hasSdrFillAttribute() && 0.0 != maFillAttribute->getTransparence()) - { - return true; - } - - if(hasFillGradientAttribute() && !maFillGradientAttribute->isDefault()) - { - return true; - } - - if(hasSdrFillAttribute()) - { - const Graphic& rGraphic = getFillAttribute().getFillGraphic().getFillGraphic(); - - return rGraphic.IsSupportedGraphic() && rGraphic.IsTransparent(); - } - - return false; -} - -const drawinglayer::attribute::SdrFillAttribute& FillAttributes::getFillAttribute() const -{ - if(!maFillAttribute.get()) - { - const_cast< FillAttributes* >(this)->maFillAttribute.reset(new drawinglayer::attribute::SdrFillAttribute()); - } - - return *maFillAttribute.get(); -} - -const drawinglayer::primitive2d::Primitive2DSequence& FillAttributes::getPrimitive2DSequence( - const basegfx::B2DRange& rPaintRange, - const basegfx::B2DRange& rDefineRange) const -{ - if(maPrimitives.getLength() && (maLastPaintRange != rPaintRange || maLastDefineRange != rDefineRange)) - { - const_cast< FillAttributes* >(this)->maPrimitives.realloc(0); - } - - if(!maPrimitives.getLength()) - { - const_cast< FillAttributes* >(this)->createPrimitive2DSequence(rPaintRange, rDefineRange); - } - - return maPrimitives; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 749fa8469c78..d8ff9576af8d 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -557,6 +557,19 @@ const SwAttrSet* SwFrm::GetAttrSet() const return &((const SwLayoutFrm*)this)->GetFmt()->GetAttrSet(); } +//UUUU +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFrm::getSdrAllFillAttributesHelper() const +{ + if(IsCntntFrm()) + { + return static_cast< const SwCntntFrm* >(this)->GetNode()->getSdrAllFillAttributesHelper(); + } + else + { + return static_cast< const SwLayoutFrm* >(this)->GetFmt()->getSdrAllFillAttributesHelper(); + } +} + /* * SwFrm::_FindNext(), _FindPrev(), InvalidateNextPos() * _FindNextCnt() visits tables and sections and only returns SwCntntFrms. diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 849d29c74fa2..b47482329da4 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -63,6 +63,9 @@ #include <switerator.hxx> #include <DocumentSettingManager.hxx> +//UUUU +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> + // ftnfrm.cxx: void sw_RemoveFtns( SwFtnBossFrm* pBoss, bool bPageOnly, bool bEndNotes ); @@ -201,9 +204,23 @@ SwFrmNotify::~SwFrmNotify() (aPrt.*fnRect->fnGetHeight)()!=(pFrm->Prt().*fnRect->fnGetHeight)(); if ( bPrtWidth || bPrtHeight ) { - const SvxGraphicPosition ePos = pFrm->GetAttrSet()->GetBackground().GetGraphicPos(); - if ( GPOS_NONE != ePos && GPOS_TILED != ePos ) - pFrm->SetCompletePaint(); + //UUUU + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pFrm->getSdrAllFillAttributesHelper()); + + if(aFillAttributes.get() && aFillAttributes->isUsed()) + { + //UUUU use SetCompletePaint if needed + if(aFillAttributes->needCompleteRepaint()) + { + pFrm->SetCompletePaint(); + } + } + else + { + const SvxGraphicPosition ePos = pFrm->GetAttrSet()->GetBackground().GetGraphicPos(); + if(GPOS_NONE != ePos && GPOS_TILED != ePos) + pFrm->SetCompletePaint(); + } } else { diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index d046fb4b311e..f51680cde904 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -80,7 +80,9 @@ #include <vcl/settings.hxx> //UUUU +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> #include <drawinglayer/processor2d/processor2dtools.hxx> +#include <ndtxt.hxx> #define COL_NOTES_SIDEPANE RGB_COLORDATA(230,230,230) #define COL_NOTES_SIDEPANE_BORDER RGB_COLORDATA(200,200,200) @@ -1826,7 +1828,7 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut, } bool DrawFillAttributes( - const FillAttributesPtr& rFillAttributes, + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, const SwRect& rOriginalLayoutRect, const SwRect& rPaintRect, OutputDevice& rOut) @@ -1836,9 +1838,12 @@ bool DrawFillAttributes( if(bUseNew && rFillAttributes.get() && rFillAttributes->isUsed()) { + //UUUU Need to substract a half logical pixel unit from TopLeft to get the correct + // layering for AAed paints + const basegfx::B2DVector aHalfSingleUnit(rOut.GetInverseViewTransformation() * basegfx::B2DVector(0.5, 0.5)); const basegfx::B2DRange aPaintRange( - rPaintRect.Left(), - rPaintRect.Top(), + rPaintRect.Left() - aHalfSingleUnit.getX(), + rPaintRect.Top() - aHalfSingleUnit.getY(), rPaintRect.Right(), rPaintRect.Bottom()); @@ -3884,7 +3889,7 @@ bool SwFlyFrm::IsBackgroundTransparent() const const Color* pSectionTOXColor = 0; SwRect aDummyRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; if ( GetBackgroundBrush( aFillAttributes, pBackgrdBrush, pSectionTOXColor, aDummyRect, false) ) { @@ -4119,10 +4124,10 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const { const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* >(GetFmt()); - if(pSwFrmFmt && RES_FLYFRMFMT == pSwFrmFmt->Which()) + if(pSwFrmFmt && (RES_FLYFRMFMT == pSwFrmFmt->Which() || RES_FRMFMT == pSwFrmFmt->Which())) { //UUUU check for transparency - const FillAttributesPtr aFillAttributes(pSwFrmFmt->getFillAttributes()); + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes(pSwFrmFmt->getSdrAllFillAttributesHelper()); // check if the new fill attributes are used if(aFillAttributes.get() && aFillAttributes->isUsed()) @@ -5895,38 +5900,22 @@ void SwPageFrm::PaintGrid( OutputDevice* pOut, SwRect &rRect ) const void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect, SwViewShell* _pViewShell ) const { - if ( _pViewShell->GetWin() && - !_pViewShell->GetViewOptions()->getBrowseMode() ) + if ( _pViewShell->GetWin() && !_pViewShell->GetViewOptions()->getBrowseMode() ) { - SwRect aPgPrtRect( Prt() ); - aPgPrtRect.Pos() += Frm().Pos(); - if ( !aPgPrtRect.IsInside( _rOutputRect ) ) + //UUUU Simplified paint with DrawingLayer FillStyle + SwRect aPgRect = Frm(); + aPgRect._Intersection( _rOutputRect ); + + if(!aPgRect.IsEmpty()) { - SwRect aPgRect = Frm(); - aPgRect._Intersection( _rOutputRect ); - if(aPgRect.Height() < 0 || aPgRect.Width() <= 0) // No intersection - return; - SwRegionRects aPgRegion( aPgRect ); - aPgRegion -= aPgPrtRect; - //const SwPageFrm* pPage = static_cast<const SwPageFrm*>(this); - //if ( pPage->GetSortedObjs() ) - // ::lcl_SubtractFlys( this, pPage, aPgRect, aPgRegion ); - if ( !aPgRegion.empty() ) + OutputDevice *pOut = _pViewShell->GetOut(); + + if(pOut->GetFillColor() != aGlobalRetoucheColor) { - OutputDevice *pOut = _pViewShell->GetOut(); - if ( pOut->GetFillColor() != aGlobalRetoucheColor ) - pOut->SetFillColor( aGlobalRetoucheColor ); - for ( sal_uInt16 i = 0; i < aPgRegion.size(); ++i ) - { - if ( 1 < aPgRegion.size() ) - { - ::SwAlignRect( aPgRegion[i], pGlobalShell ); - if( !aPgRegion[i].HasArea() ) - continue; - } - pOut->DrawRect(aPgRegion[i].SVRect()); - } + pOut->SetFillColor(aGlobalRetoucheColor); } + + pOut->DrawRect(aPgRect.SVRect()); } } } @@ -6429,7 +6418,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, bool bLowMode = true; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; bool bBack = GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, bLowerMode ); //- Output if a separate background is used. @@ -6461,14 +6450,14 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, pTmpBackBrush = new SvxBrushItem( Color( COL_WHITE ), RES_BACKGROUND ); //UUU - aFillAttributes.reset(new FillAttributes(Color( COL_WHITE ))); + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(Color( COL_WHITE ))); } else { pTmpBackBrush = new SvxBrushItem( aGlobalRetoucheColor, RES_BACKGROUND); //UUU - aFillAttributes.reset(new FillAttributes(aGlobalRetoucheColor)); + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(aGlobalRetoucheColor)); } pItem = pTmpBackBrush; @@ -6519,7 +6508,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, pItem = pNewItem; //UUUU - aFillAttributes.reset(new FillAttributes(*pCol)); + aFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(*pCol)); } //if ( pPage->GetSortedObjs() ) @@ -7207,32 +7196,40 @@ const Color SwPageFrm::GetDrawBackgrdColor() const SwRect aDummyRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; if ( GetBackgroundBrush( aFillAttributes, pBrushItem, pDummyColor, aDummyRect, true) ) { - OUString referer; - SwViewShell * sh1 = getRootFrm()->GetCurrShell(); - if (sh1 != 0) { - SfxObjectShell * sh2 = sh1->GetDoc()->GetPersist(); - if (sh2 != 0 && sh2->HasName()) { - referer = sh2->GetMedium()->GetName(); - } - } - const Graphic* pGraphic = pBrushItem->GetGraphic(referer); - - if(pGraphic) + if(aFillAttributes.get() && aFillAttributes->isUsed()) //UUUU { - // #i29105# when a graphic is set, it may be possible to calculate a single - // color which looks good in all places of the graphic. Since it is - // planned to have text edit on the overlay one day and the fallback - // to aGlobalRetoucheColor returns something useful, just use that - // for now. + // let SdrAllFillAttributesHelper do the average color calculation + return Color(aFillAttributes->getAverageColor(aGlobalRetoucheColor.getBColor())); } - else + else if(pBrushItem) { - // not a graphic, use (hopefully) initialized color - return pBrushItem->GetColor(); + OUString referer; + SwViewShell * sh1 = getRootFrm()->GetCurrShell(); + if (sh1 != 0) { + SfxObjectShell * sh2 = sh1->GetDoc()->GetPersist(); + if (sh2 != 0 && sh2->HasName()) { + referer = sh2->GetMedium()->GetName(); + } + } + const Graphic* pGraphic = pBrushItem->GetGraphic(referer); + + if(pGraphic) + { + // #29105# when a graphic is set, it may be possible to calculate a single + // color which looks good in all places of the graphic. Since it is + // planned to have text edit on the overlay one day and the fallback + // to aGlobalRetoucheColor returns something useful, just use that + // for now. + } + else + { + // not a graphic, use (hopefully) initialized color + return pBrushItem->GetColor(); + } } } @@ -7369,7 +7366,7 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const @return true, if a background brush for the frame is found */ bool SwFrm::GetBackgroundBrush( - FillAttributesPtr& rFillAttributes, + drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, const SvxBrushItem* & rpBrush, const Color*& rpCol, SwRect &rOrigRect, @@ -7385,18 +7382,7 @@ bool SwFrm::GetBackgroundBrush( return false; //UUUU - const SwLayoutFrm* pSwLayoutFrm = dynamic_cast< const SwLayoutFrm* >(pFrm); - - if(pSwLayoutFrm) - { - const SwFrmFmt* pSwFrmFmt = dynamic_cast< const SwFrmFmt* >(pSwLayoutFrm->GetFmt()); - - if(pSwFrmFmt && RES_FLYFRMFMT == pSwFrmFmt->Which()) - { - rFillAttributes = pSwFrmFmt->getFillAttributes(); - } - } - + rFillAttributes = pFrm->getSdrAllFillAttributesHelper(); const SvxBrushItem &rBack = pFrm->GetAttrSet()->GetBackground(); if( pFrm->IsSctFrm() ) diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index f45a7aff2c7d..b66bf33aa936 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -505,7 +505,7 @@ static bool lcl_IsDarkBackground( const SwTxtPaintInfo& rInf ) SwRect aOrigBackRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; // Consider, that [GetBackgroundBrush(...)] can set <pCol> // See implementation in /core/layout/paintfrm.cxx diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 0fe340f2eacb..2f746477f453 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -847,7 +847,7 @@ static bool isA11yRelevantAttribute(MSHORT nWhich) return nWhich != RES_CHRATR_RSID; } -static bool hasA11yRelevantAttribute( const std::vector<MSHORT>& nWhich ) +static bool hasA11yRelevantAttribute( const std::vector<sal_uInt16>& nWhich ) { for( std::vector<MSHORT>::const_iterator nItr = nWhich.begin(); nItr < nWhich.end(); ++nItr ) @@ -955,8 +955,8 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) break; case RES_UPDATE_ATTR: { - nPos = ((SwUpdateAttr*)pNew)->nStart; - nLen = ((SwUpdateAttr*)pNew)->nEnd - nPos; + nPos = ((SwUpdateAttr*)pNew)->getStart(); + nLen = ((SwUpdateAttr*)pNew)->getEnd() - nPos; if( IsIdxInside( nPos, nLen ) ) { // Es muss in jedem Fall neu formatiert werden, @@ -969,7 +969,7 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) nLen = 1; _InvalidateRange( SwCharRange( nPos, nLen) ); - MSHORT nTmp = ((SwUpdateAttr*)pNew)->nWhichAttr; + MSHORT nTmp = ((SwUpdateAttr*)pNew)->getWhichAttr(); if( ! nTmp || RES_TXTATR_CHARFMT == nTmp || RES_TXTATR_AUTOFMT == nTmp || RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp ) @@ -979,8 +979,8 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) } } - if( isA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->nWhichAttr ) && - hasA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->aWhichFmtAttr ) ) + if( isA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->getWhichAttr() ) && + hasA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->getFmtAttr() ) ) { // #i104008# SwViewShell* pViewSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0; diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index de3583011b01..1aec6e54285d 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2518,7 +2518,7 @@ bool SwDrawTextInfo::ApplyAutoColor( Font* pFont ) SwRect aOrigBackRect; //UUUU - FillAttributesPtr aFillAttributes; + drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; /// OD 21.08.2002 /// consider, that [GetBackgroundBrush(...)] can set <pCol> diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 2ba1b2b0a26c..0160bfa367cd 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -83,6 +83,10 @@ #include <attrhint.hxx> #include <boost/scoped_ptr.hpp> +//UUUU +#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> +#include <svl/itemiter.hxx> + using namespace ::com::sun::star; typedef std::vector<SwTxtAttr*> SwpHts; @@ -186,18 +190,23 @@ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere, } while( true ); } -SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, - SwTxtFmtColl *pTxtColl, - const SfxItemSet* pAutoAttr ) - : SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ), - m_pSwpHints( 0 ), - mpNodeNum( 0 ), - m_bLastOutlineState( false ), - m_bNotifiable( false ), - // #i70748# - mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ), - mbInSetOrResetAttr( false ), - mpList( 0 ) +SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere, SwTxtFmtColl *pTxtColl, const SfxItemSet* pAutoAttr ) +: SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ), + m_pSwpHints( 0 ), + mpNodeNum( 0 ), + m_Text(), + m_pParaIdleData_Impl(0), + m_bContainsHiddenChars(false), + m_bHiddenCharsHidePara(false), + m_bRecalcHiddenCharFlags(false), + m_bLastOutlineState( false ), + m_bNotifiable( false ), + mbEmptyListStyleSetDueToSetOutlineLevelAttr( false ), + mbInSetOrResetAttr( false ), + mpList( 0 ), + m_pNumStringCache(), + m_wXParagraph(), + maFillAttributes() { InitSwParaStatistics( true ); @@ -1521,7 +1530,11 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const sal_Int32 nTxtStartIdx, if( this != pDest ) { // Frames benachrichtigen, sonst verschwinden die Ftn-Nummern - SwUpdateAttr aHint( nOldPos, nOldPos, 0 ); + SwUpdateAttr aHint( + nOldPos, + nOldPos, + 0); + pDest->ModifyNotification( 0, &aHint ); } } @@ -2425,7 +2438,11 @@ void SwTxtNode::GCAttr() if(bChanged) { //TxtFrm's reagieren auf aHint, andere auf aNew - SwUpdateAttr aHint( nMin, nMax, 0 ); + SwUpdateAttr aHint( + nMin, + nMax, + 0); + NotifyClients( 0, &aHint ); SwFmtChg aNew( GetTxtColl() ); NotifyClients( 0, &aNew ); @@ -3645,6 +3662,28 @@ void SwTxtNode::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewVal (SwTxtFmtColl*)((SwFmtChg*)pNewValue)->pChangedFmt ); } + //UUUU reset fill information + if(maFillAttributes.get()) + { + sal_uInt16 nWhich = pNewValue ? pNewValue->Which() : 0; + bool bReset(RES_FMT_CHG == nWhich); // ..on format change (e.g. style changed) + + if(!bReset && RES_ATTRSET_CHG == nWhich) // ..on ItemChange from DrawingLayer FillAttributes + { + SfxItemIter aIter(*((SwAttrSetChg*)pNewValue)->GetChgSet()); + + for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem && !bReset; pItem = aIter.NextItem()) + { + bReset = !IsInvalidItem(pItem) && pItem->Which() >= XATTR_FILL_FIRST && pItem->Which() <= XATTR_FILL_LAST; + } + } + + if(bReset) + { + maFillAttributes.reset(); + } + } + if ( !mbInSetOrResetAttr ) { HandleModifyAtTxtNode( *this, pOldValue, pNewValue ); @@ -3687,6 +3726,12 @@ SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl ) SwFmtChg aTmp2( pNewColl ); HandleModifyAtTxtNode( *this, &aTmp1, &aTmp2 ); } + + //UUUU reset fill information on parent style change + if(maFillAttributes.get()) + { + maFillAttributes.reset(); + } } // nur wenn im normalen Nodes-Array @@ -4976,4 +5021,16 @@ SwTxtNode::MakeUnoObject() return xMeta; } +//UUUU +drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwTxtNode::getSdrAllFillAttributesHelper() const +{ + // create SdrAllFillAttributesHelper on demand + if(!maFillAttributes.get()) + { + const_cast< SwTxtNode* >(this)->maFillAttributes.reset(new drawinglayer::attribute::SdrAllFillAttributesHelper(GetSwAttrSet())); + } + + return maFillAttributes; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 465a7c5816c0..b83b86633cc3 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1661,7 +1661,10 @@ void SwTxtNode::DeleteAttribute( SwTxtAttr * const pAttr ) { // create MsgHint before start/end become invalid SwUpdateAttr aHint( - pAttr->GetStart(), *pAttr->GetEnd(), pAttr->Which() ); + pAttr->GetStart(), + *pAttr->GetEnd(), + pAttr->Which()); + m_pSwpHints->Delete( pAttr ); SwTxtAttr::Destroy( pAttr, GetDoc()->GetAttrPool() ); NotifyClients( 0, &aHint ); @@ -1734,7 +1737,11 @@ void SwTxtNode::DeleteAttributes( // Start und End weg. // Das CalcVisibleFlag bei HiddenParaFields entfaellt, // da dies das Feld im Dtor selbst erledigt. - SwUpdateAttr aHint( nStart, *pEndIdx, nWhich ); + SwUpdateAttr aHint( + nStart, + *pEndIdx, + nWhich); + m_pSwpHints->DeleteAtPos( nPos ); // gefunden, loeschen, SwTxtAttr::Destroy( pTxtHt, GetDoc()->GetAttrPool() ); NotifyClients( 0, &aHint ); @@ -3169,11 +3176,16 @@ bool SwpHints::TryInsertHint( CHECK; #endif // ... und die Abhaengigen benachrichtigen - if ( rNode.GetDepends() ) + if(rNode.GetDepends()) { - SwUpdateAttr aHint( nHtStart, nHtStart, nWhich ); - rNode.ModifyNotification( 0, &aHint ); + SwUpdateAttr aHint( + nHtStart, + nHtStart, + nWhich); + + rNode.ModifyNotification(0,&aHint); } + return true; } @@ -3250,8 +3262,11 @@ bool SwpHints::TryInsertHint( // ... und die Abhaengigen benachrichtigen if ( rNode.GetDepends() ) { - SwUpdateAttr aHint( nHtStart, nHtStart == nHintEnd ? nHintEnd + 1 : nHintEnd, - nWhich, aWhichSublist ); + SwUpdateAttr aHint( + nHtStart, + nHtStart == nHintEnd ? nHintEnd + 1 : nHintEnd, + nWhich); + rNode.ModifyNotification( 0, &aHint ); } diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index e676498d8c9e..11f4f2f37606 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -59,7 +59,11 @@ void SwTxtCharFmt::ModifyNotification( const SfxPoolItem* pOld, const SfxPoolIte if ( m_pTxtNode ) { - SwUpdateAttr aUpdateAttr( GetStart(), *GetEnd(), nWhich ); + SwUpdateAttr aUpdateAttr( + GetStart(), + *GetEnd(), + nWhich); + m_pTxtNode->ModifyNotification( &aUpdateAttr, &aUpdateAttr ); } } @@ -167,7 +171,11 @@ void SwTxtINetFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if ( m_pTxtNode ) { - SwUpdateAttr aUpdateAttr( GetStart(), *GetEnd(), nWhich ); + SwUpdateAttr aUpdateAttr( + GetStart(), + *GetEnd(), + nWhich); + m_pTxtNode->ModifyNotification( &aUpdateAttr, &aUpdateAttr ); } } @@ -212,7 +220,11 @@ void SwTxtRuby::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) if ( m_pTxtNode ) { - SwUpdateAttr aUpdateAttr( GetStart(), *GetEnd(), nWhich ); + SwUpdateAttr aUpdateAttr( + GetStart(), + *GetEnd(), + nWhich); + m_pTxtNode->ModifyNotification( &aUpdateAttr, &aUpdateAttr ); } } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index af8e9f2a10e3..307830c89941 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -626,14 +626,20 @@ void SwTxtNode::RstTxtAttr( } TryDeleteSwpHints(); + if (bChanged) { if ( HasHints() ) { // possibly sometimes Resort would be sufficient, but... m_pSwpHints->MergePortions(*this); } + // TxtFrm's respond to aHint, others to aNew - SwUpdateAttr aHint( nMin, nMax, 0 ); + SwUpdateAttr aHint( + nMin, + nMax, + 0); + NotifyClients( 0, &aHint ); SwFmtChg aNew( GetFmtColl() ); NotifyClients( 0, &aNew ); diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 44079f8fb2f7..002a988cef37 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -978,20 +978,31 @@ SwHistory::~SwHistory() delete *it; } -void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, - sal_uLong nNodeIdx ) +void SwHistory::Add( + const SfxPoolItem* pOldValue, + const SfxPoolItem* pNewValue, + sal_uLong nNodeIdx) { OSL_ENSURE( !m_nEndDiff, "History was not deleted after REDO" ); + const sal_uInt16 nWhich(pNewValue->Which()); - sal_uInt16 nWhich = pNewValue->Which(); - if( (nWhich >= POOLATTR_END) - || (nWhich == RES_TXTATR_FIELD) - || (nWhich == RES_TXTATR_ANNOTATION) ) + // excluded values + if(nWhich == RES_TXTATR_FIELD || nWhich == RES_TXTATR_ANNOTATION) + { return; + } - // no default attribute? - SwHistoryHint * pHt; - if ( pOldValue && pOldValue != GetDfltAttr( pOldValue->Which() ) ) + // no default Attribute? + SwHistoryHint* pHt = 0; + + //UUUU To be able to include the DrawingLayer FillItems something more + // general has to be done to check if an Item is default than to check + // if it's pointzer equals that in Writer's global PoolDefaults (held in + // aAttrTab and used to fill the pool defaults in Writer - looks as if + // Writer is *older* than the SfxItemPool ?). I checked the possibility to + // get the SfxItemPool here (works), but decided to use the SfxPoolItem's + // global tooling aka IsDefaultItem(const SfxPoolItem*) for now + if(pOldValue && !IsDefaultItem(pOldValue)) { pHt = new SwHistorySetFmt( pOldValue, nNodeIdx ); } @@ -999,6 +1010,7 @@ void SwHistory::Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, { pHt = new SwHistoryResetFmt( pNewValue, nNodeIdx ); } + m_SwpHstry.push_back( pHt ); } @@ -1195,21 +1207,34 @@ sal_uInt16 SwHistory::SetTmpEnd( sal_uInt16 nNewTmpEnd ) return nOld; } -void SwHistory::CopyFmtAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx ) +void SwHistory::CopyFmtAttr( + const SfxItemSet& rSet, + sal_uLong nNodeIdx) { - if( rSet.Count() ) + if(rSet.Count()) { - SfxItemIter aIter( rSet ); - do { - if( (SfxPoolItem*)-1 != aIter.GetCurItem() ) + SfxItemIter aIter(rSet); + + do + { + if(!IsInvalidItem(aIter.GetCurItem())) { const SfxPoolItem* pNew = aIter.GetCurItem(); - Add( pNew, pNew, nNodeIdx ); + + Add( + pNew, + pNew, + nNodeIdx); } - if( aIter.IsAtEnd() ) + + if(aIter.IsAtEnd()) + { break; + } + aIter.NextItem(); - } while( true ); + + } while(true); } } @@ -1296,29 +1321,38 @@ SwRegHistory::SwRegHistory( const SwNode& rNd, SwHistory* pHst ) void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { - // #i114861# - // Do not handle a "noop" modify - // - e.g. <SwTxtNode::NumRuleChgd()> uses such a "noop" modify - if ( m_pHistory && ( pOld || pNew ) && - pOld != pNew ) + if ( m_pHistory && ( pOld || pNew ) && pOld != pNew ) { if ( pNew->Which() < POOLATTR_END ) { - m_pHistory->Add( pOld, pNew, m_nNodeIndex ); + if(RES_UPDATE_ATTR == pNew->Which()) + { + // const SfxItemPool& rPool = static_cast< const SwUpdateAttr* >(pNew)->GetSfxItemPool(); + + m_pHistory->Add( + // rPool, + pOld, + pNew, + m_nNodeIndex); + } + else + { + OSL_ENSURE(false, "Unexpected update attribute (!)"); + } } else if (pOld && RES_ATTRSET_CHG == pNew->Which()) { SwHistoryHint* pNewHstr; - const SfxItemSet& rSet = - *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet(); + const SfxItemSet& rSet = *static_cast< const SwAttrSetChg* >(pOld)->GetChgSet(); + if ( 1 < rSet.Count() ) { - pNewHstr = - new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet ); + pNewHstr = new SwHistorySetAttrSet( rSet, m_nNodeIndex, m_WhichIdSet ); } else { const SfxPoolItem* pItem = SfxItemIter( rSet ).FirstItem(); + if ( m_WhichIdSet.count( pItem->Which() ) ) { pNewHstr = new SwHistorySetFmt( pItem, m_nNodeIndex ); @@ -1328,6 +1362,7 @@ void SwRegHistory::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) pNewHstr = new SwHistoryResetFmt( pItem, m_nNodeIndex ); } } + m_pHistory->m_SwpHstry.push_back( pNewHstr ); } } diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index d7157b578f3a..f91f541018ae 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -36,7 +36,12 @@ #include <ucbhelper/content.hxx> #include <swunohelper.hxx> -namespace SWUnoHelper { +//UUUU +#include <svx/xfillit0.hxx> +#include <svl/itemset.hxx> + +namespace SWUnoHelper +{ sal_Int32 GetEnumAsInt32( const ::com::sun::star::uno::Any& rVal ) { @@ -259,6 +264,34 @@ bool UCB_GetFileListOfFolder( const OUString& rURL, return bOk; } +//UUUU +bool needToMapFillItemsToSvxBrushItemTypes(const SfxItemSet& rSet) +{ + const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rSet.GetItem(XATTR_FILLSTYLE, false))); + + if(!pXFillStyleItem) + { + return false; + } + + // here different FillStyles can be excluded for export; it will depend on the + // quality these fallbacks can reach. That again is done in getSvxBrushItemFromSourceSet, + // take a look there how the superset of DrawObject FillStyles is mapped to SvxBrushItem. + // For now, take them all - except XFILL_NONE + + if(XFILL_NONE != pXFillStyleItem->GetValue()) + { + return true; + } + + // if(XFILL_SOLID == pXFillStyleItem->GetValue() || XFILL_BITMAP == pXFillStyleItem->GetValue()) + // { + // return true; + // } + + return false; +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 75f2f704a76b..bf9a249db400 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -35,10 +35,8 @@ #include <svx/sdtaitm.hxx> #include <svx/xflclit.hxx> #include <editeng/memberids.hrc> - #include <swtypes.hxx> #include <cmdid.h> - #include <memory> #include <hints.hxx> #include <doc.hxx> @@ -120,7 +118,7 @@ #include <cppuhelper/supportsservice.hxx> //UUUU -#include <unobrushitemhelper.hxx> +#include <svx/unobrushitemhelper.hxx> #include <svx/xfillit0.hxx> #include <svx/xbtmpit.hxx> #include <svx/xgrscit.hxx> @@ -138,6 +136,7 @@ #include <svx/unoshape.hxx> #include <svx/xflhtit.hxx> #include <svx/xfltrit.hxx> +#include <swunohelper.hxx> // from fefly1.cxx extern bool sw_ChkAndSetNewAnchor( SwEditShell& rEditShell, const SwFlyFrm& rFly, SfxItemSet& rSet ); @@ -151,9 +150,6 @@ using ::com::sun::star::style::XStyleFamiliesSupplier; const sal_Char sPackageProtocol[] = "vnd.sun.star.Package:"; const sal_Char sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:"; -//UUUU -#define OWN_ATTR_FILLBMP_MODE (OWN_ATTR_VALUE_START+45) - class BaseFrameProperties_Impl { SwUnoCursorHelper::SwAnyMapHelper aAnyMap; @@ -184,6 +180,13 @@ bool BaseFrameProperties_Impl::GetProperty(sal_uInt16 nWID, sal_uInt8 nMemberId, bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet& rFromSet, bool& rSizeFound) { + //UUUU assert when the target SfxItemSet has no parent. It *should* have the pDfltFrmFmt + // from SwDoc set as parent (or similar) to have the necessary XFILL_NONE in the ItemSet + if(!rToSet.GetParent()) + { + OSL_ENSURE(false, "OOps, target SfxItemSet *should* have a parent which contains XFILL_NONE as XFillStyleItem (!)"); + } + bool bRet = true; //Anker kommt auf jeden Fall in den Set SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) ); @@ -278,7 +281,10 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI // in the obvious order some attributes may be wrong since they are set by the 1st set, but not // redefined as needed by the 2nd set when they are default (and thus no tset) in the 2nd set. If // it is necessary for any reason to set both (it should not) a in-between step will be needed - // that resets the items for FillAttributes in rToSet to default + // that resets the items for FillAttributes in rToSet to default. + // Note: There are other mechanisms in XMLOFF to pre-sort this relationship already, but this version + // was used initially, is tested and works. Keep it to be able to react when another feed adds attributes + // from both sets. if(bSvxBrushItemPropertiesUsed && !bXFillStyleItemUsed) { //UUUU create a temporary SvxBrushItem, fill the attributes to it and use it to set @@ -327,7 +333,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY); } - sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); + setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); } if(bXFillStyleItemUsed) @@ -354,7 +360,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI // Fill style is set to solid, but no fill color is given. // On the other hand, we have a BackColor, so use that. aBrush.PutValue(*pCol, MID_BACK_COLOR); - sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); + setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); } if(pXFillGradientItem || pXFillGradientNameItem) @@ -452,7 +458,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI // Fill style is set to solid, but no fill transparency is given. // On the other hand, we have a BackColorTransparency, so use that. aBrush.PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY); - sw::setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); + setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); } if(pXGradientStepCountItem) @@ -1737,14 +1743,14 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: if(RES_BACKGROUND == pEntry->nWID) { const SwAttrSet& rSet = pFmt->GetAttrSet(); - const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); SvxBrushItem aChangedBrushItem(aOriginalBrushItem); aChangedBrushItem.PutValue(aValue, nMemberId); if(!(aChangedBrushItem == aOriginalBrushItem)) { - sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet); + setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet); pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet ); } @@ -2225,7 +2231,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) if(RES_BACKGROUND == pEntry->nWID) { //UUUU - const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); if(!aOriginalBrushItem.QueryValue(aAny, nMemberId)) { @@ -2359,42 +2365,6 @@ beans::PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName ) return aStates.getConstArray()[0]; } -//UUUU -bool SwXFrame::needToMapFillItemsToSvxBrushItemTypes() const -{ - SwFrmFmt* pFmt = GetFrmFmt(); - - if(!pFmt) - { - return false; - } - - const SwAttrSet& rFmtSet = pFmt->GetAttrSet(); - const XFillStyleItem* pXFillStyleItem(static_cast< const XFillStyleItem* >(rFmtSet.GetItem(XATTR_FILLSTYLE, false))); - - if(!pXFillStyleItem) - { - return false; - } - - //UUUU here different FillStyles can be excluded for export; it will depend on the - // quality these fallbacks can reach. That again is done in sw::getSvxBrushItemFromSourceSet, - // take a look there how the superset of DrawObject FillStyles is mapped to SvxBrushItem. - // For now, take them all - except XFILL_NONE - - if(XFILL_NONE != pXFillStyleItem->GetValue()) - { - return true; - } - - //if(XFILL_SOLID == pXFillStyleItem->GetValue() || XFILL_BITMAP == pXFillStyleItem->GetValue()) - //{ - // return true; - //} - - return false; -} - uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates( const uno::Sequence< OUString >& aPropertyNames ) throw(beans::UnknownPropertyException, uno::RuntimeException, std::exception) @@ -2440,7 +2410,7 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates( // as beans::PropertyState_DIRECT_VALUE to let users of this property call // getPropertyValue where the member properties will be mapped from the // fill attributes to the according SvxBrushItem entries - else if(RES_BACKGROUND == pEntry->nWID && needToMapFillItemsToSvxBrushItemTypes()) + else if(RES_BACKGROUND == pEntry->nWID && SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(rFmtSet)) { pStates[i] = beans::PropertyState_DIRECT_VALUE; } @@ -2747,6 +2717,10 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange ); SfxItemSet aFrmSet(pDoc->GetAttrPool(), aFrmAttrRange ); + + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + aFrmSet.SetParent(&pDoc->GetDfltFrmFmt()->GetAttrSet()); + //jetzt muessen die passenden Items in den Set bool bSizeFound; if(!pProps->AnyToItemSet( pDoc, aFrmSet, aGrSet, bSizeFound)) diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 9464e49a9be0..2a3ad60a7619 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -639,6 +639,12 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s COMMON_TEXT_CONTENT_PROPERTIES { OUString(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, { OUString(UNO_NAME_CHAR_STYLE_NAMES), FN_UNO_CHARFMT_SEQUENCE, cppu::UnoType< cppu::UnoSequenceType<OUString> >::get(), PropertyAttribute::MAYBEVOID, 0}, + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to style import/export + //UUUU Added for paragraph backgrounds, this is for paragraph itself + FILL_PROPERTIES_SW { OUString(), 0, css::uno::Type(), 0, 0 } }; aMapEntriesArr[nPropertyId] = aParagraphMap_Impl; @@ -666,6 +672,12 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s TABSTOPS_MAP_ENTRY COMMON_TEXT_CONTENT_PROPERTIES { OUString(UNO_NAME_PARA_AUTO_STYLE_NAME), RES_AUTO_STYLE, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to style import/export + //UUUU Added for paragraph backgrounds, this is for Paragraph AutoStyles + FILL_PROPERTIES_SW { OUString(), 0, css::uno::Type(), 0, 0 } }; aMapEntriesArr[nPropertyId] = aAutoParaStyleMap; @@ -806,6 +818,12 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s static SfxItemPropertyMapEntry const aParaStyleMap [] = { COMMON_PARA_STYLE_PROPERTIES + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to style import/export + //UUUU Added for paragraph backgrounds, this is for Paragraph Styles + FILL_PROPERTIES_SW { OUString(), 0, css::uno::Type(), 0, 0 } }; aMapEntriesArr[nPropertyId] = aParaStyleMap; @@ -817,6 +835,14 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { COMMON_PARA_STYLE_PROPERTIES { OUString(UNO_NAME_PARA_STYLE_CONDITIONS), FN_UNO_PARA_STYLE_CONDITIONS, cppu::UnoType< cppu::UnoSequenceType<css::beans::NamedValue> >::get(), PropertyAttribute::MAYBEVOID, 0}, + + //UUUU added FillProperties for SW, same as FILL_PROPERTIES in svx + // but need own defines in Writer due to later association of strings + // and uno types (see loop at end of this method and definition of SW_PROP_NMID) + // This entry is for adding that properties to style import/export + //UUUU Added for paragraph backgrounds, this is for Paragraph Styles + FILL_PROPERTIES_SW + { OUString(), 0, css::uno::Type(), 0, 0 } }; aMapEntriesArr[nPropertyId] = aParaStyleMap; @@ -940,57 +966,62 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s { OUString(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, { OUString(UNO_NAME_SHADOW_TRANSPARENCE), RES_SHADOW, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_SHADOW_TRANSPARENCE}, - { OUString(UNO_NAME_HEADER_BACK_COLOR), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_BACK_COLOR }, - // { OUString(UNO_NAME_HEADER_GRAPHIC), FN_UNO_HEADER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC - { OUString(UNO_NAME_HEADER_GRAPHIC_URL), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, - { OUString(UNO_NAME_HEADER_GRAPHIC_FILTER), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, - { OUString(UNO_NAME_HEADER_GRAPHIC_LOCATION), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, - { OUString(UNO_NAME_HEADER_LEFT_MARGIN), FN_UNO_HEADER_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, - { OUString(UNO_NAME_HEADER_RIGHT_MARGIN), FN_UNO_HEADER_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, - { OUString(UNO_NAME_HEADER_BACK_TRANSPARENT), FN_UNO_HEADER_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, - { OUString(UNO_NAME_HEADER_LEFT_BORDER), FN_UNO_HEADER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, LEFT_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_RIGHT_BORDER), FN_UNO_HEADER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, RIGHT_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_TOP_BORDER), FN_UNO_HEADER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, TOP_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_BOTTOM_BORDER), FN_UNO_HEADER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, BOTTOM_BORDER|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_TOP_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), FN_UNO_HEADER_BOX, cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_SHADOW_FORMAT), FN_UNO_HEADER_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, - { OUString(UNO_NAME_HEADER_BODY_DISTANCE), FN_UNO_HEADER_BODY_DISTANCE,cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT), FN_UNO_HEADER_IS_DYNAMIC_DISTANCE,cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_HEADER_IS_SHARED), FN_UNO_HEADER_SHARE_CONTENT,cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_HEADER_HEIGHT), FN_UNO_HEADER_HEIGHT, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, - { OUString(UNO_NAME_HEADER_IS_ON), FN_UNO_HEADER_ON, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_HEADER_DYNAMIC_SPACING), FN_UNO_HEADER_EAT_SPACING, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID ,0 }, + //UUU use real WhichIDs for Header, no longer use extra-defined WhichIDs which make handling harder as needed. + // The implementation will decide if these are part of Header/Footer or PageStyle depending on the SlotName, + // more precisely on the first characters. Thus it is necessary that these are 'Header' for the Header slots + { OUString(UNO_NAME_HEADER_BACK_COLOR), RES_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_BACK_COLOR }, + // { OUString(UNO_NAME_HEADER_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC + { OUString(UNO_NAME_HEADER_GRAPHIC_URL), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, + { OUString(UNO_NAME_HEADER_GRAPHIC_FILTER), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, + { OUString(UNO_NAME_HEADER_GRAPHIC_LOCATION), RES_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, + { OUString(UNO_NAME_HEADER_LEFT_MARGIN), RES_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, + { OUString(UNO_NAME_HEADER_RIGHT_MARGIN), RES_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, + { OUString(UNO_NAME_HEADER_BACK_TRANSPARENT), RES_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, + { OUString(UNO_NAME_HEADER_LEFT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, LEFT_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_RIGHT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, RIGHT_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_TOP_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, TOP_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_BOTTOM_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, BOTTOM_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_TOP_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_SHADOW_FORMAT), RES_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, + { OUString(UNO_NAME_HEADER_BODY_DISTANCE), RES_UL_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT), SID_ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_HEADER_IS_SHARED), SID_ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_HEADER_HEIGHT), SID_ATTR_PAGE_SIZE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, + { OUString(UNO_NAME_HEADER_IS_ON), SID_ATTR_PAGE_ON, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_HEADER_DYNAMIC_SPACING), RES_HEADER_FOOTER_EAT_SPACING, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID ,0 }, + - { OUString(UNO_NAME_FIRST_IS_SHARED), FN_UNO_FIRST_SHARE_CONTENT,cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 }, + { OUString(UNO_NAME_FIRST_IS_SHARED), SID_ATTR_PAGE_SHARED_FIRST, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 }, - { OUString(UNO_NAME_FOOTER_BACK_COLOR), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_BACK_COLOR }, - // { OUString(UNO_NAME_FOOTER_GRAPHIC), FN_UNO_FOOTER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC - { OUString(UNO_NAME_FOOTER_GRAPHIC_URL), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, - { OUString(UNO_NAME_FOOTER_GRAPHIC_FILTER), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, - { OUString(UNO_NAME_FOOTER_GRAPHIC_LOCATION), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, - { OUString(UNO_NAME_FOOTER_LEFT_MARGIN), FN_UNO_FOOTER_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, - { OUString(UNO_NAME_FOOTER_RIGHT_MARGIN), FN_UNO_FOOTER_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, - { OUString(UNO_NAME_FOOTER_BACK_TRANSPARENT), FN_UNO_FOOTER_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, - { OUString(UNO_NAME_FOOTER_LEFT_BORDER), FN_UNO_FOOTER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, LEFT_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_RIGHT_BORDER), FN_UNO_FOOTER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, RIGHT_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_TOP_BORDER), FN_UNO_FOOTER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, TOP_BORDER |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_BOTTOM_BORDER), FN_UNO_FOOTER_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, BOTTOM_BORDER|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_SHADOW_FORMAT), FN_UNO_FOOTER_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, - { OUString(UNO_NAME_FOOTER_BODY_DISTANCE), FN_UNO_FOOTER_BODY_DISTANCE,cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT), FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE,cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_FOOTER_IS_SHARED), FN_UNO_FOOTER_SHARE_CONTENT,cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_FOOTER_HEIGHT), FN_UNO_FOOTER_HEIGHT, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, - { OUString(UNO_NAME_FOOTER_IS_ON), FN_UNO_FOOTER_ON, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, - { OUString(UNO_NAME_FOOTER_DYNAMIC_SPACING), FN_UNO_FOOTER_EAT_SPACING, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID ,0 }, + //UUU use real WhichIDs for Footer, see Header (above) for more infos + { OUString(UNO_NAME_FOOTER_BACK_COLOR), RES_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_BACK_COLOR }, + // { OUString(UNO_NAME_FOOTER_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC + { OUString(UNO_NAME_FOOTER_GRAPHIC_URL), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, + { OUString(UNO_NAME_FOOTER_GRAPHIC_FILTER), RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, + { OUString(UNO_NAME_FOOTER_GRAPHIC_LOCATION), RES_BACKGROUND, cppu::UnoType<css::style::GraphicLocation>::get(), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, + { OUString(UNO_NAME_FOOTER_LEFT_MARGIN), RES_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, + { OUString(UNO_NAME_FOOTER_RIGHT_MARGIN), RES_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, + { OUString(UNO_NAME_FOOTER_BACK_TRANSPARENT), RES_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, + { OUString(UNO_NAME_FOOTER_LEFT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, LEFT_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_RIGHT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, RIGHT_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_TOP_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, TOP_BORDER |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_BOTTOM_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, BOTTOM_BORDER|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_SHADOW_FORMAT), RES_SHADOW, cppu::UnoType<css::table::ShadowFormat>::get(), PROPERTY_NONE, CONVERT_TWIPS}, + { OUString(UNO_NAME_FOOTER_BODY_DISTANCE), RES_UL_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT), SID_ATTR_PAGE_DYNAMIC, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_FOOTER_IS_SHARED), SID_ATTR_PAGE_SHARED, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_FOOTER_HEIGHT), SID_ATTR_PAGE_SIZE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS }, + { OUString(UNO_NAME_FOOTER_IS_ON), SID_ATTR_PAGE_ON, cppu::UnoType<bool>::get(), PROPERTY_NONE ,0 }, + { OUString(UNO_NAME_FOOTER_DYNAMIC_SPACING), RES_HEADER_FOOTER_EAT_SPACING, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID ,0 }, { OUString(UNO_NAME_IS_LANDSCAPE), SID_ATTR_PAGE, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_PAGE_ORIENTATION }, { OUString(UNO_NAME_NUMBERING_TYPE), SID_ATTR_PAGE, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE , MID_PAGE_NUMTYPE }, diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index aa13240304f1..dc8d6363e80b 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -47,8 +47,17 @@ #include <comphelper/servicehelper.hxx> #include <boost/scoped_ptr.hpp> +//UUUU +#include <swunohelper.hxx> +#include <svx/unobrushitemhelper.hxx> +#include <editeng/unoipset.hxx> +#include <svx/xflbstit.hxx> +#include <svx/xflbmtit.hxx> +#include <com/sun/star/drawing/BitmapMode.hpp> + using namespace ::com::sun::star; + class SwParaSelection { SwCursor & m_rCursor; @@ -151,6 +160,13 @@ public: throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException); + //UUUU + void GetSinglePropertyValue_Impl( + const SfxItemPropertySimpleEntry& rEntry, + const SfxItemSet& rSet, + uno::Any& rAny ) const + throw(uno::RuntimeException); + uno::Sequence< beans::GetDirectPropertyTolerantResult > GetPropertyValuesTolerant_Impl( const uno::Sequence< OUString >& rPropertyNames, @@ -424,6 +440,98 @@ throw (beans::PropertyVetoException, lang::IllegalArgumentException, } } +//UUUU Support for DrawingLayer FillStyles for GetPropertyValue() usages +void SwXParagraph::Impl::GetSinglePropertyValue_Impl( + const SfxItemPropertySimpleEntry& rEntry, + const SfxItemSet& rSet, + uno::Any& rAny ) const +throw(uno::RuntimeException) +{ + bool bDone(false); + + switch(rEntry.nWID) + { + case RES_BACKGROUND: + { + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); + const sal_uInt8 nMemberId(rEntry.nMemberId & (~SFX_METRIC_ITEM)); + + if(!aOriginalBrushItem.QueryValue(rAny, nMemberId)) + { + OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)"); + } + + bDone = true; + break; + } + case OWN_ATTR_FILLBMP_MODE: + { + const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&rSet.Get(XATTR_FILLBMP_STRETCH)); + const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&rSet.Get(XATTR_FILLBMP_TILE)); + + if( pTileItem && pTileItem->GetValue() ) + { + rAny <<= drawing::BitmapMode_REPEAT; + } + else if( pStretchItem && pStretchItem->GetValue() ) + { + rAny <<= drawing::BitmapMode_STRETCH; + } + else + { + rAny <<= drawing::BitmapMode_NO_REPEAT; + } + + bDone = true; + break; + } + default: break; + } + + if(!bDone) + { + // fallback to standard get value implementation used before this helper was created + m_rPropSet.getPropertyValue(rEntry, rSet, rAny); + + if(rEntry.aType == ::getCppuType((const sal_Int16*)0) && rEntry.aType != rAny.getValueType()) + { + // since the sfx uInt16 item now exports a sal_Int32, we may have to fix this here + sal_Int32 nValue(0); + + rAny >>= nValue; + rAny <<= static_cast< sal_Int16 >(nValue); + } + + //UUUU check for needed metric translation + if(rEntry.nMemberId & SFX_METRIC_ITEM) + { + bool bDoIt(true); + + if(XATTR_FILLBMP_SIZEX == rEntry.nWID || XATTR_FILLBMP_SIZEY == rEntry.nWID) + { + // exception: If these ItemTypes are used, do not convert when these are negative + // since this means they are intended as percent values + sal_Int32 nValue = 0; + + if(rAny >>= nValue) + { + bDoIt = nValue > 0; + } + } + + if(bDoIt) + { + const SfxMapUnit eMapUnit(rSet.GetPool()->GetMetric(rEntry.nWID)); + + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + SvxUnoConvertToMM(eMapUnit, rAny); + } + } + } + } +} + uno::Sequence< uno::Any > SwXParagraph::Impl::GetPropertyValues_Impl( const uno::Sequence< OUString > & rPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, @@ -456,8 +564,8 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, *pEntry, aPam, &(pValues[nProp]), eTemp, &rTxtNode ); if (!bDone) { - m_rPropSet.getPropertyValue( - *pEntry, rAttrSet, pValues[nProp]); + //UUUU + GetSinglePropertyValue_Impl(*pEntry, rAttrSet, pValues[nProp]); } } } @@ -717,8 +825,8 @@ throw (uno::RuntimeException) // if not found try the real paragraph attributes... if (!bDone) { - m_rPropSet.getPropertyValue( - *pEntry, rValueAttrSet, aValue ); + //UUUU + GetSinglePropertyValue_Impl(*pEntry, rValueAttrSet, aValue); } } @@ -832,61 +940,108 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, } static beans::PropertyState lcl_SwXParagraph_getPropertyState( -// SwUnoCrsr& rUnoCrsr, - const SwTxtNode& rTxtNode, - const SwAttrSet** ppSet, - const SfxItemPropertySimpleEntry& rEntry, - bool &rAttrSetFetched ) + // SwUnoCrsr& rUnoCrsr, + const SwTxtNode& rTxtNode, + const SwAttrSet** ppSet, + const SfxItemPropertySimpleEntry& rEntry, + bool &rAttrSetFetched) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { - beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE; + beans::PropertyState eRet(beans::PropertyState_DEFAULT_VALUE); - if(!(*ppSet) && !rAttrSetFetched ) + if(!(*ppSet) && !rAttrSetFetched) { (*ppSet) = rTxtNode.GetpSwAttrSet(); rAttrSetFetched = true; } - SwPosition aPos( rTxtNode ); - SwPaM aPam( aPos ); - switch( rEntry.nWID ) + + SwPosition aPos(rTxtNode); + SwPaM aPam(aPos); + bool bDone(false); + + switch(rEntry.nWID) { - case FN_UNO_NUM_RULES: - // if numbering is set, return it; else do nothing - SwUnoCursorHelper::getNumberingProperty( aPam, eRet, NULL ); - break; - case FN_UNO_ANCHOR_TYPES: - break; - case RES_ANCHOR: - if ( MID_SURROUND_SURROUNDTYPE != rEntry.nMemberId ) - goto lcl_SwXParagraph_getPropertyStateDEFAULT; - break; - case RES_SURROUND: - if ( MID_ANCHOR_ANCHORTYPE != rEntry.nMemberId ) - goto lcl_SwXParagraph_getPropertyStateDEFAULT; - break; - case FN_UNO_PARA_STYLE: - case FN_UNO_PARA_CONDITIONAL_STYLE_NAME: + case FN_UNO_NUM_RULES: { - SwFmtColl* pFmt = SwUnoCursorHelper::GetCurTxtFmtColl( - aPam, rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME); - eRet = pFmt ? beans::PropertyState_DIRECT_VALUE - : beans::PropertyState_AMBIGUOUS_VALUE; + // if numbering is set, return it; else do nothing + SwUnoCursorHelper::getNumberingProperty(aPam,eRet,NULL); + bDone = true; + break; } - break; - case FN_UNO_PAGE_STYLE: + case FN_UNO_ANCHOR_TYPES: + { + bDone = true; + break; + } + case RES_ANCHOR: + { + bDone = (MID_SURROUND_SURROUNDTYPE == rEntry.nMemberId); + break; + } + case RES_SURROUND: + { + bDone = (MID_ANCHOR_ANCHORTYPE == rEntry.nMemberId); + break; + } + case FN_UNO_PARA_STYLE: + case FN_UNO_PARA_CONDITIONAL_STYLE_NAME: + { + SwFmtColl* pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(aPam,rEntry.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME); + eRet = pFmt ? beans::PropertyState_DIRECT_VALUE : beans::PropertyState_AMBIGUOUS_VALUE; + bDone = true; + break; + } + case FN_UNO_PAGE_STYLE: { OUString sVal; SwUnoCursorHelper::GetCurPageStyle( aPam, sVal ); eRet = !sVal.isEmpty() ? beans::PropertyState_DIRECT_VALUE : beans::PropertyState_AMBIGUOUS_VALUE; + bDone = true; + break; } - break; - lcl_SwXParagraph_getPropertyStateDEFAULT: - default: + + //UUUU DrawingLayer PropertyStyle support + case OWN_ATTR_FILLBMP_MODE: + { + if(*ppSet) + { + if(SFX_ITEM_SET == (*ppSet)->GetItemState(XATTR_FILLBMP_STRETCH, false) + || SFX_ITEM_SET == (*ppSet)->GetItemState(XATTR_FILLBMP_TILE, false)) + { + eRet = beans::PropertyState_DIRECT_VALUE; + } + else + { + eRet = beans::PropertyState_AMBIGUOUS_VALUE; + } + + bDone = true; + } + break; + } + case RES_BACKGROUND: + { + if(*ppSet) + { + if(SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(**ppSet)) + { + eRet = beans::PropertyState_DIRECT_VALUE; + bDone = true; + } + } + break; + } + } + + if(!bDone) + { if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rEntry.nWID, false)) + { eRet = beans::PropertyState_DIRECT_VALUE; - break; + } } + return eRet; } @@ -990,10 +1145,24 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) static_cast<cppu::OWeakObject *>(this)); } - if (pEntry->nWID < RES_FRMATR_END) + const bool bBelowFrmAtrEnd(pEntry->nWID < RES_FRMATR_END); + const bool bDrawingLayerRange(XATTR_FILL_FIRST <= pEntry->nWID && XATTR_FILL_LAST >= pEntry->nWID); + + if(bBelowFrmAtrEnd || bDrawingLayerRange) { std::set<sal_uInt16> aWhichIds; - aWhichIds.insert( pEntry->nWID ); + + //UUUU For FillBitmapMode two IDs have to be reset (!) + if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID) + { + aWhichIds.insert(XATTR_FILLBMP_STRETCH); + aWhichIds.insert(XATTR_FILLBMP_TILE); + } + else + { + aWhichIds.insert(pEntry->nWID); + } + if (pEntry->nWID < RES_PARATR_BEGIN) { aCursor.GetDoc()->ResetAttrs(aCursor, true, aWhichIds); @@ -1010,14 +1179,19 @@ throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { pTemp->MovePara(fnParaCurr, fnParaStart); } + pTemp->SetMark(); *pTemp->GetPoint() = aEnd; //pTemp->Exchange(); + SwUnoCursorHelper::SelectPam(*pTemp, true); + if (!SwUnoCursorHelper::IsEndOfPara(*pTemp)) { pTemp->MovePara(fnParaCurr, fnParaEnd); } + + pTemp->GetDoc()->ResetAttrs(*pTemp, true, aWhichIds); } } @@ -1051,10 +1225,13 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException, static_cast<cppu::OWeakObject *>(this)); } - if (pEntry->nWID < RES_FRMATR_END) + const bool bBelowFrmAtrEnd(pEntry->nWID < RES_FRMATR_END); + const bool bDrawingLayerRange(XATTR_FILL_FIRST <= pEntry->nWID && XATTR_FILL_LAST >= pEntry->nWID); + + if(bBelowFrmAtrEnd || bDrawingLayerRange) { - const SfxPoolItem& rDefItem = - rTxtNode.GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID); + const SfxPoolItem& rDefItem = rTxtNode.GetDoc()->GetAttrPool().GetDefaultItem(pEntry->nWID); + rDefItem.QueryValue(aRet, pEntry->nMemberId); } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 49ede1a22d4e..cfbef1ff9a29 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -73,12 +73,14 @@ #include <comphelper/sequenceasvector.hxx> //UUUU -#include <unobrushitemhelper.hxx> +#include <svx/unobrushitemhelper.hxx> #include <editeng/unoipset.hxx> #include <editeng/memberids.hrc> #include <svx/unoshape.hxx> #include <svx/xflbstit.hxx> #include <svx/xflbmtit.hxx> +#include <swunohelper.hxx> +#include <svx/xbtmpit.hxx> #include <boost/shared_ptr.hpp> @@ -89,13 +91,6 @@ #include <set> #define STYLE_FAMILY_COUNT 5 // we have 5 style families -#define TYPE_BOOL 0 -#define TYPE_SIZE 1 -#define TYPE_BRUSH 2 -#define TYPE_ULSPACE 3 -#define TYPE_SHADOW 4 -#define TYPE_LRSPACE 5 -#define TYPE_BOX 6 const sal_uInt16 aStyleByIndex[] = { @@ -117,49 +112,6 @@ const IStyleAccess::SwAutoStyleFamily aAutoStyleByIndex[] = using namespace ::com::sun::star; -//convert FN_... to RES_ in header and footer itemset -static sal_uInt16 lcl_ConvertFNToRES(sal_uInt16 nFNId) -{ - sal_uInt16 nRes = USHRT_MAX; - switch(nFNId) - { - case FN_UNO_FOOTER_ON: - case FN_UNO_HEADER_ON: - break; - case FN_UNO_FOOTER_BACKGROUND: - case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; - break; - case FN_UNO_FOOTER_BOX: - case FN_UNO_HEADER_BOX: nRes = RES_BOX; - break; - case FN_UNO_FOOTER_LR_SPACE: - case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE; - break; - case FN_UNO_FOOTER_SHADOW: - case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW; - break; - case FN_UNO_FOOTER_BODY_DISTANCE: - case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE; - break; - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC; - break; - case FN_UNO_FOOTER_SHARE_CONTENT: - case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED; - break; - case FN_UNO_FIRST_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED_FIRST; - break; - case FN_UNO_FOOTER_HEIGHT: - case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE; - break; - case FN_UNO_FOOTER_EAT_SPACING: - case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING; - break; - } - return nRes; - -} - static SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum ( SfxStyleFamily eFamily ) { switch ( eFamily ) @@ -1578,66 +1530,100 @@ void SwXStyle::ApplyDescriptorProperties() } } -struct SwStyleBase_Impl +class SwStyleBase_Impl { - SwDoc& rDoc; +private: + SwDoc& mrDoc; + const SwPageDesc* mpOldPageDesc; + rtl::Reference< SwDocStyleSheet > mxNewBase; + SfxItemSet* mpItemSet; + OUString mrStyleName; + const SwAttrSet* mpParentStyle; + +public: + SwStyleBase_Impl(SwDoc& rSwDoc, const OUString& rName, const SwAttrSet* pParentStyle) + : mrDoc(rSwDoc) + , mpOldPageDesc(0) + , mpItemSet(0) + , mrStyleName(rName) + , mpParentStyle(pParentStyle) + { + } - const SwPageDesc* pOldPageDesc; + ~SwStyleBase_Impl() + { + delete mpItemSet; + } - rtl::Reference< SwDocStyleSheet > mxNewBase; - SfxItemSet* pItemSet; + rtl::Reference< SwDocStyleSheet >& getNewBase() + { + return mxNewBase; + } - OUString rStyleName; + void setNewBase(SwDocStyleSheet* pNew) + { + mxNewBase = pNew; + } - SwStyleBase_Impl(SwDoc& rSwDoc, const OUString& rName) : - rDoc(rSwDoc), - pOldPageDesc(0), - pItemSet(0), - rStyleName(rName) - {} + bool HasItemSet() const + { + return mxNewBase.is(); + } - ~SwStyleBase_Impl(){ delete pItemSet; } + SfxItemSet* replaceItemSet(SfxItemSet* pNew) + { + SfxItemSet* pRetval = mpItemSet; + mpItemSet = pNew; + return pRetval; + } - bool HasItemSet() {return mxNewBase.is();} SfxItemSet& GetItemSet() + { + OSL_ENSURE(mxNewBase.is(), "no SwDocStyleSheet available"); + if (!mpItemSet) { - OSL_ENSURE(mxNewBase.is(), "no SwDocStyleSheet available"); - if(!pItemSet) - pItemSet = new SfxItemSet(mxNewBase->GetItemSet()); - return *pItemSet; + mpItemSet = new SfxItemSet(mxNewBase->GetItemSet()); + + //UUUU set parent style to have the correct XFillStyle setting as XFILL_NONE + if(!mpItemSet->GetParent() && mpParentStyle) + { + mpItemSet->SetParent(mpParentStyle); + } } + return *mpItemSet; + } - const SwPageDesc& GetOldPageDesc(); + const SwPageDesc& GetOldPageDesc(); }; const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc() { - if(!pOldPageDesc) + if(!mpOldPageDesc) { - const sal_uInt16 nPDescCount = rDoc.GetPageDescCnt(); + const sal_uInt16 nPDescCount = mrDoc.GetPageDescCnt(); for(sal_uInt16 i = 0; i < nPDescCount; ++i) { - const SwPageDesc& rDesc = rDoc.GetPageDesc( i ); - if(rDesc.GetName() == rStyleName) + const SwPageDesc& rDesc = mrDoc.GetPageDesc( i ); + if(rDesc.GetName() == mrStyleName) { - pOldPageDesc = & rDesc; + mpOldPageDesc = & rDesc; break; } } - if(!pOldPageDesc) + if(!mpOldPageDesc) { for(sal_uInt16 i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_LANDSCAPE; ++i) { - if(SW_RESSTR(i) == rStyleName) + if(SW_RESSTR(i) == mrStyleName) { - pOldPageDesc = rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) ); + mpOldPageDesc = mrDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) ); break; } } } } - assert(pOldPageDesc != 0); - return *pOldPageDesc; + assert(mpOldPageDesc != 0); + return *mpOldPageDesc; } static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, @@ -1696,31 +1682,31 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, if ( rValue >>= bHidden ) { //make it a 'real' style - necessary for pooled styles - rBase.mxNewBase->GetItemSet(); - rBase.mxNewBase->SetHidden( bHidden ); + rBase.getNewBase()->GetItemSet(); + rBase.getNewBase()->SetHidden( bHidden ); } } break; case FN_UNO_STYLE_INTEROP_GRAB_BAG: { - rBase.mxNewBase->GetItemSet(); - rBase.mxNewBase->SetGrabBagItem(rValue); + rBase.getNewBase()->GetItemSet(); + rBase.getNewBase()->SetGrabBagItem(rValue); } break; - case XATTR_FILLBITMAP: case XATTR_FILLGRADIENT: case XATTR_FILLHATCH: + case XATTR_FILLBITMAP: case XATTR_FILLFLOATTRANSPARENCE: // not yet needed; activate when LineStyle support may be added // case XATTR_LINESTART: // case XATTR_LINEEND: // case XATTR_LINEDASH: { - //UUUU add set commands for FillName items if(MID_NAME == nMemberId) { + //UUUU add set commands for FillName items OUString aTempName; SfxItemSet& rStyleSet = rBase.GetItemSet(); @@ -1732,28 +1718,35 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, SvxShape::SetFillAttribute(rEntry.nWID, aTempName, rStyleSet); bDone = true; } + else if(MID_GRAFURL == nMemberId) + { + if(XATTR_FILLBITMAP == rEntry.nWID) + { + //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used + const Graphic aNullGraphic; + SfxItemSet& rStyleSet = rBase.GetItemSet(); + XFillBitmapItem aXFillBitmapItem(rStyleSet.GetPool(), aNullGraphic); + + aXFillBitmapItem.PutValue(aValue, nMemberId); + rStyleSet.Put(aXFillBitmapItem); + bDone = true; + } + } break; } case RES_BACKGROUND: { - //UUUU No new FillStyle for PageBackground; need to remove again when we want - // to support that, too. Add a break to *not* set bDone to true - if(SFX_STYLE_FAMILY_PAGE == eFamily) - { - break; - } - //UUUU SfxItemSet& rStyleSet = rBase.GetItemSet(); - const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rStyleSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rStyleSet, RES_BACKGROUND)); SvxBrushItem aChangedBrushItem(aOriginalBrushItem); aChangedBrushItem.PutValue(aValue, nMemberId); if(!(aChangedBrushItem == aOriginalBrushItem)) { - sw::setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet); + setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, rStyleSet); } bDone = true; @@ -1893,7 +1886,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, aSetRule.Set( i, &aFmt ); } } - rBase.mxNewBase->SetNumRule(aSetRule); + rBase.getNewBase()->SetNumRule(aSetRule); } } else @@ -1908,7 +1901,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, sal_Int16 nLevel = 0; aValue >>= nLevel; if( 0 <= nLevel && nLevel <= MAXLEVEL) - rBase.mxNewBase->GetCollection()->SetAttrOutlineLevel( nLevel ); + rBase.getNewBase()->GetCollection()->SetAttrOutlineLevel( nLevel ); bDone = true; break; @@ -1920,7 +1913,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, aValue >>= sTmp; OUString aString; SwStyleNameMapper::FillUIName(sTmp, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true ) ; - rBase.mxNewBase->SetFollow( aString ); + rBase.getNewBase()->SetFollow( aString ); bDone = true; break; @@ -1979,9 +1972,9 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, { bool bAuto = *(sal_Bool*)aValue.getValue(); if(SFX_STYLE_FAMILY_PARA == eFamily) - rBase.mxNewBase->GetCollection()->SetAutoUpdateFmt(bAuto); + rBase.getNewBase()->GetCollection()->SetAutoUpdateFmt(bAuto); else if(SFX_STYLE_FAMILY_FRAME == eFamily) - rBase.mxNewBase->GetFrmFmt()->SetAutoUpdateFmt(bAuto); + rBase.getNewBase()->GetFrmFmt()->SetAutoUpdateFmt(bAuto); bDone = true; break; @@ -2042,7 +2035,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_CATEGORY: { - if(!rBase.mxNewBase->IsUserDefined()) + if(!rBase.getNewBase()->IsUserDefined()) throw lang::IllegalArgumentException(); short nSet = 0; aValue >>= nSet; @@ -2071,7 +2064,7 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, default: throw lang::IllegalArgumentException(); } - rBase.mxNewBase->SetMask( nId|SFXSTYLEBIT_USERDEF ); + rBase.getNewBase()->SetMask( nId|SFXSTYLEBIT_USERDEF ); bDone = true; break; } @@ -2173,16 +2166,16 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, // --> OD 2006-10-18 #i70223# if ( SFX_STYLE_FAMILY_PARA == eFamily && rEntry.nWID == RES_PARATR_NUMRULE && - rBase.mxNewBase.is() && rBase.mxNewBase->GetCollection() && - //rBase.mxNewBase->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei - rBase.mxNewBase->GetCollection()->IsAssignedToListLevelOfOutlineStyle() ) ////<-end,add by zhaojianwei + rBase.getNewBase().is() && rBase.getNewBase()->GetCollection() && + //rBase.getNewBase()->GetCollection()->GetOutlineLevel() < MAXLEVEL /* assigned to list level of outline style */) //#outline level,removed by zhaojianwei + rBase.getNewBase()->GetCollection()->IsAssignedToListLevelOfOutlineStyle() ) ////<-end,add by zhaojianwei { OUString sNewNumberingRuleName; aValue >>= sNewNumberingRuleName; if ( sNewNumberingRuleName.isEmpty() || sNewNumberingRuleName != pDoc->GetOutlineNumRule()->GetName() ) { - rBase.mxNewBase->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); + rBase.getNewBase()->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); } } } @@ -2197,26 +2190,29 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl( { if ( !m_pDoc ) throw uno::RuntimeException(); + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; + switch(eFamily) { case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ;break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); if(rPropertyNames.getLength() != rValues.getLength()) + { throw lang::IllegalArgumentException(); + } const OUString* pNames = rPropertyNames.getConstArray(); const uno::Any* pValues = rValues.getConstArray(); - SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName); + SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName, &GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); //UUUU add pDfltTxtFmtColl as parent if(pBasePool) { const sal_uInt16 nSaveMask = pBasePool->GetSearchMask(); @@ -2225,35 +2221,41 @@ void SAL_CALL SwXStyle::SetPropertyValues_Impl( pBasePool->SetSearchMask(eFamily, nSaveMask ); OSL_ENSURE(pBase, "where is the style?" ); if(pBase) - aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase); + aBaseImpl.setNewBase(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase)); else throw uno::RuntimeException(); } for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp]); + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(pNames[nProp]); if(!pEntry || (!bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS)) throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if(aBaseImpl.mxNewBase.is()) + if(aBaseImpl.getNewBase().is()) { - lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, - pBasePool, m_pDoc, eFamily); + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, pBasePool, m_pDoc, eFamily); } else if(bIsDescriptor) { if(!pPropImpl->SetProperty(pNames[nProp], pValues[nProp])) + { throw lang::IllegalArgumentException(); + } } else + { throw uno::RuntimeException(); + } } + if(aBaseImpl.HasItemSet()) - aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet()); + { + aBaseImpl.getNewBase()->SetItemSet(aBaseImpl.GetItemSet()); + } } void SwXStyle::setPropertyValues( @@ -2322,9 +2324,9 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } else if(pBase) { - if(!rBase.mxNewBase.is()) + if(!rBase.getNewBase().is()) { - rBase.mxNewBase = new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ); + rBase.setNewBase(new SwDocStyleSheet( *(SwDocStyleSheet*)pBase )); } //UUUU @@ -2358,7 +2360,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_NUM_RULES: //Sonderbehandlung fuer das SvxNumRuleItem: { - const SwNumRule* pRule = rBase.mxNewBase->GetNumRule(); + const SwNumRule* pRule = rBase.getNewBase()->GetNumRule(); OSL_ENSURE(pRule, "Wo ist die NumRule?"); uno::Reference< container::XIndexReplace > xRules = new SwXNumberingRules(*pRule, pDoc); @@ -2370,7 +2372,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, case RES_PARATR_OUTLINELEVEL: { OSL_ENSURE( SFX_STYLE_FAMILY_PARA == eFamily, "only paras" ); - int nLevel = rBase.mxNewBase->GetCollection()->GetAttrOutlineLevel(); + int nLevel = rBase.getNewBase()->GetCollection()->GetAttrOutlineLevel(); aRet <<= static_cast<sal_Int16>( nLevel ); bDone = true; break; @@ -2378,7 +2380,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, case FN_UNO_FOLLOW_STYLE: { OUString aString; - SwStyleNameMapper::FillProgName(rBase.mxNewBase->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true); + SwStyleNameMapper::FillProgName(rBase.getNewBase()->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true); aRet <<= aString; bDone = true; break; @@ -2407,9 +2409,9 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, { sal_Bool bAuto = sal_False; if(SFX_STYLE_FAMILY_PARA == eFamily) - bAuto = rBase.mxNewBase->GetCollection()->IsAutoUpdateFmt(); + bAuto = rBase.getNewBase()->GetCollection()->IsAutoUpdateFmt(); else if(SFX_STYLE_FAMILY_FRAME == eFamily) - bAuto = rBase.mxNewBase->GetFrmFmt()->IsAutoUpdateFmt(); + bAuto = rBase.getNewBase()->GetFrmFmt()->IsAutoUpdateFmt(); aRet.setValue(&bAuto, ::getBooleanCppuType()); bDone = true; @@ -2417,7 +2419,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_DISPLAY_NAME: { - aRet <<= rBase.mxNewBase->GetDisplayName(); + aRet <<= rBase.getNewBase()->GetDisplayName(); bDone = true; break; @@ -2456,7 +2458,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case FN_UNO_CATEGORY: { - const sal_uInt16 nPoolId = rBase.mxNewBase->GetCollection()->GetPoolFmtId(); + const sal_uInt16 nPoolId = rBase.getNewBase()->GetCollection()->GetPoolFmtId(); short nRet = -1; switch ( COLL_GET_RANGE_BITS & nPoolId ) @@ -2487,7 +2489,7 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case SID_SWREGISTER_COLLECTION: { - const SwPageDesc *pPageDesc = rBase.mxNewBase->GetPageDesc(); + const SwPageDesc *pPageDesc = rBase.getNewBase()->GetPageDesc(); const SwTxtFmtColl* pCol = 0; OUString aString; if( pPageDesc ) @@ -2501,16 +2503,9 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } case RES_BACKGROUND: { - //UUUU No new FillStyle for PageBackground; need to remove again when we want - // to support that, too. Add a break to *not* set bDone to true - if(SFX_STYLE_FAMILY_PAGE == eFamily) - { - break; - } - //UUUU const SfxItemSet& rSet = rBase.GetItemSet(); - const SvxBrushItem aOriginalBrushItem(sw::getSvxBrushItemFromSourceSet(rSet)); + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(rSet, RES_BACKGROUND)); if(!aOriginalBrushItem.QueryValue(aRet, nMemberId)) { @@ -2608,30 +2603,33 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( { if ( !m_pDoc ) throw uno::RuntimeException(); + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; + switch(eFamily) { case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE ;break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break; - default: - ; + default: ; } + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); - const OUString* pNames = rPropertyNames.getConstArray(); uno::Sequence< uno::Any > aRet(rPropertyNames.getLength()); uno::Any* pRet = aRet.getArray(); - SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName); + SwStyleBase_Impl aBase(*m_pDoc, m_sStyleName, &GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); //UUUU add pDfltTxtFmtColl as parent SfxStyleSheetBase* pBase = 0; + for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp]); if(!pEntry || (!bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS)) throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + if(pBasePool) { if(!pBase) @@ -2641,6 +2639,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::GetPropertyValues_Impl( pBase = pBasePool->Find(m_sStyleName); pBasePool->SetSearchMask(eFamily, nSaveMask ); } + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, eFamily, GetDoc() ); } else if(bIsDescriptor) @@ -2750,6 +2749,7 @@ void SwXStyle::setPropertyValue(const OUString& rPropertyName, const uno::Any& r SolarMutexGuard aGuard; const uno::Sequence<OUString> aProperties(&rPropertyName, 1); const uno::Sequence<uno::Any> aValues(&rValue, 1); + SetPropertyValues_Impl( aProperties, aValues ); } @@ -2794,7 +2794,6 @@ beans::PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName) throw( beans::UnknownPropertyException, uno::RuntimeException, std::exception ) { SolarMutexGuard aGuard; - uno::Sequence< OUString > aNames(1); OUString* pNames = aNames.getArray(); pNames[0] = rPropertyName; @@ -2809,6 +2808,7 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( SolarMutexGuard aGuard; uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength()); beans::PropertyState* pStates = aRet.getArray(); + if(pBasePool) { pBasePool->SetSearchMask(eFamily ); @@ -2820,61 +2820,105 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( const OUString* pNames = rPropertyNames.getConstArray(); rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; + switch(eFamily) { case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE ;break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE ;break; - default: - ; + default: ; } + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); + const SfxItemSet& rSet = xStyle->GetItemSet(); - SfxItemSet aSet = xStyle->GetItemSet(); for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) { const OUString sPropName = pNames[i]; const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName); + bool bDone(false); + if(!pEntry) + { throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) ); - if( FN_UNO_NUM_RULES == pEntry->nWID || - FN_UNO_FOLLOW_STYLE == pEntry->nWID ) + } + + if( FN_UNO_NUM_RULES == pEntry->nWID || FN_UNO_FOLLOW_STYLE == pEntry->nWID ) { + // handle NumRules first, done pStates[i] = beans::PropertyState_DIRECT_VALUE; + bDone = true; } - else if(SFX_STYLE_FAMILY_PAGE == eFamily && - (sPropName.startsWith("Header") || sPropName.startsWith("Footer"))) + + // allow to retarget the SfxItemSet working on, default correctly. Only + // use pSourceSet below this point (except in header/footer processing) + const SfxItemSet* pSourceSet = &rSet; + + if(!bDone) { - const sal_uInt16 nResId = lcl_ConvertFNToRES(pEntry->nWID); - bool bFooter = sPropName.startsWith("Footer"); - const SvxSetItem* pSetItem; - if(SFX_ITEM_SET == aSet.GetItemState( - bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - false, (const SfxPoolItem**)&pSetItem)) + // check for Header/Footer entry + const bool bHeader(SFX_STYLE_FAMILY_PAGE == eFamily && sPropName.startsWith("Header")); + const bool bFooter(SFX_STYLE_FAMILY_PAGE == eFamily && sPropName.startsWith("Footer")); + + if(bHeader || bFooter) { - const SfxItemSet& rSet = pSetItem->GetItemSet(); - SfxItemState eState = rSet.GetItemState(nResId, false); - if(SFX_ITEM_SET == eState) - pStates[i] = beans::PropertyState_DIRECT_VALUE; + const SvxSetItem* pSetItem; + + if(SFX_ITEM_SET == rSet.GetItemState( + bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, + false, + (const SfxPoolItem**)&pSetItem)) + { + // retarget the SfxItemSet to the HeaderFooter SfxSetItem's SfxItenSet + pSourceSet = &pSetItem->GetItemSet(); + } else - pStates[i] = beans::PropertyState_DEFAULT_VALUE; + { + // if no SetItem, value is ambigous and we are done + pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE; + bDone = true; + } + } + } + + if(!bDone && OWN_ATTR_FILLBMP_MODE == pEntry->nWID) + { + //UUUU + if(SFX_ITEM_SET == pSourceSet->GetItemState(XATTR_FILLBMP_STRETCH, false) + || SFX_ITEM_SET == pSourceSet->GetItemState(XATTR_FILLBMP_TILE, false)) + { + pStates[i] = beans::PropertyState_DIRECT_VALUE; } else + { pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE; + } + + bDone = true; } - else + + //UUUU for FlyFrames we need to mark all properties from type RES_BACKGROUND + // as beans::PropertyState_DIRECT_VALUE to let users of this property call + // getPropertyValue where the member properties will be mapped from the + // fill attributes to the according SvxBrushItem entries + if(!bDone && RES_BACKGROUND == pEntry->nWID + && SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(*pSourceSet)) + { + pStates[i] = beans::PropertyState_DIRECT_VALUE; + bDone = true; + } + + if(!bDone) { - pStates[i] = pPropSet->getPropertyState(*pEntry, aSet); - if( SFX_STYLE_FAMILY_PAGE == eFamily && - SID_ATTR_PAGE_SIZE == pEntry->nWID && - beans::PropertyState_DIRECT_VALUE == pStates[i] ) + pStates[i] = pPropSet->getPropertyState(*pEntry, *pSourceSet); + + if(SFX_STYLE_FAMILY_PAGE == eFamily && SID_ATTR_PAGE_SIZE == pEntry->nWID && beans::PropertyState_DIRECT_VALUE == pStates[i]) { - const SvxSizeItem& rSize = - static_cast < const SvxSizeItem& >( - aSet.Get(SID_ATTR_PAGE_SIZE) ); + const SvxSizeItem& rSize = static_cast <const SvxSizeItem&>( rSet.Get(SID_ATTR_PAGE_SIZE)); sal_uInt8 nMemberId = pEntry->nMemberId & 0x7f; + if( ( LONG_MAX == rSize.GetSize().Width() && (MID_SIZE_WIDTH == nMemberId || MID_SIZE_SIZE == nMemberId ) ) || @@ -2888,10 +2932,15 @@ uno::Sequence< beans::PropertyState > SwXStyle::getPropertyStates( } } else + { throw uno::RuntimeException(); + } } else + { throw uno::RuntimeException(); + } + return aRet; } @@ -2919,60 +2968,97 @@ void SAL_CALL SwXStyle::setPropertiesToDefault( const uno::Sequence< OUString >& rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); switch(eFamily) { - case SFX_STYLE_FAMILY_CHAR: pTargetFmt = xStyle->GetCharFmt(); break; - case SFX_STYLE_FAMILY_PARA: pTargetFmt = xStyle->GetCollection(); break; - case SFX_STYLE_FAMILY_FRAME: pTargetFmt = xStyle->GetFrmFmt(); break; + case SFX_STYLE_FAMILY_CHAR: + pTargetFmt = xStyle->GetCharFmt(); + break; + + case SFX_STYLE_FAMILY_PARA: + pTargetFmt = xStyle->GetCollection(); + break; + + case SFX_STYLE_FAMILY_FRAME: + pTargetFmt = xStyle->GetFrmFmt(); + break; + case SFX_STYLE_FAMILY_PAGE: - { - SwPageDesc *pDesc = m_pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName()); - if( pDesc ) - pTargetFmt = &pDesc->GetMaster(); - } + { + SwPageDesc *pDesc = m_pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName()); + if( pDesc ) + pTargetFmt = &pDesc->GetMaster(); break; + } case SFX_STYLE_FAMILY_PSEUDO: break; - default: - ; + default: ; } } } + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; + switch(eFamily) { case SFX_STYLE_FAMILY_PARA : nPropSetId = bIsConditional ? PROPERTY_MAP_CONDITIONAL_PARA_STYLE : PROPERTY_MAP_PARA_STYLE; break; case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break; - default: - ; + default: ; } + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); - const OUString* pNames = aPropertyNames.getConstArray(); - if ( pTargetFmt ) + if(pTargetFmt) { - for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ ) + for(sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] ); + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(pNames[nProp]); + if( !pEntry ) + { throw beans::UnknownPropertyException ( "Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + } + if ( pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_NUM_RULES ) + { throw uno::RuntimeException ("Cannot reset: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); - if ( pEntry->nFlags & beans::PropertyAttribute::READONLY ) + } + + if (pEntry->nFlags & beans::PropertyAttribute::READONLY) + { throw uno::RuntimeException("setPropertiesToDefault: property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + } if( pEntry->nWID == RES_PARATR_OUTLINELEVEL ) + { static_cast<SwTxtFmtColl*>(pTargetFmt)->DeleteAssignmentToListLevelOfOutlineStyle(); + } else + { pTargetFmt->ResetFmtAttr( pEntry->nWID ); + } + + if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID) + { + //UUUU + SwDoc* pDoc = pTargetFmt->GetDoc(); + SfxItemSet aSet(pDoc->GetAttrPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + aSet.SetParent(&pTargetFmt->GetAttrSet()); + + aSet.ClearItem(XATTR_FILLBMP_STRETCH); + aSet.ClearItem(XATTR_FILLBMP_TILE); + + pTargetFmt->SetFmtAttr(aSet); + } } } - else if ( bIsDescriptor ) + else if(bIsDescriptor) { - for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ ) - pPropImpl->ClearProperty ( pNames[ nProp ] ); + for(sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++) + { + pPropImpl->ClearProperty(pNames[nProp]); + } } } @@ -2980,6 +3066,7 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault( ) throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; + if(pBasePool) { pBasePool->SetSearchMask(eFamily); @@ -2989,98 +3076,116 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault( ) if(pBase) { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); - SwFmt *pTargetFmt = 0; sal_uInt16 nPgDscPos = USHRT_MAX; - switch( eFamily ) + switch(eFamily) { - case SFX_STYLE_FAMILY_CHAR : - pTargetFmt = xStyle->GetCharFmt(); - break; - case SFX_STYLE_FAMILY_PARA : + case SFX_STYLE_FAMILY_CHAR: + pTargetFmt = xStyle->GetCharFmt(); + break; + + case SFX_STYLE_FAMILY_PARA: { pTargetFmt = xStyle->GetCollection(); - if ( xStyle->GetCollection() ) + if(xStyle->GetCollection()) + { xStyle->GetCollection()->DeleteAssignmentToListLevelOfOutlineStyle(); + } + break; } - break; - case SFX_STYLE_FAMILY_FRAME: - pTargetFmt = xStyle->GetFrmFmt(); - break; - case SFX_STYLE_FAMILY_PAGE: + + case SFX_STYLE_FAMILY_FRAME: + pTargetFmt = xStyle->GetFrmFmt(); + break; + + case SFX_STYLE_FAMILY_PAGE: { SwPageDesc *pDesc = m_pDoc->FindPageDesc(xStyle->GetPageDesc()->GetName(), &nPgDscPos); if( pDesc ) { pTargetFmt = &pDesc->GetMaster(); - pDesc->SetUseOn ( nsUseOnPage::PD_ALL ); + pDesc->SetUseOn(nsUseOnPage::PD_ALL); } + break; } - break; - case SFX_STYLE_FAMILY_PSEUDO: - break; - default: - ; + case SFX_STYLE_FAMILY_PSEUDO: + break; + + default: ; } - if( pTargetFmt ) + + if(pTargetFmt) { - if( USHRT_MAX != nPgDscPos ) + if(USHRT_MAX != nPgDscPos) { SwPageDesc& rPageDesc = m_pDoc->GetPageDesc(nPgDscPos); rPageDesc.ResetAllMasterAttr(); SvxLRSpaceItem aLR(RES_LR_SPACE); - sal_Int32 nSize = GetMetricVal ( CM_1) * 2; - aLR.SetLeft ( nSize ); - aLR.SetLeft ( nSize ); - SvxULSpaceItem aUL( RES_UL_SPACE ); - aUL.SetUpper ( static_cast < sal_uInt16 > ( nSize ) ); - aUL.SetLower ( static_cast < sal_uInt16 > ( nSize ) ); - pTargetFmt->SetFmtAttr( aLR ); - pTargetFmt->SetFmtAttr( aUL ); - - SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD ); - SwFmtFrmSize aFrmSz( ATT_FIX_SIZE ); - if( RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId() ) + sal_Int32 nSize = GetMetricVal(CM_1) * 2; + aLR.SetLeft(nSize); + aLR.SetLeft(nSize); + SvxULSpaceItem aUL(RES_UL_SPACE); + aUL.SetUpper(static_cast <sal_uInt16> (nSize)); + aUL.SetLower(static_cast <sal_uInt16> (nSize)); + pTargetFmt->SetFmtAttr(aLR); + pTargetFmt->SetFmtAttr(aUL); + SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD); + SwFmtFrmSize aFrmSz(ATT_FIX_SIZE); + + if(RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId()) { - if( m_pDoc->getIDocumentDeviceAccess().getPrinter( false ) ) + if(m_pDoc->getIDocumentDeviceAccess().getPrinter(false)) { const Size aPhysSize( SvxPaperInfo::GetPaperSize( - static_cast<Printer*>( m_pDoc->getIDocumentDeviceAccess().getPrinter( false ) )) ); - aFrmSz.SetSize( aPhysSize ); + static_cast<Printer*>(m_pDoc->getIDocumentDeviceAccess().getPrinter(false)))); + aFrmSz.SetSize(aPhysSize); } else - aFrmSz.SetSize( SvxPaperInfo::GetDefaultPaperSize() ); + { + aFrmSz.SetSize(SvxPaperInfo::GetDefaultPaperSize()); + } } else { aFrmSz = pStdPgDsc->GetMaster().GetFrmSize(); } - if( pStdPgDsc->GetLandscape() ) + + if(pStdPgDsc->GetLandscape()) { SwTwips nTmp = aFrmSz.GetHeight(); - aFrmSz.SetHeight( aFrmSz.GetWidth() ); - aFrmSz.SetWidth( nTmp ); + aFrmSz.SetHeight(aFrmSz.GetWidth()); + aFrmSz.SetWidth(nTmp); } + pTargetFmt->SetFmtAttr( aFrmSz ); } else + { pTargetFmt->ResetAllFmtAttr(); + } - if( USHRT_MAX != nPgDscPos ) - m_pDoc->ChgPageDesc( nPgDscPos, m_pDoc->GetPageDesc(nPgDscPos) ); + if(USHRT_MAX != nPgDscPos) + { + m_pDoc->ChgPageDesc(nPgDscPos, m_pDoc->GetPageDesc(nPgDscPos)); + } } - } else + { throw uno::RuntimeException(); + } } else if ( bIsDescriptor ) + { pPropImpl->ClearAllProperties(); + } else + { throw uno::RuntimeException(); + } } uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) @@ -3088,10 +3193,12 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq { SolarMutexGuard aGuard; sal_Int32 nCount = aPropertyNames.getLength(); - uno::Sequence < uno::Any > aRet ( nCount ); - if ( nCount ) + + uno::Sequence < uno::Any > aRet(nCount); + + if(nCount) { - if( pBasePool) + if(pBasePool) { pBasePool->SetSearchMask(eFamily); SfxStyleSheetBase* pBase = pBasePool->Find(m_sStyleName); @@ -3099,7 +3206,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq if(pBase) { - rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); + rtl::Reference< SwDocStyleSheet > xStyle(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase)); sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_STYLE; switch(eFamily) { @@ -3107,8 +3214,7 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq case SFX_STYLE_FAMILY_FRAME : nPropSetId = PROPERTY_MAP_FRAME_STYLE; break; case SFX_STYLE_FAMILY_PAGE : nPropSetId = PROPERTY_MAP_PAGE_STYLE; break; case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_MAP_NUM_STYLE; break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); @@ -3116,11 +3222,15 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq const SfxItemSet &rSet = xStyle->GetItemSet(), *pParentSet = rSet.GetParent(); const OUString *pNames = aPropertyNames.getConstArray(); uno::Any *pRet = aRet.getArray(); - for ( sal_Int32 i = 0 ; i < nCount; i++) + + for(sal_Int32 i = 0; i < nCount; i++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[i] ); - if ( !pEntry ) - throw beans::UnknownPropertyException ( "Unknown property: " + pNames[i], static_cast < cppu::OWeakObject * > ( this ) ); + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(pNames[i]); + + if(!pEntry) + { + throw beans::UnknownPropertyException("Unknown property: " + pNames[i], static_cast < cppu::OWeakObject * >(this)); + } if (pEntry->nWID >= RES_UNKNOWNATR_END) { @@ -3128,20 +3238,28 @@ uno::Sequence< uno::Any > SAL_CALL SwXStyle::getPropertyDefaults( const uno::Seq // parent set, so the default value is void continue; } - if( pParentSet ) + + if(pParentSet) + { aSwMapProvider.GetPropertySet(nPropSetId)->getPropertyValue(pNames[i], *pParentSet, pRet[i]); - else if( pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID) ) + } + else if(pEntry->nWID != rSet.GetPool()->GetSlotId(pEntry->nWID)) { const SfxPoolItem& rItem = rSet.GetPool()->GetDefaultItem(pEntry->nWID); + rItem.QueryValue(pRet[i], pEntry->nMemberId); } } } else + { throw uno::RuntimeException(); + } } else + { throw uno::RuntimeException(); + } } return aRet; } @@ -3203,39 +3321,25 @@ SwXPageStyle::~SwXPageStyle() } -static void lcl_putItemToSet(const SvxSetItem* pSetItem, sal_uInt16 nRes, sal_uInt16 nItemType, const uno::Any& rVal, sal_uInt8 nMemberId, SwStyleBase_Impl& rBaseImpl) +static void lcl_putItemToSet(const SvxSetItem* pSetItem, const SfxItemPropertySet& rPropSet, const SfxItemPropertySimpleEntry& rEntry, const uno::Any& rVal, SwStyleBase_Impl& rBaseImpl, SfxStyleSheetBasePool* pPool, SwDoc *pDoc, SfxStyleFamily eFamily) { - SvxSetItem* pNewSetItem = (SvxSetItem*)pSetItem->Clone(); + // create a new SvxSetItem and get it's ItemSet as new target + SvxSetItem* pNewSetItem = static_cast< SvxSetItem* >(pSetItem->Clone()); SfxItemSet& rSetSet = pNewSetItem->GetItemSet(); - const SfxPoolItem* pItem = 0; - SfxPoolItem* pNewItem = 0; - rSetSet.GetItemState(nRes, true, &pItem); - if(!pItem && nRes != rSetSet.GetPool()->GetSlotId(nRes)) - pItem = &rSetSet.GetPool()->GetDefaultItem(nRes); - if(pItem) - { - pNewItem = pItem->Clone(); - } - else - { - switch(nItemType) - { - case TYPE_BOOL: pNewItem = new SfxBoolItem(nRes); break; - case TYPE_SIZE: pNewItem = new SvxSizeItem(nRes); break; - case TYPE_BRUSH: pNewItem = new SvxBrushItem(nRes); break; - case TYPE_ULSPACE: pNewItem = new SvxULSpaceItem(nRes); break; - case TYPE_SHADOW : pNewItem = new SvxShadowItem(nRes); break; - case TYPE_LRSPACE: pNewItem = new SvxLRSpaceItem(nRes); break; - case TYPE_BOX: pNewItem = new SvxBoxItem(nRes); break; - } - } - assert(pNewItem); - if (pNewItem) - { - pNewItem->PutValue(rVal, nMemberId); - rSetSet.Put(*pNewItem); - delete pNewItem; - } + + // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem + rSetSet.SetParent(&pDoc->GetDfltFrmFmt()->GetAttrSet()); + + // replace the used SfxItemSet at the SwStyleBase_Impl temporarily and use the + // default method to set the property + SfxItemSet* pRememberItemSet = rBaseImpl.replaceItemSet(&rSetSet); + lcl_SetStyleProperty(rEntry, rPropSet, rVal, rBaseImpl, pPool, pDoc, eFamily); + rBaseImpl.replaceItemSet(pRememberItemSet); + + // reset paret at ItemSet from SetItem + rSetSet.SetParent(0); + + // set the new SvxSetItem at the real target and delete it rBaseImpl.GetItemSet().Put(*pNewSetItem); delete pNewSetItem; } @@ -3257,7 +3361,7 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( const uno::Any* pValues = rValues.getConstArray(); const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); - SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName()); + SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrmFmt()->GetAttrSet()); //UUUU add pDfltFrmFmt as parent if(GetBasePool()) { const sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask(); @@ -3266,140 +3370,194 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( GetBasePool()->SetSearchMask(GetFamily(), nSaveMask ); OSL_ENSURE(pBase, "where is the style?" ); if(pBase) - aBaseImpl.mxNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase); + { + aBaseImpl.setNewBase(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase)); + } else + { throw uno::RuntimeException(); + } } for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] ); + const OUString& rPropName = pNames[nProp]; + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(rPropName); + if (!pEntry) + { throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + } + if ( pEntry->nFlags & beans::PropertyAttribute::READONLY) + { throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + } if(GetBasePool()) { switch(pEntry->nWID) { - case FN_UNO_HEADER_ON: - case FN_UNO_HEADER_BACKGROUND: - case FN_UNO_HEADER_BOX: - case FN_UNO_HEADER_LR_SPACE: - case FN_UNO_HEADER_SHADOW: - case FN_UNO_HEADER_BODY_DISTANCE: - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: - case FN_UNO_HEADER_SHARE_CONTENT: - case FN_UNO_HEADER_HEIGHT: - case FN_UNO_HEADER_EAT_SPACING: - - case FN_UNO_FIRST_SHARE_CONTENT: - - case FN_UNO_FOOTER_ON: - case FN_UNO_FOOTER_BACKGROUND: - case FN_UNO_FOOTER_BOX: - case FN_UNO_FOOTER_LR_SPACE: - case FN_UNO_FOOTER_SHADOW: - case FN_UNO_FOOTER_BODY_DISTANCE: - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: - case FN_UNO_FOOTER_SHARE_CONTENT: - case FN_UNO_FOOTER_HEIGHT: - case FN_UNO_FOOTER_EAT_SPACING: + case SID_ATTR_PAGE_ON: + case RES_BACKGROUND: + case RES_BOX: + case RES_LR_SPACE: + case RES_SHADOW: + case RES_UL_SPACE: + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + case SID_ATTR_PAGE_SHARED_FIRST: + case SID_ATTR_PAGE_SIZE: + case RES_HEADER_FOOTER_EAT_SPACING: { - bool bFooter = false; - sal_uInt16 nItemType = TYPE_BOOL; - sal_uInt16 nRes = 0; - switch(pEntry->nWID) + // these entries are used in Header, Footer and (partially) in the PageStyle itself. + // Check for Header/Footer entry + const bool bHeader(rPropName.startsWith("Header")); + const bool bFooter(rPropName.startsWith("Footer")); + + if(bHeader || bFooter) { - case FN_UNO_FOOTER_ON: bFooter = true; - // no break - case FN_UNO_HEADER_ON: nRes = SID_ATTR_PAGE_ON; - break; - case FN_UNO_FOOTER_BACKGROUND: bFooter = true; - // no break - case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; nItemType = TYPE_BRUSH; - break; - case FN_UNO_FOOTER_BOX: bFooter = true; - // no break - case FN_UNO_HEADER_BOX: nRes = RES_BOX; nItemType = TYPE_BOX; - break; - case FN_UNO_FOOTER_LR_SPACE: bFooter = true; - // no break - case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE;nItemType = TYPE_LRSPACE; - break; - case FN_UNO_FOOTER_SHADOW: bFooter = true; - // no break - case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW;nItemType = TYPE_SHADOW; - break; - case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = true; - // no break - case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE;nItemType = TYPE_ULSPACE; - break; - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = true; - // no break - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC; - break; - case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = true; - // no break - case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED; - break; - case FN_UNO_FIRST_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED_FIRST; - break; - case FN_UNO_FOOTER_HEIGHT: bFooter = true; - // no break - case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE;nItemType = TYPE_SIZE; - break; - case FN_UNO_FOOTER_EAT_SPACING: bFooter = true; - // no break - case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;nItemType = TYPE_SIZE; - break; + // it is a Header/Footer entry, access the SvxSetItem containing it's information + const SvxSetItem* pSetItem = 0; + + if (SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState( + bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, + false, (const SfxPoolItem**)&pSetItem)) + { + lcl_putItemToSet(pSetItem, *pPropSet, *pEntry, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + + if (pEntry->nWID == SID_ATTR_PAGE_SHARED_FIRST) + { + // Need to add this to the other as well + if (SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState( + bFooter ? SID_ATTR_PAGE_HEADERSET : SID_ATTR_PAGE_FOOTERSET, + false, (const SfxPoolItem**)&pSetItem)) + { + lcl_putItemToSet(pSetItem, *pPropSet, *pEntry, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + } + } + } + else if(pEntry->nWID == SID_ATTR_PAGE_ON) + { + bool bVal = *(sal_Bool*)pValues[nProp].getValue(); + + if(bVal) + { + // Header/footer gets switched on, create defauts and the needed SfxSetItem + SfxItemSet aTempSet(*aBaseImpl.GetItemSet().GetPool(), + RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [82 + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER, // [10023 + SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE, // [10051 + SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED, // [10060 + SID_ATTR_PAGE_SHARED_FIRST,SID_ATTR_PAGE_SHARED_FIRST, + 0); + + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + aTempSet.SetParent(&GetDoc()->GetDfltFrmFmt()->GetAttrSet()); + + aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_ON, true)); + aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(MM50, MM50))); + aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE)); + aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE)); + aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, true)); + aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED_FIRST, true)); + aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, true)); + + SvxSetItem aNewSetItem(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, aTempSet); + aBaseImpl.GetItemSet().Put(aNewSetItem); + } + } } - const SvxSetItem* pSetItem; - if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState( - bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - false, (const SfxPoolItem**)&pSetItem)) + else { - lcl_putItemToSet(pSetItem, nRes, nItemType, pValues[nProp], pEntry->nMemberId, aBaseImpl); - - if (nRes == SID_ATTR_PAGE_SHARED_FIRST) + switch(pEntry->nWID) { - // Need to add this to the other as well - if (SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState( - bFooter ? SID_ATTR_PAGE_HEADERSET : SID_ATTR_PAGE_FOOTERSET, - false, (const SfxPoolItem**)&pSetItem)) - lcl_putItemToSet(pSetItem, nRes, nItemType, pValues[nProp], pEntry->nMemberId, aBaseImpl); + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + case SID_ATTR_PAGE_SHARED_FIRST: + case SID_ATTR_PAGE_ON: + case RES_HEADER_FOOTER_EAT_SPACING: + { + // these slots are exclusive to Header/Footer, thus this is an error + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + break; + } + default: + { + // part of PageStyle, fallback to default + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + } } } - else if(SID_ATTR_PAGE_ON == nRes ) + break; + } + + case XATTR_FILLBMP_SIZELOG: + case XATTR_FILLBMP_TILEOFFSETX: + case XATTR_FILLBMP_TILEOFFSETY: + case XATTR_FILLBMP_POSOFFSETX: + case XATTR_FILLBMP_POSOFFSETY: + case XATTR_FILLBMP_POS: + case XATTR_FILLBMP_SIZEX: + case XATTR_FILLBMP_SIZEY: + case XATTR_FILLBMP_STRETCH: + case XATTR_FILLBMP_TILE: + case OWN_ATTR_FILLBMP_MODE: + case XATTR_FILLCOLOR: + case XATTR_FILLBACKGROUND: + case XATTR_FILLBITMAP: + case XATTR_GRADIENTSTEPCOUNT: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLSTYLE: + case XATTR_FILLTRANSPARENCE: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_SECONDARYFILLCOLOR: + { + // This DrawingLayer FillStyle attributes can be part of Header, Footer and PageStyle + // itself, so decide what to do using the name + const bool bHeader(rPropName.startsWith("Header")); + const bool bFooter(rPropName.startsWith("Footer")); + + if(bHeader || bFooter) { - bool bVal = *(sal_Bool*)pValues[nProp].getValue(); - if(bVal) + const SvxSetItem* pSetItem = 0; + + if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem)) { - SfxItemSet aTempSet(*aBaseImpl.GetItemSet().GetPool(), - RES_BACKGROUND, RES_SHADOW, - RES_LR_SPACE, RES_UL_SPACE, - nRes, nRes, - SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, - SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC, - SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED, - SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST, - 0 ); - aTempSet.Put(SfxBoolItem(nRes, true)); - aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(MM50, MM50))); - aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE)); - aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE)); - aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, true)); - aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED_FIRST, true)); - aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, true)); - - SvxSetItem aNewSetItem( bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - aTempSet); - aBaseImpl.GetItemSet().Put(aNewSetItem); + // create a new SvxSetItem and get it's ItemSet as new target + SvxSetItem* pNewSetItem = static_cast< SvxSetItem* >(pSetItem->Clone()); + SfxItemSet& rSetSet = pNewSetItem->GetItemSet(); + + // set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem + rSetSet.SetParent(&GetDoc()->GetDfltFrmFmt()->GetAttrSet()); + + // replace the used SfxItemSet at the SwStyleBase_Impl temporarily and use the + // default method to set the property + SfxItemSet* pRememberItemSet = aBaseImpl.replaceItemSet(&rSetSet); + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + aBaseImpl.replaceItemSet(pRememberItemSet); + + // reset paret at ItemSet from SetItem + rSetSet.SetParent(0); + + // set the new SvxSetItem at the real target and delete it + aBaseImpl.GetItemSet().Put(*pNewSetItem); + delete pNewSetItem; } } + else + { + // part of PageStyle, fallback to default + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + } + + break; } - break; case FN_PARAM_FTN_INFO : { const SfxPoolItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO); @@ -3409,8 +3567,8 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( delete pNewFtnItem; if(!bPut) throw lang::IllegalArgumentException(); + break; } - break; case FN_UNO_HEADER : case FN_UNO_HEADER_LEFT : case FN_UNO_HEADER_RIGHT : @@ -3419,30 +3577,40 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( case FN_UNO_FOOTER_LEFT : case FN_UNO_FOOTER_RIGHT : case FN_UNO_FOOTER_FIRST : + { throw lang::IllegalArgumentException(); - //break; + break; + } default: - lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, - GetBasePool(), GetDoc(), GetFamily()); + { + //UUUU + lcl_SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl, GetBasePool(), GetDoc(), GetFamily()); + break; + } } } else if(IsDescriptor()) { - if(!GetPropImpl()->SetProperty(pNames[nProp], pValues[nProp])) + if(!GetPropImpl()->SetProperty(rPropName, pValues[nProp])) throw lang::IllegalArgumentException(); } else + { throw uno::RuntimeException(); + } } + if(aBaseImpl.HasItemSet()) { ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo()); + if (undoGuard.UndoWasEnabled()) { // Fix i64460: as long as Undo of page styles with header/footer causes trouble... GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); } - aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet()); + + aBaseImpl.getNewBase()->SetItemSet(aBaseImpl.GetItemSet()); } } @@ -3505,13 +3673,18 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( uno::Any* pRet = aRet.getArray(); const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PAGE_STYLE); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); - SwStyleBase_Impl aBase(*GetDoc(), GetStyleName()); + SwStyleBase_Impl aBase(*GetDoc(), GetStyleName(), &GetDoc()->GetDfltFrmFmt()->GetAttrSet()); //UUUU add pDfltFrmFmt as parent SfxStyleSheetBase* pBase = 0; + for(sal_Int32 nProp = 0; nProp < nLength; nProp++) { - const SfxItemPropertySimpleEntry* pEntry = rMap.getByName( pNames[nProp] ); + const OUString& rPropName = pNames[nProp]; + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(rPropName); + if (!pEntry) - throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) ); + { + throw beans::UnknownPropertyException("Unknown property: " + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + } if(GetBasePool()) { @@ -3522,138 +3695,152 @@ uno::Sequence< uno::Any > SAL_CALL SwXPageStyle::GetPropertyValues_Impl( pBase = GetBasePool()->Find(GetStyleName()); GetBasePool()->SetSearchMask(GetFamily(), nSaveMask ); } + sal_uInt16 nRes = 0; - bool bHeader = false; bool bLeft = false; bool bFirst = false; + const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM)); + switch(pEntry->nWID) { - case FN_UNO_HEADER_ON: - case FN_UNO_HEADER_BACKGROUND: - case FN_UNO_HEADER_BOX: - case FN_UNO_HEADER_LR_SPACE: - case FN_UNO_HEADER_SHADOW: - case FN_UNO_HEADER_BODY_DISTANCE: - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: - case FN_UNO_HEADER_SHARE_CONTENT: - case FN_UNO_HEADER_HEIGHT: - case FN_UNO_HEADER_EAT_SPACING: - - case FN_UNO_FIRST_SHARE_CONTENT: - - case FN_UNO_FOOTER_ON: - case FN_UNO_FOOTER_BACKGROUND: - case FN_UNO_FOOTER_BOX: - case FN_UNO_FOOTER_LR_SPACE: - case FN_UNO_FOOTER_SHADOW: - case FN_UNO_FOOTER_BODY_DISTANCE: - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: - case FN_UNO_FOOTER_SHARE_CONTENT: - case FN_UNO_FOOTER_HEIGHT: - case FN_UNO_FOOTER_EAT_SPACING: + case SID_ATTR_PAGE_ON: + case RES_BACKGROUND: + case RES_BOX: + case RES_LR_SPACE: + case RES_SHADOW: + case RES_UL_SPACE: + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + case SID_ATTR_PAGE_SHARED_FIRST: + case SID_ATTR_PAGE_SIZE: + case RES_HEADER_FOOTER_EAT_SPACING: { - SfxStyleSheetBasePool* pBasePool2 = ((SwXPageStyle*)this)->GetBasePool(); - pBasePool2->SetSearchMask(GetFamily()); - SfxStyleSheetBase* pBase2 = pBasePool2->Find(GetStyleName()); - if(pBase2) + // These slots are used for Header, Footer and (partially) for PageStyle directly. + // Check for Header/Footer entry + const bool bHeader(rPropName.startsWith("Header")); + const bool bFooter(rPropName.startsWith("Footer")); + + if(bHeader || bFooter) { + // slot is a Header/Footer slot rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); const SfxItemSet& rSet = xStyle->GetItemSet(); - bool bFooter = false; + const SvxSetItem* pSetItem; + + if(SFX_ITEM_SET == rSet.GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem)) + { + // get from SfxItemSet of the corresponding SfxSetItem + const SfxItemSet& rSetSet = pSetItem->GetItemSet(); + SfxItemSet* pRememberItemSet = aBase.replaceItemSet(&const_cast< SfxItemSet& >(rSetSet)); + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + aBase.replaceItemSet(pRememberItemSet); + } + else if(pEntry->nWID == SID_ATTR_PAGE_ON) + { + // header/footer is not available, thus off. Default is sal_False, though + sal_Bool bRet = sal_False; + pRet[nProp].setValue(&bRet, ::getCppuBooleanType()); + } + } + else + { switch(pEntry->nWID) { - case FN_UNO_FOOTER_ON: - bFooter = true; - // no break - case FN_UNO_HEADER_ON: + case SID_ATTR_PAGE_DYNAMIC: + case SID_ATTR_PAGE_SHARED: + case SID_ATTR_PAGE_SHARED_FIRST: + case SID_ATTR_PAGE_ON: + case RES_HEADER_FOOTER_EAT_SPACING: + { + // these slots are exclusive to Header/Footer, thus this is an error + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + break; + } + default: { - //falls das SetItem nicht da ist, dann ist der Wert sal_False - sal_Bool bRet = sal_False; - pRet[nProp].setValue(&bRet, ::getCppuBooleanType()); - nRes = SID_ATTR_PAGE_ON; + // part of PageStyle, fallback to default + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); } - break; - case FN_UNO_FOOTER_BACKGROUND: bFooter = true; - // no break - case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; - break; - case FN_UNO_FOOTER_BOX: bFooter = true; - // no break - case FN_UNO_HEADER_BOX: nRes = RES_BOX; - break; - case FN_UNO_FOOTER_LR_SPACE: bFooter = true; - // no break - case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE; - break; - case FN_UNO_FOOTER_SHADOW: bFooter = true; - // no break - case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW; - break; - case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = true; - // no break - case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE; - break; - case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = true; - // no break - case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC; - break; - case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = true; - // no break - case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED; - break; - case FN_UNO_FIRST_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED_FIRST; - break; - case FN_UNO_FOOTER_HEIGHT: bFooter = true; - // no break - case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE; - break; - case FN_UNO_FOOTER_EAT_SPACING: bFooter = true; - // no break - case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING; - break; } + } + + break; + } + + case XATTR_FILLBMP_SIZELOG: + case XATTR_FILLBMP_TILEOFFSETX: + case XATTR_FILLBMP_TILEOFFSETY: + case XATTR_FILLBMP_POSOFFSETX: + case XATTR_FILLBMP_POSOFFSETY: + case XATTR_FILLBMP_POS: + case XATTR_FILLBMP_SIZEX: + case XATTR_FILLBMP_SIZEY: + case XATTR_FILLBMP_STRETCH: + case XATTR_FILLBMP_TILE: + case OWN_ATTR_FILLBMP_MODE: + case XATTR_FILLCOLOR: + case XATTR_FILLBACKGROUND: + case XATTR_FILLBITMAP: + case XATTR_GRADIENTSTEPCOUNT: + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLSTYLE: + case XATTR_FILLTRANSPARENCE: + case XATTR_FILLFLOATTRANSPARENCE: + case XATTR_SECONDARYFILLCOLOR: + { + // This DrawingLayer FillStyle attributes can be part of Header, Footer and PageStyle + // itself, so decide what to do using the name + const bool bHeader(rPropName.startsWith("Header")); + const bool bFooter(rPropName.startsWith("Footer")); + + if(bHeader || bFooter) + { + rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); + const SfxItemSet& rSet = xStyle->GetItemSet(); const SvxSetItem* pSetItem; - if(SFX_ITEM_SET == rSet.GetItemState( - bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, - false, (const SfxPoolItem**)&pSetItem)) + if(SFX_ITEM_SET == rSet.GetItemState(bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET, sal_False, (const SfxPoolItem**)&pSetItem)) { - const SfxItemSet& rTmpSet = pSetItem->GetItemSet(); - const SfxPoolItem* pItem = 0; - rTmpSet.GetItemState(nRes, true, &pItem); - if(!pItem && nRes != rTmpSet.GetPool()->GetSlotId(nRes)) - pItem = &rTmpSet.GetPool()->GetDefaultItem(nRes); - if(pItem) - pItem->QueryValue(pRet[nProp], pEntry->nMemberId); + // set at SfxItemSet of the corresponding SfxSetItem + const SfxItemSet& rSetSet = pSetItem->GetItemSet(); + SfxItemSet* pRememberItemSet = aBase.replaceItemSet(&const_cast< SfxItemSet& >(rSetSet)); + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + aBase.replaceItemSet(pRememberItemSet); } } + else + { + // part of PageStyle, fallback to default + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + } + + break; } - break; - case FN_UNO_HEADER : - goto Header; - case FN_UNO_HEADER_LEFT : - bLeft = true; goto Header; - case FN_UNO_HEADER_FIRST : - bFirst = true; goto Header; - case FN_UNO_HEADER_RIGHT : - goto Header; -Header: - bHeader = true; - nRes = RES_HEADER; goto MakeObject; - case FN_UNO_FOOTER : - goto Footer; - case FN_UNO_FOOTER_LEFT : - bLeft = true; goto Footer; - case FN_UNO_FOOTER_FIRST : - bFirst = true; goto Footer; - case FN_UNO_FOOTER_RIGHT : -Footer: - nRes = RES_FOOTER; -MakeObject: + + case FN_UNO_HEADER: + case FN_UNO_HEADER_LEFT: + case FN_UNO_HEADER_RIGHT: + case FN_UNO_FOOTER: + case FN_UNO_FOOTER_LEFT: + case FN_UNO_FOOTER_RIGHT: { + //UUUU cleanups for readability (undos removed, rearranged) + bool bHeader(false); + + switch(pEntry->nWID) + { + case FN_UNO_HEADER: bHeader = true; nRes = RES_HEADER; break; + case FN_UNO_HEADER_LEFT: bHeader = true; nRes = RES_HEADER; bLeft = true; break; + case FN_UNO_HEADER_RIGHT: bHeader = true; nRes = RES_HEADER; break; + case FN_UNO_FOOTER: bHeader = false; nRes = RES_FOOTER; break; + case FN_UNO_FOOTER_LEFT: bHeader = false; nRes = RES_FOOTER; bLeft = true; break; + case FN_UNO_FOOTER_RIGHT: bHeader = false; nRes = RES_FOOTER; break; + default: break; + } + const SwPageDesc& rDesc = aBase.GetOldPageDesc(); const SwFrmFmt* pFrmFmt = 0; - bool bShare = (bHeader && rDesc.IsHeaderShared())|| - (!bHeader && rDesc.IsFooterShared()); + bool bShare = (bHeader && rDesc.IsHeaderShared()) || (!bHeader && rDesc.IsFooterShared()); bool bShareFirst = rDesc.IsFirstShared(); // TextLeft returns the left content if there is one, // Text and TextRight return the master content. @@ -3679,32 +3866,45 @@ MakeObject: { pRet[nProp] <<= xRet; } + break; } - break; + case FN_PARAM_FTN_INFO : { rtl::Reference< SwDocStyleSheet > xStyle( new SwDocStyleSheet( *(SwDocStyleSheet*)pBase ) ); const SfxItemSet& rSet = xStyle->GetItemSet(); const SfxPoolItem& rItem = rSet.Get(FN_PARAM_FTN_INFO); - rItem.QueryValue(pRet[nProp], pEntry->nMemberId); + rItem.QueryValue(pRet[nProp], nMemberId); + break; } - break; default: - pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + { + //UUUU + pRet[nProp] = lcl_GetStyleProperty(*pEntry, *pPropSet, aBase, pBase, GetFamily(), GetDoc() ); + break; + } } } else if(IsDescriptor()) { uno::Any* pAny = 0; - GetPropImpl()->GetProperty(pNames[nProp], pAny); + GetPropImpl()->GetProperty(rPropName, pAny); + if ( !pAny ) - GetPropImpl()->GetProperty ( pNames[nProp], mxStyleData, pRet[ nProp ] ); + { + GetPropImpl()->GetProperty(rPropName, mxStyleData, pRet[nProp]); + } else + { pRet[nProp] = *pAny; + } } else + { throw uno::RuntimeException(); + } } + return aRet; } @@ -3915,8 +4115,11 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( const uno::Sequence< beans::PropertyValue >& Values ) throw (uno::RuntimeException, std::exception) { - if( !pDocShell ) + if (!pDocShell) + { throw uno::RuntimeException(); + } + const sal_uInt16* pRange = 0; const SfxItemPropertySet* pPropSet = 0; switch( eFamily ) @@ -3925,23 +4128,21 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( { pRange = aCharAutoFmtSetRange; pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE); + break; } - break; case IStyleAccess::AUTO_STYLE_RUBY: { pRange = 0;//aTxtNodeSetRange; pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_RUBY_AUTO_STYLE); + break; } - break; case IStyleAccess::AUTO_STYLE_PARA: { - pRange = aTxtNodeSetRange; + pRange = aTxtNodeSetRange; //UUUU checked, already added support for [XATTR_FILL_FIRST, XATTR_FILL_LAST] pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARA_AUTO_STYLE); + break; } - break; - - default: - ; + default: ; } if( !pPropSet) @@ -3950,24 +4151,183 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( SwAttrSet aSet( pDocShell->GetDoc()->GetAttrPool(), pRange ); const beans::PropertyValue* pSeq = Values.getConstArray(); sal_Int32 nLen = Values.getLength(); - for( sal_Int32 i = 0; i < nLen; ++i ) + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == eFamily); + + if(!bTakeCareOfDrawingLayerFillStyle) { - try + for( sal_Int32 i = 0; i < nLen; ++i ) { - pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet ); - } - catch (beans::UnknownPropertyException &) - { - OSL_FAIL( "Unknown property" ); + try + { + pPropSet->setPropertyValue( pSeq[i].Name, pSeq[i].Value, aSet ); + } + catch (beans::UnknownPropertyException &) + { + OSL_FAIL( "Unknown property" ); + } + catch (lang::IllegalArgumentException &) + { + OSL_FAIL( "Illegal argument" ); + } } - catch (lang::IllegalArgumentException &) + } + else + { + //UUUU set parent to ItemSet to ensure XFILL_NONE as XFillStyleItem + // to make cases in RES_BACKGROUND work correct; target *is* a style + // where this is the case + aSet.SetParent(&pDocShell->GetDoc()->GetDfltTxtFmtColl()->GetAttrSet()); + + //UUUU here the used DrawingLayer FillStyles are imported when family is + // equal to IStyleAccess::AUTO_STYLE_PARA, thus we will need to serve the + // used slots functionality here to do this correctly + const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); + + for( sal_Int32 i = 0; i < nLen; ++i ) { - OSL_FAIL( "Illegal argument" ); - } + const OUString& rPropName = pSeq[i].Name; + uno::Any aValue(pSeq[i].Value); + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(rPropName); + + if(!pEntry) + { + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + } + + const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM)); + bool bDone(false); + + // check for needed metric translation + if(pEntry->nMemberId & SFX_METRIC_ITEM) + { + bool bDoIt(true); + + if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID) + { + // exception: If these ItemTypes are used, do not convert when these are negative + // since this means they are intended as percent values + sal_Int32 nValue = 0; + + if(aValue >>= nValue) + { + bDoIt = nValue > 0; + } + } + + if(bDoIt) + { + const SfxItemPool& rPool = pDocShell->GetDoc()->GetAttrPool(); + const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID)); + + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + SvxUnoConvertFromMM(eMapUnit, aValue); + } + } + } + + switch(pEntry->nWID) + { + case XATTR_FILLGRADIENT: + case XATTR_FILLHATCH: + case XATTR_FILLBITMAP: + case XATTR_FILLFLOATTRANSPARENCE: + // not yet needed; activate when LineStyle support may be added + // case XATTR_LINESTART: + // case XATTR_LINEEND: + // case XATTR_LINEDASH: + { + if(MID_NAME == nMemberId) + { + //UUUU add set commands for FillName items + OUString aTempName; + + if(!(aValue >>= aTempName)) + { + throw lang::IllegalArgumentException(); + } + + SvxShape::SetFillAttribute(pEntry->nWID, aTempName, aSet); + bDone = true; + } + else if(MID_GRAFURL == nMemberId) + { + if(XATTR_FILLBITMAP == pEntry->nWID) + { + //UUUU Bitmap also has the MID_GRAFURL mode where a Bitmap URL is used + const Graphic aNullGraphic; + XFillBitmapItem aXFillBitmapItem(aSet.GetPool(), aNullGraphic); + + aXFillBitmapItem.PutValue(aValue, nMemberId); + aSet.Put(aXFillBitmapItem); + bDone = true; + } + } + + break; + } + case RES_BACKGROUND: + { + //UUUU + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND)); + SvxBrushItem aChangedBrushItem(aOriginalBrushItem); + + aChangedBrushItem.PutValue(aValue, nMemberId); + + if(!(aChangedBrushItem == aOriginalBrushItem)) + { + setSvxBrushItemAsFillAttributesToTargetSet(aChangedBrushItem, aSet); + } + + bDone = true; + break; + } + case OWN_ATTR_FILLBMP_MODE: + { + //UUUU + drawing::BitmapMode eMode; + + if(!(aValue >>= eMode)) + { + sal_Int32 nMode = 0; + + if(!(aValue >>= nMode)) + { + throw lang::IllegalArgumentException(); + } + + eMode = (drawing::BitmapMode)nMode; + } + + aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode)); + aSet.Put(XFillBmpTileItem(drawing::BitmapMode_REPEAT == eMode)); + + bDone = true; + break; + } + default: break; + } + + if(!bDone) + { + pPropSet->setPropertyValue( rPropName, aValue, aSet ); + } + } + + //UUUU clear parent again + aSet.SetParent(0); } + //UUUU need to ensure uniqueness of evtl. added NameOrIndex items + // currently in principle only needed when bTakeCareOfDrawingLayerFillStyle, + // but does not hurt and is easily forgotten later eventually, so keep it + // as common case + pDocShell->GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aSet); + + // AutomaticStyle creation SfxItemSet_Pointer_t pSet = pDocShell->GetDoc()->GetIStyleAccess().cacheAutomaticStyle( aSet, eFamily ); uno::Reference<style::XAutoStyle> xRet = new SwXAutoStyle(pDocShell->GetDoc(), pSet, eFamily); + return xRet; } @@ -4070,11 +4430,23 @@ uno::Any SwXAutoStylesEnumerator::nextElement( ) return aRet; } -SwXAutoStyle::SwXAutoStyle( SwDoc* pDoc, SfxItemSet_Pointer_t pInitSet, IStyleAccess::SwAutoStyleFamily eFam ) -: pSet( pInitSet ), eFamily( eFam ) +//UUUU SwXAutoStyle with the family IStyleAccess::AUTO_STYLE_PARA (or +// PROPERTY_MAP_PARA_AUTO_STYLE) now uses DrawingLayer FillStyles to allow +// unified paragraph background fill, thus the UNO API implementation has to +// support the needed slots for these. This seems to be used only for reading +// (no setPropertyValue implementation here), so maybe specialized for saving +// the Writer Doc to ODF + +SwXAutoStyle::SwXAutoStyle( + SwDoc* pDoc, + SfxItemSet_Pointer_t pInitSet, + IStyleAccess::SwAutoStyleFamily eFam) +: mpSet(pInitSet), + meFamily(eFam), + mrDoc(*pDoc) { // Register ourselves as a listener to the document (via the page descriptor) - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + mrDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); } SwXAutoStyle::~SwXAutoStyle() @@ -4085,14 +4457,16 @@ void SwXAutoStyle::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) { ClientModify(this, pOld, pNew); if(!GetRegisteredIn()) - pSet.reset(); + { + mpSet.reset(); + } } uno::Reference< beans::XPropertySetInfo > SwXAutoStyle::getPropertySetInfo( ) throw (uno::RuntimeException, std::exception) { uno::Reference< beans::XPropertySetInfo > xRet; - switch( eFamily ) + switch( meFamily ) { case IStyleAccess::AUTO_STYLE_CHAR: { @@ -4197,43 +4571,138 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl( const uno::Sequence< OUString > & rPropertyNames ) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException ) { - if( !pSet.get() ) + if( !mpSet.get() ) + { throw uno::RuntimeException(); - // query_item + } + // query_item sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; - switch(eFamily) + switch(meFamily) { case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); const OUString* pNames = rPropertyNames.getConstArray(); - sal_Int32 nLen = rPropertyNames.getLength(); + const sal_Int32 nLen(rPropertyNames.getLength()); uno::Sequence< uno::Any > aRet( nLen ); uno::Any* pValues = aRet.getArray(); - - SfxItemSet& rSet = *pSet.get(); + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily); for( sal_Int32 i = 0; i < nLen; ++i ) { const OUString sPropName = pNames[i]; const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName); if(!pEntry) + { throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) ); - else if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID ) + } + + uno::Any aTarget; + bool bDone(false); + + if ( RES_TXTATR_AUTOFMT == pEntry->nWID || RES_AUTO_STYLE == pEntry->nWID ) { - pValues[i] <<= StylePool::nameOf( pSet ); + pValues[i] <<= StylePool::nameOf( mpSet ); + bDone = true; } - else - pPropSet->getPropertyValue( *pEntry, rSet, pValues[i] ); + else if(bTakeCareOfDrawingLayerFillStyle) + { + //UUUU add support for DrawingLayer FillStyle slots + switch(pEntry->nWID) + { + case RES_BACKGROUND: + { + const SvxBrushItem aOriginalBrushItem(getSvxBrushItemFromSourceSet(*mpSet, RES_BACKGROUND)); + const sal_uInt8 nMemberId(pEntry->nMemberId & (~SFX_METRIC_ITEM)); + + if(!aOriginalBrushItem.QueryValue(aTarget, nMemberId)) + { + OSL_ENSURE(false, "Error getting attribute from RES_BACKGROUND (!)"); + } + + bDone = true; + break; + } + case OWN_ATTR_FILLBMP_MODE: + { + const XFillBmpStretchItem* pStretchItem = dynamic_cast< const XFillBmpStretchItem* >(&mpSet->Get(XATTR_FILLBMP_STRETCH)); + const XFillBmpTileItem* pTileItem = dynamic_cast< const XFillBmpTileItem* >(&mpSet->Get(XATTR_FILLBMP_TILE)); + + if( pTileItem && pTileItem->GetValue() ) + { + aTarget <<= drawing::BitmapMode_REPEAT; + } + else if( pStretchItem && pStretchItem->GetValue() ) + { + aTarget <<= drawing::BitmapMode_STRETCH; + } + else + { + aTarget <<= drawing::BitmapMode_NO_REPEAT; + } + + bDone = true; + break; + } + } + } + + if(!bDone) + { + pPropSet->getPropertyValue( *pEntry, *mpSet, aTarget ); + } + + if(bTakeCareOfDrawingLayerFillStyle) + { + if(pEntry->aType == ::getCppuType((const sal_Int16*)0) && pEntry->aType != aTarget.getValueType()) + { + // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here + sal_Int32 nValue = 0; + aTarget >>= nValue; + aTarget <<= (sal_Int16)nValue; + } + + // check for needed metric translation + if(pEntry->nMemberId & SFX_METRIC_ITEM) + { + bool bDoIt(true); + + if(XATTR_FILLBMP_SIZEX == pEntry->nWID || XATTR_FILLBMP_SIZEY == pEntry->nWID) + { + // exception: If these ItemTypes are used, do not convert when these are negative + // since this means they are intended as percent values + sal_Int32 nValue = 0; + + if(aTarget >>= nValue) + { + bDoIt = nValue > 0; + } + } + + if(bDoIt) + { + const SfxItemPool& rPool = mrDoc.GetAttrPool(); + const SfxMapUnit eMapUnit(rPool.GetMetric(pEntry->nWID)); + + if(eMapUnit != SFX_MAPUNIT_100TH_MM) + { + SvxUnoConvertToMM(eMapUnit, aTarget); + } + } + } + } + + // add value + pValues[i] = aTarget; } + return aRet; } @@ -4313,34 +4782,79 @@ uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates( const uno::Sequence< OUString >& rPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { - if( !pSet.get() ) + if (!mpSet.get()) + { throw uno::RuntimeException(); + } + SolarMutexGuard aGuard; uno::Sequence< beans::PropertyState > aRet(rPropertyNames.getLength()); beans::PropertyState* pStates = aRet.getArray(); const OUString* pNames = rPropertyNames.getConstArray(); sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; - switch(eFamily) + switch(meFamily) { case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); - SfxItemSet& rSet = *pSet.get(); + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily); + for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) { const OUString sPropName = pNames[i]; const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(sPropName); if(!pEntry) + { throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) ); - pStates[i] = pPropSet->getPropertyState(*pEntry, rSet ); + } + + bool bDone(false); + + if(bTakeCareOfDrawingLayerFillStyle) + { + //UUUU DrawingLayer PropertyStyle support + switch(pEntry->nWID) + { + case OWN_ATTR_FILLBMP_MODE: + { + if(SFX_ITEM_SET == mpSet->GetItemState(XATTR_FILLBMP_STRETCH, false) + || SFX_ITEM_SET == mpSet->GetItemState(XATTR_FILLBMP_TILE, false)) + { + pStates[i] = beans::PropertyState_DIRECT_VALUE; + } + else + { + pStates[i] = beans::PropertyState_AMBIGUOUS_VALUE; + } + + bDone = true; + break; + } + case RES_BACKGROUND: + { + if(SWUnoHelper::needToMapFillItemsToSvxBrushItemTypes(*mpSet)) + { + pStates[i] = beans::PropertyState_DIRECT_VALUE; + bDone = true; + } + + break; + } + } + } + + if(!bDone) + { + pStates[i] = pPropSet->getPropertyState(*pEntry, *mpSet ); + } } + return aRet; } @@ -4350,9 +4864,56 @@ void SwXAutoStyle::setAllPropertiesToDefault( ) } void SwXAutoStyle::setPropertiesToDefault( - const uno::Sequence< OUString >& /*aPropertyNames*/ ) + const uno::Sequence< OUString >& rPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) { + if( !mpSet.get() ) + { + throw uno::RuntimeException(); + } + + const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == meFamily); + + if(!bTakeCareOfDrawingLayerFillStyle) + { + return; + } + + //UUUU support DrawingLayer FillStyle slots from here on + SolarMutexGuard aGuard; + const OUString* pNames = rPropertyNames.getConstArray(); + sal_Int8 nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; + + switch(meFamily) + { + case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; + case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; + default: ; + } + + const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); + const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap(); + + for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++) + { + const OUString& rPropName = pNames[i]; + const SfxItemPropertySimpleEntry* pEntry = rMap.getByName(rPropName); + + if(!pEntry) + { + throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) ); + } + + switch(pEntry->nWID) + { + case OWN_ATTR_FILLBMP_MODE: + { + mpSet->ClearItem(XATTR_FILLBMP_STRETCH); + mpSet->ClearItem(XATTR_FILLBMP_TILE); + } + } + } } uno::Sequence< uno::Any > SwXAutoStyle::getPropertyDefaults( @@ -4366,26 +4927,25 @@ uno::Sequence< uno::Any > SwXAutoStyle::getPropertyDefaults( uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() throw (uno::RuntimeException, std::exception) { - if( !pSet.get() ) + if( !mpSet.get() ) throw uno::RuntimeException(); SolarMutexGuard aGuard; std::vector< beans::PropertyValue > aPropertyVector; sal_Int8 nPropSetId = 0; - switch(eFamily) + switch(meFamily) { case IStyleAccess::AUTO_STYLE_CHAR : nPropSetId = PROPERTY_MAP_CHAR_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_RUBY : nPropSetId = PROPERTY_MAP_RUBY_AUTO_STYLE; break; case IStyleAccess::AUTO_STYLE_PARA : nPropSetId = PROPERTY_MAP_PARA_AUTO_STYLE; break; - default: - ; + default: ; } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet(nPropSetId); const SfxItemPropertyMap &rMap = pPropSet->getPropertyMap(); PropertyEntryVector_t aPropVector = rMap.getPropertyEntries(); - SfxItemSet& rSet = *pSet.get(); + SfxItemSet& rSet = *mpSet.get(); SfxItemIter aIter(rSet); const SfxPoolItem* pItem = aIter.FirstItem(); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 4eeb1766285b..83fd5d86fb1e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -113,7 +113,7 @@ #include <breakit.hxx> #include <com/sun/star/i18n/ScriptType.hpp> #include <unotools/localedatawrapper.hxx> -#include <unobrushitemhelper.hxx> +#include <svx/unobrushitemhelper.hxx> #include <svx/xenum.hxx> #include <tgrditem.hxx> #include <flddropdown.hxx> @@ -858,7 +858,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF case XFILL_SOLID: { // Construct an SvxBrushItem, as expected by the exporters. - aSet.Put(sw::getSvxBrushItemFromSourceSet(rFrmFmt.GetAttrSet())); + aSet.Put(getSvxBrushItemFromSourceSet(rFrmFmt.GetAttrSet(), RES_BACKGROUND)); break; } default: diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx index 215426c194e6..c805b8bd0347 100644 --- a/sw/source/ui/chrdlg/pardlg.cxx +++ b/sw/source/ui/chrdlg/pardlg.cxx @@ -65,6 +65,8 @@ SwParaDlg::SwParaDlg(Window *pParent, , m_nParaDrpCps(0) , m_nParaBckGrnd(0) , m_nParaBorder(0) + , m_nAreaId(0) + , m_nTransparenceId(0) { nHtmlMode = ::GetHtmlMode(rVw.GetDocShell()); bool bHtmlMode = (nHtmlMode & HTMLMODE_ON) == HTMLMODE_ON; @@ -139,13 +141,20 @@ SwParaDlg::SwParaDlg(Window *pParent, if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES))) { - OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); - OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); - m_nParaBckGrnd = AddTabPage("labelTP_BACKGROUND", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + //UUUU remove? + //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); + //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); + //m_nParaBckGrnd = AddTabPage("labelTP_BACKGROUND", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + // + //UUUU add Area and Transparence TabPages + m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA )); + m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) ); } else { - RemoveTabPage("labelTP_BACKGROUND"); + //UUUU RemoveTabPage("labelTP_BACKGROUND"); + RemoveTabPage("area"); + RemoveTabPage("transparence"); } OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!"); @@ -214,8 +223,15 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) if(!( nHtmlMode & HTMLMODE_ON ) || nHtmlMode & HTMLMODE_SOME_STYLES) { - aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); - rPage.PageCreated(aSet); + // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in + // einer Tabelle steht + const sal_uInt16 eType = rSh.GetFrmType(0,sal_True); + if(!(FRMTYPE_BODY & eType) || + rSh.GetSelectionType() & nsSelectionType::SEL_TBL) + { + aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_True)); + rPage.PageCreated(aSet); + } } } else if( m_nParaNumPara == nId) @@ -240,7 +256,29 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) for(std::set<OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it) rBox.InsertEntry(*it); } + //UUUU inits for Area and Transparency TabPages + // The selection attribute lists (XPropertyList derivates, e.g. XColorList for + // the color table) need to be added as items (e.g. SvxColorTableItem) to make + // these pages find the needed attributes for fill style suggestions. + // These are added in SwDocStyleSheet::GetItemSet() for the SFX_STYLE_FAMILY_PARA on + // demand, but could also be directly added from the DrawModel. + else if (m_nAreaId == nId) + { + SfxItemSet aNew(*aSet.GetPool(), + SID_COLOR_TABLE, SID_BITMAP_LIST, + SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0); + + aNew.Put(*GetInputSetImpl()); + + // add flag for direct graphic content selection + aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true)); + rPage.PageCreated(aNew); + } + else if (m_nTransparenceId == nId) + { + rPage.PageCreated(*GetInputSetImpl()); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index f63907a3322d..29b5103c13e0 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -194,10 +194,17 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, m_nOutlineId = AddTabPage("outline", SwParagraphNumTabPage::Create, SwParagraphNumTabPage::GetRanges); m_nDropCapsId = AddTabPage("dropcaps", SwDropCapsPage::Create, - SwDropCapsPage::GetRanges ); - OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); - OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); - m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + SwDropCapsPage::GetRanges ); + + //UUUU add Area and Transparence TabPages + m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA )); + m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) ); + + //UUUU remove? + //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); + //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); + //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!"); OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!"); m_nBorderId = AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) ); @@ -242,8 +249,9 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, SwFrmAddPage::GetRanges); m_nWrapId = AddTabPage("wrap", SwWrapTabPage::Create, SwWrapTabPage::GetRanges); - OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); - OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); + //UUUU remove? + //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); + //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); //UUUU remove? //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); @@ -266,9 +274,15 @@ SwTemplateDlg::SwTemplateDlg(Window* pParent, // page styles case SFX_STYLE_FAMILY_PAGE: { - OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); - OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); - m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + //UUUU remove? + //OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!"); + //OSL_ENSURE(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!"); + //m_nBackgroundId = AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) ); + + //UUUU add Area and Transparence TabPages + m_nAreaId = AddTabPage("area", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_AREA )); + m_nTransparenceId = AddTabPage("transparence", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_TRANSPARENCE ) ); + m_nHeaderId = AddTabPage("header", SvxHeaderPage::Create, SvxHeaderPage::GetRanges); m_nFooterId = AddTabPage("footer", SvxFooterPage::Create, SvxFooterPage::GetRanges); @@ -501,7 +515,9 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) pFirstStyle = pStyleSheetPool->Next(); } } - aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList)); + //UUUU set DrawingLayer FillStyles active + aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true)); + aSet.Put(SfxStringListItem(SID_COLLECT_LIST, &aList)); rPage.PageCreated(aSet); } } @@ -556,12 +572,24 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) else if (nId == m_nHeaderId) { if(0 == (nHtmlMode & HTMLMODE_ON )) + { ((SvxHeaderPage&)rPage).EnableDynamicSpacing(); + } + + //UUUU set DrawingLayer FillStyles active + aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true)); + rPage.PageCreated(aSet); } else if (nId == m_nFooterId) { if(0 == (nHtmlMode & HTMLMODE_ON )) + { ((SvxFooterPage&)rPage).EnableDynamicSpacing(); + } + + //UUUU set DrawingLayer FillStyles active + aSet.Put(SfxBoolItem(SID_DRAWINGLAYER_FILLSTYLES, true)); + rPage.PageCreated(aSet); } else if (nId == m_nBorderId) { @@ -583,16 +611,12 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) // demand, but could also be directly added from the DrawModel. else if (nId == m_nAreaId) { - SfxItemSet aNew(*aSet.GetPool(), - SID_COLOR_TABLE, SID_BITMAP_LIST, - SID_OFFER_IMPORT, SID_OFFER_IMPORT, 0, 0); - - aNew.Put(GetStyleSheet().GetItemSet()); + aSet.Put(GetStyleSheet().GetItemSet()); // add flag for direct graphic content selection - aNew.Put(SfxBoolItem(SID_OFFER_IMPORT, true)); + aSet.Put(SfxBoolItem(SID_OFFER_IMPORT, true)); - rPage.PageCreated(aNew); + rPage.PageCreated(aSet); } else if (nId == m_nTransparenceId) { diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 8b7f77fe4406..b95e8e64e61a 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -48,6 +48,10 @@ #include <numrule.hxx> #include <swundo.hxx> +//UUUU +#include <svx/svdmodel.hxx> +#include <svx/drawitem.hxx> + #include "view.hxx" #include "wrtsh.hxx" #include "docsh.hxx" @@ -56,6 +60,8 @@ #include "globals.hrc" #include "viewopt.hxx" #include <doc.hxx> +#include <drawdoc.hxx> +#include "IDocumentDrawModelAccess.hxx" #include <IDocumentUndoRedo.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> @@ -573,13 +579,6 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl) ::ConvertAttrGenToChar(aTmpSet, CONV_ATTR_STD); } - //UUUU - if(m_bNew && SFX_STYLE_FAMILY_FRAME == m_nFamily) - { - // clear FillStyle so that it works as a derived attribute - aTmpSet.ClearItem(XATTR_FILLSTYLE); - } - m_xTmp->SetItemSet( aTmpSet ); if( SFX_STYLE_FAMILY_PAGE == m_nFamily && SvtLanguageOptions().IsCTLFontEnabled() ) @@ -589,6 +588,20 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl) SwChartHelper::DoUpdateAllCharts( pDoc ); } } + + //UUUU + if(m_bNew && SFX_STYLE_FAMILY_FRAME == m_nFamily) + { + if(SFX_STYLE_FAMILY_FRAME == m_nFamily || SFX_STYLE_FAMILY_PARA == m_nFamily) + { + // clear FillStyle so that it works as a derived attribute + SfxItemSet aTmpSet(*m_pDlg->GetOutputItemSet()); + + aTmpSet.ClearItem(XATTR_FILLSTYLE); + m_xTmp->SetItemSet(aTmpSet); + } + } + if(SFX_STYLE_FAMILY_PAGE == m_nFamily) pView->InvalidateRulerPos(); @@ -606,10 +619,6 @@ IMPL_LINK_NOARG(ApplyStyle, ApplyHdl) return m_nRet; } -//UUUU -//#include <svx/svdmodel.hxx> -//#include <svx/drawitem.hxx> - sal_uInt16 SwDocShell::Edit( const OUString &rName, const OUString &rParent, @@ -739,22 +748,22 @@ sal_uInt16 SwDocShell::Edit( { ::ConvertAttrCharToGen(xTmp->GetItemSet(), CONV_ATTR_STD); } - if (!bBasic) + + if(SFX_STYLE_FAMILY_PAGE == nFamily || SFX_STYLE_FAMILY_PARA == nFamily) { - //UUUU - //if(SFX_STYLE_FAMILY_FRAME == nFamily) - //{ - // //UUUU create needed items for XPropertyList entries from the DrawModel so that - // // the Area TabPage can access them - // SfxItemSet& rSet = xTmp->GetItemSet(); - // const SdrModel* pDrawModel = GetDoc()->GetDrawModel(); - // - // rSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE)); - // rSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST)); - // rSet.Put(SvxHatchListItem(pDrawModel->GetHatchListFromSdrModel(), SID_HATCH_LIST)); - // rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapListFromSdrModel(), SID_BITMAP_LIST)); - //} + //UUUU create needed items for XPropertyList entries from the DrawModel so that + // the Area TabPage can access them + SfxItemSet& rSet = xTmp->GetItemSet(); + const SdrModel* pDrawModel = GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); + + rSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE)); + rSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST)); + rSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST)); + rSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST)); + } + if (!bBasic) + { // prior to the dialog the HtmlMode at the DocShell is being sunk sal_uInt16 nHtmlMode = ::GetHtmlMode(this); diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index fb5845ea11e4..ecc667fbda1c 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -57,7 +57,11 @@ #include <svx/xdef.hxx> #include <SwRewriter.hxx> -using namespace com::sun::star; +//UUUU +#include <svx/xfillit0.hxx> +#include <svx/xflftrit.hxx> +#include <svx/svdmodel.hxx> +#include <svx/drawitem.hxx> // The Format names in the list of all names have the // following family as their first character: @@ -68,6 +72,8 @@ using namespace com::sun::star; #define cPAGE (sal_Unicode)'g' #define cNUMRULE (sal_Unicode)'n' +using namespace com::sun::star; + // At the names' publication, this character is removed again and the // family is newly generated. @@ -768,6 +774,11 @@ OUString SwDocStyleSheet::GetDescription(SfxMapUnit eUnit) bool bHasCJKFontPrefix = false; SvtCJKOptions aCJKOptions; + //UUUU Get currently used FillStyle and remember, also need the XFillFloatTransparenceItem + // to decide if gradient transparence is used + const XFillStyle eFillStyle(static_cast< const XFillStyleItem& >(pSet->Get(XATTR_FILLSTYLE)).GetValue()); + const bool bUseFloatTransparence(static_cast< const XFillFloatTransparenceItem& >(pSet->Get(XATTR_FILLFLOATTRANSPARENCE)).IsEnabled()); + for ( const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem() ) { if(!IsInvalidItem(pItem)) @@ -795,6 +806,44 @@ OUString SwDocStyleSheet::GetDescription(SfxMapUnit eUnit) bool bIsDefault = false; switch ( pItem->Which() ) { + //UUUU + case XATTR_FILLCOLOR: + { + // only use active FillStyle information + bIsDefault = (XFILL_SOLID == eFillStyle); + break; + } + case XATTR_FILLGRADIENT: + { + // only use active FillStyle information + bIsDefault = (XFILL_GRADIENT == eFillStyle); + break; + } + case XATTR_FILLHATCH: + { + // only use active FillStyle information + bIsDefault = (XFILL_HATCH == eFillStyle); + break; + } + case XATTR_FILLBITMAP: + { + // only use active FillStyle information + bIsDefault = (XFILL_BITMAP == eFillStyle); + break; + } + case XATTR_FILLTRANSPARENCE: + { + // only active when not FloatTransparence + bIsDefault = !bUseFloatTransparence; + break; + } + case XATTR_FILLFLOATTRANSPARENCE: + { + // only active when FloatTransparence + bIsDefault = bUseFloatTransparence; + break; + } + case SID_ATTR_PARA_PAGENUM: sPageNum = aItemPresentation; break; @@ -1102,10 +1151,6 @@ bool SwDocStyleSheet::SetFollow( const OUString& rStr) // extract ItemSet to Name and Family, Mask -//UUUU -#include <svx/svdmodel.hxx> -#include <svx/drawitem.hxx> - SfxItemSet& SwDocStyleSheet::GetItemSet() { if(!bPhysical) @@ -1168,6 +1213,12 @@ SfxItemSet& SwDocStyleSheet::GetItemSet() case SFX_STYLE_FAMILY_PAGE : { + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + if(!aCoreSet.GetParent()) + { + aCoreSet.SetParent(&rDoc.GetDfltFrmFmt()->GetAttrSet()); + } + OSL_ENSURE(pDesc, "No PageDescriptor"); ::PageDescToItemSet(*((SwPageDesc*)pDesc), aCoreSet); } diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 98b4bad4a852..b1f04173bf80 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -20,7 +20,6 @@ #include "cmdid.h" #include "hintids.hxx" #include <algorithm> - #include <svl/eitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/ulspitem.hxx> @@ -37,6 +36,9 @@ #include "colex.hxx" #include "colmgr.hxx" +//UUUU +#include <svx/unobrushitemhelper.hxx> + // Taking the updated values from the set void SwPageExample::UpdateExample( const SfxItemSet& rSet ) { @@ -114,12 +116,20 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) SetHdLeft( rLR.GetLeft() ); SetHdRight( rLR.GetRight() ); SetHeader( true ); - if ( rHeaderSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET ) + + if(SFX_ITEM_SET == rHeaderSet.GetItemState(RES_BACKGROUND)) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rHeaderSet.Get( RES_BACKGROUND ); - SetHdColor( rItem.GetColor() ); + //UUUU create FillAttributes from SvxBrushItem //SetHdColor(rItem.GetColor()); + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(RES_BACKGROUND)); + SfxItemSet aTempSet(*rHeaderSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setHeaderFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + aTempSet))); } + if ( rHeaderSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) { const SvxBoxItem& rItem = @@ -153,12 +163,20 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) SetFtLeft( rLR.GetLeft() ); SetFtRight( rLR.GetRight() ); SetFooter( true ); + if( rFooterSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET ) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rFooterSet.Get( RES_BACKGROUND ); - SetFtColor( rItem.GetColor() ); + //UUUU create FillAttributes from SvxBrushItem //SetFtColor(rItem.GetColor()); + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rFooterSet.Get(RES_BACKGROUND)); + SfxItemSet aTempSet(*rFooterSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setFooterFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + aTempSet))); } + if( rFooterSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) { const SvxBoxItem& rItem = @@ -169,19 +187,18 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) else SetFooter( false ); } - if( SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, - false, &pItem ) ) - { - SetColor( ( (const SvxBrushItem*)pItem )->GetColor() ); - const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic(); - if ( pGrf ) - { - Bitmap aBitmap = pGrf->GetBitmap(); - SetBitmap( &aBitmap ); - } - else - SetBitmap( NULL ); + if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND, false, &pItem)) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem); + SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setPageFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + aTempSet))); } Invalidate(); @@ -215,14 +232,23 @@ void SwColExample::DrawPage( const Point& rOrg, - GetFtHeight() - GetFtDist(); DrawRect(aRect); - if(GetColor() == Color(COL_TRANSPARENT)) + //UUUU + const Rectangle aDefineRect(aRect); + + //UUUU + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes = getPageFillAttributes(); + + if(!rFillAttributes.get() || !rFillAttributes->isUsed()) { + //UUUU If there is no fill, use fallback color const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); const Color& rFieldColor = rStyleSettings.GetFieldColor(); - SetFillColor( rFieldColor ); + + setPageFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + rFieldColor))); } - else - SetFillColor( GetColor() ); // #97495# make sure that the automatic column width's are always equal bool bAutoWidth = pColMgr->IsAutoWidth(); @@ -242,7 +268,10 @@ void SwColExample::DrawPage( const Point& rOrg, if(!bAutoWidth) nAutoColWidth = pColMgr->GetColWidth( i ); aRect.Right() = aRect.Left() + nAutoColWidth; - DrawRect(aRect); + + //UUUU use primitive draw command + drawFillAttributes(getPageFillAttributes(), aRect, aDefineRect); + if(i < nColumnCount - 1) aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i); } diff --git a/sw/source/uibase/inc/swuipardlg.hxx b/sw/source/uibase/inc/swuipardlg.hxx index 99192eab4120..cf59afd6a9dd 100644 --- a/sw/source/uibase/inc/swuipardlg.hxx +++ b/sw/source/uibase/inc/swuipardlg.hxx @@ -34,6 +34,8 @@ class SwParaDlg: public SfxTabDialog sal_uInt16 m_nParaDrpCps; sal_uInt16 m_nParaBckGrnd; sal_uInt16 m_nParaBorder; + sal_uInt16 m_nAreaId; + sal_uInt16 m_nTransparenceId; void PageCreated(sal_uInt16 nId, SfxTabPage& rPage) SAL_OVERRIDE; diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 6d544b4bd240..57ab6e7256be 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -21,7 +21,6 @@ #include <hintids.hxx> #include <svl/urihelper.hxx> #include <svl/languageoptions.hxx> - #include <svx/svxids.hrc> #include <sfx2/linkmgr.hxx> #include <sfx2/htmlmode.hxx> @@ -95,7 +94,6 @@ #include <fmtinfmt.hxx> #include <doc.hxx> #include <IDocumentSettingAccess.hxx> - #include "swabstdlg.hxx" #include "dialog.hrc" #include "fldui.hrc" @@ -105,12 +103,14 @@ #include <svx/fmshell.hxx> #include <SwRewriter.hxx> #include <comcore.hrc> - #include <unomid.h> #include <svx/galleryitem.hxx> #include <com/sun/star/gallery/GalleryItemType.hpp> #include <boost/scoped_ptr.hpp> +//UUUU +#include <svx/unobrushitemhelper.hxx> + FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END; // These variables keep the state of Gallery (slot SID_GALLERY_BG_BRUSH) @@ -2134,27 +2134,10 @@ void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet ) void SwBaseShell::GetBckColState(SfxItemSet &rSet) { SwWrtShell &rSh = GetShell(); - SfxWhichIter aIter( rSet ); - sal_uInt16 nWhich = aIter.FirstWhich(); - int nSelType = rSh.GetSelectionType(); - - if( nSelType & nsSelectionType::SEL_OLE ) - { - rSet.DisableItem( SID_BACKGROUND_COLOR ); - return; - } - - if ( nSelType & nsSelectionType::SEL_FRM ) - { - bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0; - if (bParentCntProt) - { - rSet.DisableItem( SID_BACKGROUND_COLOR ); - return; - } - } - - SvxBrushItem aBrushItem( RES_BACKGROUND ); + SfxWhichIter aIter(rSet); + sal_uInt16 nWhich(aIter.FirstWhich()); + int nSelType(rSh.GetSelectionType()); + SvxBrushItem aBrushItem(RES_BACKGROUND); if( nsSelectionType::SEL_TBL_CELLS & nSelType ) { @@ -2162,54 +2145,41 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet) } else { - //UUUU - if(nSelType & nsSelectionType::SEL_GRF) - { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - - rSh.GetFlyFrmAttr( aCoreSet ); - aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); - } - else if(nsSelectionType::SEL_FRM & nSelType) - { - SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - const XFillStyleItem& rXFillStyleItem(static_cast< const XFillStyleItem& >(aCoreSet.Get(XATTR_FILLSTYLE))); + //UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set + SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - if(XFILL_SOLID == rXFillStyleItem.GetValue()) - { - const Color aFillColor(static_cast< const XFillColorItem& >(aCoreSet.Get(XATTR_FILLCOLOR)).GetColorValue()); + aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrmFmt()->GetAttrSet()); - aBrushItem.SetColor(aFillColor); - } - else - { - // keep default in SvxBrushItem which equals no fill - } + if(nSelType & nsSelectionType::SEL_GRF || nsSelectionType::SEL_FRM & nSelType) + { + rSh.GetFlyFrmAttr(aCoreSet); } else { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - - rSh.GetCurAttr( aCoreSet ); - aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); + rSh.GetCurAttr(aCoreSet); } + + aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND); } - while ( nWhich ) + while(nWhich) { switch(nWhich) { - case SID_BACKGROUND_COLOR : + case SID_BACKGROUND_COLOR: { - SvxColorItem aColorItem(aBrushItem.GetColor(), SID_BACKGROUND_COLOR); - rSet.Put( aColorItem, SID_BACKGROUND_COLOR ); + SvxColorItem aColorItem(aBrushItem.GetColor(),SID_BACKGROUND_COLOR); + rSet.Put(aColorItem,SID_BACKGROUND_COLOR); + break; } - break; case SID_ATTR_BRUSH: case RES_BACKGROUND: - rSet.Put( aBrushItem, GetPool().GetWhich(nWhich) ); - break; + { + rSet.Put(aBrushItem,GetPool().GetWhich(nWhich)); + break; + } } + nWhich = aIter.NextWhich(); } } @@ -2217,18 +2187,16 @@ void SwBaseShell::GetBckColState(SfxItemSet &rSet) void SwBaseShell::ExecBckCol(SfxRequest& rReq) { SwWrtShell &rSh = GetShell(); - int nSelType = rSh.GetSelectionType(); - if ( nSelType & nsSelectionType::SEL_OLE ) + int nSelType(rSh.GetSelectionType()); + const SfxItemSet* pArgs = rReq.GetArgs(); + sal_uInt16 nSlot(rReq.GetSlot()); + + if(!pArgs && nSlot != SID_BACKGROUND_COLOR) { return; } - const SfxItemSet* pArgs = rReq.GetArgs(); - sal_uInt16 nSlot = rReq.GetSlot(); - if( !pArgs && nSlot != SID_BACKGROUND_COLOR) - return ; - - SvxBrushItem aBrushItem( RES_BACKGROUND ); + SvxBrushItem aBrushItem(RES_BACKGROUND); if( nsSelectionType::SEL_TBL_CELLS & nSelType ) { @@ -2236,123 +2204,98 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) } else { - //UUUU - if(nSelType & nsSelectionType::SEL_GRF) - { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - - rSh.GetFlyFrmAttr( aCoreSet ); - aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); - } - else if(nsSelectionType::SEL_FRM & nSelType) - { - SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - const XFillStyleItem& rXFillStyleItem(static_cast< const XFillStyleItem& >(aCoreSet.Get(XATTR_FILLSTYLE))); + //UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set + SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - if(XFILL_SOLID == rXFillStyleItem.GetValue()) - { - const Color aFillColor(static_cast< const XFillColorItem& >(aCoreSet.Get(XATTR_FILLCOLOR)).GetColorValue()); + aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrmFmt()->GetAttrSet()); - aBrushItem.SetColor(aFillColor); - } - else - { - // keep default in SvxBrushItem which equals no fill - } + if((nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType)) + { + rSh.GetFlyFrmAttr(aCoreSet); } else { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - - rSh.GetCurAttr( aCoreSet ); - aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND); + rSh.GetCurAttr(aCoreSet); } + + aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND); } - switch (nSlot) + switch(nSlot) { - // RES_BACKGROUND (=SID_ATTR_BRUSH) must be set with two IDs: case SID_BACKGROUND_COLOR: - { - aBrushItem.SetGraphicPos(GPOS_NONE); + { + aBrushItem.SetGraphicPos(GPOS_NONE); - if(pArgs) - { - const SvxColorItem& rNewColorItem = (const SvxColorItem&) - pArgs->Get(SID_BACKGROUND_COLOR); - const Color& rNewColor = rNewColorItem.GetValue(); - aBrushItem.SetColor( rNewColor ); - GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem); - } - else - { - aBrushItem.SetColor( COL_TRANSPARENT ); - rReq.AppendItem( SvxColorItem( Color( COL_TRANSPARENT ), nSlot ) ); - } + if(pArgs) + { + const SvxColorItem& rNewColorItem = (const SvxColorItem&)pArgs->Get(SID_BACKGROUND_COLOR); + const Color& rNewColor = rNewColorItem.GetValue(); + aBrushItem.SetColor(rNewColor); + GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem); + } + else + { + aBrushItem.SetColor(COL_TRANSPARENT); + rReq.AppendItem(SvxColorItem(Color(COL_TRANSPARENT),nSlot)); } break; + } case SID_ATTR_BRUSH: case RES_BACKGROUND: { - const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&) - pArgs->Get( GetPool().GetWhich(nSlot) ); + const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&)pArgs->Get(GetPool().GetWhich(nSlot)); aBrushItem = rNewBrushItem; + break; } - break; default: + { rReq.Ignore(); OSL_FAIL("unknown message in ExecuteAttr!" ); return; + } } if( nsSelectionType::SEL_TBL_CELLS & nSelType ) { rSh.SetBoxBackground( aBrushItem ); } - //UUUU - else if(nsSelectionType::SEL_GRF & nSelType) - { - SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND); - aCoreSet.Put( aBrushItem ); - // Template autoupdate - SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); - if(pFmt && pFmt->IsAutoUpdateFmt()) - rSh.AutoUpdateFrame( pFmt, aCoreSet); - else - rSh.SetFlyFrmAttr( aCoreSet ); - } - else if(nsSelectionType::SEL_FRM & nSelType) + else { + //UUUU Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set SfxItemSet aCoreSet(GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); - // set FillStyle and color when applying - aCoreSet.Put(XFillStyleItem(XFILL_SOLID)); - aCoreSet.Put(XFillColorItem(OUString(), aBrushItem.GetColor())); - - // Vorlagen-AutoUpdate - SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); + aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrmFmt()->GetAttrSet()); + setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, aCoreSet); - if(pFmt && pFmt->IsAutoUpdateFmt()) + if((nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType)) { - rSh.AutoUpdateFrame( pFmt, aCoreSet); + // Template autoupdate + SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); + + if(pFmt && pFmt->IsAutoUpdateFmt()) + { + rSh.AutoUpdateFrame(pFmt, aCoreSet); + } + else + { + rSh.SetFlyFrmAttr(aCoreSet); + } } else { - rSh.SetFlyFrmAttr( aCoreSet ); - } - } - else - { - SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); - if( pColl && pColl->IsAutoUpdateFmt()) - { - SfxItemSet aSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND ); - aSet.Put(aBrushItem); - rSh.AutoUpdatePara( pColl, aSet); + SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); + + if(pColl && pColl->IsAutoUpdateFmt()) + { + rSh.AutoUpdatePara(pColl, aCoreSet); + } + else + { + rSh.SetAttrSet(aCoreSet); + } } - else - rSh.SetAttrItem( aBrushItem ); } rReq.Done(); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index a01bd9f8d267..3bb5a6301840 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -48,6 +48,7 @@ #include <editeng/svxacorr.hxx> #include <svl/cjkoptions.hxx> #include <svl/ctloptions.hxx> +#include <IDocumentDrawModelAccess.hxx> #include <IDocumentSettingAccess.hxx> #include <charfmt.hxx> #include <editeng/fontitem.hxx> @@ -107,6 +108,7 @@ #include <editeng/unolingu.hxx> #include <unotools/syslocaleoptions.hxx> #include <doc.hxx> +#include <drawdoc.hxx> #include <view.hxx> #include <ndtxt.hxx> #include <pam.hxx> @@ -117,6 +119,11 @@ #include <tools/diagnose_ex.h> #include <svx/nbdtmgfact.hxx> #include <svx/nbdtmg.hxx> + +//UUUU +#include <svx/svdmodel.hxx> +#include <svx/drawitem.hxx> + #include <numrule.hxx> #include <boost/scoped_ptr.hpp> @@ -891,23 +898,45 @@ void SwTextShell::Execute(SfxRequest &rReq) bool bApplyCharUnit = ::HasCharUnit(0 != PTR_CAST(SwWebView, &GetView())); SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit)); - SfxItemSet aCoreSet( GetPool(), - RES_PARATR_BEGIN, RES_PARATR_END - 1, - RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1, - RES_FRMATR_BEGIN, RES_FRMATR_END - 1, - SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS, - SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS, - SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, - SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP, - SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM, - SID_HTML_MODE, SID_HTML_MODE, - FN_PARAM_1, FN_PARAM_1, - FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT, - FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME, + SfxItemSet aCoreSet( GetPool(), //UUUU sorted by indices, one group of three concatenated + RES_PARATR_BEGIN, RES_PARATR_END - 1, // [60 + RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1, // [77 + RES_FRMATR_BEGIN, RES_FRMATR_END - 1, // [82 + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + // includes SID_ATTR_TABSTOP_POS + SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_OFFSET, // [10003 .. 10005 + + SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, // [10023 + SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP, // [10065 + + //UUUU items to hand over XPropertyList things like + // XColorList, XHatchList, XGradientList and XBitmapList + // to the Area TabPage + SID_COLOR_TABLE, SID_BITMAP_LIST, // [10179 + + SID_HTML_MODE, SID_HTML_MODE, // [10414 + SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM, // [10457 + FN_PARAM_1, FN_PARAM_1, // [21160 + FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT, // [21738 + FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME, // [22418 0); + // get also the list level indent values merged as LR-SPACE item, if needed. - rWrtSh.GetPaMAttr( pPaM, aCoreSet, true ); + rWrtSh.GetCurAttr( aCoreSet, true ); + + //UUUU create needed items for XPropertyList entries from the DrawModel so that + // the Area TabPage can access them + // Do this after GetCurAttr, this resets the ItemSet content again + const SdrModel* pDrawModel = GetView().GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel(); + + aCoreSet.Put(SvxColorListItem(pDrawModel->GetColorList(), SID_COLOR_TABLE)); + aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientList(), SID_GRADIENT_LIST)); + aCoreSet.Put(SvxHatchListItem(pDrawModel->GetHatchList(), SID_HATCH_LIST)); + aCoreSet.Put(SvxBitmapListItem(pDrawModel->GetBitmapList(), SID_BITMAP_LIST)); + aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index f545c04e55d3..171ee44c355f 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -25,7 +25,6 @@ #include <svl/aeitem.hxx> #include <svl/whiter.hxx> #include <svl/cjkoptions.hxx> - #include <sfx2/viewfrm.hxx> #include <sfx2/objitem.hxx> #include <svl/imageitm.hxx> @@ -57,10 +56,12 @@ #include <docary.hxx> #include <cmdid.h> - #include <IDocumentRedlineAccess.hxx> #include <doc.hxx> +//UUUU +#include <doc.hxx> + using namespace ::com::sun::star; void SwView::GetState(SfxItemSet &rSet) @@ -146,6 +147,15 @@ void SwView::GetState(SfxItemSet &rSet) { const sal_uInt16 nCurIdx = m_pWrtShell->GetCurPageDesc(); const SwPageDesc& rDesc = m_pWrtShell->GetPageDesc( nCurIdx ); + + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + if(!rSet.GetParent()) + { + const SwFrmFmt& rMaster = rDesc.GetMaster(); + + rSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet()); + } + ::PageDescToItemSet( rDesc, rSet); } break; diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 1327f482af25..48ffaaf80a48 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -448,13 +448,20 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) OSL_ENSURE(pHeaderFmt != 0, "no header format"); // HeaderInfo, margins, background, border - SfxItemSet aHeaderSet( *rSet.GetPool(), - SID_ATTR_PAGE_ON, SID_ATTR_PAGE_SHARED, - SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST, - SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, - RES_FRMATR_BEGIN, RES_FRMATR_END-1, - 0); + SfxItemSet aHeaderSet(*rSet.GetPool(), + RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [82 + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER, // [10023 + SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE, // [10051 + SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED, // [10060 + SID_ATTR_PAGE_SHARED_FIRST,SID_ATTR_PAGE_SHARED_FIRST, + 0, 0); + + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + aHeaderSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet()); // Dynamic or fixed height SfxBoolItem aOn(SID_ATTR_PAGE_ON, true); @@ -492,13 +499,20 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) OSL_ENSURE(pFooterFmt != 0, "no footer format"); // FooterInfo, margins, background, border - SfxItemSet aFooterSet( *rSet.GetPool(), - SID_ATTR_PAGE_ON, SID_ATTR_PAGE_SHARED, - SID_ATTR_PAGE_SHARED_FIRST, SID_ATTR_PAGE_SHARED_FIRST, - SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, - SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, - RES_FRMATR_BEGIN, RES_FRMATR_END-1, - 0); + SfxItemSet aFooterSet(*rSet.GetPool(), + RES_FRMATR_BEGIN,RES_FRMATR_END - 1, // [82 + + //UUUU FillAttribute support + XATTR_FILL_FIRST, XATTR_FILL_LAST, // [1014 + + SID_ATTR_BORDER_INNER,SID_ATTR_BORDER_INNER, // [10023 + SID_ATTR_PAGE_SIZE,SID_ATTR_PAGE_SIZE, // [10051 + SID_ATTR_PAGE_ON,SID_ATTR_PAGE_SHARED, // [10060 + SID_ATTR_PAGE_SHARED_FIRST,SID_ATTR_PAGE_SHARED_FIRST, + 0, 0); + + //UUUU set correct parent to get the XFILL_NONE FillStyle as needed + aFooterSet.SetParent(&rMaster.GetDoc()->GetDfltFrmFmt()->GetAttrSet()); // Dynamic or fixed height SfxBoolItem aOn(SID_ATTR_PAGE_ON, true); diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx index 65658d07a7eb..70f23c6b5491 100644 --- a/vcl/source/gdi/bmpacc3.cxx +++ b/vcl/source/gdi/bmpacc3.cxx @@ -36,6 +36,12 @@ void BitmapWriteAccess::SetLineColor( const Color& rColor ) mpLineColor = ( HasPalette() ? new BitmapColor( (sal_uInt8) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) ); } +void BitmapWriteAccess::SetFillColor() +{ + delete mpFillColor; + mpFillColor = NULL; +} + void BitmapWriteAccess::SetFillColor( const Color& rColor ) { delete mpFillColor; diff --git a/xmloff/inc/PageMasterImportContext.hxx b/xmloff/inc/PageMasterImportContext.hxx index bf9306d27110..876773da9499 100644 --- a/xmloff/inc/PageMasterImportContext.hxx +++ b/xmloff/inc/PageMasterImportContext.hxx @@ -25,7 +25,12 @@ class PageStyleContext : public XMLPropStyleContext { +private: OUString sPageUsage; + + //UUUU + bool m_bIsFillStyleAlreadyConverted : 1; + protected: virtual void SetAttribute( sal_uInt16 nPrefixKey, diff --git a/xmloff/inc/xmlsdtypes.hxx b/xmloff/inc/xmlsdtypes.hxx new file mode 100644 index 000000000000..fb13d9f1e77b --- /dev/null +++ b/xmloff/inc/xmlsdtypes.hxx @@ -0,0 +1,204 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLSDTYPES_HXX +#define _XMLSDTYPES_HXX + +//#include <xmloff/xmlnume.hxx> +//#include <xmloff/maptype.hxx> +#include <xmloff/xmltypes.hxx> +//#include <xmloff/xmlement.hxx> +//#include <xmloff/prhdlfac.hxx> +//#include <xmloff/xmlprmap.hxx> +//#include "xmloff/XMLTextListAutoStylePool.hxx" +//#include <xmloff/xmlexppr.hxx> + +////////////////////////////////////////////////////////////////////////////// +// types of own properties + +#define XML_SD_TYPE_STROKE (XML_SD_TYPES_START + 0) +#define XML_SD_TYPE_PRESPAGE_TYPE (XML_SD_TYPES_START + 1) +#define XML_SD_TYPE_PRESPAGE_STYLE (XML_SD_TYPES_START + 2) +#define XML_SD_TYPE_PRESPAGE_SPEED (XML_SD_TYPES_START + 3) +#define XML_SD_TYPE_PRESPAGE_DURATION (XML_SD_TYPES_START + 4) +#define XML_SD_TYPE_PRESPAGE_VISIBILITY (XML_SD_TYPES_START + 5) +#define XML_SD_TYPE_MARKER (XML_SD_TYPES_START + 6 ) +#define XML_SD_TYPE_OPACITY (XML_SD_TYPES_START + 7 ) +#define XML_SD_TYPE_LINEJOIN (XML_SD_TYPES_START + 8 ) +#define XML_SD_TYPE_FILLSTYLE (XML_SD_TYPES_START + 9 ) +#define XML_SD_TYPE_GRADIENT (XML_SD_TYPES_START + 10 ) +#define XML_SD_TYPE_GRADIENT_STEPCOUNT (XML_SD_TYPES_START + 11 ) +#define XML_SD_TYPE_SHADOW (XML_SD_TYPES_START + 12 ) +#define XML_SD_TYPE_TEXT_CROSSEDOUT (XML_SD_TYPES_START + 13 ) +#define XML_SD_TYPE_NUMBULLET (XML_SD_TYPES_START + 14 ) +#define XML_SD_TYPE_WRITINGMODE (XML_SD_TYPES_START + 15 ) +#define XML_SD_TYPE_BITMAP_MODE (XML_SD_TYPES_START + 16 ) +#define XML_SD_TYPE_BITMAPREPOFFSETX (XML_SD_TYPES_START + 17 ) +#define XML_SD_TYPE_BITMAPREPOFFSETY (XML_SD_TYPES_START + 18 ) +#define XML_SD_TYPE_FILLBITMAPSIZE (XML_SD_TYPES_START + 19 ) +#define XML_SD_TYPE_LOGICAL_SIZE (XML_SD_TYPES_START + 20 ) +#define XML_SD_TYPE_BITMAP_REFPOINT (XML_SD_TYPES_START + 21 ) +#define XML_SD_TYPE_PRESPAGE_BACKSIZE (XML_SD_TYPES_START + 22 ) +#define XML_TYPE_TEXT_ANIMATION_BLINKING (XML_SD_TYPES_START + 23 ) +#define XML_TYPE_TEXT_ANIMATION_STEPS (XML_SD_TYPES_START + 24 ) +#define XML_SD_TYPE_TEXT_ALIGN (XML_SD_TYPES_START + 25 ) +#define XML_SD_TYPE_VERTICAL_ALIGN (XML_SD_TYPES_START + 26 ) +#define XML_SD_TYPE_FITTOSIZE (XML_SD_TYPES_START + 27 ) +#define XML_SD_TYPE_MEASURE_HALIGN (XML_SD_TYPES_START + 28 ) +#define XML_SD_TYPE_MEASURE_VALIGN (XML_SD_TYPES_START + 29 ) +#define XML_SD_TYPE_MEASURE_UNIT (XML_SD_TYPES_START + 30 ) +#define XML_SD_TYPE_MEASURE_PLACING (XML_SD_TYPES_START + 31 ) +#define XML_SD_TYPE_CONTROL_BORDER (XML_SD_TYPES_START + 32 ) +#define XML_SD_TYPE_CONTROL_BORDER_COLOR (XML_SD_TYPES_START + 33 ) +#define XML_SD_TYPE_IMAGE_SCALE_MODE (XML_SD_TYPES_START + 34 ) +#define XML_SD_TYPE_LINECAP (XML_SD_TYPES_START + 35 ) + +////////////////////////////////////////////////////////////////////////////// +// 3D property types +#define XML_SD_TYPE_BACKFACE_CULLING (XML_SD_TYPES_START + 40 ) +#define XML_SD_TYPE_NORMALS_KIND (XML_SD_TYPES_START + 41 ) +#define XML_SD_TYPE_NORMALS_DIRECTION (XML_SD_TYPES_START + 42 ) +#define XML_SD_TYPE_TEX_GENERATION_MODE_X (XML_SD_TYPES_START + 43 ) +#define XML_SD_TYPE_TEX_GENERATION_MODE_Y (XML_SD_TYPES_START + 44 ) +#define XML_SD_TYPE_TEX_KIND (XML_SD_TYPES_START + 45 ) +#define XML_SD_TYPE_TEX_MODE (XML_SD_TYPES_START + 46 ) + +////////////////////////////////////////////////////////////////////////////// +// #FontWork# types +#define XML_SD_TYPE_FONTWORK_STYLE (XML_SD_TYPES_START + 47 ) +#define XML_SD_TYPE_FONTWORK_ADJUST (XML_SD_TYPES_START + 48 ) +#define XML_SD_TYPE_FONTWORK_SHADOW (XML_SD_TYPES_START + 49 ) +#define XML_SD_TYPE_FONTWORK_FORM (XML_SD_TYPES_START + 50 ) + +////////////////////////////////////////////////////////////////////////////// +// Caption types +#define XML_SD_TYPE_CAPTION_ANGLE_TYPE (XML_SD_TYPES_START + 60 ) +#define XML_SD_TYPE_CAPTION_IS_ESC_REL (XML_SD_TYPES_START + 61 ) +#define XML_SD_TYPE_CAPTION_ESC_REL (XML_SD_TYPES_START + 62 ) +#define XML_SD_TYPE_CAPTION_ESC_ABS (XML_SD_TYPES_START + 63 ) +#define XML_SD_TYPE_CAPTION_ESC_DIR (XML_SD_TYPES_START + 64 ) +#define XML_SD_TYPE_CAPTION_TYPE (XML_SD_TYPES_START + 65 ) + +////////////////////////////////////////////////////////////////////////////// +// header & footer types +#define XML_SD_TYPE_DATETIMEUPDATE (XML_SD_TYPES_START + 70 ) +#define XML_SD_TYPE_DATETIME_FORMAT (XML_SD_TYPES_START + 71 ) + +////////////////////////////////////////////////////////////////////////////// +// new types for merged style:protect attribute +#define XML_SD_TYPE_MOVE_PROTECT (XML_SD_TYPES_START + 72 ) +#define XML_SD_TYPE_SIZE_PROTECT (XML_SD_TYPES_START + 73 ) + +////////////////////////////////////////////////////////////////////////////// +// new type for style:mirror attribute +#define XML_TYPE_SD_MIRROR (XML_SD_TYPES_START + 74 ) + +////////////////////////////////////////////////////////////////////////////// +// new smil transition types for pages +#define XML_SD_TYPE_TRANSITION_TYPE (XML_SD_TYPES_START + 75 ) +#define XML_SD_TYPE_TRANSTIION_SUBTYPE (XML_SD_TYPES_START + 76 ) +#define XML_SD_TYPE_TRANSTIION_DIRECTION (XML_SD_TYPES_START + 77 ) +#define XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE (XML_SD_TYPES_START + 78 ) + +////////////////////////////////////////////////////////////////////////////// + +#define CTF_NUMBERINGRULES 1000 +#define CTF_CONTROLWRITINGMODE 1001 +#define CTF_WRITINGMODE 1002 +#define CTF_REPEAT_OFFSET_X 1003 +#define CTF_REPEAT_OFFSET_Y 1004 +#define CTF_PAGE_SOUND_URL 1005 +#define CTF_PAGE_VISIBLE 1006 +#define CTF_PAGE_TRANS_TYPE 1007 +#define CTF_PAGE_TRANS_STYLE 1008 +#define CTF_PAGE_TRANS_SPEED 1009 +#define CTF_PAGE_TRANS_DURATION 1010 +#define CTF_PAGE_BACKSIZE 1011 +#define CTF_DASHNAME 1012 +#define CTF_LINESTARTNAME 1013 +#define CTF_LINEENDNAME 1014 +#define CTF_FILLGRADIENTNAME 1015 +#define CTF_FILLHATCHNAME 1016 +#define CTF_FILLBITMAPNAME 1017 +#define CTF_FILLTRANSNAME 1018 +#define CTF_TEXTANIMATION_BLINKING 1019 +#define CTF_TEXTANIMATION_KIND 1020 + +#define CTF_PAGE_TRANSITION_TYPE 1021 +#define CTF_PAGE_TRANSITION_SUBTYPE 1022 +#define CTF_PAGE_TRANSITION_DIRECTION 1023 +#define CTF_PAGE_TRANSITION_FADECOLOR 1024 + +////////////////////////////////////////////////////////////////////////////// +// #FontWork# +#define CTF_FONTWORK_STYLE 1021 +#define CTF_FONTWORK_ADJUST 1022 +#define CTF_FONTWORK_DISTANCE 1023 +#define CTF_FONTWORK_START 1024 +#define CTF_FONTWORK_MIRROR 1025 +#define CTF_FONTWORK_OUTLINE 1026 +#define CTF_FONTWORK_SHADOW 1027 +#define CTF_FONTWORK_SHADOWCOLOR 1028 +#define CTF_FONTWORK_SHADOWOFFSETX 1029 +#define CTF_FONTWORK_SHADOWOFFSETY 1030 +#define CTF_FONTWORK_FORM 1031 +#define CTF_FONTWORK_HIDEFORM 1032 +#define CTF_FONTWORK_SHADOWTRANSPARENCE 1033 + +////////////////////////////////////////////////////////////////////////////// +// OLE part 1 +#define CTF_SD_OLE_VIS_AREA_IMPORT_LEFT 1040 +#define CTF_SD_OLE_VIS_AREA_IMPORT_TOP 1041 +#define CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH 1042 +#define CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT 1043 +#define CTF_SD_OLE_ISINTERNAL 1044 + +#define CTF_SD_MOVE_PROTECT 1045 +#define CTF_SD_SIZE_PROTECT 1046 + +////////////////////////////////////////////////////////////////////////////// +// caption +#define CTF_CAPTION_ISESCREL 1047 +#define CTF_CAPTION_ESCREL 1048 +#define CTF_CAPTION_ESCABS 1049 + +////////////////////////////////////////////////////////////////////////////// +// header&footer +#define CTF_HEADER_VISIBLE 1050 +#define CTF_FOOTER_VISIBLE 1051 +#define CTF_PAGE_NUMBER_VISIBLE 1052 +#define CTF_DATE_TIME_VISIBLE 1053 +#define CTF_HEADER_TEXT 1054 +#define CTF_FOOTER_TEXT 1055 +#define CTF_DATE_TIME_TEXT 1056 +#define CTF_DATE_TIME_FORMAT 1057 +#define CTF_DATE_TIME_UPDATE 1058 + +////////////////////////////////////////////////////////////////////////////// +// OLE part 2 +#define CTF_SD_OLE_ASPECT 1059 +#define CTF_SD_OLE_VIS_AREA_EXPORT_LEFT 1060 +#define CTF_SD_OLE_VIS_AREA_EXPORT_TOP 1061 +#define CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH 1062 +#define CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT 1063 + +////////////////////////////////////////////////////////////////////////////// + +#endif // _XMLSDTYPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/draw/XMLShapeStyleContext.cxx b/xmloff/source/draw/XMLShapeStyleContext.cxx index fad397572064..5ee61370ebff 100644 --- a/xmloff/source/draw/XMLShapeStyleContext.cxx +++ b/xmloff/source/draw/XMLShapeStyleContext.cxx @@ -54,7 +54,7 @@ XMLShapeStyleContext::XMLShapeStyleContext( sal_uInt16 nFamily) : XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ), m_bIsNumRuleAlreadyConverted( false ), - m_bIsFillStyleAlreadyConverted( false ) //UUUU + m_bIsFillStyleAlreadyConverted(false) //UUUU { } @@ -186,77 +186,15 @@ void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet } } + //UUUU need to filter out old fill definitions when the new ones are used. The new + // ones are used when a FillStyle is defined if(!m_bIsFillStyleAlreadyConverted && GetProperties().size()) { - const UniReference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper(); - ::std::vector< XMLPropertyState >& rProperties = GetProperties(); - ::std::vector< XMLPropertyState >::iterator a; - FillStyle eFS(FillStyle_NONE); static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle")); - // try to find a FillStyle entry and a value from it - for(a = rProperties.begin(); a != rProperties.end(); ++a) + if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle)) { - if(a->mnIndex != -1) - { - const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex); - - if(rPropName == s_FillStyle) - { - if(a->maValue >>= eFS) - { - // okay, type was good, eFS is set - } - else - { - // also try an int (see XFillStyleItem::PutValue) - sal_Int32 nFS = 0; - - if(a->maValue >>= nFS) - { - eFS = (FillStyle)nFS; - } - } - - // exit loop, we found out what we needed to know - break; - } - } - } - - if(FillStyle_NONE != eFS) - { - //UUUU a FillStyle was found, thus the new [XATTR_FILL_FIRST .. XATTR_FILL_LAST] - // description for the Fill definitions is used. All formally used props based - // on RES_BACKGROUND need to be deleted to get no conflicts between the two - // sets of properties; old files will keep these and adapt accordingly - static ::rtl::OUString s_BackColorRGB(RTL_CONSTASCII_USTRINGPARAM("BackColorRGB")); - static ::rtl::OUString s_BackTransparent(RTL_CONSTASCII_USTRINGPARAM("BackTransparent")); - static ::rtl::OUString s_BackColorTransparency(RTL_CONSTASCII_USTRINGPARAM("BackColorTransparency")); - static ::rtl::OUString s_BackGraphicURL(RTL_CONSTASCII_USTRINGPARAM("BackGraphicURL")); - static ::rtl::OUString s_BackGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("BackGraphicFilter")); - static ::rtl::OUString s_BackGraphicLocation(RTL_CONSTASCII_USTRINGPARAM("BackGraphicLocation")); - static ::rtl::OUString s_BackGraphicTransparency(RTL_CONSTASCII_USTRINGPARAM("BackGraphicTransparency")); - - for(a = rProperties.begin(); a != rProperties.end(); ++a) - { - if(a->mnIndex != -1) - { - const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex); - - if(s_BackColorRGB == rPropName - || s_BackTransparent == rPropName - || s_BackColorTransparency == rPropName - || s_BackGraphicURL == rPropName - || s_BackGraphicFilter == rPropName - || s_BackGraphicLocation == rPropName - || s_BackGraphicTransparency== rPropName) - { - // mark entry as inactive - a->mnIndex = -1; - } - } - } + deactivateOldFillStyleDefinitions(getStandardSet()); } m_bIsFillStyleAlreadyConverted = true; diff --git a/xmloff/source/draw/sdpropls.hxx b/xmloff/source/draw/sdpropls.hxx index 7f0247f2d508..d784a2f4c5c3 100644 --- a/xmloff/source/draw/sdpropls.hxx +++ b/xmloff/source/draw/sdpropls.hxx @@ -28,6 +28,7 @@ #include <xmloff/prhdlfac.hxx> #include <xmloff/xmlprmap.hxx> #include <xmloff/xmlexppr.hxx> +#include <xmlsdtypes.hxx> // entry list for graphic properties @@ -38,161 +39,6 @@ extern const XMLPropertyMapEntry aXMLSDProperties[]; extern const XMLPropertyMapEntry aXMLSDPresPageProps[]; extern const XMLPropertyMapEntry aXMLSDPresPageProps_onlyHeadersFooter[]; -// types of own properties - -#define XML_SD_TYPE_STROKE (XML_SD_TYPES_START + 0) -#define XML_SD_TYPE_PRESPAGE_TYPE (XML_SD_TYPES_START + 1) -#define XML_SD_TYPE_PRESPAGE_STYLE (XML_SD_TYPES_START + 2) -#define XML_SD_TYPE_PRESPAGE_SPEED (XML_SD_TYPES_START + 3) -#define XML_SD_TYPE_PRESPAGE_DURATION (XML_SD_TYPES_START + 4) -#define XML_SD_TYPE_PRESPAGE_VISIBILITY (XML_SD_TYPES_START + 5) -#define XML_SD_TYPE_MARKER (XML_SD_TYPES_START + 6 ) -#define XML_SD_TYPE_OPACITY (XML_SD_TYPES_START + 7 ) -#define XML_SD_TYPE_LINEJOIN (XML_SD_TYPES_START + 8 ) -#define XML_SD_TYPE_FILLSTYLE (XML_SD_TYPES_START + 9 ) -#define XML_SD_TYPE_GRADIENT (XML_SD_TYPES_START + 10 ) -#define XML_SD_TYPE_GRADIENT_STEPCOUNT (XML_SD_TYPES_START + 11 ) -#define XML_SD_TYPE_SHADOW (XML_SD_TYPES_START + 12 ) -#define XML_SD_TYPE_TEXT_CROSSEDOUT (XML_SD_TYPES_START + 13 ) -#define XML_SD_TYPE_NUMBULLET (XML_SD_TYPES_START + 14 ) -#define XML_SD_TYPE_WRITINGMODE (XML_SD_TYPES_START + 15 ) -#define XML_SD_TYPE_BITMAP_MODE (XML_SD_TYPES_START + 16 ) -#define XML_SD_TYPE_BITMAPREPOFFSETX (XML_SD_TYPES_START + 17 ) -#define XML_SD_TYPE_BITMAPREPOFFSETY (XML_SD_TYPES_START + 18 ) -#define XML_SD_TYPE_FILLBITMAPSIZE (XML_SD_TYPES_START + 19 ) -#define XML_SD_TYPE_LOGICAL_SIZE (XML_SD_TYPES_START + 20 ) -#define XML_SD_TYPE_BITMAP_REFPOINT (XML_SD_TYPES_START + 21 ) -#define XML_SD_TYPE_PRESPAGE_BACKSIZE (XML_SD_TYPES_START + 22 ) -#define XML_TYPE_TEXT_ANIMATION_BLINKING (XML_SD_TYPES_START + 23 ) -#define XML_TYPE_TEXT_ANIMATION_STEPS (XML_SD_TYPES_START + 24 ) -#define XML_SD_TYPE_TEXT_ALIGN (XML_SD_TYPES_START + 25 ) -#define XML_SD_TYPE_VERTICAL_ALIGN (XML_SD_TYPES_START + 26 ) -#define XML_SD_TYPE_FITTOSIZE (XML_SD_TYPES_START + 27 ) -#define XML_SD_TYPE_MEASURE_HALIGN (XML_SD_TYPES_START + 28 ) -#define XML_SD_TYPE_MEASURE_VALIGN (XML_SD_TYPES_START + 29 ) -#define XML_SD_TYPE_MEASURE_UNIT (XML_SD_TYPES_START + 30 ) -#define XML_SD_TYPE_MEASURE_PLACING (XML_SD_TYPES_START + 31 ) -#define XML_SD_TYPE_CONTROL_BORDER (XML_SD_TYPES_START + 32 ) -#define XML_SD_TYPE_CONTROL_BORDER_COLOR (XML_SD_TYPES_START + 33 ) -#define XML_SD_TYPE_IMAGE_SCALE_MODE (XML_SD_TYPES_START + 34 ) -#define XML_SD_TYPE_LINECAP (XML_SD_TYPES_START + 35 ) - -// 3D property types -#define XML_SD_TYPE_BACKFACE_CULLING (XML_SD_TYPES_START + 40 ) -#define XML_SD_TYPE_NORMALS_KIND (XML_SD_TYPES_START + 41 ) -#define XML_SD_TYPE_NORMALS_DIRECTION (XML_SD_TYPES_START + 42 ) -#define XML_SD_TYPE_TEX_GENERATION_MODE_X (XML_SD_TYPES_START + 43 ) -#define XML_SD_TYPE_TEX_GENERATION_MODE_Y (XML_SD_TYPES_START + 44 ) -#define XML_SD_TYPE_TEX_KIND (XML_SD_TYPES_START + 45 ) -#define XML_SD_TYPE_TEX_MODE (XML_SD_TYPES_START + 46 ) - -// #FontWork# types -#define XML_SD_TYPE_FONTWORK_STYLE (XML_SD_TYPES_START + 47 ) -#define XML_SD_TYPE_FONTWORK_ADJUST (XML_SD_TYPES_START + 48 ) -#define XML_SD_TYPE_FONTWORK_SHADOW (XML_SD_TYPES_START + 49 ) -#define XML_SD_TYPE_FONTWORK_FORM (XML_SD_TYPES_START + 50 ) - -// Caption types -#define XML_SD_TYPE_CAPTION_ANGLE_TYPE (XML_SD_TYPES_START + 60 ) -#define XML_SD_TYPE_CAPTION_IS_ESC_REL (XML_SD_TYPES_START + 61 ) -#define XML_SD_TYPE_CAPTION_ESC_REL (XML_SD_TYPES_START + 62 ) -#define XML_SD_TYPE_CAPTION_ESC_ABS (XML_SD_TYPES_START + 63 ) -#define XML_SD_TYPE_CAPTION_ESC_DIR (XML_SD_TYPES_START + 64 ) -#define XML_SD_TYPE_CAPTION_TYPE (XML_SD_TYPES_START + 65 ) - -// header & footer types -#define XML_SD_TYPE_DATETIMEUPDATE (XML_SD_TYPES_START + 70 ) -#define XML_SD_TYPE_DATETIME_FORMAT (XML_SD_TYPES_START + 71 ) - -// new types for merged style:protect attribute -#define XML_SD_TYPE_MOVE_PROTECT (XML_SD_TYPES_START + 72 ) -#define XML_SD_TYPE_SIZE_PROTECT (XML_SD_TYPES_START + 73 ) - -// new type for style:mirror attribute -#define XML_TYPE_SD_MIRROR (XML_SD_TYPES_START + 74 ) - -// new smil transition types for pages -#define XML_SD_TYPE_TRANSITION_TYPE (XML_SD_TYPES_START + 75 ) -#define XML_SD_TYPE_TRANSTIION_SUBTYPE (XML_SD_TYPES_START + 76 ) -#define XML_SD_TYPE_TRANSTIION_DIRECTION (XML_SD_TYPES_START + 77 ) - -#define XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE (XML_SD_TYPES_START + 78 ) - -#define CTF_NUMBERINGRULES 1000 -#define CTF_CONTROLWRITINGMODE 1001 -#define CTF_WRITINGMODE 1002 -#define CTF_REPEAT_OFFSET_X 1003 -#define CTF_REPEAT_OFFSET_Y 1004 -#define CTF_PAGE_SOUND_URL 1005 -#define CTF_PAGE_VISIBLE 1006 -#define CTF_PAGE_TRANS_TYPE 1007 -#define CTF_PAGE_TRANS_STYLE 1008 -#define CTF_PAGE_TRANS_SPEED 1009 -#define CTF_PAGE_TRANS_DURATION 1010 -#define CTF_PAGE_BACKSIZE 1011 -#define CTF_DASHNAME 1012 -#define CTF_LINESTARTNAME 1013 -#define CTF_LINEENDNAME 1014 -#define CTF_FILLGRADIENTNAME 1015 -#define CTF_FILLHATCHNAME 1016 -#define CTF_FILLBITMAPNAME 1017 -#define CTF_FILLTRANSNAME 1018 -#define CTF_TEXTANIMATION_BLINKING 1019 -#define CTF_TEXTANIMATION_KIND 1020 - -#define CTF_PAGE_TRANSITION_TYPE 1021 -#define CTF_PAGE_TRANSITION_SUBTYPE 1022 -#define CTF_PAGE_TRANSITION_DIRECTION 1023 -#define CTF_PAGE_TRANSITION_FADECOLOR 1024 - -// #FontWork# -#define CTF_FONTWORK_STYLE 1021 -#define CTF_FONTWORK_ADJUST 1022 -#define CTF_FONTWORK_DISTANCE 1023 -#define CTF_FONTWORK_START 1024 -#define CTF_FONTWORK_MIRROR 1025 -#define CTF_FONTWORK_OUTLINE 1026 -#define CTF_FONTWORK_SHADOW 1027 -#define CTF_FONTWORK_SHADOWCOLOR 1028 -#define CTF_FONTWORK_SHADOWOFFSETX 1029 -#define CTF_FONTWORK_SHADOWOFFSETY 1030 -#define CTF_FONTWORK_FORM 1031 -#define CTF_FONTWORK_HIDEFORM 1032 -#define CTF_FONTWORK_SHADOWTRANSPARENCE 1033 - -// OLE part 1 -#define CTF_SD_OLE_VIS_AREA_IMPORT_LEFT 1040 -#define CTF_SD_OLE_VIS_AREA_IMPORT_TOP 1041 -#define CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH 1042 -#define CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT 1043 -#define CTF_SD_OLE_ISINTERNAL 1044 - -#define CTF_SD_MOVE_PROTECT 1045 -#define CTF_SD_SIZE_PROTECT 1046 - -// caption -#define CTF_CAPTION_ISESCREL 1047 -#define CTF_CAPTION_ESCREL 1048 -#define CTF_CAPTION_ESCABS 1049 - -// header&footer -#define CTF_HEADER_VISIBLE 1050 -#define CTF_FOOTER_VISIBLE 1051 -#define CTF_PAGE_NUMBER_VISIBLE 1052 -#define CTF_DATE_TIME_VISIBLE 1053 -#define CTF_HEADER_TEXT 1054 -#define CTF_FOOTER_TEXT 1055 -#define CTF_DATE_TIME_TEXT 1056 -#define CTF_DATE_TIME_FORMAT 1057 -#define CTF_DATE_TIME_UPDATE 1058 - -// OLE part 2 -#define CTF_SD_OLE_ASPECT 1059 -#define CTF_SD_OLE_VIS_AREA_EXPORT_LEFT 1060 -#define CTF_SD_OLE_VIS_AREA_EXPORT_TOP 1061 -#define CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH 1062 -#define CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT 1063 - // enum maps for attributes extern SvXMLEnumMapEntry const aXML_ConnectionKind_EnumMap[]; diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx index b8b2ada6dcb3..17a9522a817d 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -26,6 +26,9 @@ #include <rtl/ustrbuf.hxx> #include <comphelper/extract.hxx> +//UUUU +#include <xmloff/txtprmap.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -332,6 +335,14 @@ void XMLPageMasterExportPropMapper::ContextFilter( XMLPropertyState* pPrint = NULL; + //UUUU + XMLPropertyState* pRepeatOffsetX = NULL; + XMLPropertyState* pRepeatOffsetY = NULL; + XMLPropertyState* pHeaderRepeatOffsetX = NULL; + XMLPropertyState* pHeaderRepeatOffsetY = NULL; + XMLPropertyState* pFooterRepeatOffsetX = NULL; + XMLPropertyState* pFooterRepeatOffsetY = NULL; + UniReference < XMLPropertySetMapper > aPropMapper(getPropertySetMapper()); for( ::std::vector< XMLPropertyState >::iterator aIter = rPropState.begin(); aIter != rPropState.end(); ++aIter ) @@ -390,7 +401,64 @@ void XMLPageMasterExportPropMapper::ContextFilter( case CTP_PM_GRID_BASE_WIDTH: pPMGridBaseWidth = pProp; break; case CTP_PM_GRID_SNAP_TO_CHARS: pPMGridSnapToChars = pProp; break; case CTP_PM_GRID_SNAP_TO: pPMGridSnapTo = pProp; break; + + //UUUU + case CTF_PM_REPEAT_OFFSET_X: + pRepeatOffsetX = pProp; + break; + + //UUUU + case CTF_PM_REPEAT_OFFSET_Y: + pRepeatOffsetY = pProp; + break; + + //UUUU + case CTF_PM_HEADERREPEAT_OFFSET_X: + pHeaderRepeatOffsetX = pProp; + break; + + //UUUU + case CTF_PM_HEADERREPEAT_OFFSET_Y: + pHeaderRepeatOffsetY = pProp; + break; + + //UUUU + case CTF_PM_FOOTERREPEAT_OFFSET_X: + pFooterRepeatOffsetX = pProp; + break; + + //UUUU + case CTF_PM_FOOTERREPEAT_OFFSET_Y: + pFooterRepeatOffsetY = pProp; + break; + + //UUUU Sort out empty entries + case CTF_PM_FILLGRADIENTNAME: + case CTF_PM_FILLHATCHNAME: + case CTF_PM_FILLBITMAPNAME: + case CTF_PM_FILLTRANSNAME: + + case CTF_PM_HEADERFILLGRADIENTNAME: + case CTF_PM_HEADERFILLHATCHNAME: + case CTF_PM_HEADERFILLBITMAPNAME: + case CTF_PM_HEADERFILLTRANSNAME: + + case CTF_PM_FOOTERFILLGRADIENTNAME: + case CTF_PM_FOOTERFILLHATCHNAME: + case CTF_PM_FOOTERFILLBITMAPNAME: + case CTF_PM_FOOTERFILLTRANSNAME: + { + rtl::OUString aStr; + + if( (pProp->maValue >>= aStr) && 0 == aStr.getLength() ) + { + pProp->mnIndex = -1; + } + + break; + } } + if (nPrintId == CTF_PM_PRINTMASK) { pPrint = pProp; @@ -398,6 +466,54 @@ void XMLPageMasterExportPropMapper::ContextFilter( } } + //UUUU These entries need to be reduced to a single one for XML export. + // Both would be exported as 'draw:tile-repeat-offset' following a percent + // value and a 'vertical' or 'horizontal' tag as mark. If both would be active + // and both would be exported this would create an XML error (same property twice) + if(pRepeatOffsetX && pRepeatOffsetY) + { + sal_Int32 nOffset(0); + + if((pRepeatOffsetX->maValue >>= nOffset) && (!nOffset)) + { + pRepeatOffsetX->mnIndex = -1; + } + else + { + pRepeatOffsetY->mnIndex = -1; + } + } + + //UUUU Same as above for Header + if(pHeaderRepeatOffsetX && pHeaderRepeatOffsetY) + { + sal_Int32 nOffset(0); + + if((pHeaderRepeatOffsetX->maValue >>= nOffset) && (!nOffset)) + { + pHeaderRepeatOffsetX->mnIndex = -1; + } + else + { + pHeaderRepeatOffsetY->mnIndex = -1; + } + } + + //UUUU Same as above for Footer + if(pFooterRepeatOffsetX && pFooterRepeatOffsetY) + { + sal_Int32 nOffset(0); + + if((pFooterRepeatOffsetX->maValue >>= nOffset) && (!nOffset)) + { + pFooterRepeatOffsetX->mnIndex = -1; + } + else + { + pFooterRepeatOffsetY->mnIndex = -1; + } + } + if( pPMStandardMode && !getBOOL(pPMStandardMode->maValue) ) { lcl_RemoveState(pPMStandardMode); diff --git a/xmloff/source/style/PageMasterImportContext.cxx b/xmloff/source/style/PageMasterImportContext.cxx index c2589eb07a5b..a88d204462ef 100644 --- a/xmloff/source/style/PageMasterImportContext.cxx +++ b/xmloff/source/style/PageMasterImportContext.cxx @@ -28,11 +28,19 @@ #include <xmloff/PageMasterStyleMap.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +//UUUU +#include <xmlsdtypes.hxx> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <xmloff/xmlerror.hxx> + using namespace ::com::sun::star; using namespace ::xmloff::token; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; +//UUUU +using namespace ::com::sun::star::beans; + void PageStyleContext::SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName, const OUString& rValue ) @@ -56,7 +64,8 @@ PageStyleContext::PageStyleContext( SvXMLImport& rImport, SvXMLStylesContext& rStyles, bool bDefaultStyle) : XMLPropStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, XML_STYLE_FAMILY_PAGE_MASTER, bDefaultStyle), - sPageUsage() + sPageUsage(), + m_bIsFillStyleAlreadyConverted(false) //UUUU { } @@ -153,10 +162,148 @@ SvXMLImportContext *PageStyleContext::CreateChildContext( return pContext; } -void PageStyleContext::FillPropertySet( - const uno::Reference<beans::XPropertySet > & rPropSet ) +void PageStyleContext::FillPropertySet(const uno::Reference<beans::XPropertySet > & rPropSet) { - XMLPropStyleContext::FillPropertySet(rPropSet); + //UUUU need to filter out old fill definitions when the new ones are used. The new + // ones are used when a FillStyle is defined + if(!m_bIsFillStyleAlreadyConverted && GetProperties().size()) + { + static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle")); + static ::rtl::OUString s_HeaderFillStyle(RTL_CONSTASCII_USTRINGPARAM("HeaderFillStyle")); + static ::rtl::OUString s_FooterFillStyle(RTL_CONSTASCII_USTRINGPARAM("FooterFillStyle")); + + if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle)) + { + deactivateOldFillStyleDefinitions(getStandardSet()); + } + + if(doNewDrawingLayerFillStyleDefinitionsExist(s_HeaderFillStyle)) + { + deactivateOldFillStyleDefinitions(getHeaderSet()); + } + + if(doNewDrawingLayerFillStyleDefinitionsExist(s_FooterFillStyle)) + { + deactivateOldFillStyleDefinitions(getFooterSet()); + } + + m_bIsFillStyleAlreadyConverted = true; + } + + //UUUU do not use XMLPropStyleContext::FillPropertySet, we need to handle this ourselves since + // we have properties which use the MID_FLAG_NO_PROPERTY_IMPORT flag since they need some special + // handling + UniReference < SvXMLImportPropertyMapper > xImpPrMap = GetStyles()->GetImportPropertyMapper(GetFamily()); + + if(xImpPrMap.is()) + { + // properties that need special handling because they need the used name to be translated first + struct _ContextID_Index_Pair aContextIDs[] = + { + { CTF_PM_FILLGRADIENTNAME, -1 }, + { CTF_PM_FILLTRANSNAME, -1 }, + { CTF_PM_FILLHATCHNAME, -1 }, + { CTF_PM_FILLBITMAPNAME, -1 }, + + // also need to special handling for header entries + { CTF_PM_HEADERFILLGRADIENTNAME, -1 }, + { CTF_PM_HEADERFILLTRANSNAME, -1 }, + { CTF_PM_HEADERFILLHATCHNAME, -1 }, + { CTF_PM_HEADERFILLBITMAPNAME, -1 }, + + // also need to special handling for footer entries + { CTF_PM_FOOTERFILLGRADIENTNAME, -1 }, + { CTF_PM_FOOTERFILLTRANSNAME, -1 }, + { CTF_PM_FOOTERFILLHATCHNAME, -1 }, + { CTF_PM_FOOTERFILLBITMAPNAME, -1 }, + + {-1, -1} + }; + + // the style families associated with the same index modulo 4 + static sal_uInt16 aFamilies[] = + { + XML_STYLE_FAMILY_SD_GRADIENT_ID, + XML_STYLE_FAMILY_SD_GRADIENT_ID, + XML_STYLE_FAMILY_SD_HATCH_ID, + XML_STYLE_FAMILY_SD_FILL_IMAGE_ID + }; + + //UUUU Fill PropertySet, but let it handle special properties not itself + xImpPrMap->FillPropertySet(GetProperties(), rPropSet, aContextIDs); + + // get property set mapper + const UniReference< XMLPropertySetMapper >& rMapper = xImpPrMap->getPropertySetMapper(); + Reference< XPropertySetInfo > xInfo; + + //UUUU handle special attributes which have MID_FLAG_NO_PROPERTY_IMPORT set + for(sal_uInt16 i = 0; aContextIDs[i].nContextID != -1; i++) + { + sal_Int32 nIndex = aContextIDs[i].nIndex; + + if(nIndex != -1) + { + switch(aContextIDs[i].nContextID) + { + case CTF_PM_FILLGRADIENTNAME: + case CTF_PM_FILLTRANSNAME: + case CTF_PM_FILLHATCHNAME: + case CTF_PM_FILLBITMAPNAME: + + case CTF_PM_HEADERFILLGRADIENTNAME: + case CTF_PM_HEADERFILLTRANSNAME: + case CTF_PM_HEADERFILLHATCHNAME: + case CTF_PM_HEADERFILLBITMAPNAME: + + case CTF_PM_FOOTERFILLGRADIENTNAME: + case CTF_PM_FOOTERFILLTRANSNAME: + case CTF_PM_FOOTERFILLHATCHNAME: + case CTF_PM_FOOTERFILLBITMAPNAME: + { + struct XMLPropertyState& rState = GetProperties()[nIndex]; + rtl::OUString sStyleName; + rState.maValue >>= sStyleName; + + //UUUU translate the used name from ODF intern to the name used in the Model + sStyleName = GetImport().GetStyleDisplayName(aFamilies[i%4], sStyleName); + + try + { + // set property + const rtl::OUString& rPropertyName = rMapper->GetEntryAPIName(rState.mnIndex); + + if(!xInfo.is()) + { + xInfo = rPropSet->getPropertySetInfo(); + } + + if(xInfo->hasPropertyByName(rPropertyName)) + { + rPropSet->setPropertyValue(rPropertyName,Any(sStyleName)); + } + } + catch(::com::sun::star::lang::IllegalArgumentException& e) + { + Sequence< rtl::OUString > aSeq(1); + aSeq[0] = sStyleName; + GetImport().SetError( + XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING, + aSeq,e.Message,NULL); + } + break; + } + } + } + } + } + else + { + OSL_ENSURE(xImpPrMap.is(), "Got no SvXMLImportPropertyMapper (!)"); + } + + //UUUU old code, replaced by above stuff + // XMLPropStyleContext::FillPropertySet(rPropSet); + if (!sPageUsage.isEmpty()) { uno::Any aPageUsage; diff --git a/xmloff/source/style/PageMasterPropHdlFactory.cxx b/xmloff/source/style/PageMasterPropHdlFactory.cxx index 337103586c07..a90132e1e639 100644 --- a/xmloff/source/style/PageMasterPropHdlFactory.cxx +++ b/xmloff/source/style/PageMasterPropHdlFactory.cxx @@ -28,8 +28,24 @@ #include <xmloff/PageMasterStyleMap.hxx> #include <com/sun/star/text/TextGridMode.hpp> +//UUUU +#include <xmloff/EnumPropertyHdl.hxx> +#include <com/sun/star/drawing/FillStyle.hpp> +#include "XMLFillBitmapSizePropertyHandler.hxx" +#include "XMLBitmapLogicalSizePropertyHandler.hxx" +#include <com/sun/star/drawing/RectanglePoint.hpp> +#include <com/sun/star/drawing/BitmapMode.hpp> +#include "XMLBitmapRepeatOffsetPropertyHandler.hxx" + using namespace ::xmloff::token; using namespace ::com::sun::star; +//UUUU +using namespace ::com::sun::star::drawing; + +//UUUU +extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[]; +extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[]; +extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[]; static SvXMLEnumMapEntry const aXML_TextGridMode_ConstantMap[] = { @@ -118,6 +134,34 @@ const XMLPropertyHandler* XMLPageMasterPropHdlFactory::GetPropertyHandler( sal_I pHdl = new XMLConstantsPropertyHandler( aXML_TextGridMode_ConstantMap, XML_NONE ); break; + + //UUUU + case XML_SW_TYPE_FILLSTYLE: + pHdl = new XMLEnumPropertyHdl( aXML_FillStyle_EnumMap, ::getCppuType((const FillStyle*)0) ); + break; + case XML_SW_TYPE_FILLBITMAPSIZE: + pHdl = new XMLFillBitmapSizePropertyHandler(); + break; + case XML_SW_TYPE_LOGICAL_SIZE: + pHdl = new XMLBitmapLogicalSizePropertyHandler(); + break; + case XML_SW_TYPE_BITMAP_REFPOINT: + pHdl = new XMLEnumPropertyHdl( aXML_RefPoint_EnumMap, getCppuType((const RectanglePoint*)0) ); + break; + case XML_SW_TYPE_BITMAP_MODE: + pHdl = new XMLEnumPropertyHdl( aXML_BitmapMode_EnumMap, getCppuType((const BitmapMode*)0) ); + break; + case XML_SW_TYPE_BITMAPREPOFFSETX: + case XML_SW_TYPE_BITMAPREPOFFSETY: + pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType); + break; + + //UUUU + default: + { + OSL_ENSURE(false, "XMLPropertyHandler missing (!)"); + break; + } } if( pHdl ) diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx index 1fe2c173e426..92c6ee68fde9 100644 --- a/xmloff/source/style/PageMasterStyleMap.cxx +++ b/xmloff/source/style/PageMasterStyleMap.cxx @@ -21,6 +21,9 @@ #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> +//UUUU +#include <xmloff/txtprmap.hxx> + using namespace ::xmloff::token; #define MAP(name,prefix,token,type,context,version) { name, sizeof(name)-1, prefix, token, type, context, version, false } @@ -33,61 +36,65 @@ using namespace ::xmloff::token; const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = { -// page master - PLMAP( "PageStyleLayout", XML_NAMESPACE_STYLE, XML_PAGE_USAGE, XML_PM_TYPE_PAGESTYLELAYOUT | MID_FLAG_SPECIAL_ITEM, CTF_PM_PAGEUSAGE ), - PLMAP( "Width", XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_TYPE_MEASURE, 0 ), - PLMAP( "Height", XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_TYPE_MEASURE, 0 ), - PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_PM_TYPE_NUMFORMAT | MID_FLAG_MERGE_PROPERTY, 0 ), - PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_PM_TYPE_NUMLETTERSYNC, 0 ), - PLMAP( "PrinterPaperTray", XML_NAMESPACE_STYLE, XML_PAPER_TRAY_NAME, XML_TYPE_STRING | MID_FLAG_PROPERTY_MAY_EXCEPT, 0 ), - PLMAP( "IsLandscape", XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PM_TYPE_PRINTORIENTATION, 0 ), - PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_MARGINALL ), - PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_MARGINTOP ), - PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_MARGINBOTTOM ), - PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_MARGINLEFT ), - PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_MARGINRIGHT ), - PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_BORDERALL ), - PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_BORDERTOP ), - PLMAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_BORDERBOTTOM ), - PLMAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, CTF_PM_BORDERLEFT ), - PLMAP( "RightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, CTF_PM_BORDERRIGHT ), - PLMAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHALL ), - PLMAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHTOP ), - PLMAP( "BottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHBOTTOM ), - PLMAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHLEFT ), - PLMAP( "RightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHRIGHT ), - PLMAP( "TopBorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE, CTF_PM_PADDINGALL ), - PLMAP( "TopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE, CTF_PM_PADDINGTOP ), - PLMAP( "BottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_PM_PADDINGBOTTOM ), - PLMAP( "LeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE, CTF_PM_PADDINGLEFT ), - PLMAP( "RightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE, CTF_PM_PADDINGRIGHT ), - PLMAP( "ShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW, 0 ), - PLMAP( "BackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY, 0 ), - PLMAP( "BackTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, 0 ), - PLMAP( "BackGraphicLocation", XML_NAMESPACE_STYLE, XML_POSITION, XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM, CTF_PM_GRAPHICPOSITION ), - PLMAP( "BackGraphicFilter", XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM, CTF_PM_GRAPHICFILTER ), - PLMAP( "BackGraphicURL", XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_PM_GRAPHICURL ), - PLMAP( "PrintAnnotations", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTANNOTATIONS | MID_FLAG_MULTI_PROPERTY, CTF_PM_PRINT_ANNOTATIONS ), - PLMAP( "PrintCharts", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTCHARTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_CHARTS ), - PLMAP( "PrintDrawing", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTDRAWING | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_DRAWING ), - PLMAP( "PrintFormulas", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTFORMULAS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_FORMULAS ), - PLMAP( "PrintGrid", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTGRID | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_GRID ), - PLMAP( "PrintHeaders", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTHEADERS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_HEADERS ), - PLMAP( "PrintObjects", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTOBJECTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_OBJECTS ), - PLMAP( "PrintZeroValues", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTZEROVALUES | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_ZEROVALUES ), - PLMAP( "PrintDownFirst", XML_NAMESPACE_STYLE, XML_PRINT_PAGE_ORDER, XML_PM_TYPE_PRINTPAGEORDER, 0 ), - PLMAP( "FirstPageNumber", XML_NAMESPACE_STYLE, XML_FIRST_PAGE_NUMBER, XML_PM_TYPE_FIRSTPAGENUMBER, 0 ), - PLMAP( "PageScale", XML_NAMESPACE_STYLE, XML_SCALE_TO, XML_TYPE_PERCENT16, CTF_PM_SCALETO ), - PLMAP( "ScaleToPages", XML_NAMESPACE_STYLE, XML_SCALE_TO_PAGES, XML_TYPE_NUMBER16, CTF_PM_SCALETOPAGES ), - PLMAP( "ScaleToPagesX", XML_NAMESPACE_STYLE, XML_SCALE_TO_X, XML_TYPE_NUMBER16, CTF_PM_SCALETOX ), - PLMAP( "ScaleToPagesY", XML_NAMESPACE_STYLE, XML_SCALE_TO_Y, XML_TYPE_NUMBER16, CTF_PM_SCALETOY ), + ////////////////////////////////////////////////////////////////////////// + //UUUU Section for 'page-layout-properties' + + // page master + PLMAP( "PageStyleLayout", XML_NAMESPACE_STYLE, XML_PAGE_USAGE, XML_PM_TYPE_PAGESTYLELAYOUT | MID_FLAG_SPECIAL_ITEM, CTF_PM_PAGEUSAGE ), + PLMAP( "Width", XML_NAMESPACE_FO, XML_PAGE_WIDTH, XML_TYPE_MEASURE, 0 ), + PLMAP( "Height", XML_NAMESPACE_FO, XML_PAGE_HEIGHT, XML_TYPE_MEASURE, 0 ), + PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_FORMAT, XML_PM_TYPE_NUMFORMAT | MID_FLAG_MERGE_PROPERTY, 0 ), + PLMAP( "NumberingType", XML_NAMESPACE_STYLE, XML_NUM_LETTER_SYNC, XML_PM_TYPE_NUMLETTERSYNC, 0 ), + PLMAP( "PrinterPaperTray", XML_NAMESPACE_STYLE, XML_PAPER_TRAY_NAME, XML_TYPE_STRING | MID_FLAG_PROPERTY_MAY_EXCEPT, 0 ), + PLMAP( "IsLandscape", XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PM_TYPE_PRINTORIENTATION, 0 ), + PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_MARGINALL ), + PLMAP( "TopMargin", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_MARGINTOP ), + PLMAP( "BottomMargin", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_MARGINBOTTOM ), + PLMAP( "LeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_MARGINLEFT ), + PLMAP( "RightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_MARGINRIGHT ), + PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_BORDERALL ), + PLMAP( "TopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_BORDERTOP ), + PLMAP( "BottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_BORDERBOTTOM ), + PLMAP( "LeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, CTF_PM_BORDERLEFT ), + PLMAP( "RightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, CTF_PM_BORDERRIGHT ), + PLMAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHALL ), + PLMAP( "TopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHTOP ), + PLMAP( "BottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHBOTTOM ), + PLMAP( "LeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHLEFT ), + PLMAP( "RightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_PM_BORDERWIDTHRIGHT ), + PLMAP( "TopBorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE, CTF_PM_PADDINGALL ), + PLMAP( "TopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE, CTF_PM_PADDINGTOP ), + PLMAP( "BottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_PM_PADDINGBOTTOM ), + PLMAP( "LeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE, CTF_PM_PADDINGLEFT ), + PLMAP( "RightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE, CTF_PM_PADDINGRIGHT ), + PLMAP( "ShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW, 0 ), + PLMAP( "BackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY, 0 ), + PLMAP( "BackTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, 0 ), + PLMAP( "BackGraphicLocation", XML_NAMESPACE_STYLE, XML_POSITION, XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM, CTF_PM_GRAPHICPOSITION ), + PLMAP( "BackGraphicFilter", XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM, CTF_PM_GRAPHICFILTER ), + PLMAP( "BackGraphicURL", XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_PM_GRAPHICURL ), + PLMAP( "PrintAnnotations", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTANNOTATIONS | MID_FLAG_MULTI_PROPERTY, CTF_PM_PRINT_ANNOTATIONS ), + PLMAP( "PrintCharts", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTCHARTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_CHARTS ), + PLMAP( "PrintDrawing", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTDRAWING | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_DRAWING ), + PLMAP( "PrintFormulas", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTFORMULAS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_FORMULAS ), + PLMAP( "PrintGrid", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTGRID | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_GRID ), + PLMAP( "PrintHeaders", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTHEADERS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_HEADERS ), + PLMAP( "PrintObjects", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTOBJECTS | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_OBJECTS ), + PLMAP( "PrintZeroValues", XML_NAMESPACE_STYLE, XML_PRINT, XML_PM_TYPE_PRINTZEROVALUES | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_PRINT_ZEROVALUES ), + PLMAP( "PrintDownFirst", XML_NAMESPACE_STYLE, XML_PRINT_PAGE_ORDER, XML_PM_TYPE_PRINTPAGEORDER, 0 ), + PLMAP( "FirstPageNumber", XML_NAMESPACE_STYLE, XML_FIRST_PAGE_NUMBER, XML_PM_TYPE_FIRSTPAGENUMBER, 0 ), + PLMAP( "PageScale", XML_NAMESPACE_STYLE, XML_SCALE_TO, XML_TYPE_PERCENT16, CTF_PM_SCALETO ), + PLMAP( "ScaleToPages", XML_NAMESPACE_STYLE, XML_SCALE_TO_PAGES, XML_TYPE_NUMBER16, CTF_PM_SCALETOPAGES ), + PLMAP( "ScaleToPagesX", XML_NAMESPACE_STYLE, XML_SCALE_TO_X, XML_TYPE_NUMBER16, CTF_PM_SCALETOX ), + PLMAP( "ScaleToPagesY", XML_NAMESPACE_STYLE, XML_SCALE_TO_Y, XML_TYPE_NUMBER16, CTF_PM_SCALETOY ), PLMAP( "CenterHorizontally", XML_NAMESPACE_STYLE, XML_TABLE_CENTERING, XML_PM_TYPE_CENTER_HORIZONTAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ), - PLMAP( "CenterVertically", XML_NAMESPACE_STYLE, XML_TABLE_CENTERING, XML_PM_TYPE_CENTER_VERTICAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ), - PLMAP( "TextColumns", XML_NAMESPACE_STYLE, XML_COLUMNS, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_PM_TEXTCOLUMNS ), - PLMAP( "RegisterModeActive", XML_NAMESPACE_STYLE, XML_REGISTER_TRUE, XML_TYPE_BOOL, 0 ), - PLMAP( "RegisterParagraphStyle", XML_NAMESPACE_STYLE, XML_REGISTER_TRUTH_REF_STYLE_NAME, XML_TYPE_STYLENAME| MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_PM_REGISTER_STYLE ), + PLMAP( "CenterVertically", XML_NAMESPACE_STYLE, XML_TABLE_CENTERING, XML_PM_TYPE_CENTER_VERTICAL | MID_FLAG_MULTI_PROPERTY | MID_FLAG_MERGE_ATTRIBUTE, 0 ), + PLMAP( "TextColumns", XML_NAMESPACE_STYLE, XML_COLUMNS, MID_FLAG_ELEMENT_ITEM|XML_TYPE_TEXT_COLUMNS, CTF_PM_TEXTCOLUMNS ), + PLMAP( "RegisterModeActive", XML_NAMESPACE_STYLE, XML_REGISTER_TRUE, XML_TYPE_BOOL, 0 ), + PLMAP( "RegisterParagraphStyle", XML_NAMESPACE_STYLE, XML_REGISTER_TRUTH_REF_STYLE_NAME, XML_TYPE_STYLENAME| MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_PM_REGISTER_STYLE ), PLMAP( "WritingMode", XML_NAMESPACE_STYLE, XML_WRITING_MODE, XML_TYPE_TEXT_WRITING_MODE, 0 ), + // Index 53: Grid definitions PLMAP( "GridColor", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_COLOR, XML_TYPE_COLOR, 0 ), PLMAP( "GridLines", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_LINES, XML_TYPE_NUMBER16, 0 ), PLMAP( "GridBaseHeight", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_BASE_HEIGHT, XML_TYPE_MEASURE, 0 ), @@ -103,81 +110,158 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] = //export as a default attribute PLMAP_12( "StandardPageMode", XML_NAMESPACE_STYLE, XML_LAYOUT_GRID_STANDARD_MODE, XML_TYPE_BOOL|MID_FLAG_DEFAULT_ITEM_EXPORT, CTF_PM_STANDARD_MODE ), - PLMAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ), + PLMAP( "UserDefinedAttributes", XML_NAMESPACE_TEXT, XML_XMLNS, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ), + + //UUUUIndex 65: fill attributes; use PLMAP macro here instead of GMAP, tis list is ordered and it's order is used + // to decide in which section in ODF to export the contained stuff (the PageMasterStyle creates several XML + // sections, for Page, Header and Footer). The needed order seems to rely not on filtering, but using sections + // based on the order used in this list. + // Also need own defines for the used context flags (e.g. CTF_PM_FILLGRADIENTNAME instead of + // CTF_FILLGRADIENTNAME) since these are used to *filter* up to which entry the attributes belong to the + // 'page-layout-properties' section (!), see SvXMLAutoStylePoolP_Impl::exportXML, look for XML_STYLE_FAMILY_PAGE_MASTER + PLMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, 0 ), + PLMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ), + PLMAP( "FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0 ), + PLMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLGRADIENTNAME ), + PLMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ), + PLMAP( "FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLHATCHNAME ), + PLMAP( "FillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, 0 ), + PLMAP( "FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLBITMAPNAME ), + PLMAP( "FillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too + PLMAP( "FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FILLTRANSNAME ), + PLMAP( "FillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ), + PLMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ), + PLMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ), + PLMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ), + PLMAP( "FillBitmapMode", XML_NAMESPACE_STYLE, XML_REPEAT, XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, 0 ), + PLMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ), + PLMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ), + PLMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, 0 ), + PLMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_X ), + PLMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_PM_REPEAT_OFFSET_Y ), -// footnote + // Index 85: footnote PLMAP( "FootnoteHeight", XML_NAMESPACE_STYLE, XML_FOOTNOTE_MAX_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FTN_HEIGHT ), - PLMAP( "FootnoteLineAdjust", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_TEXT_HORIZONTAL_ADJUST|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_ADJUST ), - PLMAP( "FootnoteLineColor", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_COLOR ), - PLMAP( "FootnoteLineDistance", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM,CTF_PM_FTN_DISTANCE ), + PLMAP( "FootnoteLineAdjust", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_TEXT_HORIZONTAL_ADJUST|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_ADJUST ), + PLMAP( "FootnoteLineColor", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_COLOR|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_COLOR ), + PLMAP( "FootnoteLineDistance", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM,CTF_PM_FTN_DISTANCE ), PLMAP( "FootnoteLineRelativeWidth", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_PERCENT8|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_WIDTH ), - PLMAP( "FootnoteLineTextDistance", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_DISTANCE ), - PLMAP( "FootnoteLineWeight", XML_NAMESPACE_STYLE, XML_FOOTNOTE_SEP, XML_TYPE_MEASURE16|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_WEIGHT ), - PLMAP( "FootnoteLineStyle", XML_NAMESPACE_STYLE, XML_EMPTY, XML_TYPE_STRING|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_STYLE ), - -// header - HFMAP( "HeaderHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERHEIGHT ), - HFMAP( "HeaderHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMINHEIGHT ), - HFMAP( "HeaderIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_HEADERDYNAMIC ), - HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINALL ), - HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINLEFT ), - HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINRIGHT ), - HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINBOTTOM ), - HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_HEADERBORDERALL ), - HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_HEADERBORDERTOP ), - HFMAP( "HeaderBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_HEADERBORDERBOTTOM ), - HFMAP( "HeaderLeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, CTF_PM_HEADERBORDERLEFT ), - HFMAP( "HeaderRightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, CTF_PM_HEADERBORDERRIGHT ), - HFMAP( "HeaderTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHALL ), - HFMAP( "HeaderTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHTOP ), - HFMAP( "HeaderBottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHBOTTOM ), - HFMAP( "HeaderLeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHLEFT ), - HFMAP( "HeaderRightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHRIGHT ), - HFMAP( "HeaderTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGALL ), - HFMAP( "HeaderTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGTOP ), - HFMAP( "HeaderBottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGBOTTOM ), - HFMAP( "HeaderLeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGLEFT ), - HFMAP( "HeaderRightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGRIGHT ), - HFMAP( "HeaderShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW, CTF_PM_HEADERFLAG ), - HFMAP( "HeaderBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ), - HFMAP( "HeaderBackTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_HEADERFLAG ), - HFMAP( "HeaderBackGraphicLocation", XML_NAMESPACE_STYLE, XML_POSITION, XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM, CTF_PM_HEADERGRAPHICPOSITION ), - HFMAP( "HeaderBackGraphicFilter", XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM, CTF_PM_HEADERGRAPHICFILTER ), - HFMAP( "HeaderBackGraphicURL", XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_PM_HEADERGRAPHICURL ), + PLMAP( "FootnoteLineTextDistance", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_DISTANCE ), + PLMAP( "FootnoteLineWeight", XML_NAMESPACE_STYLE, XML_FOOTNOTE_SEP, XML_TYPE_MEASURE16|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_WEIGHT ), + + ////////////////////////////////////////////////////////////////////////// + //UUUUIndex 92: Section for 'header-style' own section, all members *have* to use CTF_PM_HEADERFLAG in the context entry (the 5th one) + HFMAP( "HeaderHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERHEIGHT ), + HFMAP( "HeaderHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMINHEIGHT ), + HFMAP( "HeaderIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_HEADERDYNAMIC ), + HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINALL ), + HFMAP( "HeaderLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINLEFT ), + HFMAP( "HeaderRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINRIGHT ), + HFMAP( "HeaderBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERMARGINBOTTOM ), + HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_HEADERBORDERALL ), + HFMAP( "HeaderTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_HEADERBORDERTOP ), + HFMAP( "HeaderBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_HEADERBORDERBOTTOM ), + HFMAP( "HeaderLeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, CTF_PM_HEADERBORDERLEFT ), + HFMAP( "HeaderRightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, CTF_PM_HEADERBORDERRIGHT ), + HFMAP( "HeaderTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHALL ), + HFMAP( "HeaderTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHTOP ), + HFMAP( "HeaderBottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHBOTTOM ), + HFMAP( "HeaderLeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHLEFT ), + HFMAP( "HeaderRightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_PM_HEADERBORDERWIDTHRIGHT ), + HFMAP( "HeaderTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGALL ), + HFMAP( "HeaderTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGTOP ), + HFMAP( "HeaderBottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGBOTTOM ), + HFMAP( "HeaderLeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGLEFT ), + HFMAP( "HeaderRightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE, CTF_PM_HEADERPADDINGRIGHT ), + HFMAP( "HeaderShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderBackTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderBackGraphicLocation", XML_NAMESPACE_STYLE, XML_POSITION, XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM, CTF_PM_HEADERGRAPHICPOSITION ), + HFMAP( "HeaderBackGraphicFilter", XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM, CTF_PM_HEADERGRAPHICFILTER ), + HFMAP( "HeaderBackGraphicURL", XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_PM_HEADERGRAPHICURL ), HFMAP( "HeaderDynamicSpacing", XML_NAMESPACE_STYLE, XML_DYNAMIC_SPACING, XML_TYPE_BOOL, CTF_PM_HEADERFLAG ), -// footer - HFMAP( "FooterHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERHEIGHT ), - HFMAP( "FooterHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMINHEIGHT ), - HFMAP( "FooterIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_FOOTERDYNAMIC ), - HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINALL ), - HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINLEFT ), - HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINRIGHT ), - HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINTOP ), - HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERALL ), - HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERTOP ), - HFMAP( "FooterBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERBOTTOM ), - HFMAP( "FooterLeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERLEFT ), - HFMAP( "FooterRightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERRIGHT ), - HFMAP( "FooterTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHALL ), - HFMAP( "FooterTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHTOP ), - HFMAP( "FooterBottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHBOTTOM ), - HFMAP( "FooterLeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHLEFT ), - HFMAP( "FooterRightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHRIGHT ), - HFMAP( "FooterTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGALL ), - HFMAP( "FooterTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGTOP ), - HFMAP( "FooterBottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGBOTTOM ), - HFMAP( "FooterLeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGLEFT ), - HFMAP( "FooterRightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGRIGHT ), - HFMAP( "FooterShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW, CTF_PM_FOOTERFLAG ), - HFMAP( "FooterBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ), - HFMAP( "FooterBackTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_FOOTERFLAG ), - HFMAP( "FooterBackGraphicLocation", XML_NAMESPACE_STYLE, XML_POSITION, XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM, CTF_PM_FOOTERGRAPHICPOSITION ), - HFMAP( "FooterBackGraphicFilter", XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM, CTF_PM_FOOTERGRAPHICFILTER ), - HFMAP( "FooterBackGraphicURL", XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_PM_FOOTERGRAPHICURL ), + //UUUUIndex 121: Header DrawingLayer FillAttributes + // Use HFMAP to get XML_TYPE_PROP_HEADER_FOOTER ORed to the 4th entry + // Names have to begin with 'Header', all 5th entries need to be ORed with the CTF_PM_HEADERFLAG + HFMAP( "HeaderFillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_HEADERFILLGRADIENTNAME ), + HFMAP( "HeaderFillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_HEADERFILLHATCHNAME ), + HFMAP( "HeaderFillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_HEADERFILLBITMAPNAME ), + HFMAP( "HeaderFillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ), // exists in SW, too + HFMAP( "HeaderFillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_HEADERFILLTRANSNAME ), + HFMAP( "HeaderFillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillBitmapMode", XML_NAMESPACE_STYLE, XML_REPEAT, XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, CTF_PM_HEADERFLAG ), + HFMAP( "HeaderFillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERREPEAT_OFFSET_X ), + HFMAP( "HeaderFillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_PM_HEADERREPEAT_OFFSET_Y ), + + ////////////////////////////////////////////////////////////////////////// + //UUUUIndex 141: Section for 'footer-style' own section, all members *have* to use CTF_PM_FOOTERFLAG in the context entry (the 5th one) + HFMAP( "FooterHeight", XML_NAMESPACE_SVG, XML_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERHEIGHT ), + HFMAP( "FooterHeight", XML_NAMESPACE_FO, XML_MIN_HEIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMINHEIGHT ), + HFMAP( "FooterIsDynamicHeight", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_BOOL, CTF_PM_FOOTERDYNAMIC ), + HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINALL ), + HFMAP( "FooterLeftMargin", XML_NAMESPACE_FO, XML_MARGIN_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINLEFT ), + HFMAP( "FooterRightMargin", XML_NAMESPACE_FO, XML_MARGIN_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINRIGHT ), + HFMAP( "FooterBodyDistance", XML_NAMESPACE_FO, XML_MARGIN_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERMARGINTOP ), + HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERALL ), + HFMAP( "FooterTopBorder", XML_NAMESPACE_FO, XML_BORDER_TOP, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERTOP ), + HFMAP( "FooterBottomBorder", XML_NAMESPACE_FO, XML_BORDER_BOTTOM, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERBOTTOM ), + HFMAP( "FooterLeftBorder", XML_NAMESPACE_FO, XML_BORDER_LEFT, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERLEFT ), + HFMAP( "FooterRightBorder", XML_NAMESPACE_FO, XML_BORDER_RIGHT, XML_TYPE_BORDER, CTF_PM_FOOTERBORDERRIGHT ), + HFMAP( "FooterTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHALL ), + HFMAP( "FooterTopBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_TOP, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHTOP ), + HFMAP( "FooterBottomBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_BOTTOM, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHBOTTOM ), + HFMAP( "FooterLeftBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHLEFT ), + HFMAP( "FooterRightBorder", XML_NAMESPACE_STYLE, XML_BORDER_LINE_WIDTH_RIGHT, XML_TYPE_BORDER_WIDTH, CTF_PM_FOOTERBORDERWIDTHRIGHT ), + HFMAP( "FooterTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGALL ), + HFMAP( "FooterTopBorderDistance", XML_NAMESPACE_FO, XML_PADDING_TOP, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGTOP ), + HFMAP( "FooterBottomBorderDistance", XML_NAMESPACE_FO, XML_PADDING_BOTTOM, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGBOTTOM ), + HFMAP( "FooterLeftBorderDistance", XML_NAMESPACE_FO, XML_PADDING_LEFT, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGLEFT ), + HFMAP( "FooterRightBorderDistance", XML_NAMESPACE_FO, XML_PADDING_RIGHT, XML_TYPE_MEASURE, CTF_PM_FOOTERPADDINGRIGHT ), + HFMAP( "FooterShadowFormat", XML_NAMESPACE_STYLE, XML_SHADOW, XML_TYPE_TEXT_SHADOW, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterBackColor", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT | MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterBackTransparent", XML_NAMESPACE_FO, XML_BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterBackGraphicLocation", XML_NAMESPACE_STYLE, XML_POSITION, XML_TYPE_BUILDIN_CMP_ONLY | MID_FLAG_SPECIAL_ITEM, CTF_PM_FOOTERGRAPHICPOSITION ), + HFMAP( "FooterBackGraphicFilter", XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TYPE_STRING | MID_FLAG_SPECIAL_ITEM, CTF_PM_FOOTERGRAPHICFILTER ), + HFMAP( "FooterBackGraphicURL", XML_NAMESPACE_STYLE, XML_BACKGROUND_IMAGE, XML_TYPE_STRING | MID_FLAG_ELEMENT_ITEM, CTF_PM_FOOTERGRAPHICURL ), HFMAP( "FooterDynamicSpacing", XML_NAMESPACE_STYLE, XML_DYNAMIC_SPACING, XML_TYPE_BOOL, CTF_PM_FOOTERFLAG ), - { 0L, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010, false } + //UUUUIndex 170: Footer DrawingLayer FillAttributes + // Use HFMAP to get XML_TYPE_PROP_HEADER_FOOTER ORed to the 4th entry + // Names have to begin with 'Footer', all 5th entries need to be ORed with the CTF_PM_FOOTERFLAG + HFMAP( "FooterFillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FOOTERFILLGRADIENTNAME ), + HFMAP( "FooterFillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FOOTERFILLHATCHNAME ), + HFMAP( "FooterFillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FOOTERFILLBITMAPNAME ), + HFMAP( "FooterFillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ), // exists in SW, too + HFMAP( "FooterFillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_PM_FOOTERFILLTRANSNAME ), + HFMAP( "FooterFillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillBitmapMode", XML_NAMESPACE_STYLE, XML_REPEAT, XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, CTF_PM_FOOTERFLAG ), + HFMAP( "FooterFillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERREPEAT_OFFSET_X ), + HFMAP( "FooterFillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_PM_FOOTERREPEAT_OFFSET_Y ), + + { 0L, 0, 0, XML_EMPTY, 0, 0, SvtSaveOptions::ODFVER_010, false } // index 190 }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index 7b98643f5420..828b4a45f31b 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -30,11 +30,12 @@ #include <com/sun/star/beans/XMultiPropertyStates.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <xmloff/xmlimp.hxx> - #include <xmloff/prstylei.hxx> #include <xmloff/attrlist.hxx> #include <xmloff/xmlerror.hxx> +//UUUU +#include <com/sun/star/drawing/FillStyle.hpp> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -45,6 +46,8 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; using namespace ::xmloff::token; +//UUUU +using namespace com::sun::star::drawing; void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName, @@ -62,6 +65,12 @@ void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey, TYPEINIT1( XMLPropStyleContext, SvXMLStyleContext ); +//UUUU +OldFillStyleDefinitionSet XMLPropStyleContext::maStandardSet; +OldFillStyleDefinitionSet XMLPropStyleContext::maHeaderSet; +OldFillStyleDefinitionSet XMLPropStyleContext::maFooterSet; +OldFillStyleDefinitionSet XMLPropStyleContext::maParaSet; + XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< XAttributeList > & xAttrList, @@ -78,6 +87,74 @@ XMLPropStyleContext::~XMLPropStyleContext() { } +const OldFillStyleDefinitionSet& XMLPropStyleContext::getStandardSet() +{ + if(maStandardSet.empty()) + { + maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackColorRGB"))); + maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackTransparent"))); + maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackColorTransparency"))); + maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicURL"))); + maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicFilter"))); + maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicLocation"))); + maStandardSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BackGraphicTransparency"))); + } + + return maStandardSet; +} + +const OldFillStyleDefinitionSet& XMLPropStyleContext::getHeaderSet() +{ + if(maHeaderSet.empty()) + { + maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackColorRGB"))); + maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackTransparent"))); + maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackColorTransparency"))); + maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicURL"))); + maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicFilter"))); + maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicLocation"))); + maHeaderSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeaderBackGraphicTransparency"))); + } + + return maHeaderSet; +} + +const OldFillStyleDefinitionSet& XMLPropStyleContext::getFooterSet() +{ + if(maFooterSet.empty()) + { + maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackColorRGB"))); + maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackTransparent"))); + maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackColorTransparency"))); + maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicURL"))); + maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicFilter"))); + maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicLocation"))); + maFooterSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FooterBackGraphicTransparency"))); + } + + return maFooterSet; +} + +const OldFillStyleDefinitionSet& XMLPropStyleContext::getParaSet() +{ + if(maParaSet.empty()) + { + // Caution: here it is *not* 'ParaBackColorRGB' as it should be, but indeed + // 'ParaBackColor' is used, see aXMLParaPropMap definition (line 313) + maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColor"))); + maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackTransparent"))); + maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicLocation"))); + maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicFilter"))); + maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicURL"))); + + // These are not used in aXMLParaPropMap definition, thus not needed here + // maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColorTransparency"))); + // maParaSet.insert(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackGraphicTransparency"))); + } + + return maParaSet; +} + SvXMLImportContext *XMLPropStyleContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, @@ -172,16 +249,45 @@ typedef ::std::set < OUString > PropertyNameSet; void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) { - if( ((SvXMLStylesContext *)&mxStyles)->IsAutomaticStyle() + SvXMLStylesContext* pSvXMLStylesContext = static_cast< SvXMLStylesContext* >(&mxStyles); + UniReference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily()); + OSL_ENSURE(xImpPrMap.is(), "There is no import prop mapper"); + + //UUUU need to filter out old fill definitions when the new ones are used. The new + // ones are used when a FillStyle is defined + const bool bTakeCareOfDrawingLayerFillStyle(xImpPrMap.is() && GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH); + bool bDrawingLayerFillStylesUsed(false); + + if(bTakeCareOfDrawingLayerFillStyle) + { + // check if new FillStyles are used and if so mark old ones with -1 + static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle")); + + if(doNewDrawingLayerFillStyleDefinitionsExist(s_FillStyle)) + { + deactivateOldFillStyleDefinitions(getParaSet()); + bDrawingLayerFillStylesUsed = true; + } + } + + if( pSvXMLStylesContext->IsAutomaticStyle() && ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) ) { - Reference < XAutoStyleFamily > xAutoFamily = - ((SvXMLStylesContext *)&mxStyles)->GetAutoStyles( GetFamily() ); + //UUUU Need to translate StyleName from temp MapNames to names + // used in already imported items (already exist in the pool). This + // is required for AutomaticStyles since these do *not* use FillPropertySet + // and thus just trigger CheckSpecialContext in XMLTextStyleContext::FillPropertySet + // (which may be double action anyways). The mechanism there to use _ContextID_Index_Pair + // is not working for AutomaticStyles and is already too late, too (this + // method is already called before XMLTextStyleContext::FillPropertySet gets called) + if(bDrawingLayerFillStylesUsed) + { + translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames(); + } + + Reference < XAutoStyleFamily > xAutoFamily = pSvXMLStylesContext->GetAutoStyles( GetFamily() ); if( !xAutoFamily.is() ) return; - UniReference < SvXMLImportPropertyMapper > xImpPrMap = - ((SvXMLStylesContext *)&mxStyles)->GetImportPropertyMapper( GetFamily() ); - DBG_ASSERT( xImpPrMap.is(), "There is no import prop mapper" ); if( xImpPrMap.is() ) { Sequence< PropertyValue > aValues; @@ -230,8 +336,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) if( rName.isEmpty() || IsDefaultStyle() ) return; - Reference < XNameContainer > xFamilies = - ((SvXMLStylesContext *)&mxStyles)->GetStylesContainer( GetFamily() ); + Reference < XNameContainer > xFamilies = pSvXMLStylesContext->GetStylesContainer( GetFamily() ); if( !xFamilies.is() ) return; @@ -271,10 +376,6 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite ) Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY ); UniReference < XMLPropertySetMapper > xPrMap; - UniReference < SvXMLImportPropertyMapper > xImpPrMap = - ((SvXMLStylesContext *)&mxStyles)->GetImportPropertyMapper( - GetFamily() ); - DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" ); if( xImpPrMap.is() ) xPrMap = xImpPrMap->getPropertySetMapper(); if( xPrMap.is() ) @@ -408,5 +509,135 @@ void XMLPropStyleContext::Finish( bool bOverwrite ) } } +//UUUU +bool XMLPropStyleContext::doNewDrawingLayerFillStyleDefinitionsExist( + const OUString& rFillStyleTag) const +{ + if(maProperties.size() && rFillStyleTag.getLength()) + { + const UniReference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper(); + + if(rMapper.is()) + { + for(::std::vector< XMLPropertyState >::const_iterator a = maProperties.begin(); a != maProperties.end(); a++) + { + if(a->mnIndex != -1) + { + const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex); + + if(rPropName == rFillStyleTag) + { + FillStyle eFillStyle(FillStyle_NONE); + + if(a->maValue >>= eFillStyle) + { + // okay, type was good, FillStyle is set + } + else + { + // also try an int (see XFillStyleItem::PutValue) + sal_Int32 nFillStyle(0); + + if(a->maValue >>= nFillStyle) + { + eFillStyle = static_cast< FillStyle >(nFillStyle); + } + } + + // we found the entry, check it + return FillStyle_NONE != eFillStyle; + } + } + } + } + } + + return false; +} + +//UUUU +bool XMLPropStyleContext::deactivateOldFillStyleDefinitions( + const OldFillStyleDefinitionSet& rHashSetOfTags) +{ + bool bRetval(false); + + if(!rHashSetOfTags.empty() && maProperties.size()) + { + const UniReference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper(); + + if(rMapper.is()) + { + for(::std::vector< XMLPropertyState >::iterator a = maProperties.begin(); a != maProperties.end(); a++) + { + if(a->mnIndex != -1) + { + const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex); + + if(rHashSetOfTags.find(rPropName) != rHashSetOfTags.end()) + { + // mark entry as inactive + a->mnIndex = -1; + bRetval = true; + } + } + } + } + } + + return bRetval; +} + +//UUUU +bool XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames() +{ + bool bRetval(false); + + if(maProperties.size()) + { + const UniReference< XMLPropertySetMapper >& rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper(); + + if(rMapper.is()) + { + static OUString s_FillGradientName(RTL_CONSTASCII_USTRINGPARAM("FillGradientName")); + static OUString s_FillHatchName(RTL_CONSTASCII_USTRINGPARAM("FillHatchName")); + static OUString s_FillBitmapName(RTL_CONSTASCII_USTRINGPARAM("FillBitmapName")); + static OUString s_FillTransparenceGradientName(RTL_CONSTASCII_USTRINGPARAM("FillTransparenceGradientName")); + + for(::std::vector< XMLPropertyState >::iterator a = maProperties.begin(); a != maProperties.end(); a++) + { + if(a->mnIndex != -1) + { + const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex); + sal_uInt16 aStyleFamily(0); + + if(rPropName == s_FillGradientName || rPropName == s_FillTransparenceGradientName) + { + aStyleFamily = XML_STYLE_FAMILY_SD_GRADIENT_ID; + } + else if(rPropName == s_FillHatchName) + { + aStyleFamily = XML_STYLE_FAMILY_SD_HATCH_ID; + } + else if(rPropName == s_FillBitmapName) + { + aStyleFamily = XML_STYLE_FAMILY_SD_FILL_IMAGE_ID; + } + + if(aStyleFamily) + { + OUString sStyleName; + + a->maValue >>= sStyleName; + sStyleName = GetImport().GetStyleDisplayName( aStyleFamily, sStyleName ); + a->maValue <<= sStyleName; + bRetval = true; + } + } + } + } + } + + return bRetval; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index 118ad7c62633..6be3360e402c 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -311,7 +311,7 @@ void SvXMLImportPropertyMapper::importXML( } } } - while( ( nIndex >= 0 ) && (( nFlags & MID_FLAG_MULTI_PROPERTY ) != 0 ) ); + while( ( nIndex >= 0 && nIndex + 1 < nEndIdx ) && (( nFlags & MID_FLAG_MULTI_PROPERTY ) != 0 ) ); } finished( rProperties, nStartIdx, nEndIdx ); diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx index bf3f9f0358f2..08f6a346dfcc 100644 --- a/xmloff/source/style/xmlprmap.cxx +++ b/xmloff/source/style/xmlprmap.cxx @@ -171,7 +171,7 @@ sal_Int32 XMLPropertySetMapper::GetEntryIndex( sal_Int32 nEntries = GetEntryCount(); sal_Int32 nIndex= nStartAt == - 1? 0 : nStartAt+1; - if ( nEntries ) + if ( nEntries && nIndex < nEntries ) { do { diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx index 1c7ac7ef8248..0cd2bb72f0e1 100644 --- a/xmloff/source/text/txtexppr.cxx +++ b/xmloff/source/text/txtexppr.cxx @@ -26,13 +26,13 @@ #include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/text/XChapterNumberingSupplier.hpp> - #include <tools/debug.hxx> - #include <xmloff/txtprmap.hxx> #include <xmloff/xmlexp.hxx> #include "XMLSectionFootnoteConfigExport.hxx" +//UUUU +#include <xmlsdtypes.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -795,20 +795,20 @@ void XMLTextExportPropertySetMapper::ContextFilter( case CTF_MARGINALL: pAllMargin = propertie; break; //UUUU - case CTF_SW_REPEAT_OFFSET_X: + case CTF_REPEAT_OFFSET_X: pRepeatOffsetX = propertie; break; //UUUU - case CTF_SW_REPEAT_OFFSET_Y: + case CTF_REPEAT_OFFSET_Y: pRepeatOffsetY = propertie; break; //UUUU - case CTF_SW_FILLGRADIENTNAME: - case CTF_SW_FILLHATCHNAME: - case CTF_SW_FILLBITMAPNAME: - case CTF_SW_FILLTRANSNAME: + case CTF_FILLGRADIENTNAME: + case CTF_FILLHATCHNAME: + case CTF_FILLBITMAPNAME: + case CTF_FILLTRANSNAME: { OUString aStr; if( (propertie->maValue >>= aStr) && 0 == aStr.getLength() ) diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx index 224f35ebffbd..ed63824e6d6e 100644 --- a/xmloff/source/text/txtprhdl.cxx +++ b/xmloff/source/text/txtprhdl.cxx @@ -46,14 +46,29 @@ #include <com/sun/star/text/WrapInfluenceOnPosition.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> +//UUUU +#include <xmloff/EnumPropertyHdl.hxx> +#include <com/sun/star/drawing/FillStyle.hpp> +#include "XMLFillBitmapSizePropertyHandler.hxx" +#include "XMLBitmapLogicalSizePropertyHandler.hxx" +#include <com/sun/star/drawing/RectanglePoint.hpp> +#include <com/sun/star/drawing/BitmapMode.hpp> +#include "XMLBitmapRepeatOffsetPropertyHandler.hxx" + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::style; using namespace ::com::sun::star::text; using namespace ::xmloff::token; + //UUUU using namespace ::com::sun::star::drawing; +//UUUU +extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[]; +extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[]; +extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[]; + static SvXMLEnumMapEntry const pXML_HoriPos_Enum[] = { { XML_FROM_LEFT, HoriOrientation::NONE }, @@ -1213,18 +1228,6 @@ public: ~XMLTextPropertyHandlerFactory_Impl(); }; -//UUUU -#include <xmloff/EnumPropertyHdl.hxx> -#include <com/sun/star/drawing/FillStyle.hpp> -#include "XMLFillBitmapSizePropertyHandler.hxx" -#include "XMLBitmapLogicalSizePropertyHandler.hxx" -#include <com/sun/star/drawing/RectanglePoint.hpp> -#include <com/sun/star/drawing/BitmapMode.hpp> -#include "XMLBitmapRepeatOffsetPropertyHandler.hxx" -extern SvXMLEnumMapEntry aXML_FillStyle_EnumMap[]; -extern SvXMLEnumMapEntry aXML_RefPoint_EnumMap[]; -extern SvXMLEnumMapEntry aXML_BitmapMode_EnumMap[]; - const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler ( sal_Int32 nType ) const { @@ -1418,6 +1421,12 @@ const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler pHdl = new XMLBitmapRepeatOffsetPropertyHandler(XML_SW_TYPE_BITMAPREPOFFSETX == nType); break; + //UUUU + default: + { + OSL_ENSURE(false, "XMLPropertyHandler missing (!)"); + break; + } } return pHdl; diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index dba9a4f0f455..e0b617e31fda 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -17,15 +17,15 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - #include <xmloff/txtprmap.hxx> - #include <tools/debug.hxx> - #include <xmloff/xmlnmspe.hxx> #include <xmloff/xmltoken.hxx> #include "txtprhdl.hxx" +//UUUU +#include <xmlsdtypes.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::xmloff::token; @@ -343,6 +343,29 @@ XMLPropertyMapEntry aXMLParaPropMap[] = MP_E( "ParaBackGraphicLocation", STYLE, POSITION, MID_FLAG_SPECIAL_ITEM|XML_TYPE_BUILDIN_CMP_ONLY, CTF_BACKGROUND_POS ), MP_E( "ParaBackGraphicFilter",STYLE, FILTER_NAME, MID_FLAG_SPECIAL_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_FILTER ), MP_E( "ParaBackGraphicURL", STYLE, BACKGROUND_IMAGE, MID_FLAG_ELEMENT_ITEM|XML_TYPE_STRING, CTF_BACKGROUND_URL ), + + //UUUU fill attributes for paragraph backgrounds + GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, 0 ), + GMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ), + GMAP( "FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0 ), + GMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ), + GMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ), + GMAP( "FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ), + GMAP( "FillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, 0 ), + GMAP( "FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLBITMAPNAME ), + GMAP( "FillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too + GMAP( "FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLTRANSNAME ), + GMAP( "FillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ), + GMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ), + GMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ), + GMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ), + GMAP( "FillBitmapMode", XML_NAMESPACE_STYLE,XML_REPEAT, XML_SW_TYPE_BITMAP_MODE|MID_FLAG_MULTI_PROPERTY, 0 ), + GMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ), + GMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ), + GMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, 0 ), + GMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_X ), + GMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_Y ), + // RES_BOX MP_E( "LeftBorder", STYLE, BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_ALLBORDERWIDTH ), MP_E( "LeftBorder", STYLE, BORDER_LINE_WIDTH_LEFT, XML_TYPE_BORDER_WIDTH, CTF_LEFTBORDERWIDTH ), @@ -694,13 +717,13 @@ XMLPropertyMapEntry aXMLFramePropMap[] = GMAP( "FillStyle", XML_NAMESPACE_DRAW, XML_FILL, XML_SW_TYPE_FILLSTYLE, 0 ), GMAP( "FillColor", XML_NAMESPACE_DRAW, XML_FILL_COLOR, XML_TYPE_COLOR, 0 ), GMAP( "FillColor2", XML_NAMESPACE_DRAW, XML_SECONDARY_FILL_COLOR, XML_TYPE_COLOR, 0 ), - GMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SW_FILLGRADIENTNAME ), + GMAP( "FillGradientName", XML_NAMESPACE_DRAW, XML_FILL_GRADIENT_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLGRADIENTNAME ), GMAP( "FillGradientStepCount", XML_NAMESPACE_DRAW, XML_GRADIENT_STEP_COUNT, XML_TYPE_NUMBER16, 0 ), - GMAP( "FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SW_FILLHATCHNAME ), + GMAP( "FillHatchName", XML_NAMESPACE_DRAW, XML_FILL_HATCH_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLHATCHNAME ), GMAP( "FillBackground", XML_NAMESPACE_DRAW, XML_FILL_HATCH_SOLID, XML_TYPE_BOOL, 0 ), - GMAP( "FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SW_FILLBITMAPNAME ), + GMAP( "FillBitmapName", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLBITMAPNAME ), GMAP( "FillTransparence", XML_NAMESPACE_DRAW, XML_OPACITY, XML_TYPE_NEG_PERCENT16|MID_FLAG_MULTI_PROPERTY, 0 ), // exists in SW, too - GMAP( "FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_SW_FILLTRANSNAME ), + GMAP( "FillTransparenceGradientName", XML_NAMESPACE_DRAW, XML_OPACITY_NAME, XML_TYPE_STYLENAME|MID_FLAG_NO_PROPERTY_IMPORT, CTF_FILLTRANSNAME ), GMAP( "FillBitmapSizeX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ), GMAP( "FillBitmapLogicalSize", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_WIDTH, XML_SW_TYPE_LOGICAL_SIZE|MID_FLAG_MULTI_PROPERTY, 0 ), GMAP( "FillBitmapSizeY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_HEIGHT, XML_SW_TYPE_FILLBITMAPSIZE|MID_FLAG_MULTI_PROPERTY, 0 ), @@ -709,8 +732,8 @@ XMLPropertyMapEntry aXMLFramePropMap[] = GMAP( "FillBitmapPositionOffsetX", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_X, XML_TYPE_PERCENT, 0 ), GMAP( "FillBitmapPositionOffsetY", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT_Y, XML_TYPE_PERCENT, 0 ), GMAP( "FillBitmapRectanglePoint", XML_NAMESPACE_DRAW, XML_FILL_IMAGE_REF_POINT, XML_SW_TYPE_BITMAP_REFPOINT, 0 ), - GMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_SW_REPEAT_OFFSET_X ), - GMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_SW_REPEAT_OFFSET_Y ), + GMAP( "FillBitmapOffsetX", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETX|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_X ), + GMAP( "FillBitmapOffsetY", XML_NAMESPACE_DRAW, XML_TILE_REPEAT_OFFSET, XML_SW_TYPE_BITMAPREPOFFSETY|MID_FLAG_MULTI_PROPERTY, CTF_REPEAT_OFFSET_Y ), // RES_BOX MG_ED( "LeftBorder", STYLE, BORDER_LINE_WIDTH, XML_TYPE_BORDER_WIDTH, CTF_ALLBORDERWIDTH ), diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx index 47b8d0f44da5..b6db59197d95 100644 --- a/xmloff/source/text/txtstyli.cxx +++ b/xmloff/source/text/txtstyli.cxx @@ -48,6 +48,10 @@ #include <utility> #include <vector> +//UUUU +#include <xmlsdtypes.hxx> +#include <xmloff/xmlerror.hxx> + using namespace ::std; using namespace ::com::sun::star; @@ -397,22 +401,19 @@ void XMLTextStyleContext::FillPropertySet( // catch the combined characters attribute // imitate XMLPropStyleContext::FillPropertySet(...) - UniReference < SvXMLImportPropertyMapper > xImpPrMap = - ((SvXMLStylesContext *)GetStyles())->GetImportPropertyMapper(GetFamily()); - DBG_ASSERT( xImpPrMap.is(), "Where is the import prop mapper?" ); - if( xImpPrMap.is() ) - { + SvXMLStylesContext* pSvXMLStylesContext = static_cast< SvXMLStylesContext* >(GetStyles()); + UniReference < SvXMLImportPropertyMapper > xImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily()); + DBG_ASSERT(xImpPrMap.is(),"Where is the import prop mapper?"); + if(xImpPrMap.is()) + { // imitate SvXMLImportPropertyMapper::FillPropertySet(...) - // The reason for this is that we have no other way to // efficiently intercept the value of combined characters. To // get that value, we could iterate through the map once more, // but instead we chose to insert the code into this // iteration. I haven't been able to come up with a much more // intelligent solution. - - struct _ContextID_Index_Pair aContextIDs[] = { { CTF_COMBINED_CHARACTERS_FIELD, -1 }, @@ -422,28 +423,56 @@ void XMLTextStyleContext::FillPropertySet( { CTF_FONTFAMILYNAME, -1 }, { CTF_FONTFAMILYNAME_CJK, -1 }, { CTF_FONTFAMILYNAME_CTL, -1 }, + + //UUU need special handling for DrawingLayer FillStyle names + { CTF_FILLGRADIENTNAME, -1 }, + { CTF_FILLTRANSNAME, -1 }, + { CTF_FILLHATCHNAME, -1 }, + { CTF_FILLBITMAPNAME, -1 }, + { -1, -1 } }; - // get property set info - Reference< XPropertySetInfo > xInfo( rPropSet->getPropertySetInfo(), UNO_SET_THROW ); + // the style families associated with the same index modulo 4 + static sal_uInt16 aFamilies[] = + { + XML_STYLE_FAMILY_SD_GRADIENT_ID, + XML_STYLE_FAMILY_SD_GRADIENT_ID, + XML_STYLE_FAMILY_SD_HATCH_ID, + XML_STYLE_FAMILY_SD_FILL_IMAGE_ID + }; + // get property set info + Reference< XPropertySetInfo > xInfo; + UniReference< XMLPropertySetMapper > rPropMapper; bool bAutomatic = false; - if( ((SvXMLStylesContext *)GetStyles())->IsAutomaticStyle() && - ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT || GetFamily() == XML_STYLE_FAMILY_TEXT_PARAGRAPH ) ) + + if(pSvXMLStylesContext->IsAutomaticStyle() && + (XML_STYLE_FAMILY_TEXT_TEXT == GetFamily() || XML_STYLE_FAMILY_TEXT_PARAGRAPH == GetFamily())) { bAutomatic = true; + if( !GetAutoName().isEmpty() ) { OUString sAutoProp = ( GetFamily() == XML_STYLE_FAMILY_TEXT_TEXT ) ? OUString( "CharAutoStyleName" ): OUString( "ParaAutoStyleName" ); + try { + if(!xInfo.is()) + { + xInfo = rPropSet->getPropertySetInfo(); + } + if ( xInfo->hasPropertyByName( sAutoProp ) ) + { rPropSet->setPropertyValue( sAutoProp, makeAny(GetAutoName()) ); + } else + { bAutomatic = false; + } } catch( const RuntimeException& ) { throw; } catch( const Exception& ) @@ -453,13 +482,19 @@ void XMLTextStyleContext::FillPropertySet( } } } + if( bAutomatic ) + { xImpPrMap->CheckSpecialContext( GetProperties(), rPropSet, aContextIDs ); + } else + { xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs ); + } - // have we found a combined characters sal_Int32 nIndex = aContextIDs[0].nIndex; + + // have we found a combined characters if ( nIndex != -1 ) { Any& rAny = GetProperties()[nIndex].maValue; @@ -472,71 +507,140 @@ void XMLTextStyleContext::FillPropertySet( // value; if we didn't find one, we'll set to false, the file // format default. // border-model: same - if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_ROW ) + if(IsDefaultStyle() && XML_STYLE_FAMILY_TABLE_ROW == GetFamily()) { - OUString sIsSplitAllowed( "IsSplitAllowed" ); - DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ), - "property missing?" ); - rPropSet->setPropertyValue( sIsSplitAllowed, - (aContextIDs[1].nIndex == -1) - ? makeAny( false ) - : GetProperties()[aContextIDs[1].nIndex].maValue ); + OUString sIsSplitAllowed("IsSplitAllowed"); + DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ), "property missing?" ); + rPropSet->setPropertyValue( + sIsSplitAllowed, + (aContextIDs[1].nIndex == -1) ? makeAny( false ) : GetProperties()[aContextIDs[1].nIndex].maValue ); } - if( IsDefaultStyle() && GetFamily() == XML_STYLE_FAMILY_TABLE_TABLE ) + if(XML_STYLE_FAMILY_TABLE_TABLE == IsDefaultStyle() && GetFamily()) { OUString sCollapsingBorders("CollapsingBorders"); - DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ), - "property missing?" ); - rPropSet->setPropertyValue( sCollapsingBorders, + DBG_ASSERT( rPropSet->getPropertySetInfo()->hasPropertyByName( sCollapsingBorders ), "property missing?" ); + rPropSet->setPropertyValue( + sCollapsingBorders, (aContextIDs[2].nIndex == -1) ? makeAny( false ) : GetProperties()[aContextIDs[2].nIndex].maValue ); } - // check for StarBats and StarMath fonts - - // iterate over aContextIDs entries 3..6 - for ( sal_Int32 i = 3; i < 7; i++ ) + // iterate over aContextIDs entries, start with 3, prev ones are already used above + for(sal_uInt16 i(3); aContextIDs[i].nContextID != -1; i++) { nIndex = aContextIDs[i].nIndex; + if ( nIndex != -1 ) { // Found! struct XMLPropertyState& rState = GetProperties()[nIndex]; - Any rAny = rState.maValue; - sal_Int32 nMapperIndex = rState.mnIndex; - - // Now check for font name in rState and set corrected value, - // if necessary. - OUString sFontName; - rAny >>= sFontName; - if ( !sFontName.isEmpty() ) + + switch(aContextIDs[i].nContextID) { - if ( sFontName.equalsIgnoreAsciiCase( "StarBats" ) || - sFontName.equalsIgnoreAsciiCase( "StarMath" ) ) + case CTF_FILLGRADIENTNAME: + case CTF_FILLTRANSNAME: + case CTF_FILLHATCHNAME: + case CTF_FILLBITMAPNAME: { - // construct new value - sFontName = "StarSymbol"; - Any aAny( rAny ); - aAny <<= sFontName; - - // get property set mapper - UniReference<XMLPropertySetMapper> rPropMapper = - xImpPrMap->getPropertySetMapper(); - - // set property - OUString rPropertyName( - rPropMapper->GetEntryAPIName(nMapperIndex) ); - if ( xInfo->hasPropertyByName( rPropertyName ) ) + // DrawingLayer FillStyle nameneeds to be mapped to DisplayName + rtl::OUString sStyleName; + rState.maValue >>= sStyleName; + + //UUUU translate the used name from ODF intern to the name used in the Model + sStyleName = GetImport().GetStyleDisplayName(aFamilies[i - 7], sStyleName); + + if(bAutomatic) + { + // in this case the rPropSet got not really filled since above the call to + // CheckSpecialContext was used and not FillPropertySet, thus the below call to + // setPropertyValue can fail/will not be useful (e.g. when the rPropSet + // is a SwXTextCursor). + // This happens for AutoStyles which are already filled in XMLPropStyleContext::CreateAndInsert, + // thus the whole mechanism based on _ContextID_Index_Pair will not work + // in that case. Thus the slots which need to be converted already get + // converted there (its called first) and not here (see + // translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames) + // For convenience, still Write back the corrected value to the XMLPropertyState entry + rState.maValue <<= sStyleName; + break; + } + + // Still needed if it's not an AutomaticStyle (!) + try + { + if(!rPropMapper.is()) + { + rPropMapper = xImpPrMap->getPropertySetMapper(); + } + + // set property + const rtl::OUString& rPropertyName = rPropMapper->GetEntryAPIName(rState.mnIndex); + + if(!xInfo.is()) + { + xInfo = rPropSet->getPropertySetInfo(); + } + + if(xInfo->hasPropertyByName(rPropertyName)) + { + rPropSet->setPropertyValue(rPropertyName,Any(sStyleName)); + } + } + catch(::com::sun::star::lang::IllegalArgumentException& e) + { + Sequence< rtl::OUString > aSeq(1); + aSeq[0] = sStyleName; + GetImport().SetError(XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING, aSeq, e.Message, NULL); + } + break; + } + default: + { + // check for StarBats and StarMath fonts + Any rAny = rState.maValue; + sal_Int32 nMapperIndex = rState.mnIndex; + + // Now check for font name in rState and set corrected value, + // if necessary. + OUString sFontName; + rAny >>= sFontName; + + if ( !sFontName.isEmpty() ) { - rPropSet->setPropertyValue( rPropertyName, aAny ); + if ( sFontName.equalsIgnoreAsciiCase( "StarBats" ) || + sFontName.equalsIgnoreAsciiCase( "StarMath" ) ) + { + // construct new value + sFontName = "StarSymbol"; + Any aAny(rAny); + aAny <<= sFontName; + + if(!rPropMapper.is()) + { + rPropMapper = xImpPrMap->getPropertySetMapper(); + } + + // set property + OUString rPropertyName(rPropMapper->GetEntryAPIName(nMapperIndex)); + + if(!xInfo.is()) + { + xInfo = rPropSet->getPropertySetInfo(); + } + + if(xInfo->hasPropertyByName(rPropertyName)) + { + rPropSet->setPropertyValue(rPropertyName,aAny); + } + } + // else: "normal" style name -> no correction is necessary } + // else: no style name found -> illegal value -> ignore } - // else: "normal" style name -> no correction is necessary } - // else: no style name found -> illegal value -> ignore } } } |