[Libreoffice-commits] core.git: basic/source include/tools

2015-02-04 Thread Juan Picca
 basic/source/runtime/methods1.cxx |2 +-
 basic/source/runtime/runtime.cxx  |   26 +-
 basic/source/sbx/sbxvalue.cxx |   28 ++--
 include/tools/ref.hxx |2 ++
 4 files changed, 30 insertions(+), 28 deletions(-)

New commits:
commit 6e1d28efb3d314d553e970f197f19636ce4e0ded
Author: Juan Picca jumap...@gmail.com
Date:   Sun Feb 1 00:49:08 2015 -0200

fdo#39440: replace C-style cast's

* Add get() method to tools::SvRef

Change-Id: I3825852176c9c37f3ee21f4fd57328b1c7451951
Reviewed-on: https://gerrit.libreoffice.org/14268
Tested-by: Michael Stahl mst...@redhat.com
Reviewed-by: Michael Stahl mst...@redhat.com

diff --git a/basic/source/runtime/methods1.cxx 
b/basic/source/runtime/methods1.cxx
index 11c8bd6..a4376de 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1832,7 +1832,7 @@ RTLFUNC(Split)
 {
 SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
 xVar-PutString( vRet[i] );
-pArray-Put( (SbxVariable*)xVar, i );
+pArray-Put( xVar.get(), i );
 }
 
 // return array
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 0dea790..e87a109 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1278,7 +1278,7 @@ SbiForStack* SbiRuntime::FindForStackItemForCollection( 
class BasicCollection* p
 {
 for (SbiForStack *p = pForStk; p; p = p-pNext)
 {
-SbxVariable* pVar = p-refEnd.Is() ? (SbxVariable*)p-refEnd : NULL;
+SbxVariable* pVar = p-refEnd.Is() ? p-refEnd.get() : NULL;
 if( p-eForType == FOR_EACH_COLLECTION  pVar != NULL 
 PTR_CAST(BasicCollection,pVar) == pCollection )
 {
@@ -1713,7 +1713,7 @@ void SbiRuntime::StepPUT()
 // store on its own method (inside a function)?
 bool bFlagsChanged = false;
 SbxFlagBits n = SBX_NONE;
-if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
+if( refVar.get() == static_castSbxVariable*(pMeth) )
 {
 bFlagsChanged = true;
 n = refVar-GetFlags();
@@ -1865,13 +1865,13 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef refVal, 
SbxVariableRef refVar, b
 {
 bool bFlagsChanged = false;
 SbxFlagBits n = SBX_NONE;
-if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
+if( refVar.get() == static_castSbxVariable*(pMeth) )
 {
 bFlagsChanged = true;
 n = refVar-GetFlags();
 refVar-SetFlag( SBX_WRITE );
 }
-SbProcedureProperty* pProcProperty = 
PTR_CAST(SbProcedureProperty,(SbxVariable*)refVar);
+SbProcedureProperty* pProcProperty = PTR_CAST(SbProcedureProperty, 
refVar.get());
 if( pProcProperty )
 {
 pProcProperty-setSet( true );
@@ -1907,7 +1907,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef refVal, 
SbxVariableRef refVar, b
 SbxObject* pObj = NULL;
 
 
-pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
+pObj = PTR_CAST(SbxObject,refVar.get());
 
 // calling GetObject on a SbxEMPTY variable raises
 // object not set errors, make sure its an Object
@@ -2066,7 +2066,7 @@ void SbiRuntime::StepLSET()
 else
 {
 SbxFlagBits n = refVar-GetFlags();
-if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
+if( refVar.get() == static_castSbxVariable*(pMeth) )
 {
 refVar-SetFlag( SBX_WRITE );
 }
@@ -2102,7 +2102,7 @@ void SbiRuntime::StepRSET()
 else
 {
 SbxFlagBits n = refVar-GetFlags();
-if( (SbxVariable*) refVar == (SbxVariable*) pMeth )
+if( refVar.get() == static_castSbxVariable*(pMeth) )
 {
 refVar-SetFlag( SBX_WRITE );
 }
@@ -3103,7 +3103,7 @@ void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 )
 {
 Any aElem = p-xEnumeration-nextElement();
 SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
-unoToSbxValue( (SbxVariable*)xVar, aElem );
+unoToSbxValue( xVar.get(), aElem );
 (*pForStk-refVar) = *xVar;
 }
 else
@@ -3239,7 +3239,7 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef 
refVal,
 bool bOk = bDefault;
 
 SbxDataType t = refVal-GetType();
-SbxVariable* pVal = (SbxVariable*)refVal;
+SbxVariable* pVal = refVal.get();
 // we don't know the type of uno properties that are (maybevoid)
 if ( t == SbxEMPTY  refVal-ISA(SbUnoProperty) )
 {
@@ -3597,7 +3597,7 @@ SbxVariable* SbiRuntime::FindElement( SbxObject* pObj, 
sal_uInt32 nOp1, sal_uInt
 SbxVariableRef refTemp = pElem;
 
 // dissolve the notify while copying variable
-SbxVariable* pNew = new SbxVariable( *((SbxVariable*)pElem) );
+SbxVariable* pNew = new SbxVariable( *pElem

[Libreoffice-commits] core.git: include/oox oox/source sc/source

2015-02-02 Thread Juan Picca
 include/oox/export/utils.hxx|5 -
 oox/source/export/drawingml.cxx |   14 +++---
 oox/source/export/shapes.cxx|4 ++--
 sc/source/filter/excel/xeescher.cxx |4 ++--
 sc/source/filter/xcl97/xcl97rec.cxx |8 
 5 files changed, 15 insertions(+), 20 deletions(-)

New commits:
commit c32aa53a7df7af4ef23b8d235483eabb51463183
Author: Juan Picca jumap...@gmail.com
Date:   Sat Jan 31 21:24:42 2015 -0200

fdo#88826: replace MM100toEMU() by convertHmmToEmu()

Change-Id: I9ca79dfa0c214e3f58b7f45a78ad0877d4c7d10a
Reviewed-on: https://gerrit.libreoffice.org/14266
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx
index 2c4fcec..417e552 100644
--- a/include/oox/export/utils.hxx
+++ b/include/oox/export/utils.hxx
@@ -39,11 +39,6 @@ static inline sal_Int64 PPTtoEMU( sal_Int32 nPPT )
 return (sal_Int64)( (double)nPPT * 1587.5 );
 }
 
-static inline sal_Int64 MM100toEMU( sal_Int32 nMM100 )
-{
-return (sal_Int64)nMM100 * 360;
-}
-
 static inline sal_Int64 TwipsToEMU( sal_Int32 nTwips )
 {
 return sal_Int64( nTwips ) * 635;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 3c5c3f3..fcacb7a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -636,7 +636,7 @@ void DrawingML::WriteOutline( ReferenceXPropertySet 
rXPropSet )
 mpFS-startElementNS( XML_a, XML_ln,
   XML_cap, cap,
   XML_w, nLineWidth  1  nStyleLineWidth != 
nLineWidth ?
-  I64S( MM100toEMU( nLineWidth ) ) :NULL,
+  I64S( oox::drawingml::convertHmmToEmu( 
nLineWidth ) ) :NULL,
   FSEND );
 
 if( bColorSet )
@@ -1120,8 +1120,8 @@ void DrawingML::WriteTransformation( const Rectangle 
rRect,
 nTop = 0;
 }
 
-mpFS-singleElementNS( XML_a, XML_off, XML_x, IS( MM100toEMU( nLeft ) ), 
XML_y, IS( MM100toEMU( nTop ) ), FSEND );
-mpFS-singleElementNS( XML_a, XML_ext, XML_cx, IS( MM100toEMU( 
rRect.GetWidth() ) ), XML_cy, IS( MM100toEMU( rRect.GetHeight() ) ), FSEND );
+mpFS-singleElementNS( XML_a, XML_off, XML_x, IS( 
oox::drawingml::convertHmmToEmu( nLeft ) ), XML_y, IS( 
oox::drawingml::convertHmmToEmu( nTop ) ), FSEND );
+mpFS-singleElementNS( XML_a, XML_ext, XML_cx, IS( 
oox::drawingml::convertHmmToEmu( rRect.GetWidth() ) ), XML_cy, IS( 
oox::drawingml::convertHmmToEmu( rRect.GetHeight() ) ), FSEND );
 
 mpFS-endElementNS( nXmlNamespace, XML_xfrm );
 }
@@ -1924,10 +1924,10 @@ void DrawingML::WriteText( Reference XInterface  
rXIface, const OUString pres
 }
 mpFS-startElementNS( (nXmlNamespace ? nXmlNamespace : XML_a), 
XML_bodyPr,
XML_wrap, pWrap,
-   XML_lIns, (nLeft != DEFLRINS) ? IS( MM100toEMU( 
nLeft ) ) : NULL,
-   XML_rIns, (nRight != DEFLRINS) ? IS( 
MM100toEMU( nRight ) ) : NULL,
-   XML_tIns, (nTop != DEFTBINS) ? IS( MM100toEMU( 
nTop ) ) : NULL,
-   XML_bIns, (nBottom != DEFTBINS) ? IS( 
MM100toEMU( nBottom ) ) : NULL,
+   XML_lIns, (nLeft != DEFLRINS) ? IS( 
oox::drawingml::convertHmmToEmu( nLeft ) ) : NULL,
+   XML_rIns, (nRight != DEFLRINS) ? IS( 
oox::drawingml::convertHmmToEmu( nRight ) ) : NULL,
+   XML_tIns, (nTop != DEFTBINS) ? IS( 
oox::drawingml::convertHmmToEmu( nTop ) ) : NULL,
+   XML_bIns, (nBottom != DEFTBINS) ? IS( 
oox::drawingml::convertHmmToEmu( nBottom ) ) : NULL,
XML_anchor, sVerticalAlignment,
XML_anchorCtr, bHorizontalCenter ? 1 : NULL,
XML_vert, sWritingMode,
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 71968b9..a41ea2b 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -867,7 +867,7 @@ void ShapeExport::WriteTable( Reference XShape  rXShape  )
 sal_Int32 nWidth(0);
 xColPropSet-getPropertyValue( Width ) = nWidth;
 
-mpFS-singleElementNS( XML_a, XML_gridCol, XML_w, 
I64S(MM100toEMU(nWidth)), FSEND );
+mpFS-singleElementNS( XML_a, XML_gridCol, XML_w, 
I64S(oox::drawingml::convertHmmToEmu(nWidth)), FSEND );
 }
 
 mpFS-endElementNS( XML_a, XML_tblGrid );
@@ -879,7 +879,7 @@ void ShapeExport::WriteTable( Reference XShape  rXShape  )
 
 xRowPropSet-getPropertyValue( Height ) = nRowHeight;
 
-mpFS-startElementNS( XML_a, XML_tr, XML_h, I64S( MM100toEMU( 
nRowHeight ) ), FSEND );
+mpFS-startElementNS( XML_a, XML_tr, XML_h, I64S( 
oox::drawingml::convertHmmToEmu( nRowHeight

[Libreoffice-commits] core.git: basctl/source

2015-01-05 Thread Juan Picca
 basctl/source/basicide/baside2b.cxx |   19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 5573fd8cf991b62c405ec9a4b624ebaf28cb8894
Author: Juan Picca jumap...@gmail.com
Date:   Tue Dec 30 11:58:14 2014 -0200

fdo#39596: replace cstyle casts

Change-Id: I1a0814ec973b1dc0f4db4ee88a999d9ffc219e7a
Reviewed-on: https://gerrit.libreoffice.org/13701
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index 452bf87..1bd399e 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1762,7 +1762,7 @@ bool WatchWindow::RemoveSelectedWatch()
 aTreeListBox.GetModel()-Remove( pEntry );
 pEntry = aTreeListBox.GetCurEntry();
 if ( pEntry )
-aXEdit.SetText( ((WatchItem*)pEntry-GetUserData())-maName );
+aXEdit.SetText( 
static_castWatchItem*(pEntry-GetUserData())-maName );
 else
 aXEdit.SetText( OUString() );
 if ( !aTreeListBox.GetEntryCount() )
@@ -2117,7 +2117,7 @@ WatchTreeListBox::~WatchTreeListBox()
 SvTreeListEntry* pEntry = First();
 while ( pEntry )
 {
-delete (WatchItem*)pEntry-GetUserData();
+delete static_castWatchItem*(pEntry-GetUserData());
 pEntry = Next( pEntry );
 }
 }
@@ -2145,7 +2145,7 @@ void WatchTreeListBox::RequestingChildren( 
SvTreeListEntry * pParent )
 return;
 
 SvTreeListEntry* pEntry = pParent;
-WatchItem* pItem = (WatchItem*)pEntry-GetUserData();
+WatchItem* pItem = static_castWatchItem*(pEntry-GetUserData());
 
 SbxDimArray* pArray = pItem-mpArray;
 SbxDimArray* pRootArray = pItem-GetRootArray();
@@ -2232,11 +2232,11 @@ SbxBase* WatchTreeListBox::ImplGetSBXForEntry( 
SvTreeListEntry* pEntry, bool rb
 SbxBase* pSBX = NULL;
 rbArrayElement = false;
 
-WatchItem* pItem = (WatchItem*)pEntry-GetUserData();
+WatchItem* pItem = static_castWatchItem*(pEntry-GetUserData());
 OUString aVName( pItem-maName );
 
 SvTreeListEntry* pParentEntry = GetParent( pEntry );
-WatchItem* pParentItem = pParentEntry ? 
(WatchItem*)pParentEntry-GetUserData() : NULL;
+WatchItem* pParentItem = pParentEntry ? 
static_castWatchItem*(pParentEntry-GetUserData()) : NULL;
 if( pParentItem )
 {
 SbxObject* pObj = pParentItem-mpObject;
@@ -2269,7 +2269,7 @@ SbxBase* WatchTreeListBox::ImplGetSBXForEntry( 
SvTreeListEntry* pEntry, bool rb
 
 bool WatchTreeListBox::EditingEntry( SvTreeListEntry* pEntry, Selection )
 {
-WatchItem* pItem = (WatchItem*)pEntry-GetUserData();
+WatchItem* pItem = static_castWatchItem*(pEntry-GetUserData());
 
 bool bEdit = false;
 if ( StarBASIC::IsRunning()  StarBASIC::GetActiveMethod()  
!SbxBase::IsError() )
@@ -2348,7 +2348,7 @@ void implCollapseModifiedObjectEntry( SvTreeListEntry* 
pParent, WatchTreeListBox
 {
 implCollapseModifiedObjectEntry( pDeleteEntry, pThis );
 
-delete (WatchItem*)pDeleteEntry-GetUserData();
+delete static_castWatchItem*(pDeleteEntry-GetUserData());
 pModel-Remove( pDeleteEntry );
 }
 }
@@ -2409,7 +2409,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
 SvTreeListEntry* pEntry = First();
 while ( pEntry )
 {
-WatchItem* pItem = (WatchItem*)pEntry-GetUserData();
+WatchItem* pItem = static_castWatchItem*(pEntry-GetUserData());
 DBG_ASSERT( !pItem-maName.isEmpty(), Var? - Must not be empty! );
 OUString aWatchStr;
 OUString aTypeStr;
@@ -2504,10 +2504,9 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped 
)
 {
 if (SbxObject* pObj = 
dynamic_castSbxObject*(pVar-GetObject()))
 {
-// Check if member list has changed
-bool bObjChanged = false;
 if (pItem-mpObject  !pItem-maMemberList.empty())
 {
+bool bObjChanged = false; // Check if member list 
has changed
 SbxArray* pProps = pObj-GetProperties();
 sal_uInt16 nPropCount = pProps-Count();
 for( sal_uInt16 i = 0 ; i  nPropCount - 3 ; i++ )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/svx svx/source

2014-12-18 Thread Juan Picca
 include/svx/svdtrans.hxx   |   14 +
 svx/source/svdraw/svdtrans.cxx |   44 ++---
 2 files changed, 26 insertions(+), 32 deletions(-)

New commits:
commit 82aa4dbd8330eb446cdf535794c13185f0c0ca81
Author: Juan Picca jumap...@gmail.com
Date:   Mon Nov 3 22:33:52 2014 -0200

Fraction: rewrite 'GetDenominator()==0' conditions

Change-Id: Ie42972db98da48b60b3f5314e019046b2a2ee0e7
Reviewed-on: https://gerrit.libreoffice.org/12238
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
index 0dca975..f2e1591 100644
--- a/include/svx/svdtrans.hxx
+++ b/include/svx/svdtrans.hxx
@@ -104,10 +104,16 @@ void CrookStretchPoly(XPolyPolygon rPoly, const Point 
rCenter, const Point rR
 
 inline void ResizePoint(Point rPnt, const Point rRef, Fraction xFact, 
Fraction yFact)
 {
-if (xFact.GetDenominator()==0) xFact=Fraction(xFact.GetNumerator(),1); // 
DivZero abfangen
-if (yFact.GetDenominator()==0) yFact=Fraction(yFact.GetNumerator(),1); // 
DivZero abfangen
-rPnt.X()=rRef.X()+ 
Round(((double)(rPnt.X()-rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
-rPnt.Y()=rRef.Y()+ 
Round(((double)(rPnt.Y()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
+if (!xFact.IsValid()) {
+SAL_WARN( svx.svdraw, invalid fraction xFact, using Fraction(1,1) 
);
+xFact = Fraction(1,1);
+}
+if (!yFact.IsValid()) {
+SAL_WARN( svx.svdraw, invalid fraction yFact, using Fraction(1,1) 
);
+yFact = Fraction(1,1);
+}
+rPnt.X() = rRef.X() + Round( (rPnt.X() - rRef.X()) * double(xFact) );
+rPnt.Y() = rRef.Y() + Round( (rPnt.Y() - rRef.Y()) * double(yFact) );
 }
 
 inline void RotatePoint(Point rPnt, const Point rRef, double sn, double cs)
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index fea8637..4de3f70 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -37,36 +37,24 @@ void ResizeRect(Rectangle rRect, const Point rRef, const 
Fraction rxFact, con
 Fraction xFact(rxFact);
 Fraction yFact(ryFact);
 
-{
-if (xFact.GetDenominator()==0) {
-long nWdt=rRect.Right()-rRect.Left();
-if (xFact.GetNumerator()=0) { // catch divisions by zero
-xFact=Fraction(xFact.GetNumerator(),1);
-if (nWdt==0) rRect.Right()++;
-} else {
-xFact=Fraction(xFact.GetNumerator(),-1);
-if (nWdt==0) rRect.Left()--;
-}
-}
-rRect.Left()  =rRef.X()+Round(((double)(rRect.Left()  
-rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
-rRect.Right() =rRef.X()+Round(((double)(rRect.Right() 
-rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
+if (!xFact.IsValid()) {
+SAL_WARN( svx.svdraw, invalid fraction xFract, using Fraction(1,1) 
);
+xFact = Fraction(1,1);
+long nWdt = rRect.Right() - rRect.Left();
+if (nWdt == 0) rRect.Right()++;
 }
-{
-if (yFact.GetDenominator()==0) {
-long nHgt=rRect.Bottom()-rRect.Top();
-if (yFact.GetNumerator()=0) { // catch divisions by zero
-yFact=Fraction(yFact.GetNumerator(),1);
-if (nHgt==0) rRect.Bottom()++;
-} else {
-yFact=Fraction(yFact.GetNumerator(),-1);
-if (nHgt==0) rRect.Top()--;
-}
-
-yFact=Fraction(yFact.GetNumerator(),1); // catch divisions by zero
-}
-rRect.Top()   =rRef.Y()+Round(((double)(rRect.Top()   
-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
-
rRect.Bottom()=rRef.Y()+Round(((double)(rRect.Bottom()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
+rRect.Left()  = rRef.X() + Round( (rRect.Left()  - rRef.X()) * 
double(xFact) );
+rRect.Right() = rRef.X() + Round( (rRect.Right() - rRef.X()) * 
double(xFact) );
+
+if (!yFact.IsValid()) {
+SAL_WARN( svx.svdraw, invalid fraction yFract, using Fraction(1,1) 
);
+yFact = Fraction(1,1);
+long nHgt = rRect.Bottom() - rRect.Top();
+if (nHgt == 0) rRect.Bottom()++;
 }
+rRect.Top()= rRef.Y() + Round( (rRect.Top()- rRef.Y()) * 
double(yFact) );
+rRect.Bottom() = rRef.Y() + Round( (rRect.Bottom() - rRef.Y()) * 
double(yFact) );
+
 if (!bNoJustify) rRect.Justify();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sd/source sw/inc sw/source

2014-11-24 Thread Juan Picca
 sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx |   15 +-
 sw/inc/unocrsrhelper.hxx   |   10 ++-
 sw/source/core/access/accframe.cxx |   16 +--
 sw/source/core/access/accfrmobjmap.cxx |4 +-
 sw/source/core/access/accfrmobjmap.hxx |   24 ++---
 sw/source/core/access/acchypertextdata.cxx |2 -
 sw/source/core/access/acchypertextdata.hxx |   17 ++--
 sw/source/core/unocore/unocrsrhelper.cxx   |   22 +++
 8 files changed, 69 insertions(+), 41 deletions(-)

New commits:
commit ee42495de1279f9966dd2305966ab96711403463
Author: Juan Picca jumap...@gmail.com
Date:   Mon Nov 17 10:48:32 2014 -0200

fdo#75757: remove inheritance to std::map

Change-Id: I9dfabddf4b51994c1ae078582dec3f385e7d1a5c
Reviewed-on: https://gerrit.libreoffice.org/12513
Reviewed-by: Takeshi Abe t...@fixedpoint.jp
Tested-by: Takeshi Abe t...@fixedpoint.jp

diff --git a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx 
b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx
index 23abe79..feb4f02 100644
--- a/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsPageCacheManager.cxx
@@ -135,10 +135,21 @@ public:
 /** The recently used caches are stored in one queue for each document.
 */
 class PageCacheManager::RecentlyUsedPageCaches
-: public ::std::mapDocumentKey,RecentlyUsedQueue
 {
 public:
-RecentlyUsedPageCaches (void) {};
+typedef DocumentKey key_type;
+typedef RecentlyUsedQueue   mapped_type;
+typedef std::pairconst key_type,mapped_type   value_type;
+typedef std::mapkey_type,mapped_type::iteratoriterator;
+private:
+std::mapkey_type,mapped_type maMap;
+public:
+RecentlyUsedPageCaches () {};
+
+iterator end() { return maMap.end(); }
+void clear() { maMap.clear(); }
+iterator find(const key_type key) { return maMap.find(key); }
+std::pairiterator,bool insert(const value_type value) { return 
maMap.insert(value); }
 };
 
 class PageCacheManager::Deleter
diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx
index ade29a1..f5949dd 100644
--- a/sw/inc/unocrsrhelper.hxx
+++ b/sw/inc/unocrsrhelper.hxx
@@ -19,7 +19,7 @@
 #ifndef INCLUDED_SW_INC_UNOCRSRHELPER_HXX
 #define INCLUDED_SW_INC_UNOCRSRHELPER_HXX
 
-#include map
+#include boost/ptr_container/ptr_map.hpp
 
 #include com/sun/star/beans/XPropertyState.hpp
 #include com/sun/star/beans/XPropertySet.hpp
@@ -66,13 +66,11 @@ enum SwGetPropertyStatesCaller
 
 namespace SwUnoCursorHelper
 {
-//  keep Any's mapped by (WhichId  16 ) + (MemberId)
-typedef std::map sal_uInt32, com::sun::star::uno::Any * AnyMapHelper_t;
-class SwAnyMapHelper : public AnyMapHelper_t
+class SwAnyMapHelper
 {
+//  keep Any's mapped by (WhichId  16 ) + (MemberId)
+boost::ptr_mapsal_uInt32,com::sun::star::uno::Any maMap;
 public:
-~SwAnyMapHelper();
-
 voidSetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const 
com::sun::star::uno::Any rAny );
 boolFillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, 
const com::sun::star::uno::Any* pAny );
 };
diff --git a/sw/source/core/access/accframe.cxx 
b/sw/source/core/access/accframe.cxx
index e292df9..9a34ec7 100644
--- a/sw/source/core/access/accframe.cxx
+++ b/sw/source/core/access/accframe.cxx
@@ -89,8 +89,8 @@ SwAccessibleChild SwAccessibleFrame::GetChild(
 {
 // We need a sorted list here
 const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
-SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
-while( aIter != aVisMap.end()  !aRet.IsValid() )
+SwAccessibleChildMap::const_iterator aIter( aVisMap.cbegin() );
+while( aIter != aVisMap.cend()  !aRet.IsValid() )
 {
 const SwAccessibleChild rLower = (*aIter).second;
 if( rLower.IsAccessible( bInPagePreview ) )
@@ -155,8 +155,8 @@ bool SwAccessibleFrame::GetChildIndex(
 {
 // We need a sorted list here
 const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
-SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
-while( aIter != aVisMap.end()  !bFound )
+SwAccessibleChildMap::const_iterator aIter( aVisMap.cbegin() );
+while( aIter != aVisMap.cend()  !bFound )
 {
 const SwAccessibleChild rLower = (*aIter).second;
 if( rLower.IsAccessible( bInPagePreview ) )
@@ -220,8 +220,8 @@ SwAccessibleChild SwAccessibleFrame::GetChildAtPixel( const 
SwRect rVisArea,
 // We need a sorted list here, and we have to reverse iterate,
 // because objects in front should be returned.
 const SwAccessibleChildMap

[Libreoffice-commits] core.git: sw/source

2014-11-14 Thread Juan Picca
 sw/source/core/access/accmap.cxx |   64 +++
 1 file changed, 51 insertions(+), 13 deletions(-)

New commits:
commit 2ec556b0726e51010aebaa4849195444fda4aa1d
Author: Juan Picca jumap...@gmail.com
Date:   Thu Nov 13 08:03:21 2014 -0200

fdo#75757: remove inheritance to std::map

Change-Id: I26ec60868c7854517b81ade3aec6b7ab29b0aa89
Reviewed-on: https://gerrit.libreoffice.org/12401
Reviewed-by: Takeshi Abe t...@fixedpoint.jp
Tested-by: Takeshi Abe t...@fixedpoint.jp

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 6a153ff..92e75a4 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -86,11 +86,18 @@ struct SwFrmFunc
 }
 };
 
-typedef ::std::map  const SwFrm *, uno::WeakReference  XAccessible , 
SwFrmFunc  _SwAccessibleContextMap_Impl;
-
-class SwAccessibleContextMap_Impl: public _SwAccessibleContextMap_Impl
+class SwAccessibleContextMap_Impl
 {
 public:
+typedef const SwFrm *   
key_type;
+typedef uno::WeakReference  XAccessible   
mapped_type;
+typedef std::pairconst key_type,mapped_type   
value_type;
+typedef SwFrmFunc   
key_compare;
+typedef std::mapkey_type,mapped_type,key_compare::iterator
iterator;
+typedef std::mapkey_type,mapped_type,key_compare::const_iterator  
const_iterator;
+private:
+std::map key_type,mapped_type,key_compare maMap;
+public:
 
 #if OSL_DEBUG_LEVEL  0
 bool mbLocked;
@@ -102,6 +109,13 @@ public:
 #endif
 {}
 
+iterator begin() { return maMap.begin(); }
+iterator end() { return maMap.end(); }
+bool empty() const { return maMap.empty(); }
+void clear() { maMap.clear(); }
+iterator find(const key_type key) { return maMap.find(key); }
+std::pairiterator,bool insert(const value_type value ) { return 
maMap.insert(value); }
+iterator erase(const_iterator pos) { return maMap.erase(pos); }
 };
 
 class SwDrawModellListener_Impl : public SfxListener,
@@ -579,11 +593,23 @@ struct SwAccessibleChildFunc
 }
 };
 
-typedef ::std::map  SwAccessibleChild, SwAccessibleEventList_Impl::iterator,
- SwAccessibleChildFunc  _SwAccessibleEventMap_Impl;
-
-class SwAccessibleEventMap_Impl: public _SwAccessibleEventMap_Impl
+class SwAccessibleEventMap_Impl
 {
+public:
+typedef SwAccessibleChild   
key_type;
+typedef SwAccessibleEventList_Impl::iterator
mapped_type;
+typedef std::pairconst key_type,mapped_type   
value_type;
+typedef SwAccessibleChildFunc   
key_compare;
+typedef std::mapkey_type,mapped_type,key_compare::iterator
iterator;
+typedef std::mapkey_type,mapped_type,key_compare::const_iterator  
const_iterator;
+private:
+std::map key_type,mapped_type,key_compare maMap;
+public:
+iterator begin() { return maMap.begin(); }
+iterator end() { return maMap.end(); }
+iterator find(const key_type key) { return maMap.find(key); }
+std::pairiterator,bool insert(const value_type value ) { return 
maMap.insert(value); }
+iterator erase(const_iterator pos) { return maMap.erase(pos); }
 };
 
 struct SwAccessibleParaSelection
@@ -607,12 +633,24 @@ struct SwXAccWeakRefComp
 }
 };
 
-typedef ::std::map uno::WeakReference  XAccessible ,
-SwAccessibleParaSelection,
-SwXAccWeakRefComp  _SwAccessibleSelectedParas_Impl;
-
-class SwAccessibleSelectedParas_Impl: public _SwAccessibleSelectedParas_Impl
-{};
+class SwAccessibleSelectedParas_Impl
+{
+public:
+typedef uno::WeakReference  XAccessible   
key_type;
+typedef SwAccessibleParaSelection   
mapped_type;
+typedef std::pairconst key_type,mapped_type   
value_type;
+typedef SwXAccWeakRefComp   
key_compare;
+typedef std::mapkey_type,mapped_type,key_compare::iterator
iterator;
+typedef std::mapkey_type,mapped_type,key_compare::const_iterator  
const_iterator;
+private:
+std::mapkey_type,mapped_type,key_compare maMap;
+public:
+iterator begin() { return maMap.begin(); }
+iterator end() { return maMap.end(); }
+iterator find(const key_type key) { return maMap.find(key); }
+std::pairiterator,bool insert(const value_type value ) { return 
maMap.insert(value); }
+iterator erase(const_iterator pos) { return maMap.erase(pos); }
+};
 
 // helper class that stores preview data
 class SwAccPreviewData
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/source

2014-11-13 Thread Juan Picca
 sw/source/core/access/accmap.cxx |   54 ++-
 1 file changed, 36 insertions(+), 18 deletions(-)

New commits:
commit a81af704a4e930d1f8f9b307fa8508118f90ea98
Author: Juan Picca jumap...@gmail.com
Date:   Wed Nov 12 10:44:40 2014 -0200

fdo#75757: remove inheritance to std::map

Change-Id: Ie42dd57c1d75987ed462aac152426665bf416178
Reviewed-on: https://gerrit.libreoffice.org/12385
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 22c55e3..c407114 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -197,13 +197,23 @@ struct SwShapeFunc
 return p1  p2;
 }
 };
-typedef ::std::map  const SdrObject *, uno::WeakReference  XAccessible , 
SwShapeFunc  _SwAccessibleShapeMap_Impl;
 typedef ::std::pair  const SdrObject *, ::rtl::Reference  
::accessibility::AccessibleShape   SwAccessibleObjShape_Impl;
 
-class SwAccessibleShapeMap_Impl: public _SwAccessibleShapeMap_Impl
-
+class SwAccessibleShapeMap_Impl
 {
-::accessibility::AccessibleShapeTreeInfo maInfo;
+public:
+
+typedef const SdrObject *   
key_type;
+typedef uno::WeakReferenceXAccessible 
mapped_type;
+typedef std::pairconst key_type,mapped_type   
value_type;
+typedef SwShapeFunc 
key_compare;
+typedef std::mapkey_type,mapped_type,key_compare::iterator
iterator;
+typedef std::mapkey_type,mapped_type,key_compare::const_iterator  
const_iterator;
+
+private:
+
+::accessibility::AccessibleShapeTreeInfomaInfo;
+std::mapkey_type,mapped_type,SwShapeFunc  maMap;
 
 public:
 
@@ -211,8 +221,9 @@ public:
 bool mbLocked;
 #endif
 SwAccessibleShapeMap_Impl( SwAccessibleMap *pMap )
+: maMap()
 #if OSL_DEBUG_LEVEL  0
-: mbLocked( false )
+, mbLocked( false )
 #endif
 {
 maInfo.SetSdrView( pMap-GetShell()-GetDrawView() );
@@ -231,6 +242,15 @@ public:
 SwAccessibleObjShape_Impl *Copy( size_t rSize,
 const SwFEShell *pFESh = 0,
 SwAccessibleObjShape_Impl  **pSelShape = 0 ) const;
+
+iterator begin() { return maMap.begin(); }
+iterator end() { return maMap.end(); }
+const_iterator cbegin() { return maMap.cbegin(); }
+const_iterator cend() { return maMap.cend(); }
+bool empty() const { return maMap.empty(); }
+iterator find(const key_type key) { return maMap.find(key); }
+std::pairiterator,bool insert(const value_type value ) { return 
maMap.insert(value); }
+iterator erase(const_iterator pos) { return maMap.erase(pos); }
 };
 
 SwAccessibleShapeMap_Impl::~SwAccessibleShapeMap_Impl()
@@ -249,15 +269,15 @@ SwAccessibleObjShape_Impl
 SwAccessibleObjShape_Impl *pSelShape = 0;
 
 sal_uInt16 nSelShapes = pFESh ? pFESh-IsObjSelected() : 0;
-rSize = size();
+rSize = maMap.size();
 
 if( rSize  0 )
 {
 pShapes =
 new SwAccessibleObjShape_Impl[rSize];
 
-const_iterator aIter = begin();
-const_iterator aEndIter = end();
+const_iterator aIter = maMap.cbegin();
+const_iterator aEndIter = maMap.cend();
 
 SwAccessibleObjShape_Impl *pShape = pShapes;
 pSelShape = (pShapes[rSize]);
@@ -1087,8 +1107,8 @@ void SwAccessibleMap::InvalidateShapeInParaSelection()
 if( mpShapeMap )
 {
 //Checked for shapes.
-_SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap-begin();
-_SwAccessibleShapeMap_Impl::const_iterator aEndIter = 
mpShapeMap-end();
+SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap-cbegin();
+SwAccessibleShapeMap_Impl::const_iterator aEndIter = 
mpShapeMap-cend();
 ::rtl::Reference SwAccessibleContext  xParentAccImpl;
 
 if( bIsSelAll)
@@ -1972,8 +1992,7 @@ uno::Reference XAccessible SwAccessibleMap::GetContext(
 mpShapeMap = new SwAccessibleShapeMap_Impl( this );
 if( mpShapeMap )
 {
-SwAccessibleShapeMap_Impl::iterator aIter =
-   mpShapeMap-find( pObj );
+SwAccessibleShapeMap_Impl::iterator aIter = mpShapeMap-find( pObj 
);
 if( aIter != mpShapeMap-end() )
 xAcc = (*aIter).second;
 
@@ -3162,8 +3181,8 @@ bool SwAccessibleMap::ReplaceChild (
 osl::MutexGuard aGuard( maMutex );
 if( mpShapeMap )
 {
-SwAccessibleShapeMap_Impl::const_iterator aIter = 
mpShapeMap-begin();
-SwAccessibleShapeMap_Impl::const_iterator aEndIter = 
mpShapeMap-end();
+SwAccessibleShapeMap_Impl::const_iterator aIter = 
mpShapeMap-cbegin();
+SwAccessibleShapeMap_Impl::const_iterator aEndIter = 
mpShapeMap-cend();
 while( aIter != aEndIter  !pObj

[Libreoffice-commits] core.git: vcl/source

2014-11-12 Thread Juan Picca
 vcl/source/outdev/map.cxx |   21 +
 1 file changed, 9 insertions(+), 12 deletions(-)

New commits:
commit e52de1ca778d76a60579a656f61013b0dec1fdba
Author: Juan Picca jumap...@gmail.com
Date:   Tue Nov 4 00:18:02 2014 -0200

Fraction: rewrite condition 'GetDenominator()==-1'

Change-Id: I483024fd0ef3e4e187a143631b2e8bd953fa3a52
Reviewed-on: https://gerrit.libreoffice.org/12240
Reviewed-by: Julien Nabet serval2...@yahoo.fr
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index fa79b77..b9bd532 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -45,6 +45,12 @@ ctor fraction once); we could also do this with BigInts
 
 static Fraction ImplMakeFraction( long nN1, long nN2, long nD1, long nD2 )
 {
+if( nD1 == 0 || nD2 == 0 ) //under these bad circumstances the following 
while loop will be endless
+{
+DBG_ASSERT(false,Invalid parameter for ImplMakeFraction);
+return Fraction( 1, 1 );
+}
+
 long i = 1;
 
 if ( nN1  0 ) { i = -i; nN1 = -nN1; }
@@ -53,17 +59,9 @@ static Fraction ImplMakeFraction( long nN1, long nN2, long 
nD1, long nD2 )
 if ( nD2  0 ) { i = -i; nD2 = -nD2; }
 // all positive; i sign
 
-Fraction aF( i*nN1, nD1 );
-aF *= Fraction( nN2, nD2 );
+Fraction aF = Fraction( i*nN1, nD1 ) * Fraction( nN2, nD2 );
 
-if( nD1 == 0 || nD2 == 0 ) //under these bad circumstances the following 
while loop will be endless
-{
-DBG_ASSERT(false,Invalid parameter for ImplMakeFraction);
-return Fraction( 1, 1 );
-}
-
-while ( aF.GetDenominator() == -1 )
-{
+while ( !aF.IsValid() ) {
 if ( nN1  nN2 )
 nN1 = (nN1 + 1) / 2;
 else
@@ -73,8 +71,7 @@ static Fraction ImplMakeFraction( long nN1, long nN2, long 
nD1, long nD2 )
 else
 nD2 = (nD2 + 1) / 2;
 
-aF = Fraction( i*nN1, nD1 );
-aF *= Fraction( nN2, nD2 );
+aF = Fraction( i*nN1, nD1 ) * Fraction( nN2, nD2 );
 }
 
 return aF;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/svx svx/source

2014-11-04 Thread Juan Picca
 include/svx/svdtrans.hxx   |1 -
 svx/source/svdraw/svdtrans.cxx |1 -
 2 files changed, 2 deletions(-)

New commits:
commit 5310dfe1cdf4cfa1f86036476694a076b71671db
Author: Juan Picca jumap...@gmail.com
Date:   Mon Nov 3 15:31:45 2014 -0200

SdrFormatter: remove unused attribute

Change-Id: I70633d3a4cea72c21a644e5a2f25865d8ec52122
Reviewed-on: https://gerrit.libreoffice.org/12227
Reviewed-by: Noel Grandin noelgran...@gmail.com
Tested-by: Noel Grandin noelgran...@gmail.com

diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
index 8bce426..e79bbb8 100644
--- a/include/svx/svdtrans.hxx
+++ b/include/svx/svdtrans.hxx
@@ -265,7 +265,6 @@ inline bool IsInch(FieldUnit eU) {
 }
 
 class SVX_DLLPUBLIC SdrFormatter {
-Fraction  aScale;
 long  nMul_;
 long  nDiv_;
 short nKomma_;
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index f3cccd0..31a4448 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -789,7 +789,6 @@ void GetMeterOrInch(FieldUnit eFU, short rnKomma, long 
rnMul, long rnDiv, boo
 
 void SdrFormatter::Undirty()
 {
-if (aScale.GetNumerator()==0 || aScale.GetDenominator()==0) 
aScale=Fraction(1,1);
 bool bSrcMetr,bSrcInch,bDstMetr,bDstInch;
 long nMul1,nDiv1,nMul2,nDiv2;
 short nKomma1,nKomma2;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: include/tools tools/qa tools/source

2014-10-28 Thread Juan Picca
 include/tools/fract.hxx |   54 +++-
 tools/qa/cppunit/test_fract.cxx |7 
 tools/source/generic/fract.cxx  |  487 +++-
 3 files changed, 231 insertions(+), 317 deletions(-)

New commits:
commit 2ce0aededea43231d91a0955fc0676120dcc4f13
Author: Juan Picca jumap...@gmail.com
Date:   Fri Oct 24 11:43:52 2014 -0200

fdo#81356: use boost::rational internally in Fraction

Change-Id: I6f40eafee7652209395bd471e3508fe3a3d19d73
Reviewed-on: https://gerrit.libreoffice.org/12085
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/include/tools/fract.hxx b/include/tools/fract.hxx
index 10e810e..0e81155 100644
--- a/include/tools/fract.hxx
+++ b/include/tools/fract.hxx
@@ -19,26 +19,32 @@
 #ifndef INCLUDED_TOOLS_FRACT_HXX
 #define INCLUDED_TOOLS_FRACT_HXX
 
+#include boost/rational.hpp
+#include sal/log.hxx
 #include tools/toolsdllapi.h
 
 class SvStream;
 
+// This class uses the platform defined type 'long' as valid values but do all
+// calculations using sal_Int64 with checks for 'long' overflows.
 class TOOLS_DLLPUBLIC SAL_WARN_UNUSED Fraction
 {
 private:
-longnNumerator;
-longnDenominator;
+boolvalid;
+boost::rationalsal_Int64  value;
+
+boolHasOverflowValue();
 
 public:
-Fraction() { nNumerator = 0; nDenominator = 1; }
+Fraction() { valid = true; }
 Fraction( const Fraction  rFrac );
 Fraction( long nNum, long nDen=1 );
 Fraction( double dVal );
 
 boolIsValid() const;
 
-longGetNumerator() const { return nNumerator; }
-longGetDenominator() const { return nDenominator; }
+longGetNumerator() const;
+longGetDenominator() const;
 
 operatorlong() const;
 operatordouble() const;
@@ -70,28 +76,50 @@ public:
 
 inline Fraction::Fraction( const Fraction rFrac )
 {
-nNumerator   = rFrac.nNumerator;
-nDenominator = rFrac.nDenominator;
+valid = rFrac.valid;
+if ( valid )
+value.assign( rFrac.value.numerator(), rFrac.value.denominator() );
+}
+
+inline long Fraction::GetNumerator() const
+{
+if ( !valid ) {
+SAL_WARN( tools.fraction, 'GetNumerator()' on invalid fraction );
+return 0;
+}
+return value.numerator();
+}
+
+inline long Fraction::GetDenominator() const {
+if ( !valid ) {
+SAL_WARN( tools.fraction, 'GetDenominator()' on invalid fraction );
+return -1;
+}
+return value.denominator();
 }
 
 inline Fraction Fraction::operator=( const Fraction rFrac )
 {
-nNumerator   = rFrac.nNumerator;
-nDenominator = rFrac.nDenominator;
+if ( this != rFrac ) {
+valid = rFrac.valid;
+if ( valid )
+value.assign( rFrac.value.numerator(), rFrac.value.denominator() );
+}
 return *this;
 }
 
 inline bool Fraction::IsValid() const
 {
-return (nDenominator  0);
+return valid;
 }
 
 inline Fraction::operator long() const
 {
-if ( nDenominator  0 )
-return (nNumerator / nDenominator);
-else
+if ( !valid ) {
+SAL_WARN( tools.fraction, 'operator long()' on invalid fraction );
 return 0;
+}
+return boost::rational_castlong(value);
 }
 
 inline Fraction operator+( const Fraction rVal1, const Fraction rVal2 )
diff --git a/tools/qa/cppunit/test_fract.cxx b/tools/qa/cppunit/test_fract.cxx
index febece0..6352588 100644
--- a/tools/qa/cppunit/test_fract.cxx
+++ b/tools/qa/cppunit/test_fract.cxx
@@ -96,9 +96,16 @@ public:
 CPPUNIT_ASSERT_EQUAL(1L, f.GetDenominator());
 }
 
+void testCreateFromDoubleIn32BitsPlatform() {
+// This pass in 64 bits but fail in 32 bits
+Fraction f(0.960945);
+CPPUNIT_ASSERT_EQUAL(true, f.IsValid());
+}
+
 CPPUNIT_TEST_SUITE(FractionTest);
 CPPUNIT_TEST(testFraction);
 CPPUNIT_TEST(testMinLongDouble);
+CPPUNIT_TEST(testCreateFromDoubleIn32BitsPlatform);
 CPPUNIT_TEST_SUITE_END();
 };
 
diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx
index ec219d8..45d54a4 100644
--- a/tools/source/generic/fract.cxx
+++ b/tools/source/generic/fract.cxx
@@ -26,81 +26,12 @@
 #include tools/fract.hxx
 #include tools/lineend.hxx
 #include tools/stream.hxx
-#include tools/bigint.hxx
 
-/** Compute greates common divisor using Euclidian algorithm
+templatetypename T
+static boost::rationalT rational_FromDouble(double dVal);
 
-As the algorithm works on positive values only, the absolute value
-of each parameter is used.
-
-@param nVal1
-@param nVal2
-
-@note: If one parameter is {0,1}, GetGGT returns 1.
-*/
-static long GetGGT( long nVal1, long nVal2 )
-{
-nVal1 = std::abs( nVal1 );
-nVal2 = std::abs( nVal2 );
-
-if ( nVal1 = 1 || nVal2 = 1

[Libreoffice-commits] core.git: tools/CppunitTest_tools_test.mk tools/qa tools/test

2014-10-24 Thread Juan Picca
 tools/CppunitTest_tools_test.mk |1 
 tools/qa/cppunit/test_fract.cxx |  102 
 tools/test/tests.cxx|  111 
 3 files changed, 103 insertions(+), 111 deletions(-)

New commits:
commit 6805d77c70c98d6fadccb3d4d8c0823924aca18b
Author: Juan Picca jumap...@gmail.com
Date:   Thu Oct 23 21:37:43 2014 -0200

Fract: enable tests

Change-Id: I00650503f15f2dcd45b07e3c529965336e8391e6
Reviewed-on: https://gerrit.libreoffice.org/12080
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/tools/CppunitTest_tools_test.mk b/tools/CppunitTest_tools_test.mk
index bd514b5..58baeb5 100644
--- a/tools/CppunitTest_tools_test.mk
+++ b/tools/CppunitTest_tools_test.mk
@@ -15,6 +15,7 @@ $(eval $(call 
gb_CppunitTest_use_external,tools_test,boost_headers))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,tools_test, \
 tools/qa/cppunit/test_bigint \
+tools/qa/cppunit/test_fract \
 tools/qa/cppunit/test_inetmime \
 tools/qa/cppunit/test_pathutils \
 tools/qa/cppunit/test_reversemap \
diff --git a/tools/test/tests.cxx b/tools/qa/cppunit/test_fract.cxx
similarity index 97%
rename from tools/test/tests.cxx
rename to tools/qa/cppunit/test_fract.cxx
index 5e848c4..bcc6ad2 100644
--- a/tools/test/tests.cxx
+++ b/tools/qa/cppunit/test_fract.cxx
@@ -31,13 +31,6 @@ namespace tools
 class FractionTest : public CppUnit::TestFixture
 {
 public:
-void setUp()
-{
-}
-
-void tearDown()
-{
-}
 
 void testFraction()
 {
@@ -106,6 +99,4 @@ public:
 CPPUNIT_TEST_SUITE_REGISTRATION(FractionTest);
 } // namespace tools
 
-CPPUNIT_PLUGIN_IMPLEMENT();
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: basctl/source basic/source chart2/source connectivity/inc connectivity/source cui/source dbaccess/source desktop/source drawinglayer/source editeng/source filter/source

2014-10-09 Thread Juan Picca
   |4 
 vcl/source/gdi/gdimtf.cxx |   12 
 vcl/source/gdi/impgraph.cxx   |   12 
 vcl/source/gdi/mapmod.cxx |8 
 vcl/source/gdi/pdfwriter_impl.cxx |4 
 vcl/source/gdi/pdfwriter_impl2.cxx|4 
 vcl/source/gdi/textlayout.cxx |2 
 vcl/source/gdi/virdev.cxx |2 
 vcl/source/outdev/font.cxx|2 
 vcl/source/outdev/map.cxx |  157 +--
 vcl/source/window/window.cxx  |2 
 vcl/source/window/window2.cxx |   26 
 writerfilter/source/dmapper/WrapPolygonHandler.cxx|   18 
 writerfilter/source/dmapper/WrapPolygonHandler.hxx|4 
 365 files changed, 1879 insertions(+), 2448 deletions(-)

New commits:
commit 47a2d7642d249d70b5da0c330a73f3a0032e4bba
Author: Juan Picca jumap...@gmail.com
Date:   Fri Sep 19 14:19:30 2014 -0300

fdo#81356: convert Fraction to boost::rationallong - wip

* Added rational util functions used by Fraction class not
  available in the boost::rational class.
* Replaced usage of Fraction by boost::rationallong
* Removed code that relies on:
  1. fraction.IsValid() -- rational only allow valid values, ie
 denominator() != 0
  2. rational.denominator() == 0 -- always false
  3. rational.denominator()  0 -- always false but implementation
 detail: 
http://www.boost.org/doc/libs/release/libs/rational/rational.html#Internal%20representation
* Simplified code that relies on:
  1. rational.denominator() != 0 -- always true
* BUGS EXIST because Fraction allows the creation of invalid values but
  boost::rational throws the exception boost::bad_rational

Change-Id: I84970a4956afb3f91ac0c8f726547466319420f9
Reviewed-on: https://gerrit.libreoffice.org/11551
Reviewed-by: David Tardon dtar...@redhat.com
Tested-by: David Tardon dtar...@redhat.com

diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 9800c4c..5d8373a 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -234,7 +234,7 @@ DlgEditor::DlgEditor (
 pDlgEdView-SetWorkArea( Rectangle( Point( 0, 0 ), pDlgEdPage-GetSize() ) 
);
 
 pDlgEdView-SetGridCoarse( aGridSize );
-pDlgEdView-SetSnapGridWidth(Fraction(aGridSize.Width(), 1), 
Fraction(aGridSize.Height(), 1));
+pDlgEdView-SetSnapGridWidth(boost::rationallong(aGridSize.Width(),1), 
boost::rationallong(aGridSize.Height(),1));
 pDlgEdView-SetGridSnap( bGridSnap );
 pDlgEdView-SetGridVisible( bGridVisible );
 pDlgEdView-SetDragStripes(false);
@@ -508,7 +508,7 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout)
 Size   aSize = rWindow.PixelToLogic( Size( 400, 300 ) );
 
 // align with grid
-Size aGridSize_(long(pDlgEdView-GetSnapGridWidthX()), 
long(pDlgEdView-GetSnapGridWidthY()));
+Size 
aGridSize_(boost::rational_castlong(pDlgEdView-GetSnapGridWidthX()), 
boost::rational_castlong(pDlgEdView-GetSnapGridWidthY()));
 aSize.Width()  -= aSize.Width()  % aGridSize_.Width();
 aSize.Height() -= aSize.Height() % aGridSize_.Height();
 
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 4d52b5f..89a0207 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -940,7 +940,7 @@ void DlgEdObj::NbcMove( const Size rSize )
 GetDlgEdForm()-GetDlgEditor().SetDialogModelChanged(true);
 }
 
-void DlgEdObj::NbcResize(const Point rRef, const Fraction xFract, const 
Fraction yFract)
+void DlgEdObj::NbcResize(const Point rRef, const boost::rationallong 
xFract, const boost::rationallong yFract)
 {
 SdrUnoObj::NbcResize( rRef, xFract, yFract );
 
@@ -1590,7 +1590,7 @@ void DlgEdForm::NbcMove( const Size rSize )
 GetDlgEditor().SetDialogModelChanged(true);
 }
 
-void DlgEdForm::NbcResize(const Point rRef, const Fraction xFract, const 
Fraction yFract)
+void DlgEdForm::NbcResize(const Point rRef, const boost::rationallong 
xFract, const boost::rationallong yFract)
 {
 SdrUnoObj::NbcResize( rRef, xFract, yFract );
 
diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx
index 525a551..33e489f 100644
--- a/basctl/source/inc/dlgedobj.hxx
+++ b/basctl/source/inc/dlgedobj.hxx
@@ -63,7 +63,7 @@ protected:
  const com::sun::star::uno::Reference 
com::sun::star::lang::XMultiServiceFactory  rxSFac);
 
 virtual void NbcMove( const Size rSize ) SAL_OVERRIDE;
-virtual void NbcResize(const Point rRef, const Fraction xFact, const 
Fraction yFact) SAL_OVERRIDE;
+virtual void NbcResize(const Point rRef, const boost::rationallong 
xFact, const boost

License statement - Juan Picca

2014-10-09 Thread Juan Picca
All of my past  future contributions to LibreOffice may be
licensed under the MPL/LGPLv3+ dual license.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Changes to 'refs/changes/78/10478/1'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/51/11551/1'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/78/10478/2'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/05/11405/6'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/05/11405/7'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/05/11405/3'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/05/11405/5'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/05/11405/1'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/11000/6'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/11000/4'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/05/11405/2'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/11000/8'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/11000/7'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/11000/1'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/11000/2'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/11000/5'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/11000/11'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/11000/10'

2014-09-29 Thread Juan Picca

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: Problems with refactor tool based in compilerplugins.

2014-09-03 Thread Juan Picca
​​
Thanks Stephan
​.

The refactor now works for me with two passes:
1. using only ​
COMPILER_PLUGIN_TOOL=
​myplugin for rewrite only the .cxx files
​2. using COMPILER_PLUGIN_TOOL=myplugin UPDATE_FILES=all ​for end the
refactor rewriting the .hxx files
​​
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Problems with refactor tool based in compilerplugins.

2014-09-02 Thread Juan Picca
Hi, i'm writting a clang compiler plugin for refactor code (
https://bugs.freedesktop.org/show_bug.cgi?id=81356)

It rewrite some .cxx files before stop due errors with the refactored code
and the code that is parsed.
Also, the plugin only refactor .cxx files but not the .hxx files.
I try using

rewriter-overwriteChangedFiles()

for change the include files too, but it changes many included files at
once and later the compiler fails to parse the rest of .cxx files.

Someone can help me with this?
Any tip is welcome.

The current source code can be found in gitweb:
https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=47a4f0925af762895e4d632c7e903e6306640a10
, or gerrit: https://gerrit.libreoffice.org/11000

Thanks,
JMPC
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: compilerplugins/clang

2014-07-24 Thread Juan Picca
 compilerplugins/clang/store/tutorial/tutorial1.cxx |4 ++--
 compilerplugins/clang/store/tutorial/tutorial1.hxx |2 +-
 compilerplugins/clang/store/tutorial/tutorial2.cxx |4 ++--
 compilerplugins/clang/store/tutorial/tutorial2.hxx |2 +-
 compilerplugins/clang/store/tutorial/tutorial3.cxx |4 ++--
 compilerplugins/clang/store/tutorial/tutorial3.hxx |2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 9f282bdd86d25dd8c01c01a3cadcc8fba599294f
Author: Juan Picca jumap...@gmail.com
Date:   Wed Jul 23 00:02:35 2014 -0300

compilerplugins: Fix tutorials plugins

Broken in commit 1f078fcaddd45bb074e4d0a4933db01f6e8b623e

Change-Id: Ica93c3b9309b2ae4d973ccc34a84b5accac7472c
Reviewed-on: https://gerrit.libreoffice.org/10478
Reviewed-by: Thomas Arnhold tho...@arnhold.org
Tested-by: Thomas Arnhold tho...@arnhold.org

diff --git a/compilerplugins/clang/store/tutorial/tutorial1.cxx 
b/compilerplugins/clang/store/tutorial/tutorial1.cxx
index 63158e8..cd3f710 100644
--- a/compilerplugins/clang/store/tutorial/tutorial1.cxx
+++ b/compilerplugins/clang/store/tutorial/tutorial1.cxx
@@ -21,8 +21,8 @@ namespace loplugin
 {
 
 // Ctor, nothing special, pass the argument(s).
-Tutorial1::Tutorial1( CompilerInstance compiler )
-: Plugin( compiler )
+Tutorial1::Tutorial1( const InstantiationData data )
+: Plugin( data )
 {
 }
 
diff --git a/compilerplugins/clang/store/tutorial/tutorial1.hxx 
b/compilerplugins/clang/store/tutorial/tutorial1.hxx
index 9eebd64..365d925 100644
--- a/compilerplugins/clang/store/tutorial/tutorial1.hxx
+++ b/compilerplugins/clang/store/tutorial/tutorial1.hxx
@@ -26,7 +26,7 @@ class Tutorial1
 {
 public:
 // Ctor, nothing special.
-Tutorial1( CompilerInstance compiler );
+Tutorial1( const InstantiationData data );
 // The function that will be called to perform the actual action.
 virtual void run() override;
 // Function from Clang, it will be called for every return statement 
in the source.
diff --git a/compilerplugins/clang/store/tutorial/tutorial2.cxx 
b/compilerplugins/clang/store/tutorial/tutorial2.cxx
index c6bee69..5d3a2d6 100644
--- a/compilerplugins/clang/store/tutorial/tutorial2.cxx
+++ b/compilerplugins/clang/store/tutorial/tutorial2.cxx
@@ -22,8 +22,8 @@ if( a == 1 )
 namespace loplugin
 {
 
-Tutorial2::Tutorial2( CompilerInstance compiler )
-: Plugin( compiler )
+Tutorial2::Tutorial2( const InstantiationData data )
+: Plugin( data )
 {
 }
 
diff --git a/compilerplugins/clang/store/tutorial/tutorial2.hxx 
b/compilerplugins/clang/store/tutorial/tutorial2.hxx
index dde4da6..cb708d3 100644
--- a/compilerplugins/clang/store/tutorial/tutorial2.hxx
+++ b/compilerplugins/clang/store/tutorial/tutorial2.hxx
@@ -23,7 +23,7 @@ class Tutorial2
 , public Plugin
 {
 public:
-Tutorial2( CompilerInstance compiler );
+Tutorial2( const InstantiationData data );
 virtual void run() override;
 // Will be called for every if statement.
 bool VisitIfStmt( const IfStmt* ifstmt );
diff --git a/compilerplugins/clang/store/tutorial/tutorial3.cxx 
b/compilerplugins/clang/store/tutorial/tutorial3.cxx
index e0a9e94..183c3b2 100644
--- a/compilerplugins/clang/store/tutorial/tutorial3.cxx
+++ b/compilerplugins/clang/store/tutorial/tutorial3.cxx
@@ -22,8 +22,8 @@ namespace loplugin
 {
 
 // Ctor, pass arguments.
-Tutorial3::Tutorial3( CompilerInstance compiler, Rewriter rewriter )
-: RewritePlugin( compiler, rewriter )
+Tutorial3::Tutorial3( const InstantiationData data )
+: RewritePlugin( data )
 {
 }
 
diff --git a/compilerplugins/clang/store/tutorial/tutorial3.hxx 
b/compilerplugins/clang/store/tutorial/tutorial3.hxx
index 27863b5..4261d1b 100644
--- a/compilerplugins/clang/store/tutorial/tutorial3.hxx
+++ b/compilerplugins/clang/store/tutorial/tutorial3.hxx
@@ -24,7 +24,7 @@ class Tutorial3
 {
 public:
 // One more argument for ctor.
-Tutorial3( CompilerInstance compiler, Rewriter rewriter );
+Tutorial3( const InstantiationData data );
 virtual void run() override;
 // Will be called for every if statement.
 bool VisitIfStmt( const IfStmt* ifstmt );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits