You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/04/30 14:43:41 UTC
svn commit: r1477598 - in /openoffice/trunk/main: svx/inc/svx/
svx/source/dialog/ svx/source/gallery2/ svx/source/svdraw/
svx/source/tbxctrls/ svx/source/xoutdev/ vcl/inc/vcl/ vcl/source/app/
vcl/source/gdi/
Author: alg
Date: Tue Apr 30 12:43:40 2013
New Revision: 1477598
URL: http://svn.apache.org/r1477598
Log:
i122120 Changed all UI preview creators to no longer need SdrModel/SdrObject
Modified:
openoffice/trunk/main/svx/inc/svx/svdmodel.hxx
openoffice/trunk/main/svx/inc/svx/xtable.hxx
openoffice/trunk/main/svx/source/dialog/dlgctrl.cxx
openoffice/trunk/main/svx/source/gallery2/galctrl.cxx
openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx
openoffice/trunk/main/svx/source/tbxctrls/fontworkgallery.cxx
openoffice/trunk/main/svx/source/xoutdev/xtabbtmp.cxx
openoffice/trunk/main/svx/source/xoutdev/xtabcolr.cxx
openoffice/trunk/main/svx/source/xoutdev/xtabdash.cxx
openoffice/trunk/main/svx/source/xoutdev/xtabgrdt.cxx
openoffice/trunk/main/svx/source/xoutdev/xtabhtch.cxx
openoffice/trunk/main/svx/source/xoutdev/xtable.cxx
openoffice/trunk/main/svx/source/xoutdev/xtablend.cxx
openoffice/trunk/main/vcl/inc/vcl/outdev.hxx
openoffice/trunk/main/vcl/inc/vcl/settings.hxx
openoffice/trunk/main/vcl/source/app/settings.cxx
openoffice/trunk/main/vcl/source/gdi/outmap.cxx
Modified: openoffice/trunk/main/svx/inc/svx/svdmodel.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/inc/svx/svdmodel.hxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/inc/svx/svdmodel.hxx (original)
+++ openoffice/trunk/main/svx/inc/svx/svdmodel.hxx Tue Apr 30 12:43:40 2013
@@ -217,7 +217,7 @@ protected:
sal_uInt16 nStreamNumberFormat;
sal_uInt16 nDefaultTabulator;
sal_uInt32 nMaxUndoCount;
- FASTBOOL mbAutomaticXPropertyListCreation;
+ FASTBOOL bSaveNative;
sal_Bool bStarDrawPreviewMode;
@@ -488,6 +488,13 @@ public:
FASTBOOL IsSaveCompressed() const { return bSaveCompressed; }
void SetSaveCompressed(FASTBOOL bJa=sal_True) { bSaveCompressed=bJa; }
+ // Schaltet man dieses Flag auf sal_True, so werden
+ // Grafikobjekte mit gesetztem Native-Link
+ // native gespeichert.
+ // Default=FALSE. Flag ist nicht persistent.
+ FASTBOOL IsSaveNative() const { return bSaveNative; }
+ void SetSaveNative(FASTBOOL bJa=sal_True) { bSaveNative=bJa; }
+
// Schaltet man dieses Flag auf sal_True, so werden die Grafiken
// von Grafikobjekten:
// - beim Laden eines Dokuments nicht sofort mitgeladen,
@@ -718,9 +725,6 @@ public:
This returns false if undo was disabled using EnableUndo( false ) and
also during the runtime of the Undo() and Redo() methods. */
bool IsUndoEnabled() const;
-
- void SetAutomaticXPropertyListCreation(bool bNew) { mbAutomaticXPropertyListCreation = bNew; }
- bool IsAutomaticXPropertyListCreation() const { return mbAutomaticXPropertyListCreation; }
};
typedef tools::WeakReference< SdrModel > SdrModelWeakRef;
Modified: openoffice/trunk/main/svx/inc/svx/xtable.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/inc/svx/xtable.hxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/inc/svx/xtable.hxx (original)
+++ openoffice/trunk/main/svx/inc/svx/xtable.hxx Tue Apr 30 12:43:40 2013
@@ -23,25 +23,13 @@
#define _XTABLE_HXX
// include ---------------------------------------------------------------
-
#include <svx/xpoly.hxx>
#include <svx/xdash.hxx>
#include <svx/xhatch.hxx>
#include <svx/xgrad.hxx>
-#include <svx/xflasit.hxx>
-#include <svx/xlnasit.hxx>
-#include <tools/color.hxx>
-#include <tools/string.hxx>
-#include <svx/svxdllapi.h>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <svtools/grfmgr.hxx>
#include <svx/XPropertyEntry.hxx>
-
-class Color;
-class Bitmap;
-class VirtualDevice;
-class SdrModel;
-class SdrObject;
+#include <vcl/bitmap.hxx>
// Standard-Vergleichsstring
extern sal_Unicode __FAR_DATA pszStandard[]; // "standard"
@@ -180,34 +168,11 @@ public:
};
//////////////////////////////////////////////////////////////////////////////
-// helper class for UI visualization previews
-
-class sharedModelAndVDev
-{
-private:
- sal_uInt32 mnUseCount;
- VirtualDevice* mpVirtualDevice;
- SdrModel* mpSdrModel;
-
-public:
- sharedModelAndVDev();
- ~sharedModelAndVDev();
-
- void increaseUseCount();
- bool decreaseUseCount();
-
- SdrModel& getSharedSdrModel();
- VirtualDevice& getSharedVirtualDevice();
-};
-
-//////////////////////////////////////////////////////////////////////////////
// class XPropertyList
class SVX_DLLPUBLIC XPropertyList
{
protected:
- static sharedModelAndVDev* pGlobalsharedModelAndVDev;
-
String maName; // nicht persistent !
String maPath;
@@ -316,9 +281,6 @@ private:
friend class XPropertyListFactory;
XLineEndList(const String& rPath );
- SdrObject* mpBackgroundObject;
- SdrObject* mpLineObject;
-
protected:
virtual Bitmap CreateBitmapForUI(long nIndex);
@@ -345,8 +307,6 @@ private:
friend class XPropertyListFactory;
XDashList(const String& rPath );
- SdrObject* mpBackgroundObject;
- SdrObject* mpLineObject;
Bitmap maBitmapSolidLine;
String maStringSolidLine;
String maStringNoLine;
@@ -388,9 +348,6 @@ private:
friend class XPropertyListFactory;
XHatchList(const String& rPath );
- SdrObject* mpBackgroundObject;
- SdrObject* mpHatchObject;
-
protected:
virtual Bitmap CreateBitmapForUI(long nIndex);
@@ -417,8 +374,6 @@ private:
friend class XPropertyListFactory;
XGradientList(const String& rPath );
- SdrObject* mpBackgroundObject;
-
protected:
virtual Bitmap CreateBitmapForUI(long nIndex);
Modified: openoffice/trunk/main/svx/source/dialog/dlgctrl.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/dialog/dlgctrl.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/dialog/dlgctrl.cxx (original)
+++ openoffice/trunk/main/svx/source/dialog/dlgctrl.cxx Tue Apr 30 12:43:40 2013
@@ -1396,12 +1396,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())
Modified: openoffice/trunk/main/svx/source/gallery2/galctrl.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/gallery2/galctrl.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/gallery2/galctrl.cxx (original)
+++ openoffice/trunk/main/svx/source/gallery2/galctrl.cxx Tue Apr 30 12:43:40 2013
@@ -300,14 +300,25 @@ void GalleryPreview::PreviewMedia( const
// ------------------------------------------------------------------------
-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));
+ }
}
// -------------------
@@ -435,7 +446,7 @@ void GalleryIconView::UserDraw( const Us
if(bTransparent)
{
// draw checkered background
- drawCheckered(*pDev, aPos, aSize);
+ drawTransparenceBackground(*pDev, aPos, aSize);
}
aGraphic.Draw( pDev, aPos, aSize );
@@ -687,7 +698,7 @@ void GalleryListView::PaintField( Output
if(bTransparent)
{
// draw checkered background
- drawCheckered(rDev, aPos, aSize);
+ drawTransparenceBackground(rDev, aPos, aSize);
}
aGrfObj.Draw( &rDev, aPos, aSize );
Modified: openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx (original)
+++ openoffice/trunk/main/svx/source/svdraw/svdmodel.cxx Tue Apr 30 12:43:40 2013
@@ -150,7 +150,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPoo
bPageNotValid=sal_False;
bSavePortable=sal_False;
bSaveCompressed=sal_False;
- mbAutomaticXPropertyListCreation=true;
+ bSaveNative=sal_False;
bSwapGraphics=sal_False;
nSwapGraphicsMode=SDR_SWAPGRAPHICSMODE_DEFAULT;
bSaveOLEPreview=sal_False;
@@ -2122,7 +2122,7 @@ void SdrModel::SetColorTableAtSdrModel(X
XColorListSharedPtr SdrModel::GetColorTableFromSdrModel() const
{
- if(IsAutomaticXPropertyListCreation() && !maColorTable.get())
+ if(!maColorTable.get())
{
const_cast< SdrModel* >(this)->maColorTable = XPropertyListFactory::CreateSharedXColorList(aTablePath);
}
@@ -2137,7 +2137,7 @@ void SdrModel::SetDashListAtSdrModel(XDa
XDashListSharedPtr SdrModel::GetDashListFromSdrModel() const
{
- if(IsAutomaticXPropertyListCreation() && !maDashList.get())
+ if(!maDashList.get())
{
const_cast< SdrModel* >(this)->maDashList = XPropertyListFactory::CreateSharedXDashList(aTablePath);
}
@@ -2152,7 +2152,7 @@ void SdrModel::SetLineEndListAtSdrModel(
XLineEndListSharedPtr SdrModel::GetLineEndListFromSdrModel() const
{
- if(IsAutomaticXPropertyListCreation() && !maLineEndList.get())
+ if(!maLineEndList.get())
{
const_cast< SdrModel* >(this)->maLineEndList = XPropertyListFactory::CreateSharedXLineEndList(aTablePath);
}
@@ -2167,7 +2167,7 @@ void SdrModel::SetHatchListAtSdrModel(XH
XHatchListSharedPtr SdrModel::GetHatchListFromSdrModel() const
{
- if(IsAutomaticXPropertyListCreation() && !maHatchList.get())
+ if(!maHatchList.get())
{
const_cast< SdrModel* >(this)->maHatchList = XPropertyListFactory::CreateSharedXHatchList(aTablePath);
}
@@ -2182,7 +2182,7 @@ void SdrModel::SetGradientListAtSdrModel
XGradientListSharedPtr SdrModel::GetGradientListFromSdrModel() const
{
- if(IsAutomaticXPropertyListCreation() && !maGradientList.get())
+ if(!maGradientList.get())
{
const_cast< SdrModel* >(this)->maGradientList = XPropertyListFactory::CreateSharedXGradientList(aTablePath);
}
@@ -2197,7 +2197,7 @@ void SdrModel::SetBitmapListAtSdrModel(X
XBitmapListSharedPtr SdrModel::GetBitmapListFromSdrModel() const
{
- if(IsAutomaticXPropertyListCreation() && !maBitmapList.get())
+ if(!maBitmapList.get())
{
const_cast< SdrModel* >(this)->maBitmapList = XPropertyListFactory::CreateSharedXBitmapList(aTablePath);
}
Modified: openoffice/trunk/main/svx/source/tbxctrls/fontworkgallery.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/tbxctrls/fontworkgallery.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/tbxctrls/fontworkgallery.cxx (original)
+++ openoffice/trunk/main/svx/source/tbxctrls/fontworkgallery.cxx Tue Apr 30 12:43:40 2013
@@ -121,6 +121,8 @@ void FontWorkGalleryDialog::initFavorite
sal_uInt32 nModelPos;
FmFormModel *pModel = NULL;
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+
for( nModelPos = 0; nModelPos < nFavCount; nModelPos++ )
{
BitmapEx aThumb;
@@ -129,17 +131,27 @@ void FontWorkGalleryDialog::initFavorite
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));
}
}
Modified: openoffice/trunk/main/svx/source/xoutdev/xtabbtmp.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/xoutdev/xtabbtmp.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/xoutdev/xtabbtmp.cxx (original)
+++ openoffice/trunk/main/svx/source/xoutdev/xtabbtmp.cxx Tue Apr 30 12:43:40 2013
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
Modified: openoffice/trunk/main/svx/source/xoutdev/xtabcolr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/xoutdev/xtabcolr.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/xoutdev/xtabcolr.cxx (original)
+++ openoffice/trunk/main/svx/source/xoutdev/xtabcolr.cxx Tue Apr 30 12:43:40 2013
@@ -19,24 +19,15 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#ifndef SVX_LIGHT
-
#include <com/sun/star/container/XNameContainer.hpp>
#include "svx/XPropertyTable.hxx"
#include <unotools/ucbstreamhelper.hxx>
-
#include <unotools/pathoptions.hxx>
-
#include "xmlxtexp.hxx"
#include "xmlxtimp.hxx"
-
-#endif
-
#include <sfx2/docfile.hxx>
#include <tools/urlobj.hxx>
#include <svx/dialogs.hrc>
@@ -107,7 +98,7 @@ sal_Bool XColorList::Load()
if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
{
- DBG_ASSERT( !maPath.Len(), "invalid URL" );
+ OSL_ENSURE( !maPath.Len(), "invalid URL" );
return sal_False;
}
@@ -130,7 +121,7 @@ sal_Bool XColorList::Save()
if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
{
- DBG_ASSERT( !maPath.Len(), "invalid URL" );
+ OSL_ENSURE( !maPath.Len(), "invalid URL" );
return sal_False;
}
Modified: openoffice/trunk/main/svx/source/xoutdev/xtabdash.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/xoutdev/xtabdash.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/xoutdev/xtabdash.cxx (original)
+++ openoffice/trunk/main/svx/source/xoutdev/xtabdash.cxx Tue Apr 30 12:43:40 2013
@@ -19,46 +19,25 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
// include ---------------------------------------------------------------
-
-#ifndef SVX_LIGHT
-
#include <com/sun/star/container/XNameContainer.hpp>
#include "svx/XPropertyTable.hxx"
#include <unotools/ucbstreamhelper.hxx>
-
#include "xmlxtexp.hxx"
#include "xmlxtimp.hxx"
-
-#endif
#include <vcl/svapp.hxx>
-
#include <tools/urlobj.hxx>
#include <vcl/virdev.hxx>
-#include <vcl/window.hxx>
-#include <svl/itemset.hxx>
-#include <sfx2/docfile.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>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/processor2d/processor2dtools.hxx>
using namespace com::sun::star;
using namespace rtl;
@@ -75,9 +54,7 @@ sal_Unicode const pszExtDash[] = {'s','
// ----------------
XDashList::XDashList(const String& rPath )
-: XPropertyList(rPath ),
- mpBackgroundObject(0),
- mpLineObject(0),
+: XPropertyList(rPath),
maBitmapSolidLine(),
maStringSolidLine(),
maStringNoLine()
@@ -86,8 +63,6 @@ XDashList::XDashList(const String& rPath
XDashList::~XDashList()
{
- SdrObject::Free(mpBackgroundObject);
- SdrObject::Free(mpLineObject);
}
XDashEntry* XDashList::Replace(XDashEntry* pEntry, long nIndex )
@@ -115,7 +90,7 @@ sal_Bool XDashList::Load()
if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
{
- DBG_ASSERT( !maPath.Len(), "invalid URL" );
+ OSL_ENSURE( !maPath.Len(), "invalid URL" );
return sal_False;
}
@@ -136,7 +111,7 @@ sal_Bool XDashList::Save()
if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
{
- DBG_ASSERT( !maPath.Len(), "invalid URL" );
+ OSL_ENSURE( !maPath.Len(), "invalid URL" );
return sal_False;
}
@@ -167,87 +142,102 @@ sal_Bool XDashList::Create()
Bitmap XDashList::ImpCreateBitmapForXDash(const XDash* pDash)
{
- // to avoid rendering trouble (e.g. vcl renderer) and to get better AAed quality,
- // use double prerender size
- static bool bUseDoubleSize = true;
+ 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;
+
+ 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);
- Bitmap aRetval;
- OSL_ENSURE(pGlobalsharedModelAndVDev, "OOps, global values missing (!)");
-
- if(pGlobalsharedModelAndVDev)
+ if(pDash && (pDash->GetDots() || pDash->GetDashes()))
{
- SdrModel& rModel = pGlobalsharedModelAndVDev->getSharedSdrModel();
- VirtualDevice& rVirDev = pGlobalsharedModelAndVDev->getSharedVirtualDevice();
- const Point aZero(0, 0);
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
- const Size aSize(rVirDev.PixelToLogic(Size(
- bUseDoubleSize ? rSize.Width() * 5 : rSize.Width() * 5 / 2,
- bUseDoubleSize ? rSize.Height() * 2 : rSize.Height())));
-
- rVirDev.SetOutputSize(aSize);
- rVirDev.SetDrawMode(rStyleSettings.GetHighContrastMode()
- ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
- : DRAWMODE_DEFAULT);
- rVirDev.SetBackground(rStyleSettings.GetFieldColor());
+ 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);
- if(!mpBackgroundObject)
- {
- const Rectangle aBackgroundSize(aZero, aSize);
- mpBackgroundObject = new SdrRectObj(aBackgroundSize);
- OSL_ENSURE(0 != mpBackgroundObject, "XDashList: no BackgroundObject created!" );
- mpBackgroundObject->SetModel(&rModel);
- mpBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
- mpBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
- mpBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
- }
+ fFullDotDashLen = pDash->CreateDotDashArray(aDotDashArray, fLineWidthInUnits);
- if(!mpLineObject)
+ if(!aDotDashArray.empty())
{
- 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);
- mpLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon));
- OSL_ENSURE(0 != mpLineObject, "XDashList: no LineObject created!" );
- mpLineObject->SetModel(&rModel);
- mpLineObject->SetMergedItem(XLineStyleItem(XLINE_DASH));
- mpLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor()));
- const Size aLineWidth(rVirDev.PixelToLogic(Size(rStyleSettings.GetListBoxPreviewDefaultLineWidth(), 0)));
- mpLineObject->SetMergedItem(XLineWidthItem(bUseDoubleSize ? aLineWidth.getWidth() * 2 : aLineWidth.getWidth()));
- }
+ for(sal_uInt32 a(0); a < aDotDashArray.size(); a++)
+ {
+ aDotDashArray[a] *= fScaleValue;
+ }
- if(pDash)
- {
- mpLineObject->SetMergedItem(XLineStyleItem(XLINE_DASH));
- mpLineObject->SetMergedItem(XLineDashItem(String(), *pDash));
- }
- else
- {
- mpLineObject->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ fFullDotDashLen *= fScaleValue;
}
+ }
- sdr::contact::SdrObjectVector aObjectVector;
+ 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);
- aObjectVector.push_back(mpBackgroundObject);
- aObjectVector.push_back(mpLineObject);
+ 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);
- sdr::contact::ObjectContactOfObjListPainter aPainter(rVirDev, aObjectVector, 0);
- sdr::contact::DisplayInfo aDisplayInfo;
+ aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG);
+ }
+ else
+ {
+ aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
+ aVirtualDevice.Erase();
+ }
- rVirDev.Erase();
- aPainter.ProcessDisplay(aDisplayInfo);
+ // create processor and draw primitives
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
+ aVirtualDevice,
+ aNewViewInformation2D);
- aRetval = rVirDev.GetBitmap(aZero, rVirDev.GetOutputSize());
-
- if(bUseDoubleSize)
- {
- const Size aCurrentSize(aRetval.GetSizePixel());
+ if(pProcessor2D)
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aLinePrimitive, 1);
- aRetval.Scale(Size(aCurrentSize.Width() / 2, aCurrentSize.Height() / 2), BMP_SCALE_FASTESTINTERPOLATE);
- }
+ pProcessor2D->process(aSequence);
+ delete pProcessor2D;
+ }
+
+ // get result bitmap and scale
+ Bitmap aRetval(aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel()));
+
+ if(1 != nFactor)
+ {
+ aRetval.Scale(Size((rSize.Width() * 5) / 2, rSize.Height()), BMP_SCALE_FASTESTINTERPOLATE);
}
return aRetval;
Modified: openoffice/trunk/main/svx/source/xoutdev/xtabgrdt.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/xoutdev/xtabgrdt.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/xoutdev/xtabgrdt.cxx (original)
+++ openoffice/trunk/main/svx/source/xoutdev/xtabgrdt.cxx Tue Apr 30 12:43:40 2013
@@ -19,42 +19,26 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
// include ---------------------------------------------------------------
-
-#ifndef SVX_LIGHT
-
#include <com/sun/star/container/XNameContainer.hpp>
#include "svx/XPropertyTable.hxx"
#include <unotools/ucbstreamhelper.hxx>
-
#include "xmlxtexp.hxx"
#include "xmlxtimp.hxx"
-
-#endif
-
#include <tools/urlobj.hxx>
#include <vcl/virdev.hxx>
-#include <svl/itemset.hxx>
-#include <sfx2/docfile.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>
+#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>
#define GLOBALOVERFLOW
@@ -71,14 +55,12 @@ sal_Unicode const pszExtGradient[] = {'s
// --------------------
XGradientList::XGradientList( const String& rPath )
-: XPropertyList(rPath ),
- mpBackgroundObject(0)
+: XPropertyList(rPath )
{
}
XGradientList::~XGradientList()
{
- SdrObject::Free(mpBackgroundObject);
}
XGradientEntry* XGradientList::Replace(XGradientEntry* pEntry, long nIndex )
@@ -163,57 +145,125 @@ sal_Bool XGradientList::Create()
return( sal_True );
}
-Bitmap XGradientList::CreateBitmapForUI( long nIndex )
+Bitmap XGradientList::CreateBitmapForUI(long nIndex)
{
Bitmap aRetval;
- OSL_ENSURE(pGlobalsharedModelAndVDev, "OOps, global values missing (!)");
- OSL_ENSURE(nIndex < Count(), "OOps, global values missing (!)");
+ OSL_ENSURE(nIndex < Count(), "OOps, access out of range (!)");
- if(pGlobalsharedModelAndVDev && nIndex < Count())
+ if(nIndex < Count())
{
- SdrModel& rModel = pGlobalsharedModelAndVDev->getSharedSdrModel();
- VirtualDevice& rVirDev = pGlobalsharedModelAndVDev->getSharedVirtualDevice();
- const Point aZero(0, 0);
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
- const Size aSize(rVirDev.PixelToLogic(rSize));
- rVirDev.SetOutputSize(aSize);
- rVirDev.SetDrawMode(rStyleSettings.GetHighContrastMode()
- ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
- : DRAWMODE_DEFAULT);
- rVirDev.SetBackground(rStyleSettings.GetFieldColor());
+ // 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(!mpBackgroundObject)
+ if(nEndIntens != 100)
{
- const Size aSinglePixel(rVirDev.PixelToLogic(Size(1, 1)));
- const Rectangle aBackgroundSize(aZero, Size(aSize.getWidth() - aSinglePixel.getWidth(), aSize.getHeight() - aSinglePixel.getHeight()));
- mpBackgroundObject = new SdrRectObj(aBackgroundSize);
- OSL_ENSURE(0 != mpBackgroundObject, "XGradientList: no BackgroundObject created!" );
- mpBackgroundObject->SetModel(&rModel);
- mpBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT));
- mpBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID));
- mpBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK)));
- mpBackgroundObject->SetMergedItem(XGradientStepCountItem(sal_uInt16((rSize.Width() + rSize.Height()) / 3)));
+ const basegfx::BColor aBlack;
+ aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01);
}
- const SfxItemSet& rItemSet = mpBackgroundObject->GetMergedItemSet();
+ 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;
+ }
+ case XGRAD_RADIAL :
+ {
+ 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;
+ }
+ }
- mpBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_GRADIENT));
- mpBackgroundObject->SetMergedItem(XFillGradientItem(rItemSet.GetPool(), GetGradient(nIndex)->GetGradient()));
+ 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;
- sdr::contact::SdrObjectVector aObjectVector;
+ aVirtualDevice.SetOutputSizePixel(rSize);
+ aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
+ ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
+ : DRAWMODE_DEFAULT);
- aObjectVector.push_back(mpBackgroundObject);
+ // create processor and draw primitives
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
+ aVirtualDevice,
+ aNewViewInformation2D);
- sdr::contact::ObjectContactOfObjListPainter aPainter(rVirDev, aObjectVector, 0);
- sdr::contact::DisplayInfo aDisplayInfo;
+ if(pProcessor2D)
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aSequence(2);
- rVirDev.Erase();
- aPainter.ProcessDisplay(aDisplayInfo);
+ aSequence[0] = aGradientPrimitive;
+ aSequence[1] = aBlackRectanglePrimitive;
- return rVirDev.GetBitmap(aZero, rVirDev.GetOutputSize());
+ pProcessor2D->process(aSequence);
+ delete pProcessor2D;
+ }
+ // get result bitmap and scale
+ aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
}
return aRetval;
Modified: openoffice/trunk/main/svx/source/xoutdev/xtabhtch.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/xoutdev/xtabhtch.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/xoutdev/xtabhtch.cxx (original)
+++ openoffice/trunk/main/svx/source/xoutdev/xtabhtch.cxx Tue Apr 30 12:43:40 2013
@@ -19,43 +19,26 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
// include ---------------------------------------------------------------
-
-#ifndef SVX_LIGHT
-
#include <com/sun/star/container/XNameContainer.hpp>
#include "svx/XPropertyTable.hxx"
#include <unotools/ucbstreamhelper.hxx>
#include <vcl/svapp.hxx>
-
#include "xmlxtexp.hxx"
#include "xmlxtimp.hxx"
-
-#endif
-
#include <tools/urlobj.hxx>
#include <vcl/virdev.hxx>
-#include <svl/itemset.hxx>
-#include <sfx2/docfile.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;
@@ -70,16 +53,12 @@ sal_Unicode const pszExtHatch[] = {'s',
// -----------------
XHatchList::XHatchList(const String& rPath )
-: XPropertyList(rPath),
- mpBackgroundObject(0),
- mpHatchObject(0)
+: XPropertyList(rPath)
{
}
XHatchList::~XHatchList()
{
- SdrObject::Free(mpBackgroundObject);
- SdrObject::Free(mpHatchObject);
}
XHatchEntry* XHatchList::Replace(XHatchEntry* pEntry, long nIndex )
@@ -107,7 +86,7 @@ sal_Bool XHatchList::Load()
if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
{
- DBG_ASSERT( !maPath.Len(), "invalid URL" );
+ OSL_ENSURE( !maPath.Len(), "invalid URL" );
return sal_False;
}
@@ -128,7 +107,7 @@ sal_Bool XHatchList::Save()
if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
{
- DBG_ASSERT( !maPath.Len(), "invalid URL" );
+ OSL_ENSURE( !maPath.Len(), "invalid URL" );
return sal_False;
}
@@ -160,61 +139,106 @@ sal_Bool XHatchList::Create()
Bitmap XHatchList::CreateBitmapForUI( long nIndex )
{
Bitmap aRetval;
- OSL_ENSURE(pGlobalsharedModelAndVDev, "OOps, global values missing (!)");
- OSL_ENSURE(nIndex < Count(), "OOps, global values missing (!)");
+ OSL_ENSURE(nIndex < Count(), "OOps, access out of range (!)");
- if(pGlobalsharedModelAndVDev && nIndex < Count())
+ if(nIndex < Count())
{
- SdrModel& rModel = pGlobalsharedModelAndVDev->getSharedSdrModel();
- VirtualDevice& rVirDev = pGlobalsharedModelAndVDev->getSharedVirtualDevice();
- const Point aZero(0, 0);
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- const Size aSize(rVirDev.PixelToLogic(rStyleSettings.GetListBoxPreviewDefaultPixelSize()));
+ const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
- rVirDev.SetOutputSize(aSize);
- rVirDev.SetDrawMode(rStyleSettings.GetHighContrastMode()
- ? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
- : DRAWMODE_DEFAULT);
- rVirDev.SetBackground(rStyleSettings.GetFieldColor());
+ // prepare polygon geometry for rectangle
+ const basegfx::B2DPolygon aRectangle(
+ basegfx::tools::createPolygonFromRect(
+ basegfx::B2DRange(0.0, 0.0, rSize.Width(), rSize.Height())));
- const Size aSinglePixel(rVirDev.PixelToLogic(Size(1, 1)));
- const Rectangle aBackgroundSize(aZero, Size(aSize.getWidth() - aSinglePixel.getWidth(), aSize.getHeight() - aSinglePixel.getHeight()));
+ const XHatch& rHatch = GetHatch(nIndex)->GetHatch();
+ drawinglayer::attribute::HatchStyle aHatchStyle(drawinglayer::attribute::HATCHSTYLE_TRIPLE);
- if(!mpBackgroundObject)
+ switch(rHatch.GetHatchStyle())
{
- mpBackgroundObject = new SdrRectObj(aBackgroundSize);
- OSL_ENSURE(0 != mpBackgroundObject, "XDashList: no BackgroundObject created!" );
- mpBackgroundObject->SetModel(&rModel);
- mpBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
- mpBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
- mpBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_SOLID));
- mpBackgroundObject->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK)));
+ 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;
+ }
}
- if(!mpHatchObject)
+ 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);
+
+ if(rStyleSettings.GetUIPreviewUsesCheckeredBackground())
{
- mpHatchObject = new SdrRectObj(aBackgroundSize);
- OSL_ENSURE(0 != mpHatchObject, "XDashList: no HatchObject created!" );
- mpHatchObject->SetModel(&rModel);
- mpHatchObject->SetMergedItem(XFillStyleItem(XFILL_HATCH));
- mpHatchObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
- }
+ const Point aNull(0, 0);
+ static const sal_uInt32 nLen(8);
+ static const Color aW(COL_WHITE);
+ static const Color aG(0xef, 0xef, 0xef);
- mpHatchObject->SetMergedItem(XFillStyleItem(XFILL_HATCH));
- mpHatchObject->SetMergedItem(XFillHatchItem(String(), GetHatch(nIndex)->GetHatch()));
+ aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG);
+ }
+ else
+ {
+ aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
+ aVirtualDevice.Erase();
+ }
- sdr::contact::SdrObjectVector aObjectVector;
+ // create processor and draw primitives
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
+ aVirtualDevice,
+ aNewViewInformation2D);
- aObjectVector.push_back(mpBackgroundObject);
- aObjectVector.push_back(mpHatchObject);
+ if(pProcessor2D)
+ {
+ drawinglayer::primitive2d::Primitive2DSequence aSequence(2);
- sdr::contact::ObjectContactOfObjListPainter aPainter(rVirDev, aObjectVector, 0);
- sdr::contact::DisplayInfo aDisplayInfo;
+ aSequence[0] = aHatchPrimitive;
+ aSequence[1] = aBlackRectanglePrimitive;
- rVirDev.Erase();
- aPainter.ProcessDisplay(aDisplayInfo);
+ pProcessor2D->process(aSequence);
+ delete pProcessor2D;
+ }
- aRetval = rVirDev.GetBitmap(aZero, rVirDev.GetOutputSize());
+ // get result bitmap and scale
+ aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
}
return aRetval;
Modified: openoffice/trunk/main/svx/source/xoutdev/xtable.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/xoutdev/xtable.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/xoutdev/xtable.cxx (original)
+++ openoffice/trunk/main/svx/source/xoutdev/xtable.cxx Tue Apr 30 12:43:40 2013
@@ -19,17 +19,12 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#include <svx/xtable.hxx>
#include <svx/xpool.hxx>
-#include <svx/svdobj.hxx>
#include <svx/svdpool.hxx>
-#include <vcl/virdev.hxx>
-#include <svx/svdmodel.hxx>
#define GLOBALOVERFLOW
@@ -45,61 +40,6 @@ Color RGB_Color( ColorData nColorName )
return aRGBColor;
}
-sharedModelAndVDev::sharedModelAndVDev()
-: mnUseCount(0),
- mpVirtualDevice(0),
- mpSdrModel(0)
-{
-}
-
-sharedModelAndVDev::~sharedModelAndVDev()
-{
- delete mpVirtualDevice;
- delete mpSdrModel;
-}
-
-void sharedModelAndVDev::increaseUseCount()
-{
- mnUseCount++;
-}
-
-bool sharedModelAndVDev::decreaseUseCount()
-{
- if(mnUseCount)
- {
- mnUseCount--;
- }
-
- return 0 == mnUseCount;
-}
-
-SdrModel& sharedModelAndVDev::getSharedSdrModel()
-{
- if(!mpSdrModel)
- {
- mpSdrModel = new SdrModel();
- OSL_ENSURE(0 != mpSdrModel, "XPropertyList sharedModelAndVDev: no SdrModel created!" );
- mpSdrModel->GetItemPool().FreezeIdRanges();
- mpSdrModel->SetAutomaticXPropertyListCreation(false);
- }
-
- return *mpSdrModel;
-}
-
-VirtualDevice& sharedModelAndVDev::getSharedVirtualDevice()
-{
- if(!mpVirtualDevice)
- {
- mpVirtualDevice = new VirtualDevice;
- OSL_ENSURE(0 != mpVirtualDevice, "XPropertyList sharedModelAndVDev: no VirtualDevice created!" );
- mpVirtualDevice->SetMapMode(MAP_100TH_MM);
- }
-
- return *mpVirtualDevice;
-}
-
-sharedModelAndVDev* XPropertyList::pGlobalsharedModelAndVDev = 0;
-
// --------------------
// class XPropertyList
// --------------------
@@ -110,12 +50,6 @@ XPropertyList::XPropertyList( const Stri
maContent(),
mbListDirty (true)
{
- if(!pGlobalsharedModelAndVDev)
- {
- pGlobalsharedModelAndVDev = new sharedModelAndVDev();
- }
-
- pGlobalsharedModelAndVDev->increaseUseCount();
}
/*************************************************************************
@@ -131,12 +65,6 @@ XPropertyList::~XPropertyList()
delete maContent.back();
maContent.pop_back();
}
-
- if(pGlobalsharedModelAndVDev && pGlobalsharedModelAndVDev->decreaseUseCount())
- {
- delete pGlobalsharedModelAndVDev;
- pGlobalsharedModelAndVDev = 0;
- }
}
/*************************************************************************
@@ -264,7 +192,7 @@ void XPropertyList::Insert( XPropertyEnt
{
const long nObjectCount(maContent.size());
- if(static_cast<long>(LIST_APPEND) == nIndex || nIndex >= nObjectCount)
+ if(static_cast< long >(LIST_APPEND) == nIndex || nIndex >= nObjectCount)
{
maContent.push_back(pEntry);
}
Modified: openoffice/trunk/main/svx/source/xoutdev/xtablend.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/xoutdev/xtablend.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/xoutdev/xtablend.cxx (original)
+++ openoffice/trunk/main/svx/source/xoutdev/xtablend.cxx Tue Apr 30 12:43:40 2013
@@ -19,56 +19,26 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
// include ---------------------------------------------------------------
-
-#ifndef SVX_LIGHT
-
#include <com/sun/star/container/XNameContainer.hpp>
#include "svx/XPropertyTable.hxx"
#include <unotools/ucbstreamhelper.hxx>
-
#include "xmlxtexp.hxx"
#include "xmlxtimp.hxx"
-
-#endif
#include <tools/urlobj.hxx>
#include <vcl/virdev.hxx>
-
-#ifndef _SV_APP_HXX
#include <vcl/svapp.hxx>
-#endif
-#include <svl/itemset.hxx>
-#include <sfx2/docfile.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>
-
#define GLOBALOVERFLOW
using namespace com::sun::star;
@@ -84,16 +54,12 @@ sal_Unicode const pszExtLineEnd[] = {'s'
// --------------------
XLineEndList::XLineEndList(const String& rPath)
-: XPropertyList(rPath),
- mpBackgroundObject(0),
- mpLineObject(0)
+: XPropertyList(rPath)
{
}
XLineEndList::~XLineEndList()
{
- SdrObject::Free(mpBackgroundObject);
- SdrObject::Free(mpLineObject);
}
XLineEndEntry* XLineEndList::Replace(XLineEndEntry* pEntry, long nIndex )
@@ -121,7 +87,7 @@ sal_Bool XLineEndList::Load()
if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
{
- DBG_ASSERT( !maPath.Len(), "invalid URL" );
+ OSL_ENSURE( !maPath.Len(), "invalid URL" );
return sal_False;
}
@@ -142,7 +108,7 @@ sal_Bool XLineEndList::Save()
if( INET_PROT_NOT_VALID == aURL.GetProtocol() )
{
- DBG_ASSERT( !maPath.Len(), "invalid URL" );
+ OSL_ENSURE( !maPath.Len(), "invalid URL" );
return sal_False;
}
@@ -181,69 +147,82 @@ sal_Bool XLineEndList::Create()
Bitmap XLineEndList::CreateBitmapForUI( long nIndex )
{
Bitmap aRetval;
- OSL_ENSURE(pGlobalsharedModelAndVDev, "OOps, global values missing (!)");
- OSL_ENSURE(nIndex < Count(), "OOps, global values missing (!)");
+ OSL_ENSURE(nIndex < Count(), "OOps, access out of range (!)");
- if(pGlobalsharedModelAndVDev && nIndex < Count())
+ if(nIndex < Count())
{
- SdrModel& rModel = pGlobalsharedModelAndVDev->getSharedSdrModel();
- VirtualDevice& rVirDev = pGlobalsharedModelAndVDev->getSharedVirtualDevice();
- const Point aZero(0, 0);
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const Size& rSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize();
- const Size aSize(rVirDev.PixelToLogic(Size(rSize.Width() * 2, rSize.Height())));
+ 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;
- rVirDev.SetOutputSize(aSize);
- rVirDev.SetDrawMode(rStyleSettings.GetHighContrastMode()
+ aVirtualDevice.SetOutputSizePixel(aSize);
+ aVirtualDevice.SetDrawMode(rStyleSettings.GetHighContrastMode()
? DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT
: DRAWMODE_DEFAULT);
- rVirDev.SetBackground(rStyleSettings.GetFieldColor());
- if(!mpBackgroundObject)
+ if(rStyleSettings.GetUIPreviewUsesCheckeredBackground())
{
- const Rectangle aBackgroundSize(aZero, aSize);
- mpBackgroundObject = new SdrRectObj(aBackgroundSize);
- OSL_ENSURE(0 != mpBackgroundObject, "XLineEndList: no BackgroundObject created!" );
- mpBackgroundObject->SetModel(&rModel);
- mpBackgroundObject->SetMergedItem(XFillStyleItem(XFILL_SOLID));
- mpBackgroundObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
- mpBackgroundObject->SetMergedItem(XFillColorItem(String(), rStyleSettings.GetFieldColor()));
- }
+ const Point aNull(0, 0);
+ static const sal_uInt32 nLen(8);
+ static const Color aW(COL_WHITE);
+ static const Color aG(0xef, 0xef, 0xef);
- if(!mpLineObject)
+ aVirtualDevice.DrawCheckered(aNull, aSize, nLen, aW, aG);
+ }
+ else
{
- const basegfx::B2DPoint aStart(0, aSize.Height() / 2);
- const basegfx::B2DPoint aEnd(aSize.Width(), aSize.Height() / 2);
- basegfx::B2DPolygon aPolygon;
- aPolygon.append(aStart);
- aPolygon.append(aEnd);
- mpLineObject = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygon));
- OSL_ENSURE(0 != mpLineObject, "XLineEndList: no LineObject created!" );
- mpLineObject->SetModel(&rModel);
- const Size aLineWidth(rVirDev.PixelToLogic(Size(rStyleSettings.GetListBoxPreviewDefaultLineWidth(), 0)));
- mpLineObject->SetMergedItem(XLineWidthItem(aLineWidth.getWidth()));
- const sal_uInt32 nArrowHeight((aSize.Height() * 8) / 10);
- mpLineObject->SetMergedItem(XLineStartWidthItem(nArrowHeight));
- mpLineObject->SetMergedItem(XLineEndWidthItem(nArrowHeight));
- mpLineObject->SetMergedItem(XLineColorItem(String(), rStyleSettings.GetFieldTextColor()));
+ aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
+ aVirtualDevice.Erase();
}
- mpLineObject->SetMergedItem(XLineStyleItem(XLINE_SOLID));
- mpLineObject->SetMergedItem(XLineStartItem(String(), GetLineEnd(nIndex)->GetLineEnd()));
- mpLineObject->SetMergedItem(XLineEndItem(String(), GetLineEnd(nIndex)->GetLineEnd()));
+ // create processor and draw primitives
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
+ aVirtualDevice,
+ aNewViewInformation2D);
- sdr::contact::SdrObjectVector aObjectVector;
-
- aObjectVector.push_back(mpBackgroundObject);
- aObjectVector.push_back(mpLineObject);
-
- sdr::contact::ObjectContactOfObjListPainter aPainter(rVirDev, aObjectVector, 0);
- sdr::contact::DisplayInfo aDisplayInfo;
+ if(pProcessor2D)
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aLineStartEndPrimitive, 1);
- rVirDev.Erase();
- aPainter.ProcessDisplay(aDisplayInfo);
+ pProcessor2D->process(aSequence);
+ delete pProcessor2D;
+ }
- aRetval = rVirDev.GetBitmap(aZero, rVirDev.GetOutputSize());
+ // get result bitmap and scale
+ aRetval = aVirtualDevice.GetBitmap(Point(0, 0), aVirtualDevice.GetOutputSizePixel());
}
return aRetval;
Modified: openoffice/trunk/main/vcl/inc/vcl/outdev.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/inc/vcl/outdev.hxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/inc/vcl/outdev.hxx (original)
+++ openoffice/trunk/main/vcl/inc/vcl/outdev.hxx Tue Apr 30 12:43:40 2013
@@ -905,7 +905,7 @@ public:
void SetOutDevViewType( OutDevViewType eOutDevViewType ) { meOutDevViewType=eOutDevViewType; }
OutDevViewType GetOutDevViewType() const { return meOutDevViewType; }
- void SetLineColor();
+ void Fdrawrect;
void SetLineColor( const Color& rColor );
const Color& GetLineColor() const { return maLineColor; }
sal_Bool IsLineColor() const { return mbLineColor; }
@@ -1086,6 +1086,10 @@ public:
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 ); }
long GetOutputWidthPixel() const { return mnOutWidth; }
Modified: openoffice/trunk/main/vcl/inc/vcl/settings.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/inc/vcl/settings.hxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/inc/vcl/settings.hxx (original)
+++ openoffice/trunk/main/vcl/inc/vcl/settings.hxx Tue Apr 30 12:43:40 2013
@@ -440,6 +440,7 @@ private:
Size maListBoxPreviewDefaultLogicSize;
Size maListBoxPreviewDefaultPixelSize;
sal_uInt16 mnListBoxPreviewDefaultLineWidth;
+ sal_Bool mbUIPreviewUsesCheckeredBackground;
};
#define DEFAULT_WORKSPACE_GRADIENT_START_COLOR Color( 0xa3, 0xae, 0xb8 )
@@ -969,6 +970,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 );
Modified: openoffice/trunk/main/vcl/source/app/settings.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/app/settings.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/app/settings.cxx (original)
+++ openoffice/trunk/main/vcl/source/app/settings.cxx Tue Apr 30 12:43:40 2013
@@ -441,6 +441,7 @@ ImplStyleData::ImplStyleData()
maListBoxPreviewDefaultLogicSize = Size(15, 7);
maListBoxPreviewDefaultPixelSize = Size(0, 0); // on-demand calculated in GetListBoxPreviewDefaultPixelSize()
mnListBoxPreviewDefaultLineWidth = 1;
+ mbUIPreviewUsesCheckeredBackground = true;
SetStandardStyles();
}
@@ -553,6 +554,7 @@ ImplStyleData::ImplStyleData( const Impl
maListBoxPreviewDefaultLogicSize = rData.maListBoxPreviewDefaultLogicSize;
maListBoxPreviewDefaultPixelSize = rData.maListBoxPreviewDefaultPixelSize;
mnListBoxPreviewDefaultLineWidth = rData.mnListBoxPreviewDefaultLineWidth;
+ mbUIPreviewUsesCheckeredBackground = rData.mbUIPreviewUsesCheckeredBackground;
}
// -----------------------------------------------------------------------
@@ -1072,7 +1074,8 @@ sal_Bool StyleSettings::operator ==( con
(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;
Modified: openoffice/trunk/main/vcl/source/gdi/outmap.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/vcl/source/gdi/outmap.cxx?rev=1477598&r1=1477597&r2=1477598&view=diff
==============================================================================
--- openoffice/trunk/main/vcl/source/gdi/outmap.cxx (original)
+++ openoffice/trunk/main/vcl/source/gdi/outmap.cxx Tue Apr 30 12:43:40 2013
@@ -2322,43 +2322,16 @@ basegfx::B2DPolygon OutputDevice::LogicT
const MapMode& rMapModeSource,
const MapMode& rMapModeDest )
{
- if ( rMapModeSource == rMapModeDest )
- return rPolySource;
-
- MapUnit eUnitSource = rMapModeSource.GetMapUnit();
- MapUnit eUnitDest = rMapModeDest.GetMapUnit();
- ENTER2( eUnitSource, eUnitDest );
-
- basegfx::B2DHomMatrix aTransform;
-
- if ( rMapModeSource.mpImplMapMode->mbSimple &&
- rMapModeDest.mpImplMapMode->mbSimple )
- {
- ENTER3( eUnitSource, eUnitDest );
+ if(rMapModeSource == rMapModeDest)
+ {
+ return rPolySource;
+ }
- const double fScaleFactor((double)nNumerator / (double)nDenominator);
- aTransform.set(0, 0, fScaleFactor);
- aTransform.set(1, 1, fScaleFactor);
- }
- else
- {
- ENTER4( rMapModeSource, rMapModeDest );
+ const basegfx::B2DHomMatrix aTransform(LogicToLogic(rMapModeSource, rMapModeDest));
+ basegfx::B2DPolygon aPoly(rPolySource);
- 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));
-
- aTransform.set(0, 0, fScaleFactorX);
- aTransform.set(1, 1, fScaleFactorY);
- aTransform.set(0, 2, fZeroPointX);
- aTransform.set(1, 2, fZeroPointY);
- }
- basegfx::B2DPolygon aPoly( rPolySource );
- aPoly.transform( aTransform );
- return aPoly;
+ aPoly.transform(aTransform);
+ return aPoly;
}
// -----------------------------------------------------------------------
@@ -2367,43 +2340,57 @@ basegfx::B2DPolyPolygon OutputDevice::Lo
const MapMode& rMapModeSource,
const MapMode& rMapModeDest )
{
- if ( rMapModeSource == rMapModeDest )
- return rPolySource;
+ if(rMapModeSource == rMapModeDest)
+ {
+ return rPolySource;
+ }
- MapUnit eUnitSource = rMapModeSource.GetMapUnit();
- MapUnit eUnitDest = rMapModeDest.GetMapUnit();
- ENTER2( eUnitSource, eUnitDest );
+ const basegfx::B2DHomMatrix aTransform(LogicToLogic(rMapModeSource, rMapModeDest));
+ basegfx::B2DPolyPolygon aPoly(rPolySource);
- basegfx::B2DHomMatrix aTransform;
+ aPoly.transform(aTransform);
+ return aPoly;
+}
- if ( rMapModeSource.mpImplMapMode->mbSimple &&
- rMapModeDest.mpImplMapMode->mbSimple )
- {
- ENTER3( eUnitSource, eUnitDest );
+// -----------------------------------------------------------------------
- const double fScaleFactor((double)nNumerator / (double)nDenominator);
- aTransform.set(0, 0, fScaleFactor);
- aTransform.set(1, 1, fScaleFactor);
- }
- else
- {
- ENTER4( rMapModeSource, rMapModeDest );
+basegfx::B2DHomMatrix OutputDevice::LogicToLogic(const MapMode& rMapModeSource, const MapMode& rMapModeDest)
+{
+ basegfx::B2DHomMatrix aTransform;
- 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));
-
- aTransform.set(0, 0, fScaleFactorX);
- aTransform.set(1, 1, fScaleFactorY);
- aTransform.set(0, 2, fZeroPointX);
- aTransform.set(1, 2, fZeroPointY);
- }
- basegfx::B2DPolyPolygon aPoly( rPolySource );
- aPoly.transform( aTransform );
- return aPoly;
+ if(rMapModeSource == rMapModeDest)
+ {
+ 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);
+ aTransform.set(1, 1, fScaleFactor);
+ }
+ else
+ {
+ 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 fZeroPointX(double(aMapResSource.mnMapOfsX) * fScaleFactorX - double(aMapResDest.mnMapOfsX));
+ const double fZeroPointY(double(aMapResSource.mnMapOfsY) * fScaleFactorY - double(aMapResDest.mnMapOfsY));
+
+ aTransform.set(0, 0, fScaleFactorX);
+ aTransform.set(1, 1, fScaleFactorY);
+ aTransform.set(0, 2, fZeroPointX);
+ aTransform.set(1, 2, fZeroPointY);
+ }
+
+ return aTransform;
}
// -----------------------------------------------------------------------