[Libreoffice-commits] core.git: Branch 'libreoffice-4-4-0' - sc/source

2015-01-22 Thread Caolán McNamara
 sc/source/ui/dbgui/PivotLayoutTreeList.cxx |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit c06f0d71e16ffe68836441d125a4c1eb50d5ccda
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Jan 22 13:39:21 2015 +

Resolves: fdo#88455 delete in empty data field crashes

Change-Id: I399bf576fe89283f839842959f06b8fe83f13b2b
(cherry picked from commit 66df4d7d309ce237e4979d57b1069659ece1e3a5)
Reviewed-on: https://gerrit.libreoffice.org/14108
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Lionel Elie Mamane lio...@mamane.lu
Reviewed-by: Michael Meeks michael.me...@collabora.com
Tested-by: Michael Meeks michael.me...@collabora.com

diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx 
b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index 7f75da8..dcfdae3 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -38,7 +38,11 @@ void ScPivotLayoutTreeList::Setup(ScPivotLayoutDialog* 
pParent, SvPivotTreeListT
 
 bool ScPivotLayoutTreeList::DoubleClickHdl()
 {
-ScItemValue* pCurrentItemValue = (ScItemValue*) 
GetCurEntry()-GetUserData();
+SvTreeListEntry* pEntry = GetCurEntry();
+if (!pEntry)
+return false;
+
+ScItemValue* pCurrentItemValue = (ScItemValue*) pEntry-GetUserData();
 ScPivotFuncData rCurrentFunctionData = pCurrentItemValue-maFunctionData;
 
 if (mpParent-IsDataElement(rCurrentFunctionData.mnCol))
@@ -105,11 +109,12 @@ void ScPivotLayoutTreeList::KeyInput(const KeyEvent 
rKeyEvent)
 vcl::KeyCode aCode = rKeyEvent.GetKeyCode();
 sal_uInt16 nCode = aCode.GetCode();
 
-switch (nCode)
+if (nCode == KEY_DELETE)
 {
-case KEY_DELETE:
-GetModel()-Remove(GetCurEntry());
-return;
+const SvTreeListEntry* pEntry = GetCurEntry();
+if (pEntry)
+GetModel()-Remove(pEntry);
+return;
 }
 SvTreeListBox::KeyInput(rKeyEvent);
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-4-0' - sc/source

2015-01-21 Thread Eike Rathke
 sc/source/core/data/conditio.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 3a05b353f6d8a08536f324f46778d2a1356778e8
Author: Eike Rathke er...@redhat.com
Date:   Fri Jan 16 22:40:36 2015 +0100

don't access empty range list, could be rhbz#1180312

ScRangeList::DeleteArea() may remove an entire range, if it was the
last range a subsequent call to ScConditionalFormat::DeleteArea() would
attempt to access an invalid first element.

Change-Id: I8d68c27963dc8561d61a94980093c271bd3aaffb
(cherry picked from commit 9af8e14e67d354bb7736271a76a3dd8b6da78fd9)
Reviewed-on: https://gerrit.libreoffice.org/13964
Reviewed-by: Christian Lohmaier lohmaier+libreoff...@googlemail.com
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 794fb56..35a827f 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -2064,6 +2064,9 @@ void ScConditionalFormat::UpdateMoveTab( 
sc::RefUpdateMoveTabContext rCxt )
 
 void ScConditionalFormat::DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, 
SCROW nRow2 )
 {
+if (maRanges.empty())
+return;
+
 SCTAB nTab = maRanges[0]-aStart.Tab();
 maRanges.DeleteArea( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-4-0' - sc/source

2015-01-20 Thread Trent MacAlpine
 sc/source/ui/drawfunc/fupoor.cxx |   19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 5417429d0ef2d968b227dd2a533c1bf9cb0156b9
Author: Trent MacAlpine tmac...@gmail.com
Date:   Fri Jan 16 22:06:39 2015 -0500

fdo#88339 Fixed Calc constrained image movement

fixed on master by commit# 7a4a68e2515fa54e041004cf63042c1ead00d576

Change-Id: Id4143e0a8410e6a9589f941c2bda83074eaf4844
Reviewed-on: https://gerrit.libreoffice.org/14022
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com
(cherry picked from commit fdff4b60b6d4beabadab15a4fceb60cb84e542d8)
Reviewed-on: https://gerrit.libreoffice.org/14024
Reviewed-by: Eike Rathke er...@redhat.com
Tested-by: Eike Rathke er...@redhat.com

diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index 979e7b6..d66a293 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -324,17 +324,30 @@ void FuPoor::ImpForceQuadratic(Rectangle rRect)
 }
 }
 
-// #i33136#
+// #i33136# fdo#88339
 bool FuPoor::doConstructOrthogonal() const
 {
-// Check whether an image is selected - they should scale proportionally
+// Detect whether we're moving an object or resizing.
+bool bIsMoveMode = false;
+if (pView-IsDragObj())
+{
+const SdrHdl* pHdl = pView-GetDragStat().GetHdl();
+if (!pHdl || (!pHdl-IsCornerHdl()  !pHdl-IsVertexHdl()))
+{
+bIsMoveMode = true;
+}
+}
+
+// Detect image and resize proportionally, but don't constrain movement by 
default
 if (pView-AreObjectsMarked())
 {
 const SdrMarkList rMarkList = pView-GetMarkedObjectList();
 if (rMarkList.GetMarkCount() == 1)
 {
-if (rMarkList.GetMark(0)-GetMarkedSdrObj()-GetObjIdentifier() == 
OBJ_GRAF)
+if (rMarkList.GetMark(0)-GetMarkedSdrObj()-GetObjIdentifier() == 
OBJ_GRAF  !bIsMoveMode)
+{
 return true;
+}
 }
 }
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-4-4-0' - sc/source

2015-01-13 Thread Eike Rathke
 sc/source/core/tool/compiler.cxx |3 +--
 sc/source/filter/excel/xecontent.cxx |   12 
 sc/source/filter/excel/xelink.cxx|2 +-
 sc/source/filter/inc/xecontent.hxx   |5 +++--
 sc/source/ui/unoobj/linkuno.cxx  |8 +---
 5 files changed, 18 insertions(+), 12 deletions(-)

New commits:
commit 0e4df45891035e9f18070173a02c5bdc2eda9a49
Author: Eike Rathke er...@redhat.com
Date:   Fri Jan 9 13:53:27 2015 +0100

Resolves: fdo#85617 always store fully encoded external document name

Also OOXML calls these API functions, this is the central place to handle 
it.

(cherry picked from commit 97a8b3ed5e5bd42e213d3230fa764b0f5d10f0f2)

write externalLink Relationship Target IURI encoded, fdo#85617 related

(cherry picked from commit 7eb5e135422f1a5830a44d129300bc3fafb4627d)

do not drop entire external reference, fdo#85617 related

If there are no matching tab names for a FileId, preserve at least the known
reference parts. In case of 2D references the sheet name is in the token if
for example read from .xlsx, only for 3D references the second sheet name
would be needed. The underlying makeExternalRefStr() and its subroutines
handle the missing tabname elements gracefully.

Still this situation is worth an assertion.

(cherry picked from commit b6339617b1cc3136f9e527acd0746d712cd21643)

Change-Id: I3df065af8e4ef44734f468fd455c3b7c93d7fbc6
Reviewed-on: https://gerrit.libreoffice.org/13838
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com
Reviewed-by: Michael Stahl mst...@redhat.com
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 5320d7e..37c234a 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4136,8 +4136,7 @@ void ScCompiler::CreateStringFromExternal(OUStringBuffer 
rBuffer, FormulaToken*
 {
 vectorOUString aTabNames;
 pRefMgr-getAllCachedTableNames(nFileId, aTabNames);
-if (aTabNames.empty())
-return;
+assert(!aTabNames.empty()); // something is seriously wrong, but 
continue
 
 pConv-makeExternalRefStr(
 rBuffer, GetPos(), nFileId, *pFileName, aTabNames, 
t-GetString().getString(),
diff --git a/sc/source/filter/excel/xecontent.cxx 
b/sc/source/filter/excel/xecontent.cxx
index 521d1a9..47de380 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -353,7 +353,9 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot rRoot, 
const SvxURLField rU
 {
 sal_uInt16 nLevel;
 bool bRel;
-OUString aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot ) );
+/* TODO: should we differentiate between BIFF and OOXML and write IURI
+ * encoded for OOXML? */
+OUString aFileName( BuildFileName( nLevel, bRel, rUrl, rRoot, false ) 
);
 
 if( eProtocol == INET_PROT_SMB )
 {
@@ -444,9 +446,10 @@ XclExpHyperlink::~XclExpHyperlink()
 }
 
 OUString XclExpHyperlink::BuildFileName(
-sal_uInt16 rnLevel, bool rbRel, const OUString rUrl, const 
XclExpRoot rRoot )
+sal_uInt16 rnLevel, bool rbRel, const OUString rUrl, const 
XclExpRoot rRoot, bool bEncoded )
 {
-OUString aDosName( INetURLObject( rUrl ).getFSysPath( 
INetURLObject::FSYS_DOS ) );
+INetURLObject aURLObject( rUrl );
+OUString aDosName( bEncoded ? aURLObject.GetURLPath() : 
aURLObject.getFSysPath( INetURLObject::FSYS_DOS ) );
 rnLevel = 0;
 rbRel = rRoot.IsRelUrl();
 
@@ -455,7 +458,8 @@ OUString XclExpHyperlink::BuildFileName(
 // try to convert to relative file name
 OUString aTmpName( aDosName );
 aDosName = INetURLObject::GetRelURL( rRoot.GetBasePath(), rUrl,
-INetURLObject::WAS_ENCODED, INetURLObject::DECODE_WITH_CHARSET );
+INetURLObject::WAS_ENCODED,
+(bEncoded ? INetURLObject::DECODE_TO_IURI : 
INetURLObject::DECODE_WITH_CHARSET));
 
 if (aDosName.startsWith(INET_FILE_SCHEME))
 {
diff --git a/sc/source/filter/excel/xelink.cxx 
b/sc/source/filter/excel/xelink.cxx
index fe43ee7..3c8dffc 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -1655,7 +1655,7 @@ void XclExpSupbook::SaveXml( XclExpXmlStream rStrm )
 bool bRel = true;
 OUString sId = rStrm.addRelation( pExternalLink-getOutputStream(),
 
http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath;,
-XclExpHyperlink::BuildFileName( nLevel, bRel, maUrl, GetRoot()),
+XclExpHyperlink::BuildFileName( nLevel, bRel, maUrl, GetRoot(), 
true),
 true );
 
 pExternalLink-startElement( XML_externalLink,
diff --git a/sc/source/filter/inc/xecontent.hxx 

[Libreoffice-commits] core.git: Branch 'libreoffice-4-4-0' - sc/source

2015-01-13 Thread Markus Mohrhard
 sc/source/core/tool/compiler.cxx |   31 ---
 1 file changed, 28 insertions(+), 3 deletions(-)

New commits:
commit 6d26deaa4c40f554fb6bc036047564d466b361fd
Author: Markus Mohrhard markus.mohrh...@collabora.co.uk
Date:   Sat Dec 27 06:51:52 2014 +0100

handle index based external refs in formulas in ooxml import, fdo#85617

(cherry picked from commit 18cccd62fb5b730319878df6fac748d5cdf73f1f)

return after finding the reference

(cherry picked from commit cef36587674b6472471478524e87b1add4109507)

that method is the same as in the base class

(cherry picked from commit 02caf8f2eef75d8b5acb6a4ec40277355c3c6c6e)

remove copypaste code

(cherry picked from commit 757ce63f7346aea132f11c3d9a328b0a1a776403)

a22b97b0a45d8d840095737638c2ccf68373e27a
8cb6f59795d9461c0e02ab70d7edd60af1410c1f
5710856fdb9fb91573de89eeb5a29d3d106ad7a6

Change-Id: Ie4f43f041f5d614b9c2826c74574c854af05c266
Reviewed-on: https://gerrit.libreoffice.org/13837
Tested-by: Eike Rathke er...@redhat.com
Reviewed-by: Eike Rathke er...@redhat.com
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 37c234a..40f1de7 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -986,6 +986,10 @@ struct ConventionOOO_A1_ODF : public ConventionOOO_A1
 
 struct ConventionXL
 {
+virtual ~ConventionXL()
+{
+}
+
 static void GetTab(
 const ScAddress rPos, const std::vectorOUString rTabNames,
 const ScSingleRefData rRef, OUString rTabName )
@@ -1100,7 +1104,7 @@ struct ConventionXL
 }
 }
 
-static void parseExternalDocName( const OUString rFormula, sal_Int32 
rSrcPos )
+virtual void parseExternalDocName( const OUString rFormula, sal_Int32 
rSrcPos ) const
 {
 sal_Int32 nLen = rFormula.getLength();
 const sal_Unicode* p = rFormula.getStr();
@@ -1236,7 +1240,7 @@ struct ConventionXL_A1 : public Convention_A1, public 
ConventionXL
sal_Int32 nSrcPos,
const CharClass* pCharClass) const 
SAL_OVERRIDE
 {
-ConventionXL::parseExternalDocName(rFormula, nSrcPos);
+parseExternalDocName(rFormula, nSrcPos);
 
 ParseResult aRet;
 if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
@@ -1322,6 +1326,27 @@ struct ConventionXL_OOX : public ConventionXL_A1
  * CellStr. */
 }
 
+virtual void parseExternalDocName(const OUString rFormula, sal_Int32 
rSrcPos) const SAL_OVERRIDE
+{
+sal_Int32 nLen = rFormula.getLength();
+const sal_Unicode* p = rFormula.getStr();
+for (sal_Int32 i = rSrcPos; i  nLen; ++i)
+{
+sal_Unicode c = p[i];
+if (i == rSrcPos)
+{
+// first character must be '['.
+if (c != '[')
+return;
+}
+else if (c == ']')
+{
+rSrcPos = i + 1;
+return;
+}
+}
+}
+
 virtual void makeExternalRefStr(
 OUStringBuffer rBuffer, const ScAddress rPos, sal_uInt16 nFileId, 
const OUString /*rFileName*/,
 const OUString rTabName, const ScSingleRefData rRef ) const 
SAL_OVERRIDE
@@ -1461,7 +1486,7 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, 
public ConventionXL
sal_Int32 nSrcPos,
const CharClass* pCharClass) const SAL_OVERRIDE
 {
-ConventionXL::parseExternalDocName(rFormula, nSrcPos);
+parseExternalDocName(rFormula, nSrcPos);
 
 ParseResult aRet;
 if ( lcl_isValidQuotedText(rFormula, nSrcPos, aRet) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits