summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-06-18 10:07:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-06-18 13:06:12 +0100
commit7377557f277b19c4953198c17b591fd964ac7c40 (patch)
tree205ee08ac0651082379c1bced5ada7105e27029a /svx
parent08337321e655a3b4991c895de98d96858e60d863 (diff)
Resolves: #i122120# Changed UI preview creators...
to no longer need SdrModel/SdrObject (cherry picked from commit 0c353433ad94786a937fa9da01d6e7382e3da942) corrected unwanted change (cherry picked from commit 8a10735b8ee3926a592d6919f4dbb823771bed9f) Conflicts: vcl/inc/vcl/outdev.hxx 7c096015d974382e6874a874370ee72a61f02e6a Change-Id: Ib2afe135566eba2e99cc8c4a653de3df0fa7f0cd
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/dlgctrl.cxx20
-rw-r--r--svx/source/gallery2/galctrl.cxx27
-rw-r--r--svx/source/svdraw/svdmodel.cxx2
-rw-r--r--svx/source/tbxctrls/fontworkgallery.cxx22
-rw-r--r--svx/source/xoutdev/xtabdash.cxx229
-rw-r--r--svx/source/xoutdev/xtabgrdt.cxx228
-rw-r--r--svx/source/xoutdev/xtabhtch.cxx214
-rw-r--r--svx/source/xoutdev/xtable.cxx18
-rw-r--r--svx/source/xoutdev/xtablend.cxx204
9 files changed, 465 insertions, 499 deletions
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: */