[Libreoffice-commits] core.git: Branch 'distro/suse/suse-3.6' - 234 commits - basctl/source basic/source chart2/source config_host.mk.in configure.in connectivity/source cui/source dbaccess/source desktop/source desktop/unx distro-configs/LibreOfficeLinux.conf drawinglayer/source editeng/source embeddedobj/source extras/source filter/source i18npool/inc i18npool/source instsetoo_native/inc_openoffice l10ntools/source libcdr/libcdr-issupported-exception.patch.1 libcdr/makefile.mk odk/cfgWin.js odk/configure.pl odk/index.html odk/index_online.html odk/setsdkenv_unix padmin/source postprocess/packcomponents reportdesign/inc reportdesign/source RepositoryExternal.mk sal/inc sal/osl scaddins/source sc/inc scp2/source scripting/source sc/source sd/source setup_native/source sfx2/inc sfx2/source shell/CustomTarget_shlxthdl_res.mk solenv/gbuild solenv/inc starmath/source svl/inc svl/source svtools/source svx/source sw/CppunitTest_sw_subsequent_rtfexport.mk sw/qa sw/source sysui/desktop toolkit/in c tools/source ucb/source unotools/source vcl/aqua vcl/source vcl/unx vcl/win wizards/source writerfilter/CustomTarget_source.mk writerfilter/inc writerfilter/Library_writerfilter.mk writerfilter/source xmloff/inc xmloff/source
Petr Mladek
pmladek at suse.cz
Tue Mar 5 05:16:07 PST 2013
RepositoryExternal.mk | 4
basctl/source/basicide/unomodel.cxx | 24 +
basctl/source/basicide/unomodel.hxx | 12
basic/source/runtime/methods.cxx | 6
chart2/source/tools/ExplicitCategoriesProvider.cxx | 24 +
config_host.mk.in | 1
configure.in | 26 +
connectivity/source/drivers/jdbc/JStatement.cxx | 14
cui/source/inc/numpages.hxx | 13
cui/source/tabpages/numpages.cxx | 113 ++++---
cui/source/tabpages/page.cxx | 21 +
cui/source/tabpages/page.src | 29 +-
dbaccess/source/ui/inc/TableConnectionData.hxx | 3
dbaccess/source/ui/querydesign/QueryDesignView.cxx | 45 ++-
desktop/source/app/cmdlineargs.cxx | 13
desktop/source/deployment/manager/dp_extensionmanager.cxx | 30 ++
desktop/source/deployment/registry/component/dp_component.cxx | 22 +
desktop/source/migration/services/oo3extensionmigration.cxx | 25 -
desktop/unx/source/splashx.c | 3
distro-configs/LibreOfficeLinux.conf | 1
drawinglayer/source/primitive2d/metafileprimitive2d.cxx | 3
editeng/source/editeng/editdoc.cxx | 2
editeng/source/misc/svxacorr.cxx | 4
embeddedobj/source/msole/oleembed.cxx | 9
extras/source/autotext/lang/tr/crdbus50.bau |binary
extras/source/autotext/lang/tr/template.bau |binary
filter/source/msfilter/escherex.cxx | 14
i18npool/inc/breakiterator_unicode.hxx | 7
i18npool/source/breakiterator/breakiterator_unicode.cxx | 80 ++---
i18npool/source/localedata/data/he_IL.xml | 19 -
i18npool/source/localedata/localedata.cxx | 2
instsetoo_native/inc_openoffice/windows/msi_languages/Control.ulf | 4
l10ntools/source/lngmerge.cxx | 6
libcdr/libcdr-issupported-exception.patch.1 | 42 ++
libcdr/makefile.mk | 2
odk/cfgWin.js | 50 ---
odk/index.html | 7
odk/index_online.html | 7
padmin/source/rtsetup.src | 2
postprocess/packcomponents/makefile.mk | 4
reportdesign/inc/ReportDefinition.hxx | 3
reportdesign/source/core/api/ReportDefinition.cxx | 24 -
sal/inc/rtl/allocator.hxx | 8
sal/inc/rtl/ustring.hxx | 123 ++++----
sal/osl/w32/file_dirvol.cxx | 20 +
sc/inc/xmlwrap.hxx | 2
sc/source/core/data/conditio.cxx | 11
sc/source/core/data/dpcache.cxx | 6
sc/source/core/tool/compiler.cxx | 4
sc/source/core/tool/interpr1.cxx | 6
sc/source/filter/excel/xestyle.cxx | 8
sc/source/filter/oox/workbookhelper.cxx | 13
sc/source/filter/xml/xmlcondformat.cxx | 3
sc/source/filter/xml/xmlimprt.cxx | 1
sc/source/filter/xml/xmlimprt.hxx | 3
sc/source/filter/xml/xmlwrap.cxx | 14
sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx | 2
sc/source/ui/Accessibility/AccessibleTableBase.cxx | 20 +
sc/source/ui/cctrl/checklistmenu.cxx | 3
sc/source/ui/dbgui/tpsort.cxx | 2
sc/source/ui/docshell/dbdocfun.cxx | 3
sc/source/ui/inc/tabview.hxx | 2
sc/source/ui/view/gridwin.cxx | 3
sc/source/ui/view/tabview.cxx | 27 -
sc/source/ui/view/tabview4.cxx | 36 --
scaddins/source/analysis/analysishelper.cxx | 8
scp2/source/ooo/file_library_ooo.scp | 3
scripting/source/provider/ProviderCache.cxx | 2
sd/source/filter/eppt/epptso.cxx | 11
sd/source/filter/xml/sdxmlwrp.cxx | 21 -
sd/source/ui/slidesorter/controller/SlideSorterController.cxx | 5
sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx | 42 ++
sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx | 2
sd/source/ui/view/Outliner.cxx | 8
setup_native/source/packinfo/spellchecker_selection.pl | 3
sfx2/inc/sfx2/tabdlg.hxx | 4
sfx2/source/control/dispatch.cxx | 18 -
sfx2/source/dialog/tabdlg.cxx | 19 +
sfx2/source/doc/sfxbasemodel.cxx | 3
sfx2/source/view/viewprn.cxx | 1
shell/CustomTarget_shlxthdl_res.mk | 13
solenv/gbuild/platform/com_GCC_defs.mk | 6
solenv/inc/settings.mk | 4
starmath/source/mathmlexport.cxx | 16 -
starmath/source/mathmlexport.hxx | 3
svl/inc/svl/zformat.hxx | 1
svl/source/numbers/zforfind.cxx | 78 +++++
svl/source/numbers/zforfind.hxx | 10
svl/source/numbers/zformat.cxx | 9
svtools/source/control/tabbar.cxx | 8
svtools/source/misc/sampletext.cxx | 15 -
svtools/source/svhtml/parhtml.cxx | 2
svx/source/dialog/docrecovery.cxx | 4
svx/source/inc/docrecovery.hxx | 4
svx/source/svdraw/svdhdl.cxx | 10
svx/source/tbxctrls/linectrl.cxx | 5
svx/source/tbxctrls/verttexttbxctrl.cxx | 13
sw/CppunitTest_sw_subsequent_rtfexport.mk | 2
sw/qa/extras/rtfexport/data/fdo52286.odt |binary
sw/qa/extras/rtfexport/rtfexport.cxx | 23 +
sw/source/core/crsr/crstrvl.cxx | 2
sw/source/core/frmedt/feshview.cxx | 4
sw/source/core/text/porfld.cxx | 14
sw/source/core/text/portxt.cxx | 4
sw/source/core/txtnode/ndtxt.cxx | 45 ++-
sw/source/core/unocore/unocrsrhelper.cxx | 39 +-
sw/source/core/unocore/unoobj.cxx | 4
sw/source/core/unocore/unoobj2.cxx | 7
sw/source/core/view/pagepreviewlayout.cxx | 29 +-
sw/source/filter/html/htmlfldw.cxx | 5
sw/source/filter/html/htmlfly.cxx | 3
sw/source/filter/rtf/swparrtf.cxx | 4
sw/source/filter/ww8/rtfattributeoutput.cxx | 22 +
sw/source/filter/ww8/writerwordglue.cxx | 4
sw/source/filter/ww8/wrtww8.cxx | 4
sw/source/filter/ww8/ww8atr.cxx | 9
sw/source/filter/xml/wrtxml.cxx | 18 -
sw/source/filter/xml/wrtxml.hxx | 3
sw/source/ui/app/docst.cxx | 9
sw/source/ui/app/swmodul1.cxx | 24 -
sw/source/ui/app/swmodule.cxx | 2
sw/source/ui/cctrl/actctrl.cxx | 4
sw/source/ui/chrdlg/drpcps.cxx | 12
sw/source/ui/chrdlg/numpara.cxx | 4
sw/source/ui/chrdlg/pardlg.cxx | 2
sw/source/ui/docvw/edtdd.cxx | 4
sw/source/ui/docvw/edtwin.cxx | 34 +-
sw/source/ui/inc/pview.hxx | 5
sw/source/ui/inc/view.hxx | 6
sw/source/ui/ribbar/conform.cxx | 4
sw/source/ui/ribbar/drawbase.cxx | 16 -
sw/source/ui/shells/textfld.cxx | 6
sw/source/ui/uiview/pview.cxx | 27 +
sw/source/ui/uiview/view.cxx | 10
sw/source/ui/uiview/viewmdi.cxx | 23 +
sw/source/ui/uiview/viewport.cxx | 9
sw/source/ui/uno/unotxdoc.cxx | 5
sw/source/ui/wrtsh/wrtsh3.cxx | 6
sysui/desktop/menus/base.desktop | 1
sysui/desktop/menus/calc.desktop | 1
sysui/desktop/menus/draw.desktop | 1
sysui/desktop/menus/impress.desktop | 1
sysui/desktop/menus/math.desktop | 1
sysui/desktop/menus/writer.desktop | 1
sysui/desktop/share/translate.pl | 25 -
toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx | 9
tools/source/fsys/urlobj.cxx | 4
ucb/source/ucp/file/bc.cxx | 2
unotools/source/misc/fontcvt.cxx | 144 ++++++++--
vcl/aqua/source/a11y/aqua11ywrapper.mm | 37 +-
vcl/source/control/scrbar.cxx | 12
vcl/source/filter/wmf/winmtf.cxx | 6
vcl/source/gdi/bitmapex.cxx | 18 +
vcl/source/gdi/outdev3.cxx | 13
vcl/source/window/window.cxx | 2
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 5
vcl/unx/kde4/KDE4FilePicker.cxx | 2
vcl/win/source/gdi/winlayout.cxx | 9
wizards/source/importwizard/Main.xba | 2
writerfilter/CustomTarget_source.mk | 15 -
writerfilter/Library_writerfilter.mk | 21 -
writerfilter/inc/dmapper/DomainMapper.hxx | 3
writerfilter/source/dmapper/DomainMapper.cxx | 5
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 11
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 8
writerfilter/source/dmapper/NumberingManager.cxx | 8
writerfilter/source/dmapper/PropertyMap.cxx | 20 -
writerfilter/source/doctok/qnametostr.xsl | 6
writerfilter/source/filter/RtfFilter.cxx | 3
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 51 +--
writerfilter/source/ooxml/qnametostr.xsl | 8
writerfilter/source/resourcemodel/qnametostrcore.cxx | 76 +++++
writerfilter/source/resourcemodel/qnametostrfooter | 24 -
writerfilter/source/resourcemodel/qnametostrheader | 57 ---
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 121 ++++++--
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 13
xmloff/inc/xmloff/xmlnumfe.hxx | 2
xmloff/inc/xmloff/xmltoken.hxx | 2
xmloff/source/core/xmltoken.cxx | 2
xmloff/source/style/xmlnumfe.cxx | 21 -
xmloff/source/style/xmlnumfi.cxx | 20 +
xmloff/source/text/txtexppr.cxx | 8
xmloff/source/text/txtimppr.cxx | 23 +
183 files changed, 1796 insertions(+), 876 deletions(-)
New commits:
commit 1934d3489e37fdc6558c2bc9e2c71b0de6883584
Merge: 67d1f24 085f830
Author: Petr Mladek <pmladek at suse.cz>
Date: Tue Mar 5 14:14:04 2013 +0100
Merge branch 'distro/suse/suse-3.6' of ssh://logerrit/core into suse-3.6
diff --cc vcl/source/filter/wmf/winmtf.cxx
index 0000000,60c0859..57d15e5
mode 000000,100644..100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@@ -1,0 -1,2244 +1,2250 @@@
+ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+ #include "winmtf.hxx"
+ #include <basegfx/matrix/b2dhommatrix.hxx>
+ #include <basegfx/polygon/b2dpolypolygontools.hxx>
+ #include <vcl/metaact.hxx>
+ #include <vcl/graphictools.hxx>
+ #include <vcl/canvastools.hxx>
+ #include <vcl/metric.hxx>
+ #include <vcl/svapp.hxx>
+ #include <rtl/strbuf.hxx>
+ #include <rtl/tencinfo.h>
+
+ // ------------------------------------------------------------------------
+
+ #if OSL_DEBUG_LEVEL > 1
+ #define EMFP_DEBUG(x) x
+ #else
+ #define EMFP_DEBUG(x)
+ #endif
+
+ void WinMtfClipPath::intersectClipRect( const Rectangle& rRect )
+ {
+ maClip.intersectRange(
+ vcl::unotools::b2DRectangleFromRectangle(rRect));
+ }
+
+ void WinMtfClipPath::excludeClipRect( const Rectangle& rRect )
+ {
+ maClip.subtractRange(
+ vcl::unotools::b2DRectangleFromRectangle(rRect));
+ }
+
+ void WinMtfClipPath::setClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode )
+ {
+ const basegfx::B2DPolyPolygon& rB2DPoly=rPolyPolygon.getB2DPolyPolygon();
+ switch ( nClippingMode )
+ {
+ case RGN_OR :
+ maClip.unionPolyPolygon(rB2DPoly);
+ break;
+ case RGN_XOR :
+ maClip.xorPolyPolygon(rB2DPoly);
+ break;
+ case RGN_DIFF :
+ maClip.subtractPolyPolygon(rB2DPoly);
+ break;
+ case RGN_AND :
+ maClip.intersectPolyPolygon(rB2DPoly);
+ break;
+ case RGN_COPY :
+ maClip = basegfx::tools::B2DClipState(rB2DPoly);
+ break;
+ }
+ }
+
+ void WinMtfClipPath::moveClipRegion( const Size& rSize )
+ {
+ // what a weird concept. emulate, don't want this in B2DClipState
+ // API
+ basegfx::B2DPolyPolygon aCurrClip=maClip.getClipPoly();
+ basegfx::B2DHomMatrix aTranslate;
+ aTranslate.translate(rSize.Width(), rSize.Height());
+
+ aCurrClip.transform(aTranslate);
+ maClip = basegfx::tools::B2DClipState( aCurrClip );
+ }
+
+ basegfx::B2DPolyPolygon WinMtfClipPath::getClipPath() const
+ {
+ return maClip.getClipPoly();
+ }
+
+ // ------------------------------------------------------------------------
+
+ void WinMtfPathObj::AddPoint( const Point& rPoint )
+ {
+ if ( bClosed )
+ Insert( Polygon(), POLYPOLY_APPEND );
+ Polygon& rPoly = ((PolyPolygon&)*this)[ Count() - 1 ];
+ rPoly.Insert( rPoly.GetSize(), rPoint, POLY_NORMAL );
+ bClosed = sal_False;
+ }
+
+ void WinMtfPathObj::AddPolyLine( const Polygon& rPolyLine )
+ {
+ if ( bClosed )
+ Insert( Polygon(), POLYPOLY_APPEND );
+ Polygon& rPoly = ((PolyPolygon&)*this)[ Count() - 1 ];
+ rPoly.Insert( rPoly.GetSize(), rPolyLine );
+ bClosed = sal_False;
+ }
+
+ void WinMtfPathObj::AddPolygon( const Polygon& rPoly )
+ {
+ Insert( rPoly, POLYPOLY_APPEND );
+ bClosed = sal_True;
+ }
+
+ void WinMtfPathObj::AddPolyPolygon( const PolyPolygon& rPolyPoly )
+ {
+ sal_uInt16 i, nCount = rPolyPoly.Count();
+ for ( i = 0; i < nCount; i++ )
+ Insert( rPolyPoly[ i ], POLYPOLY_APPEND );
+ bClosed = sal_True;
+ }
+
+ void WinMtfPathObj::ClosePath()
+ {
+ if ( Count() )
+ {
+ Polygon& rPoly = ((PolyPolygon&)*this)[ Count() - 1 ];
+ if ( rPoly.GetSize() > 2 )
+ {
+ Point aFirst( rPoly[ 0 ] );
+ if ( aFirst != rPoly[ rPoly.GetSize() - 1 ] )
+ rPoly.Insert( rPoly.GetSize(), aFirst, POLY_NORMAL );
+ }
+ }
+ bClosed = sal_True;
+ }
+
+ // ------------------------------------------------------------------------
+
+ WinMtfFontStyle::WinMtfFontStyle( LOGFONTW& rFont )
+ {
+ CharSet eCharSet;
+ if ( ( rFont.lfCharSet == OEM_CHARSET ) || ( rFont.lfCharSet == DEFAULT_CHARSET ) )
+ eCharSet = RTL_TEXTENCODING_MS_1252;
+ else
+ eCharSet = rtl_getTextEncodingFromWindowsCharset( rFont.lfCharSet );
+ if ( eCharSet == RTL_TEXTENCODING_DONTKNOW )
+ eCharSet = RTL_TEXTENCODING_MS_1252;
+ aFont.SetCharSet( eCharSet );
+ aFont.SetName( rFont.alfFaceName );
+ FontFamily eFamily;
+ switch ( rFont.lfPitchAndFamily & 0xf0 )
+ {
+ case FF_ROMAN:
+ eFamily = FAMILY_ROMAN;
+ break;
+
+ case FF_SWISS:
+ eFamily = FAMILY_SWISS;
+ break;
+
+ case FF_MODERN:
+ eFamily = FAMILY_MODERN;
+ break;
+
+ case FF_SCRIPT:
+ eFamily = FAMILY_SCRIPT;
+ break;
+
+ case FF_DECORATIVE:
+ eFamily = FAMILY_DECORATIVE;
+ break;
+
+ default:
+ eFamily = FAMILY_DONTKNOW;
+ break;
+ }
+ aFont.SetFamily( eFamily );
+
+ FontPitch ePitch;
+ switch ( rFont.lfPitchAndFamily & 0x0f )
+ {
+ case FIXED_PITCH:
+ ePitch = PITCH_FIXED;
+ break;
+
+ case DEFAULT_PITCH:
+ case VARIABLE_PITCH:
+ default:
+ ePitch = PITCH_VARIABLE;
+ break;
+ }
+ aFont.SetPitch( ePitch );
+
+ FontWeight eWeight;
+ if( rFont.lfWeight <= FW_THIN )
+ eWeight = WEIGHT_THIN;
+ else if( rFont.lfWeight <= FW_ULTRALIGHT )
+ eWeight = WEIGHT_ULTRALIGHT;
+ else if( rFont.lfWeight <= FW_LIGHT )
+ eWeight = WEIGHT_LIGHT;
+ else if( rFont.lfWeight < FW_MEDIUM )
+ eWeight = WEIGHT_NORMAL;
+ else if( rFont.lfWeight == FW_MEDIUM )
+ eWeight = WEIGHT_MEDIUM;
+ else if( rFont.lfWeight <= FW_SEMIBOLD )
+ eWeight = WEIGHT_SEMIBOLD;
+ else if( rFont.lfWeight <= FW_BOLD )
+ eWeight = WEIGHT_BOLD;
+ else if( rFont.lfWeight <= FW_ULTRABOLD )
+ eWeight = WEIGHT_ULTRABOLD;
+ else
+ eWeight = WEIGHT_BLACK;
+ aFont.SetWeight( eWeight );
+
+ if( rFont.lfItalic )
+ aFont.SetItalic( ITALIC_NORMAL );
+
+ if( rFont.lfUnderline )
+ aFont.SetUnderline( UNDERLINE_SINGLE );
+
+ if( rFont.lfStrikeOut )
+ aFont.SetStrikeout( STRIKEOUT_SINGLE );
+
+ if ( rFont.lfOrientation )
+ aFont.SetOrientation( (short)rFont.lfOrientation );
+ else
+ aFont.SetOrientation( (short)rFont.lfEscapement );
+
+ Size aFontSize( Size( rFont.lfWidth, rFont.lfHeight ) );
+ if ( rFont.lfHeight > 0 )
+ {
+ // converting the cell height into a font height
+ VirtualDevice aVDev;
+ aFont.SetSize( aFontSize );
+ aVDev.SetFont( aFont );
+ FontMetric aMetric( aVDev.GetFontMetric() );
+ long nHeight = aMetric.GetAscent() + aMetric.GetDescent();
+ if ( nHeight )
+ {
+ double fHeight = ((double)aFontSize.Height() * rFont.lfHeight ) / nHeight;
+ aFontSize.Height() = (sal_Int32)( fHeight + 0.5 );
+ }
+ }
+ else if ( aFontSize.Height() < 0 )
+ aFontSize.Height() *= -1;
+
+ if ( !rFont.lfWidth )
+ {
+ VirtualDevice aVDev;
+ aFont.SetSize( aFontSize );
+ aVDev.SetFont( aFont );
+ FontMetric aMetric( aVDev.GetFontMetric() );
+ aFontSize.Width() = aMetric.GetWidth();
+ }
+
+ aFont.SetSize( aFontSize );
+ };
+
+ // ------------------------------------------------------------------------
+
+ #ifdef WIN_MTF_ASSERT
+ void WinMtfAssertHandler( const sal_Char* pAction, sal_uInt32 nFlags )
+ {
+ static sal_Bool bOnlyOnce;
+ static sal_Int32 nAssertCount;
+
+ if ( nFlags & WIN_MTF_ASSERT_INIT )
+ nAssertCount = 0;
+ if ( nFlags & WIN_MTF_ASSERT_ONCE )
+ bOnlyOnce = sal_True;
+ if ( nFlags & WIN_MTF_ASSERT_MIFE )
+ {
+ if ( ( nAssertCount == 0 ) || ( bOnlyOnce == sal_False ) )
+ {
+ rtl::OStringBuffer aText(RTL_CONSTASCII_STRINGPARAM(
+ "WMF/EMF Import: "));
+ if (pAction)
+ aText.append(pAction);
+ aText.append(RTL_CONSTASCII_STRINGPARAM(
+ " needs to be implemented"));
+ DBG_ASSERT( 0, aText.getStr() );
+ }
+ nAssertCount++;
+ }
+ }
+ #endif
+
+ // ------------------------------------------------------------------------
+
+ WinMtf::WinMtf( WinMtfOutput* pWinMtfOutput, SvStream& rStreamWMF, FilterConfigItem* pConfigItem ) :
+ pOut ( pWinMtfOutput ),
+ pWMF ( &rStreamWMF ),
+ pFilterConfigItem ( pConfigItem )
+ {
+ #ifdef WIN_MTF_ASSERT
+ // we want to assert not implemented features, but we do this
+ // only once, so that nobody is handicaped by getting too much assertions
+ // I hope this will bring more testdocuments, without support of these
+ // testdocuments the implementation of missing features won't be possible. (SJ)
+ WinMtfAssertHandler( NULL, WIN_MTF_ASSERT_INIT | WIN_MTF_ASSERT_ONCE );
+ #endif
+
+ SvLockBytes *pLB = pWMF->GetLockBytes();
+ if ( pLB )
+ pLB->SetSynchronMode( sal_True );
+
+ nStartPos = pWMF->Tell();
+
+ pOut->SetDevOrg( Point() );
+ if ( pFilterConfigItem )
+ {
+ xStatusIndicator = pFilterConfigItem->GetStatusIndicator();
+ if ( xStatusIndicator.is() )
+ {
+ rtl::OUString aMsg;
+ xStatusIndicator->start( aMsg, 100 );
+ }
+ }
+ }
+
+ // ------------------------------------------------------------------------
+
+ WinMtf::~WinMtf()
+ {
+ delete pOut;
+
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+ }
+
+ // ------------------------------------------------------------------------
+
+ void WinMtf::Callback( sal_uInt16 nPercent )
+ {
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->setValue( nPercent );
+ }
+
+ // ------------------------------------------------------------------------
+
+ Color WinMtf::ReadColor()
+ {
+ sal_uInt32 nColor;
+ *pWMF >> nColor;
+ return Color( (sal_uInt8)nColor, (sal_uInt8)( nColor >> 8 ), (sal_uInt8)( nColor >> 16 ) );
+ };
+
+ //-----------------------------------------------------------------------------------
+ //-----------------------------------------------------------------------------------
+ //-----------------------------------------------------------------------------------
+
+ Point WinMtfOutput::ImplMap( const Point& rPt )
+ {
+ if ( mnWinExtX && mnWinExtY )
+ {
+ double fX = rPt.X();
+ double fY = rPt.Y();
+
+ double fX2 = fX * maXForm.eM11 + fY * maXForm.eM21 + maXForm.eDx;
+ double fY2 = fX * maXForm.eM12 + fY * maXForm.eM22 + maXForm.eDy;
+
+ if ( mnGfxMode == GM_COMPATIBLE )
+ {
+ switch( mnMapMode )
+ {
+ case MM_TEXT:
+ fX2 -= mnWinOrgX;
+ fY2 -= mnWinOrgY;
+ if( mnDevWidth != 1 || mnDevHeight != 1 ) {
+ fX2 *= 2540.0/mnUnitsPerInch;
+ fY2 *= 2540.0/mnUnitsPerInch;
+ }
+ fX2 += mnDevOrgX;
+ fY2 += mnDevOrgY;
+ fX2 *= (double)mnMillX * 100.0 / (double)mnPixX;
+ fY2 *= (double)mnMillY * 100.0 / (double)mnPixY;
+
+ break;
+ case MM_LOENGLISH :
+ {
+ fX2 -= mnWinOrgX;
+ fY2 = mnWinOrgY-fY2;
+ fX2 *= 25.40;
+ fY2 *= 25.40;
+ fX2 += mnDevOrgX;
+ fY2 += mnDevOrgY;
+ }
+ break;
+ case MM_HIENGLISH :
+ {
+ fX2 -= mnWinOrgX;
+ fY2 = mnWinOrgY-fY2;
+ fX2 *= 2.540;
+ fY2 *= 2.540;
+ fX2 += mnDevOrgX;
+ fY2 += mnDevOrgY;
+ }
+ break;
+ case MM_LOMETRIC :
+ {
+ fX2 -= mnWinOrgX;
+ fY2 = mnWinOrgY-fY2;
+ fX2 *= 10;
+ fY2 *= 10;
+ fX2 += mnDevOrgX;
+ fY2 += mnDevOrgY;
+ }
+ break;
+ case MM_HIMETRIC :
+ {
+ fX2 -= mnWinOrgX;
+ fY2 = mnWinOrgY-fY2;
+ fX2 += mnDevOrgX;
+ fY2 += mnDevOrgY;
+ }
+ break;
+ default :
+ {
+ fX2 -= mnWinOrgX;
+ fY2 -= mnWinOrgY;
+ fX2 /= mnWinExtX;
+ fY2 /= mnWinExtY;
+ fX2 *= mnDevWidth;
+ fY2 *= mnDevHeight;
+ fX2 += mnDevOrgX;
+ fY2 += mnDevOrgY; // fX2, fY2 now in device units
+ fX2 *= (double)mnMillX * 100.0 / (double)mnPixX;
+ fY2 *= (double)mnMillY * 100.0 / (double)mnPixY;
+ }
+ break;
+ }
+ fX2 -= mrclFrame.Left();
+ fY2 -= mrclFrame.Top();
+ }
+ return Point( FRound( fX2 ), FRound( fY2 ) );
+ }
+ else
+ return Point();
+ };
+
+ // ------------------------------------------------------------------------
+
+ Size WinMtfOutput::ImplMap( const Size& rSz )
+ {
+ if ( mnWinExtX && mnWinExtY )
+ {
+ double fWidth = rSz.Width() * maXForm.eM11;
+ double fHeight = rSz.Height() * maXForm.eM22;
+
+ if ( mnGfxMode == GM_COMPATIBLE )
+ {
+ switch( mnMapMode )
+ {
+ case MM_TEXT:
+ if( mnDevWidth != 1 && mnDevHeight != 1 ) {
+ fWidth *= 2540.0/mnUnitsPerInch;
+ fHeight*= 2540.0/mnUnitsPerInch;
+ } else {
+ fWidth *= (double)mnMillX * 100 / (double)mnPixX;
+ fHeight *= (double)mnMillY * 100 / (double)mnPixY;
+ }
+ break;
+ case MM_LOENGLISH :
+ {
+ fWidth *= 25.40;
+ fHeight*=-25.40;
+ }
+ break;
+ case MM_HIENGLISH :
+ {
+ fWidth *= 2.540;
+ fHeight*=-2.540;
+ }
+ break;
+ case MM_LOMETRIC :
+ {
+ fWidth *= 10;
+ fHeight*=-10;
+ }
+ break;
+ case MM_HIMETRIC :
+ {
+ fHeight *= -1;
+ }
+ break;
+ default :
+ {
+ fWidth /= mnWinExtX;
+ fHeight /= mnWinExtY;
+ fWidth *= mnDevWidth;
+ fHeight *= mnDevHeight;
+ fWidth *= (double)mnMillX * 100 / (double)mnPixX;
+ fHeight *= (double)mnMillY * 100 / (double)mnPixY;
+ }
+ break;
+ }
+ }
+ return Size( FRound( fWidth ), FRound( fHeight ) );
+ }
+ else
+ return Size();
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ Rectangle WinMtfOutput::ImplMap( const Rectangle& rRect )
+ {
+ return Rectangle( ImplMap( rRect.TopLeft() ), ImplMap( rRect.GetSize() ) );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ImplMap( Font& rFont )
+ {
+ // !!! HACK: Wir setzen die Breite jetzt immer auf Null,
+ // da OS die Breite unterschiedlich interpretieren;
+ // muss spaeter in SV portabel gemacht werden ( KA 08.02.96 )
+ Size aFontSize = ImplMap ( rFont.GetSize() );
+
+ if( aFontSize.Height() < 0 )
+ aFontSize.Height() *= -1;
+
+ rFont.SetSize( aFontSize );
+
+ if( ( mnWinExtX * mnWinExtY ) < 0 )
+ rFont.SetOrientation( 3600 - rFont.GetOrientation() );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ Polygon& WinMtfOutput::ImplMap( Polygon& rPolygon )
+ {
+ sal_uInt16 nPoints = rPolygon.GetSize();
+ for ( sal_uInt16 i = 0; i < nPoints; i++ )
+ {
+ rPolygon[ i ] = ImplMap( rPolygon[ i ] );
+ }
+ return rPolygon;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ PolyPolygon& WinMtfOutput::ImplMap( PolyPolygon& rPolyPolygon )
+ {
+ sal_uInt16 nPolys = rPolyPolygon.Count();
+ for ( sal_uInt16 i = 0; i < nPolys; ImplMap( rPolyPolygon[ i++ ] ) ) ;
+ return rPolyPolygon;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SelectObject( sal_Int32 nIndex )
+ {
+ GDIObj* pGDIObj = NULL;
+
+ if ( nIndex & ENHMETA_STOCK_OBJECT )
+ pGDIObj = new GDIObj();
+ else
+ {
+ nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen
+
+ if ( (sal_uInt32)nIndex < vGDIObj.size() )
+ pGDIObj = vGDIObj[ nIndex ];
+ }
+
+ if( pGDIObj == NULL )
+ return;
+
+ if ( nIndex & ENHMETA_STOCK_OBJECT )
+ {
+ sal_uInt16 nStockId = (sal_uInt8)nIndex;
+ switch( nStockId )
+ {
+ case WHITE_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_WHITE ) ) );
+ }
+ break;
+ case LTGRAY_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_LIGHTGRAY ) ) );
+ }
+ break;
+ case GRAY_BRUSH :
+ case DKGRAY_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_GRAY ) ) );
+ }
+ break;
+ case BLACK_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_BLACK ) ) );
+ }
+ break;
+ case NULL_BRUSH :
+ {
+ pGDIObj->Set( GDI_BRUSH, new WinMtfFillStyle( Color( COL_TRANSPARENT ), sal_True ) );
+ }
+ break;
+ case WHITE_PEN :
+ {
+ pGDIObj->Set( GDI_PEN, new WinMtfLineStyle( Color( COL_WHITE ) ) );
+ }
+ break;
+ case BLACK_PEN :
+ {
+ pGDIObj->Set( GDI_PEN, new WinMtfLineStyle( Color( COL_BLACK ) ) );
+ }
+ break;
+ case NULL_PEN :
+ {
+ pGDIObj->Set( GDI_PEN, new WinMtfLineStyle( Color( COL_TRANSPARENT ), sal_True ) );
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if ( pGDIObj->pStyle )
+ {
+ switch( pGDIObj->eType )
+ {
+ case GDI_PEN :
+ maLineStyle = (WinMtfLineStyle*)pGDIObj->pStyle;
+ break;
+ case GDI_BRUSH :
+ {
+ maFillStyle = (WinMtfFillStyle*)pGDIObj->pStyle;
+ mbFillStyleSelected = sal_True;
+ }
+ break;
+ case GDI_FONT :
+ maFont = ((WinMtfFontStyle*)pGDIObj->pStyle)->aFont;
+ break;
+ default:
+ break; // -Wall many options not handled.
+ }
+ }
+ if ( nIndex & ENHMETA_STOCK_OBJECT )
+ delete pGDIObj;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ const Font& WinMtfOutput::GetFont() const
+ {
+ return maFont;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetTextLayoutMode( const sal_uInt32 nTextLayoutMode )
+ {
+ mnTextLayoutMode = nTextLayoutMode;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetBkMode( sal_uInt32 nMode )
+ {
+ mnBkMode = nMode;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetBkColor( const Color& rColor )
+ {
+ maBkColor = rColor;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetTextColor( const Color& rColor )
+ {
+ maTextColor = rColor;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetTextAlign( sal_uInt32 nAlign )
+ {
+ mnTextAlign = nAlign;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ImplResizeObjectArry( sal_uInt32 nNewEntrys )
+ {
+ sal_uInt32 i = vGDIObj.size();
+ vGDIObj.resize( nNewEntrys );
+ for ( ; i < nNewEntrys ; i++ )
+ vGDIObj[ i ] = NULL;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ImplDrawClippedPolyPolygon( const PolyPolygon& rPolyPoly )
+ {
+ if ( rPolyPoly.Count() )
+ {
+ ImplSetNonPersistentLineColorTransparenz();
+ if ( rPolyPoly.Count() == 1 )
+ {
+ if ( rPolyPoly.IsRect() )
+ mpGDIMetaFile->AddAction( new MetaRectAction( rPolyPoly.GetBoundRect() ) );
+ else
+ {
+ Polygon aPoly( rPolyPoly[ 0 ] );
+ sal_uInt16 nCount = aPoly.GetSize();
+ if ( nCount )
+ {
+ if ( aPoly[ nCount - 1 ] != aPoly[ 0 ] )
+ {
+ Point aPoint( aPoly[ 0 ] );
+ aPoly.Insert( nCount, aPoint );
+ }
+ mpGDIMetaFile->AddAction( new MetaPolygonAction( aPoly ) );
+ }
+ }
+ }
+ else
+ mpGDIMetaFile->AddAction( new MetaPolyPolygonAction( rPolyPoly ) );
+ }
+ }
+
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::CreateObject( GDIObjectType eType, void* pStyle )
+ {
+ if ( pStyle )
+ {
+ if ( eType == GDI_FONT )
+ {
+ ImplMap( ((WinMtfFontStyle*)pStyle)->aFont );
+ if (!((WinMtfFontStyle*)pStyle)->aFont.GetHeight() )
+ ((WinMtfFontStyle*)pStyle)->aFont.SetHeight( 423 ); // defaulting to 12pt
+ }
+ else if ( eType == GDI_PEN )
+ {
+ Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
+ if ( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetStyle() == LINE_DASH )
+ {
+ aSize.Width() += 1;
+ long nDotLen = ImplMap( aSize ).Width();
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDistance( nDotLen );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDotLen( nDotLen );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDashLen( nDotLen * 4 );
+ }
+ }
+ }
+ sal_uInt32 nIndex;
+ for ( nIndex = 0; nIndex < vGDIObj.size(); nIndex++ )
+ {
+ if ( vGDIObj[ nIndex ] == NULL )
+ break;
+ }
+ if ( nIndex == vGDIObj.size() )
+ ImplResizeObjectArry( vGDIObj.size() + 16 );
+
+ vGDIObj[ nIndex ] = new GDIObj( eType, pStyle );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::CreateObject( sal_Int32 nIndex, GDIObjectType eType, void* pStyle )
+ {
+ if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 )
+ {
+ nIndex &= 0xffff; // zur Sicherheit: mehr als 65535 nicht zulassen
+ if ( pStyle )
+ {
+ if ( eType == GDI_FONT )
+ ImplMap( ((WinMtfFontStyle*)pStyle)->aFont );
+ else if ( eType == GDI_PEN )
+ {
+ Size aSize( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetWidth(), 0 );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetWidth( ImplMap( aSize ).Width() );
+ if ( ((WinMtfLineStyle*)pStyle)->aLineInfo.GetStyle() == LINE_DASH )
+ {
+ aSize.Width() += 1;
+ long nDotLen = ImplMap( aSize ).Width();
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDistance( nDotLen );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDotLen( nDotLen );
+ ((WinMtfLineStyle*)pStyle)->aLineInfo.SetDashLen( nDotLen * 4 );
+ }
+ }
+ }
+ if ( (sal_uInt32)nIndex >= vGDIObj.size() )
+ ImplResizeObjectArry( nIndex + 16 );
+
+ if ( vGDIObj[ nIndex ] != NULL )
+ delete vGDIObj[ nIndex ];
+
+ vGDIObj[ nIndex ] = new GDIObj( eType, pStyle );
+ }
+ else
+ {
+ switch ( eType )
+ {
+ case GDI_PEN :
+ delete (WinMtfLineStyle*)pStyle;
+ break;
+ case GDI_BRUSH :
+ delete (WinMtfFillStyle*)pStyle;
+ break;
+ case GDI_FONT :
+ delete (WinMtfFontStyle*)pStyle;
+ break;
+
+ default:
+ OSL_FAIL( "unsupported style not deleted" );
+ break;
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DeleteObject( sal_Int32 nIndex )
+ {
+ if ( ( nIndex & ENHMETA_STOCK_OBJECT ) == 0 )
+ {
+ if ( (sal_uInt32)nIndex < vGDIObj.size() )
+ {
+ delete vGDIObj[ nIndex ];
+ vGDIObj[ nIndex ] = NULL;
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::IntersectClipRect( const Rectangle& rRect )
+ {
+ mbClipNeedsUpdate=true;
+ aClipPath.intersectClipRect( ImplMap( rRect ) );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ExcludeClipRect( const Rectangle& rRect )
+ {
+ mbClipNeedsUpdate=true;
+ aClipPath.excludeClipRect( ImplMap( rRect ) );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::MoveClipRegion( const Size& rSize )
+ {
+ mbClipNeedsUpdate=true;
+ aClipPath.moveClipRegion( ImplMap( rSize ) );
+ }
+
+ void WinMtfOutput::SetClipPath( const PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode, sal_Bool bIsMapped )
+ {
+ mbClipNeedsUpdate=true;
+ if ( bIsMapped )
+ aClipPath.setClipPath( rPolyPolygon, nClippingMode );
+ else
+ {
+ PolyPolygon aPP( rPolyPolygon );
+ aClipPath.setClipPath( ImplMap( aPP ), nClippingMode );
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+ //-----------------------------------------------------------------------------------
+ //-----------------------------------------------------------------------------------
+
+ WinMtfOutput::WinMtfOutput( GDIMetaFile& rGDIMetaFile ) :
+ mnLatestTextAlign ( 0 ),
+ mnTextAlign ( TA_LEFT | TA_TOP | TA_NOUPDATECP ),
+ maLatestBkColor ( 0x12345678 ),
+ maBkColor ( COL_WHITE ),
+ mnLatestTextLayoutMode( TEXT_LAYOUT_DEFAULT ),
+ mnTextLayoutMode ( TEXT_LAYOUT_DEFAULT ),
+ mnLatestBkMode ( 0 ),
+ mnBkMode ( OPAQUE ),
+ meLatestRasterOp ( ROP_INVERT ),
+ meRasterOp ( ROP_OVERPAINT ),
+ maActPos ( Point() ),
+ mbNopMode ( sal_False ),
+ mbFillStyleSelected ( sal_False ),
+ mbClipNeedsUpdate ( true ),
+ mbComplexClip ( false ),
+ mnGfxMode ( GM_COMPATIBLE ),
+ mnMapMode ( MM_TEXT ),
+ mnUnitsPerInch ( 96 ),
+ mnDevOrgX ( 0 ),
+ mnDevOrgY ( 0 ),
+ mnDevWidth ( 1 ),
+ mnDevHeight ( 1 ),
+ mnWinOrgX ( 0 ),
+ mnWinOrgY ( 0 ),
+ mnWinExtX ( 1 ),
+ mnWinExtY ( 1 ),
+ mnPixX ( 100 ),
+ mnPixY ( 100 ),
+ mnMillX ( 1 ),
+ mnMillY ( 1 ),
+ mpGDIMetaFile ( &rGDIMetaFile )
+ {
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_CLIPREGION ) ); // The original clipregion has to be on top
+ // of the stack so it can always be restored
+ // this is necessary to be able to support
+ // SetClipRgn( NULL ) and similar ClipRgn actions (SJ)
+
+ maFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Arial" )) ); // sj: #i57205#, we do have some scaling problems if using
+ maFont.SetCharSet( RTL_TEXTENCODING_MS_1252 ); // the default font then most times a x11 font is used, we
+ maFont.SetHeight( 423 ); // will prevent this defining a font
+
+ maLatestLineStyle.aLineColor = Color( 0x12, 0x34, 0x56 );
+ maLatestFillStyle.aFillColor = Color( 0x12, 0x34, 0x56 );
+
+ mnRop = R2_BLACK + 1;
+ SetRasterOp( R2_BLACK );
+ };
+
+ //-----------------------------------------------------------------------------------
+
+ WinMtfOutput::~WinMtfOutput()
+ {
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ mpGDIMetaFile->SetPrefMapMode( MAP_100TH_MM );
+ if ( mrclFrame.IsEmpty() )
+ mpGDIMetaFile->SetPrefSize( Size( mnDevWidth, mnDevHeight ) );
+ else
+ mpGDIMetaFile->SetPrefSize( mrclFrame.GetSize() );
+
+ for ( sal_uInt32 i = 0; i < vGDIObj.size(); i++ )
+ delete vGDIObj[ i ];
+ };
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::UpdateClipRegion()
+ {
+ if ( mbClipNeedsUpdate )
+ {
+ mbClipNeedsUpdate = false;
+ mbComplexClip = false;
+
+ mpGDIMetaFile->AddAction( new MetaPopAction() ); // taking the orignal clipregion
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_CLIPREGION ) ); //
+
+ // skip for 'no clipping at all' case
+ if( !aClipPath.isEmpty() )
+ {
+ const basegfx::B2DPolyPolygon& rClipPoly( aClipPath.getClipPath() );
+ mpGDIMetaFile->AddAction(
+ new MetaISectRectClipRegionAction(
+ vcl::unotools::rectangleFromB2DRectangle(
+ rClipPoly.getB2DRange())));
+
+ mbComplexClip = rClipPoly.count() > 1
+ || !basegfx::tools::isRectangle(rClipPoly);
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ImplSetNonPersistentLineColorTransparenz()
+ {
+ Color aColor( COL_TRANSPARENT);
+ WinMtfLineStyle aTransparentLine( aColor, sal_True );
+ if ( ! ( maLatestLineStyle == aTransparentLine ) )
+ {
+ maLatestLineStyle = aTransparentLine;
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( aTransparentLine.aLineColor, !aTransparentLine.bTransparent ) );
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::UpdateLineStyle()
+ {
+ if (!( maLatestLineStyle == maLineStyle ) )
+ {
+ maLatestLineStyle = maLineStyle;
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( maLineStyle.aLineColor, !maLineStyle.bTransparent ) );
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::UpdateFillStyle()
+ {
+ if ( !mbFillStyleSelected ) // SJ: #i57205# taking care of bkcolor if no brush is selected
+ maFillStyle = WinMtfFillStyle( maBkColor, mnBkMode == TRANSPARENT );
+ if (!( maLatestFillStyle == maFillStyle ) )
+ {
+ maLatestFillStyle = maFillStyle;
+ if (maFillStyle.aType == FillStyleSolid)
+ mpGDIMetaFile->AddAction( new MetaFillColorAction( maFillStyle.aFillColor, !maFillStyle.bTransparent ) );
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ sal_uInt32 WinMtfOutput::SetRasterOp( sal_uInt32 nRasterOp )
+ {
+ sal_uInt32 nRetROP = mnRop;
+ if ( nRasterOp != mnRop )
+ {
+ mnRop = nRasterOp;
+ static WinMtfFillStyle aNopFillStyle;
+ static WinMtfLineStyle aNopLineStyle;
+
+ if ( mbNopMode && ( nRasterOp != R2_NOP ) )
+ { // beim uebergang von R2_NOP auf anderen Modus
+ // gesetzten Pen und Brush aktivieren
+ maFillStyle = aNopFillStyle;
+ maLineStyle = aNopLineStyle;
+ mbNopMode = sal_False;
+ }
+ switch( nRasterOp )
+ {
+ case R2_NOT:
+ meRasterOp = ROP_INVERT;
+ break;
+
+ case R2_XORPEN:
+ meRasterOp = ROP_XOR;
+ break;
+
+ case R2_NOP:
+ {
+ meRasterOp = ROP_OVERPAINT;
+ if( mbNopMode == sal_False )
+ {
+ aNopFillStyle = maFillStyle;
+ aNopLineStyle = maLineStyle;
+ maFillStyle = WinMtfFillStyle( Color( COL_TRANSPARENT ), sal_True );
+ maLineStyle = WinMtfLineStyle( Color( COL_TRANSPARENT ), sal_True );
+ mbNopMode = sal_True;
+ }
+ }
+ break;
+
+ default:
+ meRasterOp = ROP_OVERPAINT;
+ break;
+ }
+ }
+ if ( nRetROP != nRasterOp )
+ mpGDIMetaFile->AddAction( new MetaRasterOpAction( meRasterOp ) );
+ return nRetROP;
+ };
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::StrokeAndFillPath( sal_Bool bStroke, sal_Bool bFill )
+ {
+ if ( aPathObj.Count() )
+ {
+ UpdateClipRegion();
+ UpdateLineStyle();
+ UpdateFillStyle();
+ if ( bFill )
+ {
+ if ( !bStroke )
+ {
+ mpGDIMetaFile->AddAction( new MetaPushAction( PUSH_LINECOLOR ) );
+ mpGDIMetaFile->AddAction( new MetaLineColorAction( Color(), sal_False ) );
+ }
+ if ( aPathObj.Count() == 1 )
+ mpGDIMetaFile->AddAction( new MetaPolygonAction( aPathObj.GetObject( 0 ) ) );
+ else
+ mpGDIMetaFile->AddAction( new MetaPolyPolygonAction( aPathObj ) );
+
+ if ( !bStroke )
+ mpGDIMetaFile->AddAction( new MetaPopAction() );
+ }
+ else
+ {
+ sal_uInt16 i, nCount = aPathObj.Count();
+ for ( i = 0; i < nCount; i++ )
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( aPathObj[ i ], maLineStyle.aLineInfo ) );
+ }
+ ClearPath();
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawPixel( const Point& rSource, const Color& rColor )
+ {
+ mpGDIMetaFile->AddAction( new MetaPixelAction( ImplMap( rSource), rColor ) );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::MoveTo( const Point& rPoint, sal_Bool bRecordPath )
+ {
+ Point aDest( ImplMap( rPoint ) );
+ if ( bRecordPath )
++ {
++ // fdo#57353 create new subpath for subsequent moves
++ if ( aPathObj.Count() )
++ if ( aPathObj[ aPathObj.Count() - 1 ].GetSize() )
++ aPathObj.Insert( Polygon(), POLYPOLY_APPEND );
+ aPathObj.AddPoint( aDest );
++ }
+ maActPos = aDest;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::LineTo( const Point& rPoint, sal_Bool bRecordPath )
+ {
+ UpdateClipRegion();
+
+ Point aDest( ImplMap( rPoint ) );
+ if ( bRecordPath )
+ aPathObj.AddPoint( aDest );
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaLineAction( maActPos, aDest, maLineStyle.aLineInfo ) );
+ }
+ maActPos = aDest;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawRect( const Rectangle& rRect, sal_Bool bEdge )
+ {
+ UpdateClipRegion();
+ UpdateFillStyle();
+
+ if ( mbComplexClip )
+ {
+ Polygon aPoly( ImplMap( rRect ) );
+ PolyPolygon aPolyPolyRect( aPoly );
+ PolyPolygon aDest;
+ PolyPolygon(aClipPath.getClipPath()).GetIntersection( aPolyPolyRect, aDest );
+ ImplDrawClippedPolyPolygon( aDest );
+ }
+ else
+ {
+ if ( bEdge )
+ {
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ ImplSetNonPersistentLineColorTransparenz();
+ mpGDIMetaFile->AddAction( new MetaRectAction( ImplMap( rRect ) ) );
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( ImplMap( rRect ) ),maLineStyle.aLineInfo ) );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaRectAction( ImplMap( rRect ) ) );
+ }
+ }
+ else
+ {
+ ImplSetNonPersistentLineColorTransparenz();
+ mpGDIMetaFile->AddAction( new MetaRectAction( ImplMap( rRect ) ) );
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawRoundRect( const Rectangle& rRect, const Size& rSize )
+ {
+ UpdateClipRegion();
+ UpdateLineStyle();
+ UpdateFillStyle();
+ mpGDIMetaFile->AddAction( new MetaRoundRectAction( ImplMap( rRect ), labs( ImplMap( rSize ).Width() ), labs( ImplMap( rSize ).Height() ) ) );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawEllipse( const Rectangle& rRect )
+ {
+ UpdateClipRegion();
+ UpdateFillStyle();
+
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ Point aCenter( ImplMap( rRect.Center() ) );
+ Size aRad( ImplMap( Size( rRect.GetWidth() / 2, rRect.GetHeight() / 2 ) ) );
+
+ ImplSetNonPersistentLineColorTransparenz();
+ mpGDIMetaFile->AddAction( new MetaEllipseAction( ImplMap( rRect ) ) );
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( aCenter, aRad.Width(), aRad.Height() ), maLineStyle.aLineInfo ) );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaEllipseAction( ImplMap( rRect ) ) );
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawArc( const Rectangle& rRect, const Point& rStart, const Point& rEnd, sal_Bool bTo )
+ {
+ UpdateClipRegion();
+ UpdateLineStyle();
+ UpdateFillStyle();
+
+ Rectangle aRect( ImplMap( rRect ) );
+ Point aStart( ImplMap( rStart ) );
+ Point aEnd( ImplMap( rEnd ) );
+
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ if ( aStart == aEnd )
+ { // SJ: #i53768# if start & end is identical, then we have to draw a full ellipse
+ Point aCenter( aRect.Center() );
+ Size aRad( aRect.GetWidth() / 2, aRect.GetHeight() / 2 );
+
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( aCenter, aRad.Width(), aRad.Height() ), maLineStyle.aLineInfo ) );
+ }
+ else
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( aRect, aStart, aEnd, POLY_ARC ), maLineStyle.aLineInfo ) );
+ }
+ else
+ mpGDIMetaFile->AddAction( new MetaArcAction( aRect, aStart, aEnd ) );
+
+ if ( bTo )
+ maActPos = aEnd;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawPie( const Rectangle& rRect, const Point& rStart, const Point& rEnd )
+ {
+ UpdateClipRegion();
+ UpdateFillStyle();
+
+ Rectangle aRect( ImplMap( rRect ) );
+ Point aStart( ImplMap( rStart ) );
+ Point aEnd( ImplMap( rEnd ) );
+
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ ImplSetNonPersistentLineColorTransparenz();
+ mpGDIMetaFile->AddAction( new MetaPieAction( aRect, aStart, aEnd ) );
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( aRect, aStart, aEnd, POLY_PIE ), maLineStyle.aLineInfo ) );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPieAction( aRect, aStart, aEnd ) );
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawChord( const Rectangle& rRect, const Point& rStart, const Point& rEnd )
+ {
+ UpdateClipRegion();
+ UpdateFillStyle();
+
+ Rectangle aRect( ImplMap( rRect ) );
+ Point aStart( ImplMap( rStart ) );
+ Point aEnd( ImplMap( rEnd ) );
+
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ ImplSetNonPersistentLineColorTransparenz();
+ mpGDIMetaFile->AddAction( new MetaChordAction( aRect, aStart, aEnd ) );
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( Polygon( aRect, aStart, aEnd, POLY_CHORD ), maLineStyle.aLineInfo ) );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaChordAction( aRect, aStart, aEnd ) );
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawPolygon( Polygon& rPolygon, sal_Bool bRecordPath )
+ {
+ UpdateClipRegion();
+ ImplMap( rPolygon );
+ if ( bRecordPath )
+ aPathObj.AddPolygon( rPolygon );
+ else
+ {
+ UpdateFillStyle();
+
+ if ( mbComplexClip )
+ {
+ PolyPolygon aPolyPoly( rPolygon );
+ PolyPolygon aDest;
+ PolyPolygon(aClipPath.getClipPath()).GetIntersection( aPolyPoly, aDest );
+ ImplDrawClippedPolyPolygon( aDest );
+ }
+ else
+ {
+ if ( maLineStyle.aLineInfo.GetWidth() || ( maLineStyle.aLineInfo.GetStyle() == LINE_DASH ) )
+ {
+ sal_uInt16 nCount = rPolygon.GetSize();
+ if ( nCount )
+ {
+ if ( rPolygon[ nCount - 1 ] != rPolygon[ 0 ] )
+ {
+ Point aPoint( rPolygon[ 0 ] );
+ rPolygon.Insert( nCount, aPoint );
+ }
+ }
+ ImplSetNonPersistentLineColorTransparenz();
+ mpGDIMetaFile->AddAction( new MetaPolygonAction( rPolygon ) );
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( rPolygon, maLineStyle.aLineInfo ) );
+ }
+ else
+ {
+ UpdateLineStyle();
+
+ if (maLatestFillStyle.aType != FillStylePattern)
+ mpGDIMetaFile->AddAction( new MetaPolygonAction( rPolygon ) );
+ else {
+ SvtGraphicFill aFill = SvtGraphicFill( PolyPolygon( rPolygon ),
+ Color(),
+ 0.0,
+ SvtGraphicFill::fillNonZero,
+ SvtGraphicFill::fillTexture,
+ SvtGraphicFill::Transform(),
+ true,
+ SvtGraphicFill::hatchSingle,
+ Color(),
+ SvtGraphicFill::gradientLinear,
+ Color(),
+ Color(),
+ 0,
+ Graphic (maLatestFillStyle.aBmp) );
+
+ SvMemoryStream aMemStm;
+
+ aMemStm << aFill;
+
+ mpGDIMetaFile->AddAction( new MetaCommentAction( "XPATHFILL_SEQ_BEGIN", 0,
+ static_cast<const sal_uInt8*>(aMemStm.GetData()),
+ aMemStm.Seek( STREAM_SEEK_TO_END ) ) );
+ mpGDIMetaFile->AddAction( new MetaCommentAction( "XPATHFILL_SEQ_END" ) );
+ }
+
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawPolyPolygon( PolyPolygon& rPolyPolygon, sal_Bool bRecordPath )
+ {
+ UpdateClipRegion();
+
+ ImplMap( rPolyPolygon );
+
+ if ( bRecordPath )
+ aPathObj.AddPolyPolygon( rPolyPolygon );
+ else
+ {
+ UpdateFillStyle();
+
+ if ( mbComplexClip )
+ {
+ PolyPolygon aDest;
+ PolyPolygon(aClipPath.getClipPath()).GetIntersection( rPolyPolygon, aDest );
+ ImplDrawClippedPolyPolygon( aDest );
+ }
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPolyPolygonAction( rPolyPolygon ) );
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawPolyLine( Polygon& rPolygon, sal_Bool bTo, sal_Bool bRecordPath )
+ {
+ UpdateClipRegion();
+
+ ImplMap( rPolygon );
+ if ( bTo )
+ {
+ rPolygon[ 0 ] = maActPos;
+ maActPos = rPolygon[ rPolygon.GetSize() - 1 ];
+ }
+ if ( bRecordPath )
+ aPathObj.AddPolyLine( rPolygon );
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( rPolygon, maLineStyle.aLineInfo ) );
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawPolyBezier( Polygon& rPolygon, sal_Bool bTo, sal_Bool bRecordPath )
+ {
+ UpdateClipRegion();
+
+ sal_uInt16 nPoints = rPolygon.GetSize();
+ if ( ( nPoints >= 4 ) && ( ( ( nPoints - 4 ) % 3 ) == 0 ) )
+ {
+ ImplMap( rPolygon );
+ if ( bTo )
+ {
+ rPolygon[ 0 ] = maActPos;
+ maActPos = rPolygon[ nPoints - 1 ];
+ }
+ sal_uInt16 i;
+ for ( i = 0; ( i + 2 ) < nPoints; )
+ {
+ rPolygon.SetFlags( i++, POLY_NORMAL );
+ rPolygon.SetFlags( i++, POLY_CONTROL );
+ rPolygon.SetFlags( i++, POLY_CONTROL );
+ }
+ if ( bRecordPath )
+ aPathObj.AddPolyLine( rPolygon );
+ else
+ {
+ UpdateLineStyle();
+ mpGDIMetaFile->AddAction( new MetaPolyLineAction( rPolygon, maLineStyle.aLineInfo ) );
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::DrawText( Point& rPosition, String& rText, sal_Int32* pDXArry, sal_Bool bRecordPath, sal_Int32 nGfxMode )
+ {
+ UpdateClipRegion();
+
+ VirtualDevice* pVDev = NULL;
+
+ rPosition = ImplMap( rPosition );
+
+ sal_Int32 nOldGfxMode = GetGfxMode();
+ SetGfxMode( GM_COMPATIBLE );
+ if ( pDXArry )
+ {
+ sal_Int32 i, nSum, nLen = rText.Len();
+
+ for( i = 0, nSum = 0; i < nLen; i++ )
+ {
+ if ( i ) {
+ pDXArry[ i - 1 ] = ImplMap( Size( nSum, 0 ) ).Width();
+ }
+ nSum += pDXArry[ i ];
+ }
+ }
+ if ( mnLatestTextLayoutMode != mnTextLayoutMode )
+ {
+ mnLatestTextLayoutMode = mnTextLayoutMode;
+ mpGDIMetaFile->AddAction( new MetaLayoutModeAction( mnTextLayoutMode ) );
+ }
+ SetGfxMode( nGfxMode );
+ sal_Bool bChangeFont = sal_False;
+ if ( mnLatestTextAlign != mnTextAlign )
+ {
+ bChangeFont = sal_True;
+ mnLatestTextAlign = mnTextAlign;
+ TextAlign eTextAlign;
+ if ( ( mnTextAlign & TA_BASELINE) == TA_BASELINE )
+ eTextAlign = ALIGN_BASELINE;
+ else if( ( mnTextAlign & TA_BOTTOM) == TA_BOTTOM )
+ eTextAlign = ALIGN_BOTTOM;
+ else
+ eTextAlign = ALIGN_TOP;
+ mpGDIMetaFile->AddAction( new MetaTextAlignAction( eTextAlign ) );
+ }
+ if ( maLatestTextColor != maTextColor )
+ {
+ bChangeFont = sal_True;
+ maLatestTextColor = maTextColor;
+ mpGDIMetaFile->AddAction( new MetaTextColorAction( maTextColor ) );
+ }
+ sal_Bool bChangeFillColor = sal_False;
+ if ( maLatestBkColor != maBkColor )
+ {
+ bChangeFillColor = sal_True;
+ maLatestBkColor = maBkColor;
+ }
+ if ( mnLatestBkMode != mnBkMode )
+ {
+ bChangeFillColor = sal_True;
+ mnLatestBkMode = mnBkMode;
+ }
+ if ( bChangeFillColor )
+ {
+ bChangeFont = sal_True;
+ mpGDIMetaFile->AddAction( new MetaTextFillColorAction( maFont.GetFillColor(), !maFont.IsTransparent() ) );
+ }
+ Font aTmp( maFont );
+ aTmp.SetColor( maTextColor );
+ aTmp.SetFillColor( maBkColor );
+
+ if( mnBkMode == TRANSPARENT )
+ aTmp.SetTransparent( sal_True );
+ else
+ aTmp.SetTransparent( sal_False );
+
+ if ( ( mnTextAlign & TA_BASELINE) == TA_BASELINE )
+ aTmp.SetAlign( ALIGN_BASELINE );
+ else if( ( mnTextAlign & TA_BOTTOM) == TA_BOTTOM )
+ aTmp.SetAlign( ALIGN_BOTTOM );
+ else
+ aTmp.SetAlign( ALIGN_TOP );
+
+ if ( nGfxMode == GM_ADVANCED )
+ {
+ // check whether there is a font rotation applied via transformation
+ Point aP1( ImplMap( Point() ) );
+ Point aP2( ImplMap( Point( 0, 100 ) ) );
+ aP2.X() -= aP1.X();
+ aP2.Y() -= aP1.Y();
+ double fX = aP2.X();
+ double fY = aP2.Y();
+ if ( fX )
+ {
+ double fOrientation = acos( fX / sqrt( fX * fX + fY * fY ) ) * 57.29577951308;
+ if ( fY > 0 )
+ fOrientation = 360 - fOrientation;
+ fOrientation += 90;
+ fOrientation *= 10;
+ fOrientation += aTmp.GetOrientation();
+ aTmp.SetOrientation( sal_Int16( fOrientation ) );
+ }
+ }
+
+ if( mnTextAlign & ( TA_UPDATECP | TA_RIGHT_CENTER ) )
+ {
+ if ( !pVDev )
+ pVDev = new VirtualDevice;
+ sal_Int32 nTextWidth;
+ pVDev->SetMapMode( MapMode( MAP_100TH_MM ) );
+ pVDev->SetFont( maFont );
+ if( pDXArry )
+ {
+ sal_uInt32 nLen = rText.Len();
+ nTextWidth = pVDev->GetTextWidth( rText.GetChar( (sal_uInt16)( nLen - 1 ) ) );
+ if( nLen > 1 )
+ nTextWidth += pDXArry[ nLen - 2 ];
+ }
+ else
+ nTextWidth = pVDev->GetTextWidth( rText );
+
+ if( mnTextAlign & TA_UPDATECP )
+ rPosition = maActPos;
+
+ if ( mnTextAlign & TA_RIGHT_CENTER )
+ {
+ double fLenght = ( ( mnTextAlign & TA_RIGHT_CENTER ) == TA_RIGHT ) ? nTextWidth : nTextWidth >> 1;
+ rPosition.X() -= (sal_Int32)( fLenght * cos( maFont.GetOrientation() * F_PI1800 ) );
+ rPosition.Y() -= (sal_Int32)(-( fLenght * sin( maFont.GetOrientation() * F_PI1800 ) ) );
+ }
+
+ if( mnTextAlign & TA_UPDATECP )
+ maActPos.X() = rPosition.X() + nTextWidth;
+ }
+ if ( bChangeFont || ( maLatestFont != aTmp ) )
+ {
+ maLatestFont = aTmp;
+ mpGDIMetaFile->AddAction( new MetaFontAction( aTmp ) );
+ mpGDIMetaFile->AddAction( new MetaTextAlignAction( aTmp.GetAlign() ) );
+ mpGDIMetaFile->AddAction( new MetaTextColorAction( aTmp.GetColor() ) );
+ mpGDIMetaFile->AddAction( new MetaTextFillColorAction( aTmp.GetFillColor(), !aTmp.IsTransparent() ) );
+ }
+ if ( bRecordPath )
+ {
+ // ToDo
+ }
+ else
+ {
+ /* because text without dx array is badly scaled, we
+ will create such an array if necessary */
+ sal_Int32* pDX = pDXArry;
+ if ( !pDXArry )
+ {
+ SolarMutexGuard aGuard;
+
+ pDX = new sal_Int32[ rText.Len() ];
+ if ( !pVDev )
+ pVDev = new VirtualDevice;
+ pVDev->SetMapMode( MAP_100TH_MM );
+ pVDev->SetFont( maLatestFont );
+ pVDev->GetTextArray( rText, pDX, 0, STRING_LEN );
+ }
+ mpGDIMetaFile->AddAction( new MetaTextArrayAction( rPosition, rText, pDX, 0, STRING_LEN ) );
+ if ( !pDXArry ) // this means we have created our own array
+ delete[] pDX; // which must be deleted
+ }
+ SetGfxMode( nOldGfxMode );
+ delete pVDev;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ImplDrawBitmap( const Point& rPos, const Size& rSize, const BitmapEx rBitmap )
+ {
+ BitmapEx aBmpEx( rBitmap );
+ if ( mbComplexClip )
+ {
+ VirtualDevice aVDev;
+ MapMode aMapMode( MAP_100TH_MM );
+ aMapMode.SetOrigin( Point( -rPos.X(), -rPos.Y() ) );
+ const Size aOutputSizePixel( aVDev.LogicToPixel( rSize, aMapMode ) );
+ const Size aSizePixel( rBitmap.GetSizePixel() );
+ if ( aOutputSizePixel.Width() && aOutputSizePixel.Height() )
+ {
+ aMapMode.SetScaleX( Fraction( aSizePixel.Width(), aOutputSizePixel.Width() ) );
+ aMapMode.SetScaleY( Fraction( aSizePixel.Height(), aOutputSizePixel.Height() ) );
+ }
+ aVDev.SetMapMode( aMapMode );
+ aVDev.SetOutputSizePixel( aSizePixel );
+ aVDev.SetFillColor( Color( COL_BLACK ) );
+ const PolyPolygon aClip( aClipPath.getClipPath() );
+ aVDev.DrawPolyPolygon( aClip );
+ const Point aEmptyPoint;
+
+ // #i50672# Extract whole VDev content (to match size of rBitmap)
+ aVDev.EnableMapMode( sal_False );
+ Bitmap aMask( aVDev.GetBitmap( aEmptyPoint, aSizePixel ).CreateMask( Color( COL_WHITE ) ) );
+
+ if ( aBmpEx.IsTransparent() )
+ {
+ if ( rBitmap.GetTransparentColor() == Color( COL_WHITE ) )
+ aMask.CombineSimple( rBitmap.GetMask(), BMP_COMBINE_OR );
+ else
+ aMask.CombineSimple( rBitmap.GetMask(), BMP_COMBINE_AND );
+ aBmpEx = BitmapEx( rBitmap.GetBitmap(), aMask );
+ }
+ else
+ aBmpEx = BitmapEx( rBitmap.GetBitmap(), aMask );
+ }
+ if ( aBmpEx.IsTransparent() )
+ mpGDIMetaFile->AddAction( new MetaBmpExScaleAction( rPos, rSize, aBmpEx ) );
+ else
+ mpGDIMetaFile->AddAction( new MetaBmpScaleAction( rPos, rSize, aBmpEx.GetBitmap() ) );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ResolveBitmapActions( BSaveStructList_impl& rSaveList )
+ {
+ UpdateClipRegion();
+
+ size_t nObjects = rSaveList.size();
+ size_t nObjectsLeft = nObjects;
+
+ while ( nObjectsLeft )
+ {
+ size_t i;
+ size_t nObjectsOfSameSize = 0;
+ size_t nObjectStartIndex = nObjects - nObjectsLeft;
+
+ BSaveStruct* pSave = rSaveList[ nObjectStartIndex ];
+ Rectangle aRect( pSave->aOutRect );
+
+ for ( i = nObjectStartIndex; i < nObjects; )
+ {
+ nObjectsOfSameSize++;
+ if ( ++i < nObjects )
+ {
+ pSave = rSaveList[ i ];
+ if ( pSave->aOutRect != aRect )
+ break;
+ }
+ }
+ Point aPos( ImplMap( aRect.TopLeft() ) );
+ Size aSize( ImplMap( aRect.GetSize() ) );
+
+ for ( i = nObjectStartIndex; i < ( nObjectStartIndex + nObjectsOfSameSize ); i++ )
+ {
+ pSave = rSaveList[ i ];
+
+ sal_uInt32 nWinRop = pSave->nWinRop;
+ sal_uInt8 nRasterOperation = (sal_uInt8)( nWinRop >> 16 );
+
+ sal_uInt32 nUsed = 0;
+ if ( ( nRasterOperation & 0xf ) != ( nRasterOperation >> 4 ) )
+ nUsed |= 1; // pattern is used
+ if ( ( nRasterOperation & 0x33 ) != ( ( nRasterOperation & 0xcc ) >> 2 ) )
+ nUsed |= 2; // source is used
+ if ( ( nRasterOperation & 0xaa ) != ( ( nRasterOperation & 0x55 ) << 1 ) )
+ nUsed |= 4; // destination is used
+
+ if ( (nUsed & 1) && (( nUsed & 2 ) == 0) && nWinRop != PATINVERT )
+ { // patterns aren't well supported yet
+ sal_uInt32 nOldRop = SetRasterOp( ROP_OVERPAINT ); // in this case nRasterOperation is either 0 or 0xff
+ UpdateFillStyle();
+ DrawRect( aRect, sal_False );
+ SetRasterOp( nOldRop );
+ }
+ else
+ {
+ sal_Bool bDrawn = sal_False;
+
+ if ( i == nObjectStartIndex ) // optimizing, sometimes it is possible to create just one transparent bitmap
+ {
+ if ( nObjectsOfSameSize == 2 )
+ {
+ BSaveStruct* pSave2 = rSaveList[ i + 1 ];
+ if ( ( pSave->aBmp.GetPrefSize() == pSave2->aBmp.GetPrefSize() ) &&
+ ( pSave->aBmp.GetPrefMapMode() == pSave2->aBmp.GetPrefMapMode() ) )
+ {
+ // TODO: Strictly speaking, we should
+ // check whether mask is monochrome, and
+ // whether image is black (upper branch)
+ // or white (lower branch). Otherwise, the
+ // effect is not the same as a masked
+ // bitmap.
+ if ( ( nWinRop == SRCPAINT ) && ( pSave2->nWinRop == SRCAND ) )
+ {
+ Bitmap aMask( pSave->aBmp ); aMask.Invert();
+ BitmapEx aBmpEx( pSave2->aBmp, aMask );
+ ImplDrawBitmap( aPos, aSize, aBmpEx );
+ bDrawn = sal_True;
+ i++;
+ }
+ // #i20085# This is just the other way
+ // around as above. Only difference: mask
+ // is inverted
+ else if ( ( nWinRop == SRCAND ) && ( pSave2->nWinRop == SRCPAINT ) )
+ {
+ Bitmap aMask( pSave->aBmp );
+ BitmapEx aBmpEx( pSave2->aBmp, aMask );
+ ImplDrawBitmap( aPos, aSize, aBmpEx );
+ bDrawn = sal_True;
+ i++;
+ }
+ }
+ }
+ }
+
+ if ( !bDrawn )
+ {
+ Push();
+ sal_uInt32 nOldRop = SetRasterOp( R2_COPYPEN );
+ Bitmap aBitmap( pSave->aBmp );
+ sal_uInt32 nOperation = ( nRasterOperation & 0xf );
+ switch( nOperation )
+ {
+ case 0x1 :
+ case 0xe :
+ {
+ SetRasterOp( R2_XORPEN );
+ ImplDrawBitmap( aPos, aSize, aBitmap );
+ SetRasterOp( R2_COPYPEN );
+ Bitmap aMask( aBitmap );
+ aMask.Invert();
+ BitmapEx aBmpEx( aBitmap, aMask );
+ ImplDrawBitmap( aPos, aSize, aBmpEx );
+ if ( nOperation == 0x1 )
+ {
+ SetRasterOp( R2_NOT );
+ DrawRect( aRect, sal_False );
+ }
+ }
+ break;
+ case 0x7 :
+ case 0x8 :
+ {
+ Bitmap aMask( aBitmap );
+ if ( ( nUsed & 1 ) && ( nRasterOperation & 0xb0 ) == 0xb0 ) // pattern used
+ {
+ aBitmap.Convert( BMP_CONVERSION_24BIT );
+ aBitmap.Erase( maFillStyle.aFillColor );
+ }
+ BitmapEx aBmpEx( aBitmap, aMask );
+ ImplDrawBitmap( aPos, aSize, aBmpEx );
+ if ( nOperation == 0x7 )
+ {
+ SetRasterOp( R2_NOT );
+ DrawRect( aRect, sal_False );
+ }
+ }
+ break;
+
+ case 0x4 :
+ case 0xb :
+ {
+ SetRasterOp( R2_NOT );
+ DrawRect( aRect, sal_False );
+ SetRasterOp( R2_COPYPEN );
+ Bitmap aMask( aBitmap );
+ aBitmap.Invert();
+ BitmapEx aBmpEx( aBitmap, aMask );
+ ImplDrawBitmap( aPos, aSize, aBmpEx );
+ SetRasterOp( R2_XORPEN );
+ ImplDrawBitmap( aPos, aSize, aBitmap );
+ if ( nOperation == 0xb )
+ {
+ SetRasterOp( R2_NOT );
+ DrawRect( aRect, sal_False );
+ }
+ }
+ break;
+
+ case 0x2 :
+ case 0xd :
+ {
+ Bitmap aMask( aBitmap );
+ aMask.Invert();
+ BitmapEx aBmpEx( aBitmap, aMask );
+ ImplDrawBitmap( aPos, aSize, aBmpEx );
+ SetRasterOp( R2_XORPEN );
+ ImplDrawBitmap( aPos, aSize, aBitmap );
+ if ( nOperation == 0xd )
+ {
+ SetRasterOp( R2_NOT );
+ DrawRect( aRect, sal_False );
+ }
+ }
+ break;
+ case 0x6 :
+ case 0x9 :
+ {
+ SetRasterOp( R2_XORPEN );
+ ImplDrawBitmap( aPos, aSize, aBitmap );
+ if ( nOperation == 0x9 )
+ {
+ SetRasterOp( R2_NOT );
+ DrawRect( aRect, sal_False );
+ }
+ }
+ break;
+
+ case 0x0 : // WHITENESS
+ case 0xf : // BLACKNESS
+ { // in this case nRasterOperation is either 0 or 0xff
+ maFillStyle = WinMtfFillStyle( Color( nRasterOperation, nRasterOperation, nRasterOperation ) );
+ UpdateFillStyle();
+ DrawRect( aRect, sal_False );
+ }
+ break;
+
+ case 0x3 : // only source is used
+ case 0xc :
+ {
+ if ( nRasterOperation == 0x33 )
+ aBitmap.Invert();
+ ImplDrawBitmap( aPos, aSize, aBitmap );
+ }
+ break;
+
+ case 0x5 : // only destination is used
+ {
+ SetRasterOp( R2_NOT );
+ DrawRect( aRect, sal_False );
+ }
+ case 0xa : // no operation
+ break;
+ }
+ SetRasterOp( nOldRop );
+ Pop();
+ }
+ }
+ }
+ nObjectsLeft -= nObjectsOfSameSize;
+ }
+
+ for( size_t i = 0, n = rSaveList.size(); i < n; ++i )
+ delete rSaveList[ i ];
+ rSaveList.clear();
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetDevOrg( const Point& rPoint )
+ {
+ mnDevOrgX = rPoint.X();
+ mnDevOrgY = rPoint.Y();
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetDevOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd )
+ {
+ mnDevOrgX += nXAdd;
+ mnDevOrgY += nYAdd;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetDevExt( const Size& rSize )
+ {
+ if ( rSize.Width() && rSize.Height() )
+ {
+ switch( mnMapMode )
+ {
+ case MM_ISOTROPIC :
+ case MM_ANISOTROPIC :
+ {
+ mnDevWidth = rSize.Width();
+ mnDevHeight = rSize.Height();
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ScaleDevExt( double fX, double fY )
+ {
+ mnDevWidth = FRound( mnDevWidth * fX );
+ mnDevHeight = FRound( mnDevHeight * fY );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetWinOrg( const Point& rPoint )
+ {
+ mnWinOrgX = rPoint.X();
+ mnWinOrgY = rPoint.Y();
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetWinOrgOffset( sal_Int32 nXAdd, sal_Int32 nYAdd )
+ {
+ mnWinOrgX += nXAdd;
+ mnWinOrgY += nYAdd;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetWinExt( const Size& rSize )
+ {
+
+ if( rSize.Width() && rSize.Height() )
+ {
+ switch( mnMapMode )
+ {
+ case MM_ISOTROPIC :
+ case MM_ANISOTROPIC :
+ {
+ mnWinExtX = rSize.Width();
+ mnWinExtY = rSize.Height();
+ }
+ }
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ScaleWinExt( double fX, double fY )
+ {
+ mnWinExtX = FRound( mnWinExtX * fX );
+ mnWinExtY = FRound( mnWinExtY * fY );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetrclBounds( const Rectangle& rRect )
+ {
+ mrclBounds = rRect;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetrclFrame( const Rectangle& rRect )
+ {
+ mrclFrame = rRect;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetRefPix( const Size& rSize )
+ {
+ mnPixX = rSize.Width();
+ mnPixY = rSize.Height();
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetRefMill( const Size& rSize )
+ {
+ mnMillX = rSize.Width();
+ mnMillY = rSize.Height();
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetMapMode( sal_uInt32 nMapMode )
+ {
+ mnMapMode = nMapMode;
+ if ( nMapMode == MM_TEXT )
+ {
+ mnWinExtX = mnDevWidth;
+ mnWinExtY = mnDevHeight;
+ }
+ else if ( mnMapMode == MM_HIMETRIC )
+ {
+ mnWinExtX = mnMillX * 100;
+ mnWinExtY = mnMillY * 100;
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetUnitsPerInch( sal_uInt16 nUnitsPerInch )
+ {
+ if( nUnitsPerInch != 0 )
+ mnUnitsPerInch = nUnitsPerInch;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::SetWorldTransform( const XForm& rXForm )
+ {
+ maXForm.eM11 = rXForm.eM11;
+ maXForm.eM12 = rXForm.eM12;
+ maXForm.eM21 = rXForm.eM21;
+ maXForm.eM22 = rXForm.eM22;
+ maXForm.eDx = rXForm.eDx;
+ maXForm.eDy = rXForm.eDy;
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::ModifyWorldTransform( const XForm& rXForm, sal_uInt32 nMode )
+ {
+ switch( nMode )
+ {
+ case MWT_IDENTITY :
+ {
+ maXForm.eM11 = maXForm.eM12 = maXForm.eM21 = maXForm.eM22 = 1.0f;
+ maXForm.eDx = maXForm.eDy = 0.0f;
+ }
+ break;
+
+ case MWT_RIGHTMULTIPLY :
+ case MWT_LEFTMULTIPLY :
+ {
+ const XForm* pLeft;
+ const XForm* pRight;
+
+ if ( nMode == MWT_LEFTMULTIPLY )
+ {
+ pLeft = &rXForm;
+ pRight = &maXForm;
+ }
+ else
+ {
+ pLeft = &maXForm;
+ pRight = &rXForm;
+ }
+
+ float aF[3][3];
+ float bF[3][3];
+ float cF[3][3];
+
+ aF[0][0] = pLeft->eM11;
+ aF[0][1] = pLeft->eM12;
+ aF[0][2] = 0;
+ aF[1][0] = pLeft->eM21;
+ aF[1][1] = pLeft->eM22;
+ aF[1][2] = 0;
+ aF[2][0] = pLeft->eDx;
+ aF[2][1] = pLeft->eDy;
+ aF[2][2] = 1;
+
+ bF[0][0] = pRight->eM11;
+ bF[0][1] = pRight->eM12;
+ bF[0][2] = 0;
+ bF[1][0] = pRight->eM21;
+ bF[1][1] = pRight->eM22;
+ bF[1][2] = 0;
+ bF[2][0] = pRight->eDx;
+ bF[2][1] = pRight->eDy;
+ bF[2][2] = 1;
+
+ int i, j, k;
+ for ( i = 0; i < 3; i++ )
+ {
+ for ( j = 0; j < 3; j++ )
+ {
+ cF[i][j] = 0;
+ for ( k = 0; k < 3; k++ )
+ cF[i][j] += aF[i][k] * bF[k][j];
+ }
+ }
+ maXForm.eM11 = cF[0][0];
+ maXForm.eM12 = cF[0][1];
+ maXForm.eM21 = cF[1][0];
+ maXForm.eM22 = cF[1][1];
+ maXForm.eDx = cF[2][0];
+ maXForm.eDy = cF[2][1];
+ }
+ break;
+ }
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::Push() // !! to be able to access the original ClipRegion it
+ { // is not allowed to use the MetaPushAction()
+ UpdateClipRegion(); // (the original clip region is on top of the stack) (SJ)
+ SaveStructPtr pSave( new SaveStruct );
+
+ pSave->aLineStyle = maLineStyle;
+ pSave->aFillStyle = maFillStyle;
+
+ pSave->aFont = maFont;
+ pSave->aTextColor = maTextColor;
+ pSave->nTextAlign = mnTextAlign;
+ pSave->nTextLayoutMode = mnTextLayoutMode;
+ pSave->nMapMode = mnMapMode;
+ pSave->nGfxMode = mnGfxMode;
+ pSave->nBkMode = mnBkMode;
+ pSave->aBkColor = maBkColor;
+ pSave->bFillStyleSelected = mbFillStyleSelected;
+
+ pSave->aActPos = maActPos;
+ pSave->aXForm = maXForm;
+ pSave->eRasterOp = meRasterOp;
+
+ pSave->nWinOrgX = mnWinOrgX;
+ pSave->nWinOrgY = mnWinOrgY;
+ pSave->nWinExtX = mnWinExtX;
+ pSave->nWinExtY = mnWinExtY;
+ pSave->nDevOrgX = mnDevOrgX;
+ pSave->nDevOrgY = mnDevOrgY;
+ pSave->nDevWidth = mnDevWidth;
+ pSave->nDevHeight = mnDevHeight;
+
+ pSave->aPathObj = aPathObj;
+ pSave->aClipPath = aClipPath;
+
+ vSaveStack.push_back( pSave );
+ }
+
+ //-----------------------------------------------------------------------------------
+
+ void WinMtfOutput::Pop()
+ {
+ // Die aktuellen Daten vom Stack holen
+ if( !vSaveStack.empty() )
+ {
+ // Die aktuelle Daten auf dem Stack sichern
+ SaveStructPtr pSave( vSaveStack.back() );
+
+ maLineStyle = pSave->aLineStyle;
+ maFillStyle = pSave->aFillStyle;
+
+ maFont = pSave->aFont;
+ maTextColor = pSave->aTextColor;
+ mnTextAlign = pSave->nTextAlign;
+ mnTextLayoutMode = pSave->nTextLayoutMode;
+ mnBkMode = pSave->nBkMode;
+ mnGfxMode = pSave->nGfxMode;
+ mnMapMode = pSave->nMapMode;
+ maBkColor = pSave->aBkColor;
+ mbFillStyleSelected = pSave->bFillStyleSelected;
+
+ maActPos = pSave->aActPos;
+ maXForm = pSave->aXForm;
+ meRasterOp = pSave->eRasterOp;
+
+ mnWinOrgX = pSave->nWinOrgX;
+ mnWinOrgY = pSave->nWinOrgY;
+ mnWinExtX = pSave->nWinExtX;
+ mnWinExtY = pSave->nWinExtY;
+ mnDevOrgX = pSave->nDevOrgX;
+ mnDevOrgY = pSave->nDevOrgY;
+ mnDevWidth = pSave->nDevWidth;
+ mnDevHeight = pSave->nDevHeight;
+
+ aPathObj = pSave->aPathObj;
+ if ( ! ( aClipPath == pSave->aClipPath ) )
+ {
+ aClipPath = pSave->aClipPath;
+ mbClipNeedsUpdate = true;
+ }
+ if ( meLatestRasterOp != meRasterOp )
+ mpGDIMetaFile->AddAction( new MetaRasterOpAction( meRasterOp ) );
+ vSaveStack.pop_back();
+ }
+ }
+
+ void WinMtfOutput::AddFromGDIMetaFile( GDIMetaFile& rGDIMetaFile )
+ {
+ rGDIMetaFile.Play( *mpGDIMetaFile, 0xFFFFFFFF );
+ }
+
+ void WinMtfOutput::PassEMFPlusHeaderInfo()
+ {
+ EMFP_DEBUG(printf ("\t\t\tadd EMF_PLUS header info\n"));
+
+ SvMemoryStream mem;
+ sal_Int32 nLeft, nRight, nTop, nBottom;
+
+ nLeft = mrclFrame.Left();
+ nTop = mrclFrame.Top();
+ nRight = mrclFrame.Right();
+ nBottom = mrclFrame.Bottom();
+
+ // emf header info
+ mem << nLeft << nTop << nRight << nBottom;
+ mem << mnPixX << mnPixY << mnMillX << mnMillY;
+
+ float one, zero;
+
+ one = 1;
+ zero = 0;
+
+ // add transformation matrix to be used in vcl's metaact.cxx for
+ // rotate and scale operations
+ mem << one << zero << zero << one << zero << zero;
+
+ // need to flush the stream, otherwise GetEndOfData will return 0
+ // on windows where the function parameters are probably resolved in reverse order
+ mem.Flush();
+
+ mpGDIMetaFile->AddAction( new MetaCommentAction( "EMF_PLUS_HEADER_INFO", 0, (const sal_uInt8*) mem.GetData(), mem.GetEndOfData() ) );
+ mpGDIMetaFile->UseCanvas( sal_True );
+ }
+
+ void WinMtfOutput::PassEMFPlus( void* pBuffer, sal_uInt32 nLength )
+ {
+ EMFP_DEBUG(printf ("\t\t\tadd EMF_PLUS comment length %04x\n",(unsigned int) nLength));
+ mpGDIMetaFile->AddAction( new MetaCommentAction( "EMF_PLUS", 0, static_cast<const sal_uInt8*>(pBuffer), nLength ) );
+ }
+
+ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 67d1f24ad292aaf1dc256d7114a2dba88d8b351a
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Feb 27 23:20:24 2013 +0100
fdo#61000: writerfilter: filter out unsupported list tab stops
Change-Id: Ic9d31eba84b1d8d9cf93d8289621a65d43521a8b
(cherry picked from commit dbb74ee9950dc706ea4fde3397a4c1d19b172fa9)
Reviewed-on: https://gerrit.libreoffice.org/2465
Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 7691410..86c38d5 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -127,7 +127,13 @@ void ListLevel::SetValue( Id nId, sal_Int32 nValue )
m_nXChFollow = nValue;
break;
case NS_ooxml::LN_CT_TabStop_pos:
- m_nTabstop = nValue;
+ if (nValue < 0)
+ {
+ SAL_INFO("writerfilter",
+ "unsupported list tab stop position " << nValue);
+ }
+ else
+ m_nTabstop = nValue;
break;
default:
OSL_FAIL( "this line should never be reached");
commit 1341131eb54abca218296ce49428cc5da78f4691
Author: Michael Meeks <michael.meeks at suse.com>
Date: Mon Feb 25 21:48:33 2013 +0000
fdo#45879 - fix selected gluepoint rendering.
Store the glue-point bitmap at a unique index in maRealMarkers for re-use.
Change-Id: I2cd5b240619502dfc8634eca331f4163e5bd5ca8
(cherry picked from commit 8d34984116c0841748ae47afa667877dc1b5a444)
Signed-off-by: Thorsten Behrens <tbehrens at suse.com>
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 62c3aae..6c06d41 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -96,11 +96,11 @@ public:
////////////////////////////////////////////////////////////////////////////////////////////////////
#define KIND_COUNT (14)
#define INDEX_COUNT (6)
-#define INDIVIDUAL_COUNT (4)
+#define INDIVIDUAL_COUNT (5)
SdrHdlBitmapSet::SdrHdlBitmapSet(sal_uInt16 nResId)
: maMarkersBitmap(ResId(nResId, *ImpGetResMgr())),
- // 14 kinds (BitmapMarkerKind) use index [0..5], 4 extra
+ // 15 kinds (BitmapMarkerKind) use index [0..5] + 5 extra
maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT)
{
}
@@ -246,20 +246,20 @@ const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal
case Glue_Deselected:
{
- return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 67), Size(9, 9)));
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, Rectangle(Point(15, 67), Size(9, 9)));
}
case Anchor: // AnchorTR for SW
case AnchorTR:
{
- return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, Rectangle(Point(24, 67), Size(24, 24)));
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(24, 67), Size(24, 24)));
}
// add AnchorPressed to be able to animate anchor control
case AnchorPressed:
case AnchorPressedTR:
{
- return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(48, 67), Size(24, 24)));
+ return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 4, Rectangle(Point(48, 67), Size(24, 24)));
}
}
}
commit f1fea45fb225c79d2f5f6b25729825f9b7c5bd91
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Feb 14 17:14:37 2013 +0100
support new attribute also in 3.6, fdo#60760
Change-Id: I8beab492a3b9b42b323d7d6d9cebfbda1eae0ce1
Reviewed-on: https://gerrit.libreoffice.org/2159
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index dbb5028..83daa86 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -294,6 +294,9 @@ SvXMLImportContext* ScXMLDataBarFormatContext::CreateChildContext( sal_uInt16 nP
case XML_TOK_DATABAR_DATABARENTRY:
pContext = new ScXMLDataBarFormatEntryContext( GetScImport(), nPrefix, rLocalName, xAttrList, mpFormatData );
break;
+ case XML_TOK_DATABAR_FORMATTINGENTRY:
+ pContext = new ScXMLDataBarFormatEntryContext( GetScImport(), nPrefix, rLocalName, xAttrList, mpFormatData );
+ break;
default:
break;
}
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 204a3fa..aa925f7 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -706,6 +706,7 @@ const SvXMLTokenMap& ScXMLImport::GetDataBarTokenMap()
static SvXMLTokenMapEntry aDataBarElemTokenMap[] =
{
{ XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, XML_TOK_DATABAR_DATABARENTRY },
+ { XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, XML_TOK_DATABAR_FORMATTINGENTRY },
XML_TOKEN_MAP_END
};
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index c4a4412..0974491 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -189,7 +189,8 @@ enum ScXMLColorScaleEntryAttrTokens
enum ScXMLDataBarFormatTokens
{
- XML_TOK_DATABAR_DATABARENTRY
+ XML_TOK_DATABAR_DATABARENTRY,
+ XML_TOK_DATABAR_FORMATTINGENTRY
};
enum ScXMLDataBarAttrTokens
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 16fe5e8..dca9fcf 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -850,6 +850,7 @@ namespace xmloff { namespace token {
XML_FOREIGN_OBJECT,
XML_FORMAT_CHANGE,
XML_FORMAT_SOURCE,
+ XML_FORMATTING_ENTRY,
XML_FORMS,
XML_FORMULA,
XML_FORMULA_HIDDEN,
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index a1147aa..b21d7fa 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -854,6 +854,7 @@ namespace xmloff { namespace token {
TOKEN( "foreign-object", XML_FOREIGN_OBJECT ),
TOKEN( "format-change", XML_FORMAT_CHANGE ),
TOKEN( "format-source", XML_FORMAT_SOURCE ),
+ TOKEN( "formatting-entry", XML_FORMATTING_ENTRY ),
TOKEN( "forms", XML_FORMS ),
TOKEN( "formula", XML_FORMULA ),
TOKEN( "formula-hidden", XML_FORMULA_HIDDEN ),
commit 29c4e4915bd659688af036f4a301f43175ed07eb
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Nov 29 17:12:54 2012 +0100
sw: fix RTF export of text frames anchored to empty paragraphs
Regression from d4069372484f18b242a42a1996767f57b031fff6
Reported-by: Michael Stahl <mstahl at redhat.com>
(cherry picked from commit 049933c035157129cc0409bb100dfc5353847a63)
Conflicts:
sw/qa/extras/rtfexport/rtfexport.cxx
Change-Id: I28e095819e0c2f1a4b110741ace366329937f863
Reviewed-on: https://gerrit.libreoffice.org/2391
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 6944bbb..0537275 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -389,7 +389,7 @@ void RtfAttributeOutput::EndParagraphProperties()
void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun )
{
- SAL_INFO("sw.rtf", OSL_THIS_FUNC);
+ SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", bSingleEmptyRun: " << bSingleEmptyRun);
m_bInRun = true;
m_bSingleEmptyRun = bSingleEmptyRun;
@@ -427,7 +427,7 @@ void RtfAttributeOutput::EndRunProperties( const SwRedlineData* /*pRedlineData*/
void RtfAttributeOutput::RunText( const String& rText, rtl_TextEncoding /*eCharSet*/ )
{
- SAL_INFO("sw.rtf", OSL_THIS_FUNC);
+ SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", rText: " << rText);
RawText( rText, 0, m_rExport.eCurrentEncoding );
}
@@ -1519,6 +1519,11 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
* would be there, causing a problem later.
*/
OString aSave = m_aRun.makeStringAndClear();
+ // Also back m_bInRun and m_bSingleEmptyRun up.
+ bool bInRunOrig = m_bInRun;
+ m_bInRun = false;
+ bool bSingleEmptyRunOrig = m_bSingleEmptyRun;
+ m_bSingleEmptyRun = false;
m_rExport.bRTFFlySyntax = true;
const SwFrmFmt& rFrmFmt = rFrame.GetFrmFmt( );
@@ -1534,6 +1539,8 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
m_rExport.bRTFFlySyntax = false;
m_aRun->append(aSave);
m_aRunText.clear();
+ m_bInRun = bInRunOrig;
+ m_bSingleEmptyRun = bSingleEmptyRunOrig;
}
m_rExport.mpParentFrame = NULL;
commit ef63a7cb4c60297e6ebcc6bd8beeaae2ee73139e
Author: Andras Timar <atimar at suse.com>
Date: Thu Feb 21 15:16:24 2013 +0100
convert Turkish AutoText files from old binary to zipped XML
I wonder when the support of old binary format was discontinued, but
at least in LibreOffice 3.6 it did not work. I converted the files with
OpenOffice.org 1.0.3.
Change-Id: Ie68371b613ab0464eefe909d083dbb8567623a2b
Reviewed-on: https://gerrit.libreoffice.org/2314
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/extras/source/autotext/lang/tr/crdbus50.bau b/extras/source/autotext/lang/tr/crdbus50.bau
index cd8ca31..a9eb8dc 100644
Binary files a/extras/source/autotext/lang/tr/crdbus50.bau and b/extras/source/autotext/lang/tr/crdbus50.bau differ
diff --git a/extras/source/autotext/lang/tr/template.bau b/extras/source/autotext/lang/tr/template.bau
index 60d51dc..b1b2b63 100644
Binary files a/extras/source/autotext/lang/tr/template.bau and b/extras/source/autotext/lang/tr/template.bau differ
commit 0978f8a622b915f7075fe1ce0eb7fefdbf428469
Author: Eike Rathke <erack at redhat.com>
Date: Tue Feb 19 19:22:27 2013 +0100
do not access vector elements beyond size, rhbz#847519 related
The actual bug (crash) is not triggered anymore because the categories
are assembled differently, nevertheless the code in question could
expose the same behavior under different preconditions.
Change-Id: Ic37f6b34effaf4e5252e80aab46b021547b36efb
(cherry picked from commit d1ba2cd612a4c39976e2980c7dc4e3fa38c88470)
Reviewed-on: https://gerrit.libreoffice.org/2274
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index bc938e6..c593a51 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -362,11 +362,14 @@ Sequence< OUString > lcl_getExplicitSimpleCategories(
}
for( aOuterIt=rComplexCats.begin(); aOuterIt != aOuterEnd; ++aOuterIt )
{
- sal_Int32 nCurrentCount = lcl_getCategoryCount( *aOuterIt );
- if( nCurrentCount< nMaxCategoryCount )
+ if ( !aOuterIt->empty() )
{
- ComplexCategory& rComplexCategory = aOuterIt->back();
- rComplexCategory.Count += (nMaxCategoryCount-nCurrentCount);
+ sal_Int32 nCurrentCount = lcl_getCategoryCount( *aOuterIt );
+ if( nCurrentCount< nMaxCategoryCount )
+ {
+ ComplexCategory& rComplexCategory = aOuterIt->back();
+ rComplexCategory.Count += (nMaxCategoryCount-nCurrentCount);
+ }
}
}
}
@@ -398,12 +401,15 @@ Sequence< OUString > lcl_getExplicitSimpleCategories(
OUString aText;
for( aOuterIt=aComplexCatsPerIndex.begin() ; aOuterIt != aOuterEnd; ++aOuterIt )
{
- OUString aAddText = (*aOuterIt)[nN].Text;
- if( !aAddText.isEmpty() )
+ if ( static_cast<size_t>(nN) < aOuterIt->size() )
{
- if(!aText.isEmpty())
- aText += aSpace;
- aText += aAddText;
+ OUString aAddText = (*aOuterIt)[nN].Text;
+ if( !aAddText.isEmpty() )
+ {
+ if(!aText.isEmpty())
+ aText += aSpace;
+ aText += aAddText;
+ }
}
}
aRet[nN]=aText;
commit b770d1f0a40688447fd452a139acb3c0c9e9d324
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Feb 14 15:21:46 2013 +0100
rhbz#908674: Adapt rtl::Allocator::construct to C++11
...otherwise, at least with some --with-system-boost versions and C++11
compilers, like with Fedora's boost-1.50.0-4.fc18.x86_64 and
gcc-c++-4.7.2-8.fc18.x86_64, using this to copy-construct an instance of
boost::unordered::detail::ptr_node<std::pair<rtl::OUString,Bootstrap_Impl*>> in
the call to p_bootstrap_map->insert(...) in rtl_bootstrap_args_open
(sal/rtl/source/bootstrap.cxx) would memcopy the ptr_node and fail to call
rtl_uString_acquire, leading to memory corruption later on when
rtl_uString_release is called one time too often.
It is not entirely clear to me whether this is a shortcoming of the given Boost
version, but this patch solves the problem and brings rtl::Allocator::construct
in line with the (changed) Allocator requirements of C++11 anyway.
The problem potentially lurks with every use of rtl::Allocator, but only showed
now begining with LO 4.0 where e5111574fd904b38a3980ca4ea3d21cfcb22dea6 "Revert
'sb140: sb140: #i116981# clean up memory upon exit'" re-introduced code into
rtl_bootstrap_args_open that inserts into a boost::unordered_map that uses
rtl::Allocator.
(cherry picked from commit c91d353872b7d4e1a39192bff1444b46cab6e5eb)
Conflicts:
config_host/config_global.h.in
...solved by resorting to the old -DHAVE_CXX11_PERFECT_FORWARDING logic spread
across various solenv/.../*.mk instead.
(cherry picked from commit https://gerrit.libreoffice.org/#/c/2166/1)
Conflicts:
configure.ac
solenv/gbuild/platform/com_GCC_defs.mk
solenv/gbuild/platform/com_MSC_defs.mk
Change-Id: I3be22f59a8eb49d31458480c27f3ce15803c7fd4
Reviewed-on: https://gerrit.libreoffice.org/2167
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Miklos Vajna <vmiklos at suse.cz>
diff --git a/config_host.mk.in b/config_host.mk.in
index 3997e7f..16d64f7 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -201,6 +201,7 @@ export GUIBASE_FOR_BUILD=@GUIBASE_FOR_BUILD@
export GUI_FOR_BUILD=@GUI_FOR_BUILD@
export GXX_INCLUDE_PATH=@GXX_INCLUDE_PATH@
export HAVE_CXX0X=@HAVE_CXX0X@
+export HAVE_CXX11_PERFECT_FORWARDING=@HAVE_CXX11_PERFECT_FORWARDING@
export HAVE_GCC_AVX=@HAVE_GCC_AVX@
export HAVE_GCC_GGDB2=@HAVE_GCC_GGDB2@
export HAVE_GCC_FINLINE_LIMIT=@HAVE_GCC_FINLINE_LIMIT@
diff --git a/configure.in b/configure.in
index cd3c4ca..18f449d 100644
--- a/configure.in
+++ b/configure.in
@@ -4879,6 +4879,32 @@ AC_SUBST(HAVE_GCC_NO_LONG_DOUBLE)
AC_SUBST(HAVE_GCC_AVX)
dnl ===================================================================
+dnl Check for C++11 perfect forwarding support
+dnl ===================================================================
+HAVE_CXX11_PERFECT_FORWARDING=
+AC_MSG_CHECKING([whether $CXX supports C++11 perfect forwarding])
+save_CXXFLAGS=$CXXFLAGS
+if test "$HAVE_CXX0X" = TRUE; then
+ CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+fi
+AC_LANG_PUSH([C++])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include <utility>
+ template<typename T, typename... Args> T * f(Args &&... v) {
+ return new T(std::forward<Args>(v)...);
+ }
+ ]], [[
+ f<int>(0);
+ ]])], [perfect_forwarding=yes], [perfect_forwarding=no])
+AC_LANG_POP([C++])
+CXXFLAGS=$save_CXXFLAGS
+AC_MSG_RESULT([$perfect_forwarding])
+if test "$perfect_forwarding" = yes; then
+ HAVE_CXX11_PERFECT_FORWARDING=TRUE
+fi
+AC_SUBST([HAVE_CXX11_PERFECT_FORWARDING])
+
+dnl ===================================================================
dnl system stl sanity tests
dnl ===================================================================
HAVE_GCC_VISIBILITY_BROKEN=
diff --git a/sal/inc/rtl/allocator.hxx b/sal/inc/rtl/allocator.hxx
index 36bbd00..10f298a 100644
--- a/sal/inc/rtl/allocator.hxx
+++ b/sal/inc/rtl/allocator.hxx
@@ -139,10 +139,18 @@ public:
}
//-----------------------------------------
+#if defined HAVE_CXX11_PERFECT_FORWARDING
+ template< typename... Args >
+ void construct (pointer p, Args &&... value)
+ {
+ new ((void*)p)T(std::forward< Args >(value)...);
+ }
+#else
void construct (pointer p, const T& value)
{
new ((void*)p)T(value);
}
+#endif
//-----------------------------------------
void destroy (pointer p)
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 60ae0c3..58d8b29 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -57,6 +57,12 @@ gb_COMPILERDEFS := \
-DCPPU_ENV=gcc3 \
-DGXX_INCLUDE_PATH=$(GXX_INCLUDE_PATH) \
+ifeq ($(HAVE_CXX11_PERFECT_FORWARDING),TRUE)
+gb_COMPILERDEFS += \
+ -DHAVE_CXX11_PERFECT_FORWARDING \
+
+endif
+
gb_CFLAGS_COMMON := \
-Wall \
-Wendif-labels \
diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk
index ea4bb0e..2f940f8 100644
--- a/solenv/inc/settings.mk
+++ b/solenv/inc/settings.mk
@@ -815,6 +815,10 @@ CDEFS+=$(CDEFS_PRESET)
CDEFS+=-DTIMELOG
.ENDIF
+.IF "$(HAVE_CXX11_PERFECT_FORWARDING)" == "TRUE"
+CDEFS += -DHAVE_CXX11_PERFECT_FORWARDING
+.ENDIF
+
CDEFSCXX=
CDEFSOBJ=
#CDEFSMT=-DMULTITHREAD
commit cb46de27c62a36936a76fe07a30438521a769a8c
Author: David Tardon <dtardon at redhat.com>
Date: Fri Feb 15 07:28:39 2013 +0100
fdo#58283 produce all translations for desktop files
Change-Id: Ie97e1ae7b2cc059630cba682a051eefff3ca044b
(cherry picked from commit 4a6f1853a2a15b938575406feada108443257536)
Reviewed-on: https://gerrit.libreoffice.org/2162
Reviewed-by: Andras Timar <atimar at suse.com>
Tested-by: Andras Timar <atimar at suse.com>
diff --git a/sysui/desktop/share/translate.pl b/sysui/desktop/share/translate.pl
index c55ee25..f67cb58 100755
--- a/sysui/desktop/share/translate.pl
+++ b/sysui/desktop/share/translate.pl
@@ -85,6 +85,8 @@ while (<SOURCE>) {
# For every section in the specified ulf file there should exist
# a template file in $workdir ..
$entry{'outfile'} = "$workdir/$prefix$template.$ext";
+ my %translations;
+ $entry{'translations'} = \%translations;
$templates{$template} = \%entry;
} else {
# split locale = "value" into 2 strings
@@ -102,8 +104,7 @@ while (<SOURCE>) {
$locale=~s/-/_/;
- $templates{$template}->{'locale'} = $locale;
- $templates{$template}->{'value'} = $value;
+ $templates{$template}->{'translations'}->{$locale} = $value;
}
}
}
@@ -134,15 +135,17 @@ foreach $template (keys %templates) {
$keyline =~ s/^$key/$outkey/;
print OUTFILE $keyline;
if (/$key/) {
- my $locale = $templates{$template}->{'locale'};
- my $value = $templates{$template}->{'value'};
- print "locale is $locale\n";
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list