You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by st...@apache.org on 2013/11/04 06:32:06 UTC
svn commit: r1538508 [13/15] - in /openoffice/branches/ia2: ./
extras/l10n/source/bg/ main/ main/basegfx/inc/basegfx/polygon/
main/basegfx/source/inc/ main/basegfx/source/polygon/
main/basegfx/source/tools/ main/basegfx/test/ main/canvas/source/tools/ ...
Modified: openoffice/branches/ia2/main/svx/source/svdraw/sdrundomanager.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/svx/source/svdraw/sdrundomanager.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/svx/source/svdraw/sdrundomanager.cxx (original)
+++ openoffice/branches/ia2/main/svx/source/svdraw/sdrundomanager.cxx Mon Nov 4 05:32:01 2013
@@ -85,6 +85,25 @@ sal_Bool SdrUndoManager::Redo()
return bRetval;
}
+void SdrUndoManager::Clear()
+{
+ if(isTextEditActive())
+ {
+ while(GetUndoActionCount() && mpLastUndoActionBeforeTextEdit != GetUndoAction(0))
+ {
+ RemoveLastUndoAction();
+ }
+
+ // urgently needed: RemoveLastUndoAction does NOT correct the Redo stack by itself (!)
+ ClearRedo();
+ }
+ else
+ {
+ // call parent
+ EditUndoManager::Clear();
+ }
+}
+
void SdrUndoManager::SetEndTextEditHdl(const Link& rLink)
{
maEndTextEditHdl = rLink;
Modified: openoffice/branches/ia2/main/svx/source/tbxctrls/fillctrl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/svx/source/tbxctrls/fillctrl.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/svx/source/tbxctrls/fillctrl.cxx (original)
+++ openoffice/branches/ia2/main/svx/source/tbxctrls/fillctrl.cxx Mon Nov 4 05:32:01 2013
@@ -74,7 +74,6 @@ SvxFillToolBoxControl::SvxFillToolBoxCon
pFillTypeLB ( NULL ),
pFillAttrLB ( NULL ),
bUpdate ( sal_False ),
- bIgnoreStatusUpdate( sal_False ),
eLastXFS ( XFILL_NONE )
{
addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillColor" )));
@@ -107,9 +106,6 @@ void SvxFillToolBoxControl::StateChanged
{
bool bEnableControls = sal_False;
- if ( bIgnoreStatusUpdate )
- return;
-
if( eState == SFX_ITEM_DISABLED )
{
if( nSID == SID_ATTR_FILL_STYLE )
@@ -229,13 +225,6 @@ void SvxFillToolBoxControl::StateChanged
//========================================================================
-void SvxFillToolBoxControl::IgnoreStatusUpdate( sal_Bool bSet )
-{
- bIgnoreStatusUpdate = bSet;
-}
-
-//========================================================================
-
void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
{
if ( pStyleItem && pState && bUpdate )
@@ -686,10 +675,8 @@ IMPL_LINK( FillControl, SelectFillAttrHd
aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ));
aXFillStyleItem.QueryValue( a );
aArgs[0].Value = a;
- ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_True );
((SvxFillToolBoxControl*)GetData())->Dispatch(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillStyle" )), aArgs );
- ( (SvxFillToolBoxControl*)GetData() )->IgnoreStatusUpdate( sal_False );
switch( eXFS )
{
Modified: openoffice/branches/ia2/main/svx/source/xoutdev/xattrbmp.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/svx/source/xoutdev/xattrbmp.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/svx/source/xoutdev/xattrbmp.cxx (original)
+++ openoffice/branches/ia2/main/svx/source/xoutdev/xattrbmp.cxx Mon Nov 4 05:32:01 2013
@@ -129,10 +129,12 @@ bool SVX_DLLPUBLIC isHistorical8x8(const
if(pRead->HasPalette() && 2 == pRead->GetPaletteEntryCount())
{
const BitmapPalette& rPalette = pRead->GetPalette();
-
- o_rBack = rPalette[1];
- o_rFront = rPalette[0];
-
+
+ // #123564# bachground and foregrund were exchanged; of course
+ // rPalette[0] is the background color
+ o_rFront = rPalette[1];
+ o_rBack = rPalette[0];
+
return true;
}
}
Modified: openoffice/branches/ia2/main/sw/inc/ndgrf.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/inc/ndgrf.hxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/inc/ndgrf.hxx (original)
+++ openoffice/branches/ia2/main/sw/inc/ndgrf.hxx Mon Nov 4 05:32:01 2013
@@ -154,7 +154,6 @@ public:
/// wrappers for non-const calls at GraphicObject
void ReleaseGraphicFromCache() { maGrfObj.ReleaseFromCache(); }
- void DrawGraphicWithPDFHandling(OutputDevice& rOutDev, const Point& rPt, const Size& rSz, const GraphicAttr* pGrfAttr = NULL, const sal_uLong nFlags = GRFMGR_DRAW_STANDARD) { maGrfObj.DrawWithPDFHandling(rOutDev, rPt, rSz, pGrfAttr, nFlags); }
void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const Size& rSz, long nExtraData = 0, const GraphicAttr* pAttr = NULL, sal_uLong nFlags = GRFMGR_DRAW_STANDARD, OutputDevice* pFirstFrameOutDev = NULL) { maGrfObj.StartAnimation(pOut, rPt, rSz, nExtraData, pAttr, nFlags, pFirstFrameOutDev); }
void StopGraphicAnimation(OutputDevice* pOut = NULL, long nExtraData = 0) { maGrfObj.StopAnimation(pOut, nExtraData); }
Modified: openoffice/branches/ia2/main/sw/inc/ndtxt.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/inc/ndtxt.hxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/inc/ndtxt.hxx (original)
+++ openoffice/branches/ia2/main/sw/inc/ndtxt.hxx Mon Nov 4 05:32:01 2013
@@ -285,8 +285,12 @@ public:
refmarks, toxmarks, and metas will be ignored unless this is true
ATTENTION: setting bInclRefToxMark is only allowed from UNDO!
*/
- void RstAttr( const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich = 0,
- const SfxItemSet* pSet = 0, sal_Bool bInclRefToxMark = sal_False );
+ void RstAttr(
+ const SwIndex &rIdx,
+ const xub_StrLen nLen,
+ const sal_uInt16 nWhich = 0,
+ const SfxItemSet* pSet = 0,
+ const sal_Bool bInclRefToxMark = sal_False );
void GCAttr();
// loesche das Text-Attribut (muss beim Pool abgemeldet werden!)
Modified: openoffice/branches/ia2/main/sw/source/core/doc/notxtfrm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/doc/notxtfrm.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/doc/notxtfrm.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/doc/notxtfrm.cxx Mon Nov 4 05:32:01 2013
@@ -76,7 +76,7 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <drawinglayer/processor2d/processor2dtools.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
-#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
using namespace com::sun::star;
@@ -816,57 +816,19 @@ bool paintUsingPrimitivesHelper(
OutputDevice& rOutputDevice,
const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
const basegfx::B2DRange& rSourceRange,
- const basegfx::B2DRange& rTargetRange,
- const sal_Int32 nLeftCrop = 0,
- const sal_Int32 nTopCrop = 0,
- const sal_Int32 nRightCrop = 0,
- const sal_Int32 nBottomCrop = 0,
- const bool bMirrorX = false,
- const bool bMirrorY = false)
+ const basegfx::B2DRange& rTargetRange)
{
- const double fSourceWidth(rSourceRange.getWidth());
- const double fSourceHeight(rSourceRange.getHeight());
-
- if(rSequence.hasElements() && !basegfx::fTools::equalZero(fSourceWidth) && !basegfx::fTools::equalZero(fSourceHeight))
+ if(rSequence.hasElements() && !basegfx::fTools::equalZero(rSourceRange.getWidth()) && !basegfx::fTools::equalZero(rSourceRange.getHeight()))
{
- // copy target range and apply evtl. cropping
- basegfx::B2DRange aTargetRange(rTargetRange);
-
- if(nLeftCrop || nTopCrop || nRightCrop || nBottomCrop)
+ if(!basegfx::fTools::equalZero(rTargetRange.getWidth()) && !basegfx::fTools::equalZero(rTargetRange.getHeight()))
{
- // calculate original TargetRange
- const double fFactor100thmmToTwips(72.0 / 127.0);
-
- aTargetRange = basegfx::B2DRange(
- aTargetRange.getMinX() - (nLeftCrop * fFactor100thmmToTwips),
- aTargetRange.getMinY() - (nTopCrop * fFactor100thmmToTwips),
- aTargetRange.getMaxX() + (nRightCrop * fFactor100thmmToTwips),
- aTargetRange.getMaxY() + (nBottomCrop * fFactor100thmmToTwips));
- }
-
- const double fTargetWidth(aTargetRange.getWidth());
- const double fTargetHeight(aTargetRange.getHeight());
-
- if(!basegfx::fTools::equalZero(fTargetWidth) && !basegfx::fTools::equalZero(fTargetHeight))
- {
- // map graphic range to target range. This will automatically include
- // tme mapping from Svg 1/100th mm content to twips since the target
- // range is twips already
- basegfx::B2DHomMatrix aMappingTransform(
- basegfx::tools::createTranslateB2DHomMatrix(
- -rSourceRange.getMinX(),
- -rSourceRange.getMinY()));
-
- aMappingTransform.scale(fTargetWidth / fSourceWidth, fTargetHeight / fSourceHeight);
- aMappingTransform.translate(aTargetRange.getMinX(), aTargetRange.getMinY());
-
- // apply mirrorings
- if(bMirrorX || bMirrorY)
- {
- aMappingTransform.translate(-aTargetRange.getCenterX(), -aTargetRange.getCenterY());
- aMappingTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // #119176# small typo with X/Y
- aMappingTransform.translate(aTargetRange.getCenterX(), aTargetRange.getCenterY());
- }
+ // map graphic range to target range. This will e.g. automatically include
+ // tme mapping from 1/100th mm content to twips if needed when the target
+ // range is defined in twips
+ const basegfx::B2DHomMatrix aMappingTransform(
+ basegfx::tools::createSourceRangeTargetRangeTransform(
+ rSourceRange,
+ rTargetRange));
// Fill ViewInformation. Use MappingTransform here, so there is no need to
// embed the primitives to it. Use original TargetRange here so there is also
@@ -875,7 +837,7 @@ bool paintUsingPrimitivesHelper(
const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
aMappingTransform,
rOutputDevice.GetViewTransformation(),
- aTargetRange,
+ rTargetRange,
0,
0.0,
uno::Sequence< beans::PropertyValue >());
@@ -983,14 +945,6 @@ void SwNoTxtFrm::PaintPicture( OutputDev
::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, sal_False );
bContinue = sal_False;
}
- else if( rGrfObj.IsCached( pOut, aAlignedGrfArea.Pos(),
- aAlignedGrfArea.SSize(), &aGrfAttr ))
- {
- pGrfNd->DrawGraphicWithPDFHandling(*pOut,
- aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(),
- &aGrfAttr );
- bContinue = sal_False;
- }
}
if( bContinue )
@@ -1028,68 +982,30 @@ void SwNoTxtFrm::PaintPicture( OutputDev
}
else
{
- const SvgDataPtr& rSvgDataPtr = rGrfObj.GetGraphic().getSvgData();
- bool bDone(false);
+ // unify using GraphicPrimitive2D
+ // -> the primitive handles all crop and mirror stuff
+ // -> the primitive renderer will create the needed pdf export data
+ // -> if bitmap conent, it will be cached system-dependent
+ const basegfx::B2DRange aTargetRange(
+ aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
+ aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
+ const basegfx::B2DHomMatrix aTargetTransform(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ aTargetRange.getRange(),
+ aTargetRange.getMinimum()));
+ drawinglayer::primitive2d::Primitive2DSequence aContent;
+
+ aContent.realloc(1);
+ aContent[0] = new drawinglayer::primitive2d::GraphicPrimitive2D(
+ aTargetTransform,
+ rGrfObj.GetGraphic(),
+ aGrfAttr);
- if(rSvgDataPtr.get())
- {
- // Graphic is Svg and can be painted as primitives (vector graphic)
- const basegfx::B2DRange aTargetRange(
- aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
- aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
- const bool bCropped(aGrfAttr.IsCropped());
- drawinglayer::primitive2d::Primitive2DSequence aContent;
- GraphicAttr aSuppressGraphicAttr(aGrfAttr);
-
- aSuppressGraphicAttr.SetCrop(0, 0, 0, 0);
- aSuppressGraphicAttr.SetRotation(0);
- aSuppressGraphicAttr.SetMirrorFlags(0);
-
- const bool bNeedTransformedGraphic(
- aSuppressGraphicAttr.IsSpecialDrawMode() ||
- aSuppressGraphicAttr.IsAdjusted() ||
- aSuppressGraphicAttr.IsMirrored() ||
- aSuppressGraphicAttr.IsRotated() ||
- aSuppressGraphicAttr.IsTransparent());
-
- if(bNeedTransformedGraphic)
- {
- // #122039# need to apply graphic transformation if GraphicAttr are used qwhich need this
- const Graphic aTransformedGraphic(rGrfObj.GetTransformedGraphic(&aSuppressGraphicAttr));
- const basegfx::B2DRange aRange(rSvgDataPtr->getRange());
- const basegfx::B2DHomMatrix aTransform(
- basegfx::tools::createScaleTranslateB2DHomMatrix(
- aRange.getRange(),
- aRange.getMinimum()));
-
- aContent.realloc(1);
- aContent[0] = new drawinglayer::primitive2d::BitmapPrimitive2D(
- aTransformedGraphic.GetBitmapEx(),
- aTransform);
- }
- else
- {
- aContent = rSvgDataPtr->getPrimitive2DSequence();
- }
-
- bDone = paintUsingPrimitivesHelper(
- *pOut,
- aContent,
- rSvgDataPtr->getRange(),
- aTargetRange,
- bCropped ? aGrfAttr.GetLeftCrop() : 0,
- bCropped ? aGrfAttr.GetTopCrop() : 0,
- bCropped ? aGrfAttr.GetRightCrop() : 0,
- bCropped ? aGrfAttr.GetBottomCrop() : 0,
- aGrfAttr.GetMirrorFlags() & BMP_MIRROR_HORZ,
- aGrfAttr.GetMirrorFlags() & BMP_MIRROR_VERT);
- }
-
- if(!bDone)
- {
- // fallback paint, uses replacement image
- pGrfNd->DrawGraphicWithPDFHandling(*pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), &aGrfAttr);
- }
+ paintUsingPrimitivesHelper(
+ *pOut,
+ aContent,
+ aTargetRange,
+ aTargetRange);
}
}
else
Modified: openoffice/branches/ia2/main/sw/source/core/layout/paintfrm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/layout/paintfrm.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/layout/paintfrm.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/layout/paintfrm.cxx Mon Nov 4 05:32:01 2013
@@ -6383,10 +6383,27 @@ const Color& SwPageFrm::GetDrawBackgrdCo
const SvxBrushItem* pBrushItem;
const Color* pDummyColor;
SwRect aDummyRect;
+
if ( GetBackgroundBrush( pBrushItem, pDummyColor, aDummyRect, true) )
- return pBrushItem->GetColor();
- else
- return aGlobalRetoucheColor;
+ {
+ const Graphic* pGraphic = pBrushItem->GetGraphic();
+
+ if(pGraphic)
+ {
+ // #29105# when a graphic is set, it may be possible to calculate a single
+ // color which looks good in all places of the graphic. Since it is
+ // planned to have text edit on the overlay one day and the fallback
+ // to aGlobalRetoucheColor returns something useful, just use that
+ // for now.
+ }
+ else
+ {
+ // not a graphic, use (hopefully) initialized color
+ return pBrushItem->GetColor();
+ }
+ }
+
+ return aGlobalRetoucheColor;
}
/*************************************************************************
Modified: openoffice/branches/ia2/main/sw/source/core/text/EnhancedPDFExportHelper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/text/EnhancedPDFExportHelper.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/text/EnhancedPDFExportHelper.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/text/EnhancedPDFExportHelper.cxx Mon Nov 4 05:32:01 2013
@@ -375,8 +375,9 @@ bool SwTaggedPDFHelper::CheckReopenTag()
if ( pKey )
{
FrmTagIdMap& rFrmTagIdMap = SwEnhancedPDFExportHelper::GetFrmTagIdMap();
- const FrmTagIdMap::const_iterator aIter = rFrmTagIdMap.find( pKey );
- nReopenTag = (*aIter).second;
+ const FrmTagIdMap::const_iterator aIter = rFrmTagIdMap.find( pKey );
+ if( aIter != rFrmTagIdMap.end())
+ nReopenTag = (*aIter).second;
}
}
}
Modified: openoffice/branches/ia2/main/sw/source/core/txtnode/txtedt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/txtnode/txtedt.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/txtnode/txtedt.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/txtnode/txtedt.cxx Mon Nov 4 05:32:01 2013
@@ -394,26 +394,25 @@ inline sal_Bool InRange(xub_StrLen nIdx,
* -> nothing to do
*/
-void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, sal_uInt16 nWhich,
- const SfxItemSet* pSet, sal_Bool bInclRefToxMark )
+void SwTxtNode::RstAttr(
+ const SwIndex &rIdx,
+ const xub_StrLen nLen,
+ const sal_uInt16 nWhich,
+ const SfxItemSet* pSet,
+ const sal_Bool bInclRefToxMark )
{
- // Attribute?
- if ( !GetpSwpHints() )
- return;
-
- sal_uInt16 i = 0;
- xub_StrLen nStt = rIdx.GetIndex();
- xub_StrLen nEnd = nStt + nLen;
- xub_StrLen nAttrStart;
- SwTxtAttr *pHt;
+ if ( !GetpSwpHints() )
+ return;
- sal_Bool bChanged = sal_False;
+ const xub_StrLen nStt = rIdx.GetIndex();
+ const xub_StrLen nEnd = nStt + nLen;
+
+ bool bChanged = false;
// nMin and nMax initialized to maximum / minimum (inverse)
xub_StrLen nMin = m_Text.Len();
xub_StrLen nMax = nStt;
-
- const sal_Bool bNoLen = !nMin;
+ const bool bNoLen = nMin == 0;
// We have to remember the "new" attributes, which have
// been introduced by splitting surrounding attributes (case 4).
@@ -422,18 +421,30 @@ void SwTxtNode::RstAttr(const SwIndex &r
// iterate over attribute array until start of attribute is behind
// deletion range
+ sal_uInt16 i = 0;
+ xub_StrLen nAttrStart;
+ SwTxtAttr *pHt = NULL;
while ((i < m_pSwpHints->Count()) &&
((( nAttrStart = *(*m_pSwpHints)[i]->GetStart()) < nEnd ) || nLen==0) )
{
pHt = m_pSwpHints->GetTextHint(i);
// attributes without end stay in!
- xub_StrLen * const pAttrEnd = pHt->GetEnd();
- if ( !pAttrEnd /*|| pHt->HasDummyChar()*/ ) // see bInclRefToxMark
+ // but consider <bInclRefToxMark> used by Undo
+ xub_StrLen* const pAttrEnd = pHt->GetEnd();
+ const bool bKeepAttrWithoutEnd =
+ pAttrEnd == NULL
+ && ( !bInclRefToxMark
+ || ( RES_TXTATR_REFMARK != pHt->Which()
+ && RES_TXTATR_TOXMARK != pHt->Which()
+ && RES_TXTATR_META != pHt->Which()
+ && RES_TXTATR_METAFIELD != pHt->Which() ) );
+ if ( bKeepAttrWithoutEnd )
{
- i++;
- continue;
- }
+
+ i++;
+ continue;
+ }
// Default behavior is to process all attributes:
bool bSkipAttr = false;;
@@ -473,28 +484,29 @@ void SwTxtNode::RstAttr(const SwIndex &r
if ( bSkipAttr )
{
- i++;
- continue;
- }
+ i++;
+ continue;
+ }
if( nStt <= nAttrStart ) // Faelle: 1,3,5
- {
- if( nEnd > nAttrStart
- || ( nEnd == *pAttrEnd && nEnd==nAttrStart ) )
- {
- // Faelle: 1,3
- if ( nMin > nAttrStart )
- nMin = nAttrStart;
- if ( nMax < *pAttrEnd )
- nMax = *pAttrEnd;
- // Falls wir nur ein nichtaufgespanntes Attribut entfernen,
- // tun wir mal so, als ob sich nichts geaendert hat.
- bChanged = bChanged || nEnd > nAttrStart || bNoLen;
- if( *pAttrEnd <= nEnd ) // Fall: 1
- {
- const xub_StrLen nAttrEnd = *pAttrEnd;
-
+ {
+ const xub_StrLen nAttrEnd = pAttrEnd != NULL
+ ? *pAttrEnd
+ : nAttrStart;
+ if( nEnd > nAttrStart
+ || ( nEnd == nAttrEnd && nEnd == nAttrStart ) )
+ {
+ // Faelle: 1,3
+ if ( nMin > nAttrStart )
+ nMin = nAttrStart;
+ if ( nMax < nAttrEnd )
+ nMax = nAttrEnd;
+ // Falls wir nur ein nichtaufgespanntes Attribut entfernen,
+ // tun wir mal so, als ob sich nichts geaendert hat.
+ bChanged = bChanged || nEnd > nAttrStart || bNoLen;
+ if( nAttrEnd <= nEnd ) // Fall: 1
+ {
m_pSwpHints->DeleteAtPos(i);
DestroyAttr( pHt );
@@ -505,22 +517,21 @@ void SwTxtNode::RstAttr(const SwIndex &r
InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
- // if the last attribute is a Field, the HintsArray is
- // deleted!
+ // if the last attribute is a Field, the HintsArray is deleted!
if ( !m_pSwpHints )
break;
- //JP 26.11.96:
- // beim DeleteAtPos wird ein Resort ausgefuehrt!!
- // darum muessen wir wieder bei 0 anfangen!!!
- // ueber den Fall 3 koennen Attribute nach hinten
- // verschoben worden sein; damit stimmt jetzt das i
- // nicht mehr!!!
- i = 0;
+ //JP 26.11.96:
+ // beim DeleteAtPos wird ein Resort ausgefuehrt!!
+ // darum muessen wir wieder bei 0 anfangen!!!
+ // ueber den Fall 3 koennen Attribute nach hinten
+ // verschoben worden sein; damit stimmt jetzt das i
+ // nicht mehr!!!
+ i = 0;
- continue;
- }
- else // Fall: 3
+ continue;
+ }
+ else // Fall: 3
{
m_pSwpHints->NoteInHistory( pHt );
*pHt->GetStart() = nEnd;
@@ -533,20 +544,21 @@ void SwTxtNode::RstAttr(const SwIndex &r
InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
- bChanged = sal_True;
- }
- }
- }
- else // Faelle: 2,4,5
+ bChanged = true;
+ }
+ }
+ }
+ else if ( pAttrEnd != NULL ) // Faelle: 2,4,5
+ {
if( *pAttrEnd > nStt ) // Faelle: 2,4
- {
- if( *pAttrEnd < nEnd ) // Fall: 2
- {
- if ( nMin > nAttrStart )
- nMin = nAttrStart;
- if ( nMax < *pAttrEnd )
- nMax = *pAttrEnd;
- bChanged = sal_True;
+ {
+ if( *pAttrEnd < nEnd ) // Fall: 2
+ {
+ if ( nMin > nAttrStart )
+ nMin = nAttrStart;
+ if ( nMax < *pAttrEnd )
+ nMax = *pAttrEnd;
+ bChanged = true;
const xub_StrLen nAttrEnd = *pAttrEnd;
@@ -557,19 +569,20 @@ void SwTxtNode::RstAttr(const SwIndex &r
if ( pStyleHandle.get() )
{
SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(),
- *pStyleHandle, nStt, nAttrEnd );
+ *pStyleHandle, nStt, nAttrEnd );
InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
- }
- else if( nLen ) // Fall: 4
- { // bei Lange 0 werden beide Hints vom Insert(Ht)
- // wieder zu einem zusammengezogen !!!!
- if ( nMin > nAttrStart )
- nMin = nAttrStart;
- if ( nMax < *pAttrEnd )
- nMax = *pAttrEnd;
- bChanged = sal_True;
- xub_StrLen nTmpEnd = *pAttrEnd;
+ }
+ else if( nLen ) // Fall: 4
+ {
+ // bei Lange 0 werden beide Hints vom Insert(Ht)
+ // wieder zu einem zusammengezogen !!!!
+ if ( nMin > nAttrStart )
+ nMin = nAttrStart;
+ if ( nMax < *pAttrEnd )
+ nMax = *pAttrEnd;
+ bChanged = true;
+ xub_StrLen nTmpEnd = *pAttrEnd;
m_pSwpHints->NoteInHistory( pHt );
*pAttrEnd = nStt;
m_pSwpHints->NoteInHistory( pHt, sal_True );
@@ -577,14 +590,14 @@ void SwTxtNode::RstAttr(const SwIndex &r
if ( pStyleHandle.get() && nStt < nEnd )
{
SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(),
- *pStyleHandle, nStt, nEnd );
+ *pStyleHandle, nStt, nEnd );
InsertHint( pNew, nsSetAttrMode::SETATTR_NOHINTADJUST );
}
if( nEnd < nTmpEnd )
{
SwTxtAttr* pNew = MakeTxtAttr( *GetDoc(),
- pHt->GetAttr(), nEnd, nTmpEnd );
+ pHt->GetAttr(), nEnd, nTmpEnd );
if ( pNew )
{
SwTxtCharFmt* pCharFmt = dynamic_cast<SwTxtCharFmt*>(pHt);
@@ -597,13 +610,14 @@ void SwTxtNode::RstAttr(const SwIndex &r
// jetzt kein i+1, weil das eingefuegte Attribut
- // ein anderes auf die Position geschoben hat !
- continue;
- }
- }
- }
- ++i;
- }
+ // ein anderes auf die Position geschoben hat !
+ continue;
+ }
+ }
+ }
+ ++i;
+ }
+ }
TryDeleteSwpHints();
if (bChanged)
Modified: openoffice/branches/ia2/main/sw/source/core/undo/untblk.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/undo/untblk.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/undo/untblk.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/undo/untblk.cxx Mon Nov 4 05:32:01 2013
@@ -219,46 +219,44 @@ void SwUndoInserts::UndoImpl(::sw::UndoR
nNdDiff += nTmp - pPam->GetPoint()->nNode.GetIndex();
}
- SwNodeIndex& rIdx = pPam->GetPoint()->nNode;
- SwTxtNode* pTxtNode = rIdx.GetNode().GetTxtNode();
- if( pTxtNode )
- {
- if( !pTxtFmtColl ) // falls 0, dann war hier auch kein TextNode,
- { // dann muss dieser geloescht werden,
- SwNodeIndex aDelIdx( rIdx );
- rIdx++;
- SwCntntNode* pCNd = rIdx.GetNode().GetCntntNode();
- xub_StrLen nCnt = 0; if( pCNd ) nCnt = pCNd->Len();
- pPam->GetPoint()->nContent.Assign( pCNd, nCnt );
- pPam->SetMark();
- pPam->DeleteMark();
-
- RemoveIdxRel( aDelIdx.GetIndex(), *pPam->GetPoint() );
-
- pDoc->GetNodes().Delete( aDelIdx, 1 );
- }
- else
- {
- if( bJoinNext && pTxtNode->CanJoinNext())
- {
- {
- RemoveIdxRel( rIdx.GetIndex()+1, SwPosition( rIdx,
- SwIndex( pTxtNode, pTxtNode->GetTxt().Len() )));
- }
- pTxtNode->JoinNext();
- }
+ SwNodeIndex& rIdx = pPam->GetPoint()->nNode;
+ SwTxtNode* pTxtNode = rIdx.GetNode().GetTxtNode();
+ if( pTxtNode )
+ {
+ if( !pTxtFmtColl ) // falls 0, dann war hier auch kein TextNode,
+ { // dann muss dieser geloescht werden,
+ SwNodeIndex aDelIdx( rIdx );
+ rIdx++;
+ SwCntntNode* pCNd = rIdx.GetNode().GetCntntNode();
+ xub_StrLen nCnt = 0; if( pCNd ) nCnt = pCNd->Len();
+ pPam->GetPoint()->nContent.Assign( pCNd, nCnt );
+ pPam->SetMark();
+ pPam->DeleteMark();
+
+ RemoveIdxRel( aDelIdx.GetIndex(), *pPam->GetPoint() );
+
+ pDoc->GetNodes().Delete( aDelIdx, 1 );
+ }
+ else
+ {
+ if( bJoinNext && pTxtNode->CanJoinNext())
+ {
+ {
+ RemoveIdxRel( rIdx.GetIndex()+1, SwPosition( rIdx,
+ SwIndex( pTxtNode, pTxtNode->GetTxt().Len() )));
+ }
+ pTxtNode->JoinNext();
+ }
// reset all text attributes in the paragraph!
- //i121897, change the hints clearing method from 'RstAttr' to 'ClarSwpHints' as the certain tox mark index hint reason
- if( pTxtNode && pTxtNode->GetpSwpHints() )
- pTxtNode->ClearSwpHintsArr( true );
+ pTxtNode->RstAttr( SwIndex(pTxtNode, 0), pTxtNode->Len(), 0, 0, true );
- // setze alle Attribute im Node zurueck
+ // setze alle Attribute im Node zurueck
pTxtNode->ResetAllAttr();
- if( USHRT_MAX != pDoc->GetTxtFmtColls()->GetPos( pTxtFmtColl ))
- pTxtFmtColl = (SwTxtFmtColl*)pTxtNode->ChgFmtColl( pTxtFmtColl );
+ if( USHRT_MAX != pDoc->GetTxtFmtColls()->GetPos( pTxtFmtColl ))
+ pTxtFmtColl = (SwTxtFmtColl*)pTxtNode->ChgFmtColl( pTxtFmtColl );
- pHistory->SetTmpEnd( nSetPos );
+ pHistory->SetTmpEnd( nSetPos );
pHistory->TmpRollback( pDoc, 0, false );
}
}
Modified: openoffice/branches/ia2/main/sw/source/filter/rtf/swparrtf.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/filter/rtf/swparrtf.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/filter/rtf/swparrtf.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/filter/rtf/swparrtf.cxx Mon Nov 4 05:32:01 2013
@@ -2290,8 +2290,13 @@ void SwRTFParser::SetAttrInDoc( SvxRTFIt
SwTxtNode* pTxtNd = pDoc->GetNodes()[ n ]->GetTxtNode();
if( pTxtNd )
{
- pTxtNd->SetAttr(
- *GetDfltAttr(RES_PARATR_NUMRULE));
+ pTxtNd->SetAttr( *GetDfltAttr(RES_PARATR_NUMRULE) );
+ // reset all list attributes
+ pTxtNd->ResetAttr( RES_PARATR_LIST_LEVEL );
+ pTxtNd->ResetAttr( RES_PARATR_LIST_ISRESTART );
+ pTxtNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE );
+ pTxtNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED );
+ pTxtNd->ResetAttr( RES_PARATR_LIST_ID );
}
}
}
Modified: openoffice/branches/ia2/main/sw/source/ui/config/optpage.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/ui/config/optpage.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/ui/config/optpage.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/ui/config/optpage.cxx Mon Nov 4 05:32:01 2013
@@ -1585,45 +1585,49 @@ void SwShdwCrsrOptionsTabPage::PageCreat
sal_Bool SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet )
{
- SwShadowCursorItem aOpt;
- aOpt.SetOn( aOnOffCB.IsChecked() );
+ SwShadowCursorItem aOpt;
+ aOpt.SetOn( aOnOffCB.IsChecked() );
- sal_uInt8 eMode;
- if( aFillIndentRB.IsChecked() )
- eMode= FILL_INDENT;
- else if( aFillMarginRB.IsChecked() )
- eMode = FILL_MARGIN;
- else if( aFillTabRB.IsChecked() )
- eMode = FILL_TAB;
- else
- eMode = FILL_SPACE;
- aOpt.SetMode( eMode );
+ sal_uInt8 eMode;
+ if( aFillIndentRB.IsChecked() )
+ eMode= FILL_INDENT;
+ else if( aFillMarginRB.IsChecked() )
+ eMode = FILL_MARGIN;
+ else if( aFillTabRB.IsChecked() )
+ eMode = FILL_TAB;
+ else
+ eMode = FILL_SPACE;
+ aOpt.SetMode( eMode );
- sal_Bool bRet = sal_False;
- const SfxPoolItem* pItem = 0;
- if( SFX_ITEM_SET != rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem )
- || ((SwShadowCursorItem&)*pItem) != aOpt )
- {
- rSet.Put( aOpt );
- bRet = sal_True;
- }
+ sal_Bool bRet = sal_False;
+ const SfxPoolItem* pItem = 0;
+ if( SFX_ITEM_SET != rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem )
+ || ((SwShadowCursorItem&)*pItem) != aOpt )
+ {
+ rSet.Put( aOpt );
+ bRet = sal_True;
+ }
- m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
+ if ( m_pWrtShell )
+ {
+ m_pWrtShell->GetDoc()->set(
+ IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
m_aMathBaselineAlignmentCB.IsChecked() );
- bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue();
+ bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue();
+ }
- if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue())
- {
- rSet.Put(SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aCrsrInProtCB.IsChecked()));
- bRet |= sal_True;
- }
+ if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue())
+ {
+ rSet.Put(SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aCrsrInProtCB.IsChecked()));
+ bRet |= sal_True;
+ }
- const SwDocDisplayItem* pOldAttr = (const SwDocDisplayItem*)
- GetOldItem(GetItemSet(), FN_PARAM_DOCDISP);
+ const SwDocDisplayItem* pOldAttr =
+ (const SwDocDisplayItem*)GetOldItem(GetItemSet(), FN_PARAM_DOCDISP);
- SwDocDisplayItem aDisp;
- if(pOldAttr)
- aDisp = *pOldAttr;
+ SwDocDisplayItem aDisp;
+ if(pOldAttr)
+ aDisp = *pOldAttr;
//
aDisp.bParagraphEnd = aParaCB .IsChecked();
aDisp.bTab = aTabCB .IsChecked();
@@ -1636,7 +1640,7 @@ sal_Bool SwShdwCrsrOptionsTabPage::FillI
aDisp.bManualBreak = aBreakCB .IsChecked();
bRet |= (!pOldAttr || aDisp != *pOldAttr);
- if(bRet)
+ if(bRet)
bRet = 0 != rSet.Put(aDisp);
return bRet;
@@ -1644,31 +1648,41 @@ sal_Bool SwShdwCrsrOptionsTabPage::FillI
void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet )
{
- const SfxPoolItem* pItem = 0;
+ const SfxPoolItem* pItem = 0;
SwShadowCursorItem aOpt;
- if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem ))
- aOpt = *(SwShadowCursorItem*)pItem;
- aOnOffCB.Check( aOpt.IsOn() );
-
- sal_uInt8 eMode = aOpt.GetMode();
- aFillIndentRB.Check( FILL_INDENT == eMode );
- aFillMarginRB.Check( FILL_MARGIN == eMode );
- aFillTabRB.Check( FILL_TAB == eMode );
- aFillSpaceRB.Check( FILL_SPACE == eMode );
-
- m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) );
- m_aMathBaselineAlignmentCB.SaveValue();
-
- if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, sal_False, &pItem ))
- aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue());
- aCrsrInProtCB.SaveValue();
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, sal_False, &pItem ))
+ {
+ aOpt = *(SwShadowCursorItem*)pItem;
+ }
+ aOnOffCB.Check( aOpt.IsOn() );
+
+ sal_uInt8 eMode = aOpt.GetMode();
+ aFillIndentRB.Check( FILL_INDENT == eMode );
+ aFillMarginRB.Check( FILL_MARGIN == eMode );
+ aFillTabRB.Check( FILL_TAB == eMode );
+ aFillSpaceRB.Check( FILL_SPACE == eMode );
+
+ if ( m_pWrtShell )
+ {
+ m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) );
+ m_aMathBaselineAlignmentCB.SaveValue();
+ }
+ else
+ {
+ m_aMathBaselineAlignmentCB.Disable();
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, sal_False, &pItem ))
+ {
+ aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+ }
+ aCrsrInProtCB.SaveValue();
const SwDocDisplayItem* pDocDisplayAttr = 0;
- rSet.GetItemState( FN_PARAM_DOCDISP, sal_False,
- (const SfxPoolItem**)&pDocDisplayAttr );
- if(pDocDisplayAttr)
+ rSet.GetItemState( FN_PARAM_DOCDISP, sal_False, (const SfxPoolItem**)&pDocDisplayAttr );
+ if(pDocDisplayAttr)
{
aParaCB .Check (pDocDisplayAttr->bParagraphEnd );
aTabCB .Check (pDocDisplayAttr->bTab );
Modified: openoffice/branches/ia2/main/sw/source/ui/uno/unotxdoc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/ui/uno/unotxdoc.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/ui/uno/unotxdoc.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/ui/uno/unotxdoc.cxx Mon Nov 4 05:32:01 2013
@@ -2666,6 +2666,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getR
if(!IsValid())
throw RuntimeException();
+ CleanUpRenderingData();
+
const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
bool bIsSwSrcView = false;
SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
@@ -2677,20 +2679,6 @@ sal_Int32 SAL_CALL SwXTextDocument::getR
return 0;
}
- // clean up <RenderData> and <PrintUIOptions>
- {
- if ( m_pRenderData )
- {
- delete m_pRenderData;
- m_pRenderData = 0;
- }
- if ( m_pPrintUIOptions )
- {
- delete m_pPrintUIOptions;
- m_pPrintUIOptions = 0;
- }
- }
-
if ( !bIsSwSrcView )
{
m_pRenderData = new SwRenderData;
@@ -3067,8 +3055,7 @@ SfxViewShell * SwXTextDocument::GuessVie
SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, sal_False );
// look for the view shell with the same controller in use,
- // otherwise look for a suitable view, preferably a SwView,
- // if that one is not found use a SwPagePreView if found.
+ // otherwise look for a suitable view
while (pFrame)
{
pView = pFrame->GetViewShell();
@@ -3081,7 +3068,7 @@ SfxViewShell * SwXTextDocument::GuessVie
if (pView && pView->GetController() == xController)
break;
}
- else if (pSwView || pSwSrcView)
+ else if ( pSwView || pSwSrcView || pSwPagePreView )
break;
pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, sal_False );
}
Modified: openoffice/branches/ia2/main/tools/source/generic/toolsin.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/tools/source/generic/toolsin.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/tools/source/generic/toolsin.cxx (original)
+++ openoffice/branches/ia2/main/tools/source/generic/toolsin.cxx Mon Nov 4 05:32:01 2013
@@ -31,7 +31,7 @@
#include <tools/debug.hxx>
#include <toolsin.hxx>
-#if defined WNT || defined OS2
+#if defined WNT
#include <dll.hxx>
#endif
Modified: openoffice/branches/ia2/main/vcl/os2/source/gdi/salgdi3.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/vcl/os2/source/gdi/salgdi3.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/vcl/os2/source/gdi/salgdi3.cxx (original)
+++ openoffice/branches/ia2/main/vcl/os2/source/gdi/salgdi3.cxx Mon Nov 4 05:32:01 2013
@@ -837,7 +837,7 @@ USHORT Os2SalGraphics::SetFont( ImplFont
return 0;
}
-#if OSL_DEBUG_LEVEL>1
+#if OSL_DEBUG_LEVEL>10
debug_printf( "Os2SalGraphics::SetFont\n");
#endif
Modified: openoffice/branches/ia2/main/vcl/source/fontsubset/sft.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/vcl/source/fontsubset/sft.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/vcl/source/fontsubset/sft.cxx (original)
+++ openoffice/branches/ia2/main/vcl/source/fontsubset/sft.cxx Mon Nov 4 05:32:01 2013
@@ -799,7 +799,10 @@ static int GetCompoundTTOutline(TrueType
} while (flags & MORE_COMPONENTS);
-
+ // #i123417# some fonts like IFAOGrec have no outline points in some compound glyphs
+ // so this unlikely but possible scenario should be handled gracefully
+ if( myPoints.empty() )
+ return 0;
np = myPoints.size();
@@ -2787,7 +2790,7 @@ GlyphData *GetTTRawGlyphData(TrueTypeFon
/* now calculate npoints and ncontours */
ControlPoint *cp;
n = GetTTGlyphPoints(ttf, glyphID, &cp);
- if (n != -1) {
+ if( n > 0) {
m = 0;
for (i = 0; i < n; i++) {
if (cp[i].flags & 0x8000) m++;
Modified: openoffice/branches/ia2/main/vcl/win/source/gdi/salbmp.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/vcl/win/source/gdi/salbmp.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/vcl/win/source/gdi/salbmp.cxx (original)
+++ openoffice/branches/ia2/main/vcl/win/source/gdi/salbmp.cxx Mon Nov 4 05:32:01 2013
@@ -333,6 +333,9 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreat
if(pExtraRGB)
{
+ // #123478# shockingly, BitmapBuffer does not free the memory it is controlling
+ // in it's destructor, this *has to be done handish*. Doing it here now
+ delete[] pExtraRGB->mpBits;
delete pExtraRGB;
}
else
@@ -471,6 +474,9 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreat
if(pExtraA)
{
+ // #123478# shockingly, BitmapBuffer does not free the memory it is controlling
+ // in it's destructor, this *has to be done handish*. Doing it here now
+ delete[] pExtraA->mpBits;
delete pExtraA;
}
else
@@ -485,6 +491,9 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreat
if(pExtraRGB)
{
+ // #123478# shockingly, BitmapBuffer does not free the memory it is controlling
+ // in it's destructor, this *has to be done handish*. Doing it here now
+ delete[] pExtraRGB->mpBits;
delete pExtraRGB;
}
else
Modified: openoffice/branches/ia2/main/xmloff/inc/xexptran.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/xmloff/inc/xexptran.hxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/xmloff/inc/xexptran.hxx (original)
+++ openoffice/branches/ia2/main/xmloff/inc/xexptran.hxx Mon Nov 4 05:32:01 2013
@@ -115,83 +115,22 @@ public:
class SdXMLImExViewBox
{
- rtl::OUString msString;
- sal_Int32 mnX;
- sal_Int32 mnY;
- sal_Int32 mnW;
- sal_Int32 mnH;
+ rtl::OUString msString;
+ double mfX;
+ double mfY;
+ double mfW;
+ double mfH;
public:
- SdXMLImExViewBox(sal_Int32 nX = 0L, sal_Int32 nY = 0L, sal_Int32 nW = 1000L, sal_Int32 nH = 1000L);
- SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
+ SdXMLImExViewBox(double fX = 0.0, double fY = 0.0, double fW = 1000.0, double fH = 1000.0);
+ SdXMLImExViewBox(const rtl::OUString& rNew, const SvXMLUnitConverter& rConv);
- sal_Int32 GetX() const { return mnX; }
- sal_Int32 GetY() const { return mnY; }
- sal_Int32 GetWidth() const { return mnW; }
- sal_Int32 GetHeight() const { return mnH; }
- const rtl::OUString& GetExportString();
+ double GetX() const { return mfX; }
+ double GetY() const { return mfY; }
+ double GetWidth() const { return mfW; }
+ double GetHeight() const { return mfH; }
+ const rtl::OUString& GetExportString();
};
-//////////////////////////////////////////////////////////////////////////////
-
-class SdXMLImExPointsElement
-{
- rtl::OUString msString;
- com::sun::star::drawing::PointSequenceSequence maPoly;
-
-public:
- SdXMLImExPointsElement(com::sun::star::drawing::PointSequence* pPoints,
- const SdXMLImExViewBox& rViewBox,
- const com::sun::star::awt::Point& rObjectPos,
- const com::sun::star::awt::Size& rObjectSize,
- // #96328#
- const bool bClosed = true);
- SdXMLImExPointsElement(const rtl::OUString& rNew,
- const SdXMLImExViewBox& rViewBox,
- const com::sun::star::awt::Point& rObjectPos,
- const com::sun::star::awt::Size& rObjectSize,
- const SvXMLUnitConverter& rConv);
-
- const rtl::OUString& GetExportString() const { return msString; }
- const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-class SdXMLImExSvgDElement
-{
- rtl::OUString msString;
- const SdXMLImExViewBox& mrViewBox;
- bool mbIsClosed;
- bool mbIsCurve;
-
- sal_Int32 mnLastX;
- sal_Int32 mnLastY;
-
- com::sun::star::drawing::PointSequenceSequence maPoly;
- com::sun::star::drawing::FlagSequenceSequence maFlag;
-
-public:
- SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox);
- SdXMLImExSvgDElement(const rtl::OUString& rNew,
- const SdXMLImExViewBox& rViewBox,
- const com::sun::star::awt::Point& rObjectPos,
- const com::sun::star::awt::Size& rObjectSize,
- const SvXMLUnitConverter& rConv);
-
- void AddPolygon(
- com::sun::star::drawing::PointSequence* pPoints,
- com::sun::star::drawing::FlagSequence* pFlags,
- const com::sun::star::awt::Point& rObjectPos,
- const com::sun::star::awt::Size& rObjectSize,
- bool bClosed = false, bool bRelative = true);
-
- const rtl::OUString& GetExportString() const { return msString; }
- bool IsClosed() const { return mbIsClosed; }
- bool IsCurve() const { return mbIsCurve; }
- const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; }
- const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maFlag; }
-};
-
-
#endif // _XEXPTRANSFORM_HXX
+// eof
Modified: openoffice/branches/ia2/main/xmloff/source/draw/XMLImageMapContext.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/xmloff/source/draw/XMLImageMapContext.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/xmloff/source/draw/XMLImageMapContext.cxx (original)
+++ openoffice/branches/ia2/main/xmloff/source/draw/XMLImageMapContext.cxx Mon Nov 4 05:32:01 2013
@@ -19,25 +19,18 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
#include "XMLImageMapContext.hxx"
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/beans/XPropertySet.hpp>
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP
#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#endif
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/drawing/PointSequenceSequence.hpp>
-
-#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
#include <com/sun/star/document/XEventsSupplier.hpp>
-#endif
#include <com/sun/star/awt/Rectangle.hpp>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlimp.hxx>
@@ -50,7 +43,8 @@
#include <xmloff/XMLEventsImportContext.hxx>
#include "XMLStringBufferImportContext.hxx"
#include <tools/debug.hxx>
-
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
using namespace ::com::sun::star;
using namespace ::xmloff::token;
@@ -506,33 +500,30 @@ void XMLImageMapPolygonContext::ProcessA
bValid = bViewBoxOK && bPointsOK;
}
-void XMLImageMapPolygonContext::Prepare(
- Reference<XPropertySet> & rPropertySet)
+void XMLImageMapPolygonContext::Prepare(Reference<XPropertySet> & rPropertySet)
{
- // process view box
- SdXMLImExViewBox aViewBox(sViewBoxString,
- GetImport().GetMM100UnitConverter());
-
- // get polygon sequence
- awt::Point aPoint(aViewBox.GetX(), aViewBox.GetY());
- awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight());
- SdXMLImExPointsElement aPoints( sPointsString, aViewBox, aPoint, aSize,
- GetImport().GetMM100UnitConverter() );
- PointSequenceSequence aPointSeqSeq = aPoints.GetPointSequenceSequence();
-
- // only use first element of sequence-sequence
- if (aPointSeqSeq.getLength() > 0)
- {
- Any aAny;
- aAny <<= aPointSeqSeq[0];
- rPropertySet->setPropertyValue(sPolygon, aAny);
- }
+ // process view box
+ SdXMLImExViewBox aViewBox(sViewBoxString, GetImport().GetMM100UnitConverter());
- // parent properties
- XMLImageMapObjectContext::Prepare(rPropertySet);
-}
+ // get polygon sequence
+ basegfx::B2DPolygon aPolygon;
+ if(basegfx::tools::importFromSvgPoints(aPolygon, sPointsString))
+ {
+ if(aPolygon.count())
+ {
+ com::sun::star::drawing::PointSequence aPointSequence;
+ uno::Any aAny;
+
+ basegfx::tools::B2DPolygonToUnoPointSequence(aPolygon, aPointSequence);
+ aAny <<= aPointSequence;
+ rPropertySet->setPropertyValue(sPolygon, aAny);
+ }
+ }
+ // parent properties
+ XMLImageMapObjectContext::Prepare(rPropertySet);
+}
class XMLImageMapCircleContext : public XMLImageMapObjectContext
{
Modified: openoffice/branches/ia2/main/xmloff/source/draw/XMLImageMapExport.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/xmloff/source/draw/XMLImageMapExport.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/xmloff/source/draw/XMLImageMapExport.cxx (original)
+++ openoffice/branches/ia2/main/xmloff/source/draw/XMLImageMapExport.cxx Mon Nov 4 05:32:01 2013
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
#include "XMLImageMapExport.hxx"
@@ -32,10 +30,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
-
-#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
#include <com/sun/star/document/XEventsSupplier.hpp>
-#endif
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
@@ -46,8 +41,8 @@
#include <xmloff/XMLEventExport.hxx>
#include <xmloff/xmluconv.hxx>
#include "xexptran.hxx"
-
-
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
using namespace ::com::sun::star;
using namespace ::xmloff::token;
@@ -322,61 +317,43 @@ void XMLImageMapExport::ExportCircle(
aBuffer.makeStringAndClear() );
}
-void XMLImageMapExport::ExportPolygon(
- const Reference<XPropertySet> & rPropertySet)
+void XMLImageMapExport::ExportPolygon(const Reference<XPropertySet> & rPropertySet)
{
- // polygons get exported as bounding box, viewbox, and coordinate
- // pair sequence. The bounding box is always the entire image.
-
- // get polygon point sequence
- Any aAny = rPropertySet->getPropertyValue(msPolygon);
- PointSequence aPoly;
- aAny >>= aPoly;
-
- // get bounding box (assume top-left to be 0,0)
- sal_Int32 nWidth = 0;
- sal_Int32 nHeight = 0;
- sal_Int32 nLength = aPoly.getLength();
- const struct awt::Point* pPointPtr = aPoly.getConstArray();
- for ( sal_Int32 i = 0; i < nLength; i++ )
- {
- sal_Int32 nPolyX = pPointPtr->X;
- sal_Int32 nPolyY = pPointPtr->Y;
-
- if ( nPolyX > nWidth )
- nWidth = nPolyX;
- if ( nPolyY > nHeight )
- nHeight = nPolyY;
-
- pPointPtr++;
- }
- DBG_ASSERT(nWidth > 0, "impossible Polygon found");
- DBG_ASSERT(nHeight > 0, "impossible Polygon found");
+ // polygons get exported as bounding box, viewbox, and coordinate
+ // pair sequence. The bounding box is always the entire image.
- // parameters svg:x, svg:y, svg:width, svg:height
- OUStringBuffer aBuffer;
- mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
- mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X,
- aBuffer.makeStringAndClear() );
- mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
- mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y,
- aBuffer.makeStringAndClear() );
- mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nWidth);
- mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH,
- aBuffer.makeStringAndClear() );
- mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, nHeight);
- mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT,
- aBuffer.makeStringAndClear() );
+ // get polygon point sequence
+ Any aAny = rPropertySet->getPropertyValue(msPolygon);
+ PointSequence aPoly;
+ aAny >>= aPoly;
+
+ const basegfx::B2DPolygon aPolygon(
+ basegfx::tools::UnoPointSequenceToB2DPolygon(
+ aPoly));
+ const basegfx::B2DRange aPolygonRange(aPolygon.getB2DRange());
+
+ // parameters svg:x, svg:y, svg:width, svg:height
+ OUStringBuffer aBuffer;
+
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_X, aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, 0);
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, basegfx::fround(aPolygonRange.getWidth()));
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, aBuffer.makeStringAndClear() );
+ mrExport.GetMM100UnitConverter().convertMeasure(aBuffer, basegfx::fround(aPolygonRange.getHeight()));
+ mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, aBuffer.makeStringAndClear() );
+
+ // svg:viewbox
+ SdXMLImExViewBox aViewBox(0.0, 0.0, aPolygonRange.getWidth(), aPolygonRange.getHeight());
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
+
+ // export point sequence
+ const ::rtl::OUString aPointString(
+ basegfx::tools::exportToSvgPoints(
+ aPolygon));
- // svg:viewbox
- SdXMLImExViewBox aViewBox(0, 0, nWidth, nHeight);
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
- aViewBox.GetExportString());
-
- // export point sequence
- awt::Point aPoint(0, 0);
- awt::Size aSize(nWidth, nHeight);
- SdXMLImExPointsElement aPoints( &aPoly, aViewBox, aPoint, aSize );
- mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_POINTS,
- aPoints.GetExportString());
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
}
+
+// eof
Modified: openoffice/branches/ia2/main/xmloff/source/draw/shapeexport2.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/xmloff/source/draw/shapeexport2.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/xmloff/source/draw/shapeexport2.cxx (original)
+++ openoffice/branches/ia2/main/xmloff/source/draw/shapeexport2.cxx Mon Nov 4 05:32:01 2013
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
#include "unointerfacetouniqueidentifiermapper.hxx"
@@ -35,10 +33,7 @@
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <com/sun/star/media/ZoomLevel.hpp>
#include "anim.hxx"
-
-#ifndef _XMLOFF_SHAPEEXPORT_HXX
#include <xmloff/shapeexport.hxx>
-#endif
#include "sdpropls.hxx"
#include <tools/debug.hxx>
#include <tools/urlobj.hxx>
@@ -50,10 +45,14 @@
#include <tools/gen.hxx> // FRound
#include <xmloff/xmltoken.hxx>
#include <xmloff/nmspmap.hxx>
-
#include "xmloff/xmlnmspe.hxx"
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -955,27 +954,27 @@ void XMLShapeExport::ImpExportEllipseSha
sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
- if(bCircle)
- {
- // write circle
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CIRCLE, bCreateNewline, sal_True);
+ // prepare name (with most used)
+ enum ::xmloff::token::XMLTokenEnum eName(XML_CIRCLE);
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportText( xShape );
- }
- else
- {
- // write ellipse
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_ELLIPSE, bCreateNewline, sal_True);
+ if(bCircle)
+ {
+ // name already set
+ }
+ else
+ {
+ // set name
+ eName = XML_ELLIPSE;
+ }
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportText( xShape );
- }
- }
+ // write ellipse or circle
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, eName, bCreateNewline, sal_True);
+
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -1014,116 +1013,79 @@ void XMLShapeExport::ImpExportPolygonSha
sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
- if(bBezier)
- {
- // get PolygonBezier
- uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
- drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
- (drawing::PolyPolygonBezierCoords*)aAny.getValue();
-
- if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
- {
- sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
- drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
- drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray();
-
- if(pOuterSequence && pOuterFlags)
- {
- // prepare svx:d element export
- SdXMLImExSvgDElement aSvgDElement(aViewBox);
-
- for(sal_Int32 a(0L); a < nOuterCnt; a++)
- {
- drawing::PointSequence* pSequence = pOuterSequence++;
- drawing::FlagSequence* pFlags = pOuterFlags++;
-
- if(pSequence && pFlags)
- {
- aSvgDElement.AddPolygon(pSequence, pFlags,
- aPoint, aSize, bClosed);
- }
- }
-
- // write point array
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
- }
-
- // write object now
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
+ // prepare name (with most used)
+ enum ::xmloff::token::XMLTokenEnum eName(XML_PATH);
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportText( xShape );
- }
- }
- else
- {
- // get non-bezier polygon
- uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
- drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
+ if(bBezier)
+ {
+ // get PolygonBezier
+ uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
+ const basegfx::B2DPolyPolygon aPolyPolygon(
+ basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*(drawing::PolyPolygonBezierCoords*)aAny.getValue()));
- if(pSourcePolyPolygon && pSourcePolyPolygon->getLength())
- {
- sal_Int32 nOuterCnt(pSourcePolyPolygon->getLength());
+ if(aPolyPolygon.count())
+ {
+ // complex polygon shape, write as svg:d
+ const ::rtl::OUString aPolygonString(
+ basegfx::tools::exportToSvgD(
+ aPolyPolygon,
+ true, // bUseRelativeCoordinates
+ false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
+ true)); // bHandleRelativeNextPointCompatible
- if(1L == nOuterCnt && !bBezier)
- {
- // simple polygon shape, can be written as svg:points sequence
- drawing::PointSequence* pSequence = pSourcePolyPolygon->getArray();
- if(pSequence)
- {
- SdXMLImExPointsElement aPoints(pSequence, aViewBox, aPoint, aSize,
- // #96328#
- bClosed);
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+ }
+ }
+ else
+ {
+ // get non-bezier polygon
+ uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
+ const basegfx::B2DPolyPolygon aPolyPolygon(
+ basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(*(drawing::PointSequenceSequence*)aAny.getValue()));
- // write point array
- mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPoints.GetExportString());
- }
+ if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
+ {
+ // simple polygon shape, can be written as svg:points sequence
+ const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
+ const ::rtl::OUString aPointString(basegfx::tools::exportToSvgPoints(aPolygon));
- // write object now
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW,
- bClosed ? XML_POLYGON : XML_POLYLINE , bCreateNewline, sal_True);
-
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportText( xShape );
- }
- else
- {
- // polypolygon or bezier, needs to be written as a svg:path sequence
- drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
- if(pOuterSequence)
- {
- // prepare svx:d element export
- SdXMLImExSvgDElement aSvgDElement(aViewBox);
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
- for(sal_Int32 a(0L); a < nOuterCnt; a++)
- {
- drawing::PointSequence* pSequence = pOuterSequence++;
- if(pSequence)
- {
- aSvgDElement.AddPolygon(pSequence, 0L, aPoint,
- aSize, bClosed);
- }
- }
+ // set name
+ eName = aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE;
+ }
+ else
+ {
+ // complex polygon shape, write as svg:d
+ const ::rtl::OUString aPolygonString(
+ basegfx::tools::exportToSvgD(
+ aPolyPolygon,
+ true, // bUseRelativeCoordinates
+ false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
+ true)); // bHandleRelativeNextPointCompatible
- // write point array
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
- }
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+ }
+ }
- // write object now
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True);
+ // write object, but after attributes are added since this call will
+ // consume all of these added attributes and the destructor will close the
+ // scope. Also before text is added; this may add sub-scopes as needed
+ SvXMLElementExport aOBJ(
+ mrExport,
+ XML_NAMESPACE_DRAW,
+ eName,
+ bCreateNewline,
+ sal_True);
- ImpExportDescription( xShape ); // #i68101#
- ImpExportEvents( xShape );
- ImpExportGluePoints( xShape );
- ImpExportText( xShape );
- }
- }
- }
- }
+ ImpExportDescription( xShape ); // #i68101#
+ ImpExportEvents( xShape );
+ ImpExportGluePoints( xShape );
+ ImpExportText( xShape );
+ }
}
//////////////////////////////////////////////////////////////////////////////
@@ -1463,43 +1425,27 @@ void XMLShapeExport::ImpExportConnectorS
}
}
- if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny )
- {
- // get PolygonBezier
- drawing::PolyPolygonBezierCoords* pSourcePolyPolygon =
- (drawing::PolyPolygonBezierCoords*)aAny.getValue();
-
- if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
- {
- sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength());
- drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray();
- drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray();
-
- if(pOuterSequence && pOuterFlags)
- {
- // prepare svx:d element export
- awt::Point aPoint( 0, 0 );
- awt::Size aSize( 1, 1 );
- SdXMLImExViewBox aViewBox( 0, 0, 1, 1 );
- SdXMLImExSvgDElement aSvgDElement(aViewBox);
-
- for(sal_Int32 a(0L); a < nOuterCnt; a++)
- {
- drawing::PointSequence* pSequence = pOuterSequence++;
- drawing::FlagSequence* pFlags = pOuterFlags++;
+ if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny )
+ {
+ // get PolygonBezier
+ drawing::PolyPolygonBezierCoords* pSourcePolyPolygon = (drawing::PolyPolygonBezierCoords*)aAny.getValue();
- if(pSequence && pFlags)
- {
- aSvgDElement.AddPolygon(pSequence, pFlags,
- aPoint, aSize, sal_False );
- }
- }
+ if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
+ {
+ const basegfx::B2DPolyPolygon aPolyPolygon(
+ basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
+ *pSourcePolyPolygon));
+ const ::rtl::OUString aPolygonString(
+ basegfx::tools::exportToSvgD(
+ aPolyPolygon,
+ true, // bUseRelativeCoordinates
+ false, // bDetectQuadraticBeziers: not used in old, but maybe activated now
+ true)); // bHandleRelativeNextPointCompatible
- // write point array
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
- }
- }
- }
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
+ }
+ }
// write connector shape. Add Export later.
sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
Modified: openoffice/branches/ia2/main/xmloff/source/draw/shapeexport3.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/xmloff/source/draw/shapeexport3.cxx?rev=1538508&r1=1538507&r2=1538508&view=diff
==============================================================================
--- openoffice/branches/ia2/main/xmloff/source/draw/shapeexport3.cxx (original)
+++ openoffice/branches/ia2/main/xmloff/source/draw/shapeexport3.cxx Mon Nov 4 05:32:01 2013
@@ -19,10 +19,9 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmloff.hxx"
+
#include <com/sun/star/drawing/HomogenMatrix.hpp>
#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
#include <com/sun/star/drawing/ProjectionMode.hpp>
@@ -32,10 +31,7 @@
#include <com/sun/star/drawing/CameraGeometry.hpp>
#include <com/sun/star/drawing/DoubleSequence.hpp>
#include <tools/gen.hxx>
-
-#ifndef _XMLOFF_SHAPEEXPORT_HXX
#include <xmloff/shapeexport.hxx>
-#endif
#include "sdpropls.hxx"
#include <tools/debug.hxx>
#include <rtl/ustrbuf.hxx>
@@ -44,8 +40,12 @@
#include "xexptran.hxx"
#include <xmloff/xmltoken.hxx>
#include <basegfx/vector/b3dvector.hxx>
-
-#include "xmloff/xmlnmspe.hxx"
+#include <xmloff/xmlnmspe.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/polygon/b3dpolypolygontools.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -124,9 +124,6 @@ void XMLShapeExport::ImpExport3DShape(
{
case XmlShapeTypeDraw3DCubeObject:
{
- // write 3DCube shape
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_CUBE, sal_True, sal_True);
-
// minEdge
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
drawing::Position3D aPosition3D;
@@ -158,13 +155,15 @@ void XMLShapeExport::ImpExport3DShape(
mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_MAX_EDGE, aStr);
}
- break;
+ // write 3DCube shape
+ // #123542# Do this *after* the attributes are added, else these will be lost since opening
+ // the scope will clear the global attribute list at the exporter
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_CUBE, sal_True, sal_True);
+
+ break;
}
case XmlShapeTypeDraw3DSphereObject:
{
- // write 3DSphere shape
- SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_SPHERE, sal_True, sal_True);
-
// Center
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")));
drawing::Position3D aPosition3D;
@@ -193,109 +192,55 @@ void XMLShapeExport::ImpExport3DShape(
mrExport.AddAttribute(XML_NAMESPACE_DR3D, XML_SIZE, aStr);
}
+ // write 3DSphere shape
+ // #123542# Do this *after* the attributes are added, else these will be lost since opening
+ // the scope will clear the global attribute list at the exporter
+ SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DR3D, XML_SPHERE, sal_True, sal_True);
+
break;
}
case XmlShapeTypeDraw3DLatheObject:
case XmlShapeTypeDraw3DExtrudeObject:
{
- // write special 3DLathe/3DExtrude attributes
- aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D")));
- drawing::PolyPolygonShape3D xPolyPolygon3D;
- aAny >>= xPolyPolygon3D;
-
- // look for maximal values
- double fXMin = 0;
- double fXMax = 0;
- double fYMin = 0;
- double fYMax = 0;
- sal_Bool bInit(sal_False);
- sal_Int32 nOuterSequenceCount(xPolyPolygon3D.SequenceX.getLength());
- drawing::DoubleSequence* pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
- drawing::DoubleSequence* pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
-
- sal_Int32 a;
- for (a = 0; a < nOuterSequenceCount; a++)
- {
- sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
- double* pArrayX = pInnerSequenceX->getArray();
- double* pArrayY = pInnerSequenceY->getArray();
-
- for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
- {
- double fX = *pArrayX++;
- double fY = *pArrayY++;
-
- if(bInit)
- {
- if(fX > fXMax)
- fXMax = fX;
-
- if(fX < fXMin)
- fXMin = fX;
-
- if(fY > fYMax)
- fYMax = fY;
-
- if(fY < fYMin)
- fYMin = fY;
- }
- else
- {
- fXMin = fXMax = fX;
- fYMin = fYMax = fY;
- bInit = sal_True;
- }
- }
-
- pInnerSequenceX++;
- pInnerSequenceY++;
- }
-
- // export ViewBox
- awt::Point aMinPoint(FRound(fXMin), FRound(fYMin));
- awt::Size aMaxSize(FRound(fXMax) - aMinPoint.X, FRound(fYMax) - aMinPoint.Y);
- SdXMLImExViewBox aViewBox(
- aMinPoint.X, aMinPoint.Y, aMaxSize.Width, aMaxSize.Height);
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX,
- aViewBox.GetExportString());
-
- // prepare svx:d element export
- SdXMLImExSvgDElement aSvgDElement(aViewBox);
- pInnerSequenceX = xPolyPolygon3D.SequenceX.getArray();
- pInnerSequenceY = xPolyPolygon3D.SequenceY.getArray();
-
- for (a = 0; a < nOuterSequenceCount; a++)
- {
- sal_Int32 nInnerSequenceCount(pInnerSequenceX->getLength());
- double* pArrayX = pInnerSequenceX->getArray();
- double* pArrayY = pInnerSequenceY->getArray();
- drawing::PointSequence aPoly(nInnerSequenceCount);
- awt::Point* pInnerSequence = aPoly.getArray();
-
- for(sal_Int32 b(0L); b < nInnerSequenceCount; b++)
- {
- double fX = *pArrayX++;
- double fY = *pArrayY++;
-
- *pInnerSequence = awt::Point(FRound(fX), FRound(fY));
- pInnerSequence++;
- }
-
- // calculate closed flag
- awt::Point* pFirst = aPoly.getArray();
- awt::Point* pLast = pFirst + (nInnerSequenceCount - 1);
- sal_Bool bClosed = (pFirst->X == pLast->X && pFirst->Y == pLast->Y);
-
- aSvgDElement.AddPolygon(&aPoly, 0L, aMinPoint,
- aMaxSize, bClosed);
-
- // #80594# corrected error in PolyPolygon3D export for 3D XML
- pInnerSequenceX++;
- pInnerSequenceY++;
- }
+ // write special 3DLathe/3DExtrude attributes, get 3D PolyPolygon as drawing::PolyPolygonShape3D
+ aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPolyPolygon3D")));
+ drawing::PolyPolygonShape3D xPolyPolygon3D;
+ aAny >>= xPolyPolygon3D;
+
+ // convert to 3D PolyPolygon
+ const basegfx::B3DPolyPolygon aPolyPolygon3D(
+ basegfx::tools::UnoPolyPolygonShape3DToB3DPolyPolygon(
+ xPolyPolygon3D));
+
+ // convert to 2D PolyPolygon using identity 3D transformation (just grep X and Y)
+ const basegfx::B3DHomMatrix aB3DHomMatrixFor2DConversion;
+ const basegfx::B2DPolyPolygon aPolyPolygon(
+ basegfx::tools::createB2DPolyPolygonFromB3DPolyPolygon(
+ aPolyPolygon3D,
+ aB3DHomMatrixFor2DConversion));
+
+ // get 2D range of it
+ const basegfx::B2DRange aPolyPolygonRange(aPolyPolygon.getB2DRange());
+
+ // export ViewBox
+ SdXMLImExViewBox aViewBox(
+ aPolyPolygonRange.getMinX(),
+ aPolyPolygonRange.getMinY(),
+ aPolyPolygonRange.getWidth(),
+ aPolyPolygonRange.getHeight());
+
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
+
+ // prepare svg:d string
+ const ::rtl::OUString aPolygonString(
+ basegfx::tools::exportToSvgD(
+ aPolyPolygon,
+ true, // bUseRelativeCoordinates
+ false, // bDetectQuadraticBeziers TTTT: not used in old, but maybe activated now
+ true)); // bHandleRelativeNextPointCompatible
- // write point array
- mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString());
+ // write point array
+ mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
if(eShapeType == XmlShapeTypeDraw3DLatheObject)
{