diff options
23 files changed, 565 insertions, 572 deletions
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index c052931a708d..148cbd81d23d 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -822,7 +822,7 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickLoadHdl_Impl) // save table XBitmapListRef pBmpList = XPropertyList::CreatePropertyList( - XBITMAP_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsBitmapList(); + XBITMAP_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ) )->AsBitmapList(); pBmpList->SetName( aURL.getName() ); if( pBmpList->Load() ) { diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index fc209ed5bf37..35352289bb87 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -159,7 +159,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickLoadHdl_Impl) if ( aDlg.Execute() == ERRCODE_NONE ) { XColorListRef pList = XPropertyList::CreatePropertyListFromURL( - meType, aDlg.GetPath(), mpXPool )->AsColorList(); + meType, aDlg.GetPath() )->AsColorList(); if( pList->Load() ) { // check whether the table may be deleted: diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index a5506b2fb4a4..379803020d1b 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -651,7 +651,7 @@ IMPL_LINK_NOARG(SvxGradientTabPage, ClickLoadHdl_Impl) // save list XGradientListRef pGrdList = XPropertyList::CreatePropertyList( - XGRADIENT_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsGradientList(); + XGRADIENT_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ) )->AsGradientList(); pGrdList->SetName( aURL.getName() ); if ( pGrdList->Load() ) diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index e73b8e0367e0..c386e368c9c4 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -697,7 +697,7 @@ IMPL_LINK_NOARG(SvxHatchTabPage, ClickLoadHdl_Impl) aPathURL.removeFinalSlash(); XHatchListRef pHatchList = XPropertyList::CreatePropertyList( - XHATCH_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsHatchList(); + XHATCH_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ) )->AsHatchList(); pHatchList->SetName( aURL.getName() ); if( pHatchList->Load() ) { diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index 44fe3f1a7394..14ceb6bcf9a0 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -773,7 +773,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl) aPathURL.removeFinalSlash(); XDashListRef pDshLst = XPropertyList::CreatePropertyList( - XGRADIENT_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsDashList(); + XGRADIENT_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ) )->AsDashList(); pDshLst->SetName( aURL.getName() ); if( pDshLst->Load() ) diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx index 52937bf29856..93ab7b026a4b 100644 --- a/cui/source/tabpages/tplneend.cxx +++ b/cui/source/tabpages/tplneend.cxx @@ -569,7 +569,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl) aPathURL.removeFinalSlash(); XLineEndListRef pLeList = XPropertyList::CreatePropertyList( - XLINE_END_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsLineEndList(); + XLINE_END_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ) )->AsLineEndList(); pLeList->SetName( aURL.getName() ); if( pLeList->Load() ) { diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 2ca0966e60ec..4e445730b4e9 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -604,6 +604,17 @@ namespace drawinglayer { } + PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D( + const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd) + : PolygonStrokePrimitive2D(rPolygon, rLineAttribute), + maStart(rStart), + maEnd(rEnd) + { + } + bool PolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { if(PolygonStrokePrimitive2D::operator==(rPrimitive)) diff --git a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx index 2985c0e449e5..bf6d83f19a10 100644 --- a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -287,6 +287,13 @@ namespace drawinglayer const attribute::LineStartEndAttribute& rStart, const attribute::LineStartEndAttribute& rEnd); + /// constructor without stroking + PolygonStrokeArrowPrimitive2D( + const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd); + /// data read access const attribute::LineStartEndAttribute& getStart() const { return maStart; } const attribute::LineStartEndAttribute& getEnd() const { return maEnd; } diff --git a/include/svx/xtable.hxx b/include/svx/xtable.hxx index 9ac5b2e75287..6f5a23aa388e 100644 --- a/include/svx/xtable.hxx +++ b/include/svx/xtable.hxx @@ -43,7 +43,6 @@ class Color; class Bitmap; class VirtualDevice; -class XOutdevItemPool; // Standard-Vergleichsstring extern sal_Unicode pszStandard[]; // "standard" @@ -212,15 +211,13 @@ protected: XPropertyListType meType; String maName; // not persistent String maPath; - XOutdevItemPool* mpXPool; XPropertyEntryList_impl maList; bool mbListDirty; bool mbEmbedInDocument; - XPropertyList( XPropertyListType t, const String& rPath, - XOutdevItemPool* pXPool = NULL ); + XPropertyList( XPropertyListType t, const String& rPath ); virtual Bitmap CreateBitmapForUI( long nIndex ) = 0; @@ -268,12 +265,10 @@ public: // Factory method for sub-classes static XPropertyListRef CreatePropertyList( XPropertyListType t, - const String& rPath, - XOutdevItemPool* pXPool = NULL ); + const String& rPath ); // as above but initializes name as expected static XPropertyListRef CreatePropertyListFromURL( XPropertyListType t, - const OUString & rUrl, - XOutdevItemPool* pXPool = NULL ); + const OUString & rUrl ); // helper accessors inline XDashListRef AsDashList(); @@ -294,9 +289,8 @@ protected: virtual Bitmap CreateBitmapForUI( long nIndex ); public: - explicit XColorList( const String& rPath, - XOutdevItemPool* pXInPool = NULL ) : - XPropertyList( XCOLOR_LIST, rPath, pXInPool ) {} + explicit XColorList( const String& rPath ) + : XPropertyList( XCOLOR_LIST, rPath ) {} using XPropertyList::Replace; using XPropertyList::Remove; @@ -319,20 +313,11 @@ class impXLineEndList; class SVX_DLLPUBLIC XLineEndList : public XPropertyList { -private: - impXLineEndList* mpData; - - void impCreate(); - void impDestroy(); - protected: virtual Bitmap CreateBitmapForUI(long nIndex); public: - explicit XLineEndList( - const String& rPath, - XOutdevItemPool* pXPool = 0 - ); + explicit XLineEndList( const String& rPath ); virtual ~XLineEndList(); using XPropertyList::Remove; @@ -352,23 +337,16 @@ class impXDashList; class SVX_DLLPUBLIC XDashList : public XPropertyList { private: - impXDashList* mpData; Bitmap maBitmapSolidLine; String maStringSolidLine; String maStringNoLine; - void impCreate(); - void impDestroy(); - protected: Bitmap ImpCreateBitmapForXDash(const XDash* pDash); virtual Bitmap CreateBitmapForUI(long nIndex); public: - explicit XDashList( - const String& rPath, - XOutdevItemPool* pXPool = 0 - ); + explicit XDashList(const String& rPath); virtual ~XDashList(); using XPropertyList::Replace; @@ -399,18 +377,11 @@ class impXHatchList; class SVX_DLLPUBLIC XHatchList : public XPropertyList { -private: - impXHatchList* mpData; - - void impCreate(); - void impDestroy(); - protected: virtual Bitmap CreateBitmapForUI(long nIndex); public: - explicit XHatchList( const String& rPath, - XOutdevItemPool* pXPool = 0 ); + explicit XHatchList( const String& rPath ); virtual ~XHatchList(); using XPropertyList::Replace; @@ -431,20 +402,11 @@ class impXGradientList; class SVX_DLLPUBLIC XGradientList : public XPropertyList { -private: - impXGradientList* mpData; - - void impCreate(); - void impDestroy(); - protected: virtual Bitmap CreateBitmapForUI(long nIndex); public: - explicit XGradientList( - const String& rPath, - XOutdevItemPool* pXPool = 0 - ); + explicit XGradientList( const String& rPath ); virtual ~XGradientList(); using XPropertyList::Replace; @@ -468,9 +430,8 @@ protected: virtual Bitmap CreateBitmapForUI( long nIndex ); public: - explicit XBitmapList( const String& rPath, - XOutdevItemPool* pXInPool = NULL ) - : XPropertyList( XBITMAP_LIST, rPath, pXInPool ) {} + explicit XBitmapList( const String& rPath ) + : XPropertyList( XBITMAP_LIST, rPath ) {} using XPropertyList::Replace; using XPropertyList::Remove; diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 306c9d455304..5edf88a966ea 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1049,6 +1049,13 @@ public: static basegfx::B2DPolygon LogicToLogic( const basegfx::B2DPolygon& rPoly, const MapMode& rMapModeSource, const MapMode& rMapModeDest ); + static basegfx::B2DPolyPolygon LogicToLogic( const basegfx::B2DPolyPolygon& rPolyPoly, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ); + + // create a mapping transformation from rMapModeSource to rMapModeDest (the above methods + // for B2DPoly/Polygons use this internally anyways to transform the B2DPolygon) + static basegfx::B2DHomMatrix LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest); Size GetOutputSizePixel() const { return Size( mnOutWidth, mnOutHeight ); } diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index 2c4d6ba71beb..10f23d44713c 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -360,6 +360,7 @@ private: Size maListBoxPreviewDefaultLogicSize; Size maListBoxPreviewDefaultPixelSize; sal_uInt16 mnListBoxPreviewDefaultLineWidth; + sal_Bool mbUIPreviewUsesCheckeredBackground; OUString maPersonaHeaderFooter; ///< Cache the settings to detect changes. @@ -932,6 +933,11 @@ public: void SetListBoxPreviewDefaultLineWidth(sal_uInt16 nWidth) { CopyData(); mpData->mnListBoxPreviewDefaultLineWidth = nWidth; } sal_uInt16 GetListBoxPreviewDefaultLineWidth() const { return mpData->mnListBoxPreviewDefaultLineWidth; } + // defines if previews which containn potentially transparent objects (e.g. the dash/line/LineStartEnd previews and others) + // use the default transparent visualization background (checkered background) as it has got standard in graphic programs nowadays + void SetUIPreviewUsesCheckeredBackground(bool bNew) { CopyData(); mpData->mbUIPreviewUsesCheckeredBackground = bNew; } + bool GetUIPreviewUsesCheckeredBackground() const { return mpData->mbUIPreviewUsesCheckeredBackground; } + void SetStandardStyles(); const StyleSettings& operator =( const StyleSettings& rSet ); diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 22777ed698db..0044f50a6cd2 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -240,7 +240,7 @@ bool DocumentSettings::LoadList( XPropertyListType t, const OUString &rInPath, } XPropertyListRef pList = XPropertyList::CreatePropertyList( - t, aPath, (XOutdevItemPool*)&pDoc->GetPool() ); + t, aPath ); pList->SetName( aName ); if( pList->LoadFrom( xStorage, rInPath ) ) diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 832c17129eca..a653b2643c6b 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1189,12 +1189,22 @@ namespace if(rBitmapEx.IsTransparent()) { - const Point aNull(0, 0); - static const sal_uInt32 nLen(8); - static const Color aW(COL_WHITE); - static const Color aG(0xef, 0xef, 0xef); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG); + if(rStyleSettings.GetUIPreviewUsesCheckeredBackground()) + { + const Point aNull(0, 0); + static const sal_uInt32 nLen(8); + static const Color aW(COL_WHITE); + static const Color aG(0xef, 0xef, 0xef); + + aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG); + } + else + { + aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor()); + aVirtualDevice.Erase(); + } } if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height()) diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx index 12980888bbfd..3e154f480f95 100644 --- a/svx/source/gallery2/galctrl.cxx +++ b/svx/source/gallery2/galctrl.cxx @@ -258,14 +258,25 @@ void GalleryPreview::PreviewMedia( const INetURLObject& rURL ) } } -void drawCheckered(OutputDevice& rOut, const Point& rPos, const Size& rSize) +void drawTransparenceBackground(OutputDevice& rOut, const Point& rPos, const Size& rSize) { - // draw checkered background - static const sal_uInt32 nLen(8); - static const Color aW(COL_WHITE); - static const Color aG(0xef, 0xef, 0xef); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - rOut.DrawCheckered(rPos, rSize, nLen, aW, aG); + if(rStyleSettings.GetUIPreviewUsesCheckeredBackground()) + { + // draw checkered background + static const sal_uInt32 nLen(8); + static const Color aW(COL_WHITE); + static const Color aG(0xef, 0xef, 0xef); + + rOut.DrawCheckered(rPos, rSize, nLen, aW, aG); + } + else + { + rOut.SetLineColor(); + rOut.SetFillColor(rStyleSettings.GetFieldColor()); + rOut.DrawRect(Rectangle(rPos, rSize)); + } } DBG_NAME(GalleryIconView) @@ -381,7 +392,7 @@ void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt ) if(bTransparent) { // draw checkered background for full rectangle. - drawCheckered(*pDev, rRect.TopLeft(), rRect.GetSize()); + drawTransparenceBackground(*pDev, rRect.TopLeft(), rRect.GetSize()); } aGraphic.Draw( pDev, aPos, aSize ); @@ -599,7 +610,7 @@ void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sa if(bTransparent) { // draw checkered background - drawCheckered(rDev, aPos, aSize); + drawTransparenceBackground(rDev, aPos, aSize); } aGrfObj.Draw( &rDev, aPos, aSize ); diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index f62bd32250a4..2e702cce873a 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -719,7 +719,7 @@ void SdrModel::ImpCreateTables() { if( !bExtColorTable || i != XCOLOR_LIST ) maProperties[i] = XPropertyList::CreatePropertyList ( - (XPropertyListType) i, aTablePath, (XOutdevItemPool*)pItemPool ); + (XPropertyListType) i, aTablePath ); } } diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 4fb418a40758..1b5cad9286ef 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -114,6 +114,8 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId) sal_uInt32 nModelPos; FmFormModel *pModel = NULL; + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + for( nModelPos = 0; nModelPos < nFavCount; nModelPos++ ) { BitmapEx aThumb; @@ -122,17 +124,27 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId) if(!!aThumb) { - static const sal_uInt32 nLen(8); - static const Color aW(COL_WHITE); - static const Color aG(0xef, 0xef, 0xef); VirtualDevice aVDev; const Point aNull(0, 0); const Size aSize(aThumb.GetSizePixel()); aVDev.SetOutputSizePixel(aSize); - aVDev.DrawCheckered(aNull, aSize, nLen, aW, aG); - aVDev.DrawBitmapEx(aNull, aThumb); + if(rStyleSettings.GetUIPreviewUsesCheckeredBackground()) + { + static const sal_uInt32 nLen(8); + static const Color aW(COL_WHITE); + static const Color aG(0xef, 0xef, 0xef); + + aVDev.DrawCheckered(aNull, aSize, nLen, aW, aG); + } + else + { + aVDev.SetBackground(rStyleSettings.GetFieldColor()); + aVDev.Erase(); + } + + aVDev.DrawBitmapEx(aNull, aThumb); maFavoritesHorizontal.push_back(aVDev.GetBitmap(aNull, aSize)); } } diff --git a/svx/source/xoutdev/xtabdash.cxx b/svx/source/xoutdev/xtabdash.cxx index a6d9d2984999..1c4d707fba68 100644 --- a/svx/source/xoutdev/xtabdash.cxx +++ b/svx/source/xoutdev/xtabdash.cxx @@ -22,129 +22,27 @@ #include <vcl/svapp.hxx> #include <vcl/virdev.hxx> -#include <vcl/window.hxx> -#include <svl/itemset.hxx> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> #include <svx/xtable.hxx> -#include <svx/xpool.hxx> -#include <svx/xlineit0.hxx> -#include <svx/xlnclit.hxx> -#include <svx/xlnwtit.hxx> -#include <svx/xlndsit.hxx> -#include <svx/xflclit.hxx> - -#include <svx/svdorect.hxx> -#include <svx/svdopath.hxx> -#include <svx/svdmodel.hxx> -#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> -#include <svx/sdr/contact/displayinfo.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -using namespace com::sun::star; - -class impXDashList -{ -private: - VirtualDevice* mpVirtualDevice; - SdrModel* mpSdrModel; - SdrObject* mpBackgroundObject; - SdrObject* mpLineObject; - -public: - impXDashList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pL) - : mpVirtualDevice(pV), - mpSdrModel(pM), - mpBackgroundObject(pB), - mpLineObject(pL) - {} - - ~impXDashList() - { - delete mpVirtualDevice; - SdrObject::Free(mpBackgroundObject); - SdrObject::Free(mpLineObject); - delete mpSdrModel; - } - - VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; } - SdrObject* getBackgroundObject() const { return mpBackgroundObject; } - SdrObject* getLineObject() const { return mpLineObject; } -}; - -// to avoid rendering trouble (e.g. vcl renderer) and to get better AAed quality, -// use double prerender size -static bool bUseDoubleSize = true; - -void XDashList::impCreate() -{ - if(!mpData) - { - const Point aZero(0, 0); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - VirtualDevice* pVirDev = new VirtualDevice; - OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" ); - pVirDev->SetMapMode(MAP_100TH_MM); - const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); - const Size aSize(pVirDev->PixelToLogic(Size( - bUseDoubleSize ? rSize.Width() * 5 : rSize.Width() * 5 / 2, - bUseDoubleSize ? rSize.Height() * 2 : rSize.Height()))); - pVirDev->SetOutputSize(aSize); - pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() - ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT - : DRAWMODE_DEFAULT); - pVirDev->SetBackground(rStyleSettings.GetFieldColor()); - - SdrModel* pSdrModel = new SdrModel(); - OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" ); - pSdrModel->GetItemPool().FreezeIdRanges(); - - const Rectangle aBackgroundSize(aZero, aSize); - SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize); - OSL_ENSURE(0 != pBackgroundObject, "XDashList: no BackgroundObject created!" ); - pBackgroundObject->SetModel(pSdrModel); - pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID)); - pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_NONE)); - pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor())); - - - const sal_uInt32 nHalfHeight(aSize.Height() / 2); - const basegfx::B2DPoint aStart(0, nHalfHeight); - const basegfx::B2DPoint aEnd(aSize.Width(), nHalfHeight); - basegfx::B2DPolygon aPolygon; - aPolygon.append(aStart); - aPolygon.append(aEnd); - SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon)); - OSL_ENSURE(0 != pLineObject, "XDashList: no LineObject created!" ); - pLineObject->SetModel(pSdrModel); - pLineObject->SetMergedItem(XLineStyleItem(XLINE_DASH)); - pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor())); - const Size aLineWidth(pVirDev->PixelToLogic(Size(rStyleSettings.GetListBoxPreviewDefaultLineWidth(), 0))); - pLineObject->SetMergedItem(XLineWidthItem(bUseDoubleSize ? aLineWidth.getWidth() * 2 : aLineWidth.getWidth())); - mpData = new impXDashList(pVirDev, pSdrModel, pBackgroundObject, pLineObject); - OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" ); - } -} +#include <drawinglayer/attribute/lineattribute.hxx> +#include <drawinglayer/attribute/strokeattribute.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> -void XDashList::impDestroy() -{ - delete mpData; - mpData = 0; -} +using namespace com::sun::star; -XDashList::XDashList(const String& rPath, XOutdevItemPool* pInPool ) -: XPropertyList( XDASH_LIST, rPath, pInPool ), - mpData(0), - maBitmapSolidLine(), - maStringSolidLine(), - maStringNoLine() +XDashList::XDashList(const String& rPath) + : XPropertyList(XDASH_LIST, rPath) + , maBitmapSolidLine() + , maStringSolidLine() + , maStringNoLine() { } XDashList::~XDashList() { - impDestroy(); } XDashEntry* XDashList::Replace(XDashEntry* pEntry, long nIndex ) @@ -186,40 +84,105 @@ sal_Bool XDashList::Create() Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash) { - impCreate(); - VirtualDevice* pVD = mpData->getVirtualDevice(); - SdrObject* pLine = mpData->getLineObject(); + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); + const sal_uInt32 nFactor(2); + const Size aSize((rSize.Width() * 5 * 2) / 2, rSize.Height() * nFactor); + + // prepare polygon geometry for line + basegfx::B2DPolygon aLine; - if(pDash) + aLine.append(basegfx::B2DPoint(0.0, aSize.Height() / 2.0)); + aLine.append(basegfx::B2DPoint(aSize.Width(), aSize.Height() / 2.0)); + + // prepare LineAttribute + const basegfx::BColor aLineColor(rStyleSettings.GetFieldTextColor().getBColor()); + const double fLineWidth(rStyleSettings.GetListBoxPreviewDefaultLineWidth() * (nFactor * 1.1)); + const drawinglayer::attribute::LineAttribute aLineAttribute( + aLineColor, + fLineWidth); + + // prepare StrokeAttribute + ::std::vector< double > aDotDashArray; + double fFullDotDashLen(0.0); + + if(pDash && (pDash->GetDots() || pDash->GetDashes())) { - pLine->SetMergedItem(XLineStyleItem(XLINE_DASH)); - pLine->SetMergedItem(XLineDashItem(String(), *pDash)); + const basegfx::B2DHomMatrix aScaleMatrix(OutputDevice::LogicToLogic(MAP_100TH_MM, MAP_PIXEL)); + const basegfx::B2DVector aScaleVector(aScaleMatrix * basegfx::B2DVector(1.0, 0.0)); + const double fScaleValue(aScaleVector.getLength() * (nFactor * (1.4 / 2.0))); + const double fLineWidthInUnits(fLineWidth / fScaleValue); + + fFullDotDashLen = pDash->CreateDotDashArray(aDotDashArray, fLineWidthInUnits); + + if(!aDotDashArray.empty()) + { + for(sal_uInt32 a(0); a < aDotDashArray.size(); a++) + { + aDotDashArray[a] *= fScaleValue; + } + + fFullDotDashLen *= fScaleValue; + } + } + + const drawinglayer::attribute::StrokeAttribute aStrokeAttribute( + aDotDashArray, + fFullDotDashLen); + + // cerate LinePrimitive + const drawinglayer::primitive2d::Primitive2DReference aLinePrimitive( + new drawinglayer::primitive2d::PolygonStrokePrimitive2D( + aLine, + aLineAttribute, + aStrokeAttribute)); + + // prepare VirtualDevice + VirtualDevice aVirtualDevice; + const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D; + + aVirtualDevice.SetOutputSizePixel(aSize); + aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode() + ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT + : DRAWMODE_DEFAULT); + + if(rStyleSettings.GetUIPreviewUsesCheckeredBackground()) + { + const Point aNull(0, 0); + static const sal_uInt32 nLen(8 * nFactor); + static const Color aW(COL_WHITE); + static const Color aG(0xef, 0xef, 0xef); + + aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG); } else { - pLine->SetMergedItem(XLineStyleItem(XLINE_SOLID)); + aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor()); + aVirtualDevice.Erase(); } - sdr::contact::SdrObjectVector aObjectVector; - aObjectVector.push_back(mpData->getBackgroundObject()); - aObjectVector.push_back(pLine); - sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); - sdr::contact::DisplayInfo aDisplayInfo; + // create processor and draw primitives + drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice( + aVirtualDevice, + aNewViewInformation2D); - pVD->Erase(); - aPainter.ProcessDisplay(aDisplayInfo); + if(pProcessor2D) + { + const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aLinePrimitive, 1); - const Point aZero(0, 0); - Bitmap aResult(pVD->GetBitmap(aZero, pVD->GetOutputSize())); + pProcessor2D->process(aSequence); + delete pProcessor2D; + } - if(bUseDoubleSize) - { - const Size aCurrentSize(aResult.GetSizePixel()); + // get result bitmap and scale + Bitmap aRetval(aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel())); - aResult.Scale(Size(aCurrentSize.Width() / 2, aCurrentSize.Height() / 2), BMP_SCALE_DEFAULT); + if(1 != nFactor) + { + aRetval.Scale(Size((rSize.Width() * 5) / 2, rSize.Height()), BMP_SCALE_DEFAULT); } - return aResult; + return aRetval; } Bitmap XDashList::CreateBitmapForUI( long nIndex ) diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index 5815678dacac..73ff6ad10647 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -20,108 +20,27 @@ #include "svx/XPropertyTable.hxx" #include <vcl/virdev.hxx> -#include <svl/itemset.hxx> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> #include <svx/xtable.hxx> -#include <svx/xpool.hxx> -#include <svx/xfillit0.hxx> -#include <svx/xflgrit.hxx> - -#include <svx/svdorect.hxx> -#include <svx/svdmodel.hxx> -#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> -#include <svx/sdr/contact/displayinfo.hxx> -#include <vcl/svapp.hxx> -#include <svx/xlnclit.hxx> -#include <svx/xgrscit.hxx> - -using namespace com::sun::star; -class impXGradientList -{ -private: - VirtualDevice* mpVirtualDevice; - SdrModel* mpSdrModel; - SdrObject* mpBackgroundObject; - -public: - impXGradientList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB) - : mpVirtualDevice(pV), - mpSdrModel(pM), - mpBackgroundObject(pB) - {} - - ~impXGradientList() - { - delete mpVirtualDevice; - SdrObject::Free(mpBackgroundObject); - delete mpSdrModel; - } - - VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; } - SdrObject* getBackgroundObject() const { return mpBackgroundObject; } -}; - -void XGradientList::impCreate() -{ - if(!mpData) - { - const Point aZero(0, 0); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); +#include <vcl/svapp.hxx> - VirtualDevice* pVirDev = new VirtualDevice; - OSL_ENSURE(0 != pVirDev, "XGradientList: no VirtualDevice created!" ); - pVirDev->SetMapMode(MAP_100TH_MM); - const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); - const Size aSize(pVirDev->PixelToLogic(rSize)); - pVirDev->SetOutputSize(aSize); - pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() - ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT - : DRAWMODE_DEFAULT); - pVirDev->SetBackground(rStyleSettings.GetFieldColor()); - - SdrModel* pSdrModel = new SdrModel(); - OSL_ENSURE(0 != pSdrModel, "XGradientList: no SdrModel created!" ); - pSdrModel->GetItemPool().FreezeIdRanges(); - - const Size aSinglePixel(pVirDev->PixelToLogic(Size(1, 1))); - const Rectangle aBackgroundSize(aZero, Size(aSize.getWidth() - aSinglePixel.getWidth(), aSize.getHeight() - aSinglePixel.getHeight())); - SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize); - OSL_ENSURE(0 != pBackgroundObject, "XGradientList: no BackgroundObject created!" ); - pBackgroundObject->SetModel(pSdrModel); - pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT)); - pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID)); - pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK))); - pBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((rSize.Width() + rSize.Height()) / 3))); - - mpData = new impXGradientList(pVirDev, pSdrModel, pBackgroundObject); - OSL_ENSURE(0 != mpData, "XGradientList: data creation went wrong!" ); - } -} +#include <drawinglayer/attribute/fillgradientattribute.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> -void XGradientList::impDestroy() -{ - if(mpData) - { - delete mpData; - mpData = 0; - } -} +using namespace com::sun::star; -XGradientList::XGradientList( const String& rPath, XOutdevItemPool* pInPool ) -: XPropertyList( XGRADIENT_LIST, rPath, pInPool ), - mpData(0) +XGradientList::XGradientList( const String& rPath ) +: XPropertyList( XGRADIENT_LIST, rPath ) { } XGradientList::~XGradientList() { - if(mpData) - { - delete mpData; - mpData = 0; - } } XGradientEntry* XGradientList::Replace(XGradientEntry* pEntry, long nIndex ) @@ -170,23 +89,126 @@ sal_Bool XGradientList::Create() Bitmap XGradientList::CreateBitmapForUI( long nIndex ) { - impCreate(); - VirtualDevice* pVD = mpData->getVirtualDevice(); - SdrObject* pBackgroundObject = mpData->getBackgroundObject(); + Bitmap aRetval; - pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT)); - pBackgroundObject->SetMergedItem(XFillGradientItem(GetGradient(nIndex)->GetGradient())); + OSL_ENSURE(nIndex < Count(), "OOps, access out of range (!)"); - sdr::contact::SdrObjectVector aObjectVector; - aObjectVector.push_back(pBackgroundObject); - sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); - sdr::contact::DisplayInfo aDisplayInfo; + if(nIndex < Count()) + { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); - pVD->Erase(); - aPainter.ProcessDisplay(aDisplayInfo); + // prepare polygon geometry for rectangle + const basegfx::B2DPolygon aRectangle( + basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, rSize.Width(), rSize.Height()))); + + const XGradient& rGradient = GetGradient(nIndex)->GetGradient(); + const sal_uInt16 nStartIntens(rGradient.GetStartIntens()); + basegfx::BColor aStart(rGradient.GetStartColor().getBColor()); + + if(nStartIntens != 100) + { + const basegfx::BColor aBlack; + aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01); + } + + const sal_uInt16 nEndIntens(rGradient.GetEndIntens()); + basegfx::BColor aEnd(rGradient.GetEndColor().getBColor()); + + if(nEndIntens != 100) + { + const basegfx::BColor aBlack; + aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01); + } + + drawinglayer::attribute::GradientStyle aGradientStyle(drawinglayer::attribute::GRADIENTSTYLE_RECT); + + switch(rGradient.GetGradientStyle()) + { + case XGRAD_LINEAR : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_LINEAR; + break; + } + case XGRAD_AXIAL : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_AXIAL; + break; + } + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_RADIAL; + break; + } + case XGRAD_ELLIPTICAL : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_ELLIPTICAL; + break; + } + case XGRAD_SQUARE : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_SQUARE; + break; + } + default : + { + aGradientStyle = drawinglayer::attribute::GRADIENTSTYLE_RECT; // XGRAD_RECT + break; + } + } + + const sal_uInt16 nSteps((rSize.Width() + rSize.Height()) / 3); + const drawinglayer::attribute::FillGradientAttribute aFillGradient( + aGradientStyle, + (double)rGradient.GetBorder() * 0.01, + (double)rGradient.GetXOffset() * 0.01, + (double)rGradient.GetYOffset() * 0.01, + (double)rGradient.GetAngle() * F_PI1800, + aStart, + aEnd, + nSteps); + + const drawinglayer::primitive2d::Primitive2DReference aGradientPrimitive( + new drawinglayer::primitive2d::PolyPolygonGradientPrimitive2D( + basegfx::B2DPolyPolygon(aRectangle), + aFillGradient)); + + const basegfx::BColor aBlack(0.0, 0.0, 0.0); + const drawinglayer::primitive2d::Primitive2DReference aBlackRectanglePrimitive( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + aRectangle, + aBlack)); + + // prepare VirtualDevice + VirtualDevice aVirtualDevice; + const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D; + + aVirtualDevice.SetOutputSizePixel(rSize); + aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode() + ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT + : DRAWMODE_DEFAULT); + + // create processor and draw primitives + drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice( + aVirtualDevice, + aNewViewInformation2D); + + if(pProcessor2D) + { + drawinglayer::primitive2d::Primitive2DSequence aSequence(2); + + aSequence[0] = aGradientPrimitive; + aSequence[1] = aBlackRectanglePrimitive; + + pProcessor2D->process(aSequence); + delete pProcessor2D; + } + + // get result bitmap and scale + aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()); + } - const Point aZero(0, 0); - return pVD->GetBitmap(aZero, pVD->GetOutputSize()); + return aRetval; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index 027953a3d742..72033e38ebda 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -21,112 +21,26 @@ #include <vcl/svapp.hxx> #include <vcl/virdev.hxx> -#include <svl/itemset.hxx> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> -#include <svx/xtable.hxx> #include <svx/xpool.hxx> -#include "svx/dlgutil.hxx" -#include <svx/xflhtit.hxx> -#include <svx/xflclit.hxx> -#include <svx/xfillit0.hxx> -#include <svx/svdorect.hxx> -#include <svx/svdmodel.hxx> -#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> -#include <svx/sdr/contact/displayinfo.hxx> -#include <svx/xlnclit.hxx> +#include <drawinglayer/attribute/fillhatchattribute.hxx> +#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> using namespace ::com::sun::star; using namespace ::rtl; -class impXHatchList -{ -private: - VirtualDevice* mpVirtualDevice; - SdrModel* mpSdrModel; - SdrObject* mpBackgroundObject; - SdrObject* mpHatchObject; - -public: - impXHatchList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pH) - : mpVirtualDevice(pV), - mpSdrModel(pM), - mpBackgroundObject(pB), - mpHatchObject(pH) - {} - - ~impXHatchList() - { - delete mpVirtualDevice; - SdrObject::Free(mpBackgroundObject); - SdrObject::Free(mpHatchObject); - delete mpSdrModel; - } - - VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; } - SdrObject* getBackgroundObject() const { return mpBackgroundObject; } - SdrObject* getHatchObject() const { return mpHatchObject; } -}; - -void XHatchList::impCreate() -{ - if(!mpData) - { - const Point aZero(0, 0); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - VirtualDevice* pVirDev = new VirtualDevice; - OSL_ENSURE(0 != pVirDev, "XDashList: no VirtualDevice created!" ); - pVirDev->SetMapMode(MAP_100TH_MM); - const Size aSize(pVirDev->PixelToLogic(rStyleSettings.GetListBoxPreviewDefaultPixelSize())); - pVirDev->SetOutputSize(aSize); - pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() - ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT - : DRAWMODE_DEFAULT); - pVirDev->SetBackground(rStyleSettings.GetFieldColor()); - - SdrModel* pSdrModel = new SdrModel(); - OSL_ENSURE(0 != pSdrModel, "XDashList: no SdrModel created!" ); - pSdrModel->GetItemPool().FreezeIdRanges(); - - const Size aSinglePixel(pVirDev->PixelToLogic(Size(1, 1))); - const Rectangle aBackgroundSize(aZero, Size(aSize.getWidth() - aSinglePixel.getWidth(), aSize.getHeight() - aSinglePixel.getHeight())); - SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize); - OSL_ENSURE(0 != pBackgroundObject, "XDashList: no BackgroundObject created!" ); - pBackgroundObject->SetModel(pSdrModel); - pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID)); - pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor())); - pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID)); - pBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK))); - - SdrObject* pHatchObject = new SdrRectObj(aBackgroundSize); - OSL_ENSURE(0 != pHatchObject, "XDashList: no HatchObject created!" ); - pHatchObject->SetModel(pSdrModel); - pHatchObject->SetMergedItem(XFillStyleItem(XFILL_HATCH)); - pHatchObject->SetMergedItem(XLineStyleItem(XLINE_NONE)); - - mpData = new impXHatchList(pVirDev, pSdrModel, pBackgroundObject, pHatchObject); - OSL_ENSURE(0 != mpData, "XDashList: data creation went wrong!" ); - } -} - -void XHatchList::impDestroy() -{ - delete mpData; - mpData = NULL; -} - -XHatchList::XHatchList(const String& rPath, XOutdevItemPool* pInPool) - : XPropertyList( XHATCH_LIST, rPath, pInPool ), - mpData(0) +XHatchList::XHatchList(const String& rPath) + : XPropertyList( XHATCH_LIST, rPath ) { } XHatchList::~XHatchList() { - delete mpData; - mpData = NULL; } XHatchEntry* XHatchList::Replace(XHatchEntry* pEntry, long nIndex ) @@ -168,24 +82,108 @@ sal_Bool XHatchList::Create() Bitmap XHatchList::CreateBitmapForUI( long nIndex ) { - impCreate(); - VirtualDevice* pVD = mpData->getVirtualDevice(); - SdrObject* pHatchObject = mpData->getHatchObject(); - - pHatchObject->SetMergedItem(XFillStyleItem(XFILL_HATCH)); - pHatchObject->SetMergedItem(XFillHatchItem(String(), GetHatch(nIndex)->GetHatch())); + Bitmap aRetval; + OSL_ENSURE(nIndex < Count(), "OOps, access out of range (!)"); - sdr::contact::SdrObjectVector aObjectVector; - aObjectVector.push_back(mpData->getBackgroundObject()); - aObjectVector.push_back(pHatchObject); - sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); - sdr::contact::DisplayInfo aDisplayInfo; + if(nIndex < Count()) + { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); + + // prepare polygon geometry for rectangle + const basegfx::B2DPolygon aRectangle( + basegfx::tools::createPolygonFromRect( + basegfx::B2DRange(0.0, 0.0, rSize.Width(), rSize.Height()))); + + const XHatch& rHatch = GetHatch(nIndex)->GetHatch(); + drawinglayer::attribute::HatchStyle aHatchStyle(drawinglayer::attribute::HATCHSTYLE_TRIPLE); + + switch(rHatch.GetHatchStyle()) + { + case XHATCH_SINGLE : + { + aHatchStyle = drawinglayer::attribute::HATCHSTYLE_SINGLE; + break; + } + case XHATCH_DOUBLE : + { + aHatchStyle = drawinglayer::attribute::HATCHSTYLE_DOUBLE; + break; + } + default : + { + aHatchStyle = drawinglayer::attribute::HATCHSTYLE_TRIPLE; // XHATCH_TRIPLE + break; + } + } + + const basegfx::B2DHomMatrix aScaleMatrix(OutputDevice::LogicToLogic(MAP_100TH_MM, MAP_PIXEL)); + const basegfx::B2DVector aScaleVector(aScaleMatrix * basegfx::B2DVector(1.0, 0.0)); + const double fScaleValue(aScaleVector.getLength()); + + const drawinglayer::attribute::FillHatchAttribute aFillHatch( + aHatchStyle, + (double)rHatch.GetDistance() * fScaleValue, + (double)rHatch.GetAngle() * F_PI1800, + rHatch.GetColor().getBColor(), + 3, // same default as VCL, a minimum of three discrete units (pixels) offset + false); + + const basegfx::BColor aBlack(0.0, 0.0, 0.0); + const drawinglayer::primitive2d::Primitive2DReference aHatchPrimitive( + new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D( + basegfx::B2DPolyPolygon(aRectangle), + aBlack, + aFillHatch)); + + const drawinglayer::primitive2d::Primitive2DReference aBlackRectanglePrimitive( + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + aRectangle, + aBlack)); + + // prepare VirtualDevice + VirtualDevice aVirtualDevice; + const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D; + + aVirtualDevice.SetOutputSizePixel(rSize); + aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode() + ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT + : DRAWMODE_DEFAULT); - pVD->Erase(); - aPainter.ProcessDisplay(aDisplayInfo); + if(rStyleSettings.GetUIPreviewUsesCheckeredBackground()) + { + const Point aNull(0, 0); + static const sal_uInt32 nLen(8); + static const Color aW(COL_WHITE); + static const Color aG(0xef, 0xef, 0xef); + aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG); + } + else + { + aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor()); + aVirtualDevice.Erase(); + } + + // create processor and draw primitives + drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice( + aVirtualDevice, + aNewViewInformation2D); + + if(pProcessor2D) + { + drawinglayer::primitive2d::Primitive2DSequence aSequence(2); + + aSequence[0] = aHatchPrimitive; + aSequence[1] = aBlackRectanglePrimitive; + pProcessor2D->process(aSequence); + delete pProcessor2D; + } + + // get result bitmap and scale + aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()); + } - const Point aZero(0, 0); - return pVD->GetBitmap(aZero, pVD->GetOutputSize()); + return aRetval; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index eb21b4d328ca..99278c5a72e1 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -41,19 +41,13 @@ Color RGB_Color( ColorData nColorName ) XPropertyList::XPropertyList( XPropertyListType type, - const String& rPath, - XOutdevItemPool* pInPool + const String& rPath ) : meType ( type ), maName ( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ), maPath ( rPath ), - mpXPool ( pInPool ), mbListDirty ( true ), mbEmbedInDocument( false ) { - if( !mpXPool ) - { - mpXPool = static_cast< XOutdevItemPool* >(&SdrObject::GetGlobalDrawObjectItemPool()); - } // fprintf (stderr, "Create type %d count %d\n", (int)meType, count++); } @@ -217,13 +211,12 @@ bool XPropertyList::SaveTo( const uno::Reference< embed::XStorage > &xStorage, } XPropertyListRef XPropertyList::CreatePropertyList( XPropertyListType t, - const String& rPath, - XOutdevItemPool* pXPool ) + const String& rPath ) { XPropertyListRef pRet; #define MAP(e,c) \ - case e: pRet = XPropertyListRef (new c( rPath, pXPool ) ); break + case e: pRet = XPropertyListRef (new c( rPath ) ); break switch (t) { MAP( XCOLOR_LIST, XColorList ); MAP( XLINE_END_LIST, XLineEndList ); @@ -243,8 +236,7 @@ XPropertyListRef XPropertyList::CreatePropertyList( XPropertyListType t, XPropertyListRef XPropertyList::CreatePropertyListFromURL( XPropertyListType t, - const OUString & rURLStr, - XOutdevItemPool* pXPool ) + const OUString & rURLStr ) { INetURLObject aURL( rURLStr ); INetURLObject aPathURL( aURL ); @@ -253,7 +245,7 @@ XPropertyList::CreatePropertyListFromURL( XPropertyListType t, aPathURL.removeFinalSlash(); XPropertyListRef pList = XPropertyList::CreatePropertyList( - t, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool ); + t, aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); pList->SetName( aURL.getName() ); return pList; diff --git a/svx/source/xoutdev/xtablend.cxx b/svx/source/xoutdev/xtablend.cxx index 30ce2a4cb1b6..4accd713b8f1 100644 --- a/svx/source/xoutdev/xtablend.cxx +++ b/svx/source/xoutdev/xtablend.cxx @@ -21,128 +21,25 @@ #include <vcl/virdev.hxx> #include <vcl/svapp.hxx> -#include <svl/itemset.hxx> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> #include <svx/xtable.hxx> -#include <svx/xpool.hxx> -#include <svx/xfillit0.hxx> -#include <svx/xflclit.hxx> -#include <svx/xlnstwit.hxx> -#include <svx/xlnedwit.hxx> -#include <svx/xlnclit.hxx> -#include <svx/xlineit0.hxx> -#include <svx/xlnstit.hxx> -#include <svx/xlnedit.hxx> -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> +#include <drawinglayer/attribute/linestartendattribute.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> -#include <svx/svdorect.hxx> -#include <svx/svdopath.hxx> -#include <svx/svdmodel.hxx> -#include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> -#include <svx/sdr/contact/displayinfo.hxx> -#include <svx/xlnwtit.hxx> - using namespace com::sun::star; -class impXLineEndList -{ -private: - VirtualDevice* mpVirtualDevice; - SdrModel* mpSdrModel; - SdrObject* mpBackgroundObject; - SdrObject* mpLineObject; - -public: - impXLineEndList(VirtualDevice* pV, SdrModel* pM, SdrObject* pB, SdrObject* pL) - : mpVirtualDevice(pV), - mpSdrModel(pM), - mpBackgroundObject(pB), - mpLineObject(pL) - {} - - ~impXLineEndList() - { - delete mpVirtualDevice; - SdrObject::Free(mpBackgroundObject); - SdrObject::Free(mpLineObject); - delete mpSdrModel; - } - - VirtualDevice* getVirtualDevice() const { return mpVirtualDevice; } - SdrObject* getBackgroundObject() const { return mpBackgroundObject; } - SdrObject* getLineObject() const { return mpLineObject; } -}; - -void XLineEndList::impCreate() -{ - if(!mpData) - { - const Point aZero(0, 0); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - - VirtualDevice* pVirDev = new VirtualDevice; - OSL_ENSURE(0 != pVirDev, "XLineEndList: no VirtualDevice created!" ); - pVirDev->SetMapMode(MAP_100TH_MM); - const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); - const Size aSize(pVirDev->PixelToLogic(Size(rSize.Width() * 2, rSize.Height()))); - pVirDev->SetOutputSize(aSize); - pVirDev->SetDrawMode(rStyleSettings.GetHighContrastMode() - ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT - : DRAWMODE_DEFAULT); - pVirDev->SetBackground(rStyleSettings.GetFieldColor()); - - SdrModel* pSdrModel = new SdrModel(); - OSL_ENSURE(0 != pSdrModel, "XLineEndList: no SdrModel created!" ); - pSdrModel->GetItemPool().FreezeIdRanges(); - - const Rectangle aBackgroundSize(aZero, aSize); - SdrObject* pBackgroundObject = new SdrRectObj(aBackgroundSize); - OSL_ENSURE(0 != pBackgroundObject, "XLineEndList: no BackgroundObject created!" ); - pBackgroundObject->SetModel(pSdrModel); - pBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID)); - pBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_NONE)); - pBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor())); - - const basegfx::B2DPoint aStart(0, aSize.Height() / 2); - const basegfx::B2DPoint aEnd(aSize.Width() - 1, aSize.Height() / 2); - basegfx::B2DPolygon aPolygon; - aPolygon.append(aStart); - aPolygon.append(aEnd); - SdrObject* pLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon)); - OSL_ENSURE(0 != pLineObject, "XLineEndList: no LineObject created!" ); - pLineObject->SetModel(pSdrModel); - const Size aLineWidth(pVirDev->PixelToLogic(Size(rStyleSettings.GetListBoxPreviewDefaultLineWidth(), 0))); - pLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth())); - const sal_uInt32 nArrowHeight((aSize.Height() * 8) / 10); - pLineObject->SetMergedItem(XLineStartWidthItem(nArrowHeight)); - pLineObject->SetMergedItem(XLineEndWidthItem(nArrowHeight)); - pLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor())); - - mpData = new impXLineEndList(pVirDev, pSdrModel, pBackgroundObject, pLineObject); - OSL_ENSURE(0 != mpData, "XLineEndList: data creation went wrong!" ); - } -} - -void XLineEndList::impDestroy() -{ - delete mpData; - mpData = NULL; -} - -XLineEndList::XLineEndList( const String& rPath, XOutdevItemPool* _pXPool ) - : XPropertyList( XLINE_END_LIST, rPath, _pXPool ), - mpData(NULL) +XLineEndList::XLineEndList( const String& rPath ) + : XPropertyList( XLINE_END_LIST, rPath ) { } XLineEndList::~XLineEndList() { - impDestroy(); } XLineEndEntry* XLineEndList::Remove(long nIndex) @@ -186,25 +83,86 @@ sal_Bool XLineEndList::Create() Bitmap XLineEndList::CreateBitmapForUI( long nIndex ) { - impCreate(); - VirtualDevice* pVD = mpData->getVirtualDevice(); - SdrObject* pLine = mpData->getLineObject(); + Bitmap aRetval; + OSL_ENSURE(nIndex < Count(), "OOps, access out of range (!)"); - pLine->SetMergedItem(XLineStyleItem(XLINE_SOLID)); - pLine->SetMergedItem(XLineStartItem(String(), GetLineEnd(nIndex)->GetLineEnd())); - pLine->SetMergedItem(XLineEndItem(String(), GetLineEnd(nIndex)->GetLineEnd())); + if(nIndex < Count()) + { + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); - sdr::contact::SdrObjectVector aObjectVector; - aObjectVector.push_back(mpData->getBackgroundObject()); - aObjectVector.push_back(pLine); - sdr::contact::ObjectContactOfObjListPainter aPainter(*pVD, aObjectVector, 0); - sdr::contact::DisplayInfo aDisplayInfo; + const Size aSize(rSize.Width() * 2, rSize.Height()); + + // prepare line geometry + basegfx::B2DPolygon aLine; + const double fBorderDistance(aSize.Height() * 0.1); + + aLine.append(basegfx::B2DPoint(fBorderDistance, aSize.Height() / 2)); + aLine.append(basegfx::B2DPoint(aSize.Width() - fBorderDistance, aSize.Height() / 2)); + + // prepare LineAttribute + const basegfx::BColor aLineColor(rStyleSettings.GetFieldTextColor().getBColor()); + const double fLineWidth(rStyleSettings.GetListBoxPreviewDefaultLineWidth() * 1.1); + const drawinglayer::attribute::LineAttribute aLineAttribute( + aLineColor, + fLineWidth); + + const basegfx::B2DPolyPolygon aLineEnd(GetLineEnd(nIndex)->GetLineEnd()); + const double fArrowHeight(aSize.Height() - (2.0 * fBorderDistance)); + const drawinglayer::attribute::LineStartEndAttribute aLineStartEndAttribute( + fArrowHeight, + aLineEnd, + false); + + // prepare line primitive + const drawinglayer::primitive2d::Primitive2DReference aLineStartEndPrimitive( + new drawinglayer::primitive2d::PolygonStrokeArrowPrimitive2D( + aLine, + aLineAttribute, + aLineStartEndAttribute, + aLineStartEndAttribute)); + + // prepare VirtualDevice + VirtualDevice aVirtualDevice; + const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D; + + aVirtualDevice.SetOutputSizePixel(aSize); + aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode() + ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT + : DRAWMODE_DEFAULT); - pVD->Erase(); - aPainter.ProcessDisplay(aDisplayInfo); + if(rStyleSettings.GetUIPreviewUsesCheckeredBackground()) + { + const Point aNull(0, 0); + static const sal_uInt32 nLen(8); + static const Color aW(COL_WHITE); + static const Color aG(0xef, 0xef, 0xef); + aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG); + } + else + { + aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor()); + aVirtualDevice.Erase(); + } + + // create processor and draw primitives + drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice( + aVirtualDevice, + aNewViewInformation2D); + + if(pProcessor2D) + { + const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aLineStartEndPrimitive, 1); + + pProcessor2D->process(aSequence); + delete pProcessor2D; + } + + // get result bitmap and scale + aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()); + } - const Point aZero(0, 0); - return pVD->GetBitmap(aZero, pVD->GetOutputSize()); + return aRetval; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 0df08a4ba2a6..6539d385b083 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -243,6 +243,7 @@ ImplStyleData::ImplStyleData() : maListBoxPreviewDefaultLogicSize = Size(15, 7); maListBoxPreviewDefaultPixelSize = Size(0, 0); // on-demand calculated in GetListBoxPreviewDefaultPixelSize() mnListBoxPreviewDefaultLineWidth = 1; + mbUIPreviewUsesCheckeredBackground = true; SetStandardStyles(); } @@ -366,6 +367,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : maListBoxPreviewDefaultLogicSize = rData.maListBoxPreviewDefaultLogicSize; maListBoxPreviewDefaultPixelSize = rData.maListBoxPreviewDefaultPixelSize; mnListBoxPreviewDefaultLineWidth = rData.mnListBoxPreviewDefaultLineWidth; + mbUIPreviewUsesCheckeredBackground = rData.mbUIPreviewUsesCheckeredBackground; } // ----------------------------------------------------------------------- @@ -982,7 +984,8 @@ sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const (mpData->mnColorValueSetMaximumRowCount == rSet.mpData->mnColorValueSetMaximumRowCount) && (mpData->maListBoxPreviewDefaultLogicSize == rSet.mpData->maListBoxPreviewDefaultLogicSize) && (mpData->maListBoxPreviewDefaultPixelSize == rSet.mpData->maListBoxPreviewDefaultPixelSize) && - (mpData->mnListBoxPreviewDefaultLineWidth == rSet.mpData->mnListBoxPreviewDefaultLineWidth)) + (mpData->mnListBoxPreviewDefaultLineWidth == rSet.mpData->mnListBoxPreviewDefaultLineWidth) && + (mpData->mbUIPreviewUsesCheckeredBackground == rSet.mpData->mbUIPreviewUsesCheckeredBackground)) return sal_True; else return sal_False; diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx index 98614c85eaa3..0f252fa84dc3 100644 --- a/vcl/source/gdi/outmap.cxx +++ b/vcl/source/gdi/outmap.cxx @@ -2173,19 +2173,54 @@ basegfx::B2DPolygon OutputDevice::LogicToLogic( const basegfx::B2DPolygon& rPoly const MapMode& rMapModeSource, const MapMode& rMapModeDest ) { - if ( rMapModeSource == rMapModeDest ) + if(rMapModeSource == rMapModeDest) + { return rPolySource; + } - MapUnit eUnitSource = rMapModeSource.GetMapUnit(); - MapUnit eUnitDest = rMapModeDest.GetMapUnit(); - ENTER2( eUnitSource, eUnitDest ); + const basegfx::B2DHomMatrix aTransform(LogicToLogic(rMapModeSource, rMapModeDest)); + basegfx::B2DPolygon aPoly(rPolySource); + + aPoly.transform(aTransform); + return aPoly; +} + +// ----------------------------------------------------------------------- + +basegfx::B2DPolyPolygon OutputDevice::LogicToLogic( const basegfx::B2DPolyPolygon& rPolySource, + const MapMode& rMapModeSource, + const MapMode& rMapModeDest ) +{ + if(rMapModeSource == rMapModeDest) + { + return rPolySource; + } + + const basegfx::B2DHomMatrix aTransform(LogicToLogic(rMapModeSource, rMapModeDest)); + basegfx::B2DPolyPolygon aPoly(rPolySource); + + aPoly.transform(aTransform); + return aPoly; +} +// ----------------------------------------------------------------------- + +basegfx::B2DHomMatrix OutputDevice::LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest) +{ basegfx::B2DHomMatrix aTransform; - if ( rMapModeSource.mpImplMapMode->mbSimple && - rMapModeDest.mpImplMapMode->mbSimple ) + if(rMapModeSource == rMapModeDest) { - ENTER3( eUnitSource, eUnitDest ); + return aTransform; + } + + MapUnit eUnitSource = rMapModeSource.GetMapUnit(); + MapUnit eUnitDest = rMapModeDest.GetMapUnit(); + ENTER2(eUnitSource, eUnitDest); + + if(rMapModeSource.mpImplMapMode->mbSimple && rMapModeDest.mpImplMapMode->mbSimple) + { + ENTER3(eUnitSource, eUnitDest); const double fScaleFactor((double)nNumerator / (double)nDenominator); aTransform.set(0, 0, fScaleFactor); @@ -2193,12 +2228,10 @@ basegfx::B2DPolygon OutputDevice::LogicToLogic( const basegfx::B2DPolygon& rPoly } else { - ENTER4( rMapModeSource, rMapModeDest ); + ENTER4(rMapModeSource, rMapModeDest); - const double fScaleFactorX( (double(aMapResSource.mnMapScNumX) * double(aMapResDest.mnMapScDenomX)) - / (double(aMapResSource.mnMapScDenomX) * double(aMapResDest.mnMapScNumX)) ); - const double fScaleFactorY( (double(aMapResSource.mnMapScNumY) * double(aMapResDest.mnMapScDenomY)) - / (double(aMapResSource.mnMapScDenomY) * double(aMapResDest.mnMapScNumY)) ); + const double fScaleFactorX((double(aMapResSource.mnMapScNumX) * double(aMapResDest.mnMapScDenomX)) / (double(aMapResSource.mnMapScDenomX) * double(aMapResDest.mnMapScNumX))); + const double fScaleFactorY((double(aMapResSource.mnMapScNumY) * double(aMapResDest.mnMapScDenomY)) / (double(aMapResSource.mnMapScDenomY) * double(aMapResDest.mnMapScNumY))); const double fZeroPointX(double(aMapResSource.mnMapOfsX) * fScaleFactorX - double(aMapResDest.mnMapOfsX)); const double fZeroPointY(double(aMapResSource.mnMapOfsY) * fScaleFactorY - double(aMapResDest.mnMapOfsY)); @@ -2207,9 +2240,8 @@ basegfx::B2DPolygon OutputDevice::LogicToLogic( const basegfx::B2DPolygon& rPoly aTransform.set(0, 2, fZeroPointX); aTransform.set(1, 2, fZeroPointY); } - basegfx::B2DPolygon aPoly( rPolySource ); - aPoly.transform( aTransform ); - return aPoly; + + return aTransform; } // ----------------------------------------------------------------------- |