[Libreoffice-commits] .: 2 commits - sc/qa sc/source
Markus Mohrhard
mmohrhard at kemper.freedesktop.org
Thu Jul 5 17:07:37 PDT 2012
sc/qa/unit/data/xlsx/singlecontrol.xlsx |binary
sc/qa/unit/subsequent_filters-test.cxx | 33 ++++++++++++++++++++++++++++++++
sc/source/ui/view/gridwin.cxx | 9 ++++++--
3 files changed, 40 insertions(+), 2 deletions(-)
New commits:
commit c433fa0639ccf5caeb0c128c8a3794322e2a1c81
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Jul 6 02:04:44 2012 +0200
adjust the calculation of the cursor pos if ALT is used, fdo#48869
Change-Id: I6316717c860d999270aa7f0fb50af5f6dfc7efd7
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 6187397..c98b89e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4113,6 +4113,9 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
String aUndo = ScGlobal::GetRscString( bIsMove ? STR_UNDO_MOVE : STR_UNDO_COPY );
pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
+ SCsCOL nCorrectCursorPosCol = 0;
+ SCsROW nCorrectCursorPosRow = 0;
+
bDone = sal_True;
if ( meDragInsertMode != INS_NONE )
{
@@ -4126,11 +4129,13 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
nDestPosX == aSource.aStart.Col() && nDestPosY < aSource.aStart.Row() )
{
bDone = aSource.Move( 0, nSizeY, 0, pSourceDoc );
+ nCorrectCursorPosRow = nSizeY;
}
else if ( meDragInsertMode == INS_CELLSRIGHT &&
nDestPosY == aSource.aStart.Row() && nDestPosX < aSource.aStart.Col() )
{
bDone = aSource.Move( nSizeX, 0, 0, pSourceDoc );
+ nCorrectCursorPosCol = nSizeX;
}
}
pDocSh->UpdateOle( pViewData );
@@ -4189,8 +4194,8 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
{
pView->MarkRange( aDest, false, false );
- SCCOL nDCol = pViewData->GetCurX() - aSource.aStart.Col();
- SCROW nDRow = pViewData->GetCurY() - aSource.aStart.Row();
+ SCCOL nDCol = pViewData->GetCurX() - aSource.aStart.Col() + nCorrectCursorPosCol;
+ SCROW nDRow = pViewData->GetCurY() - aSource.aStart.Row() + nCorrectCursorPosRow;
pView->SetCursor( aDest.aStart.Col() + nDCol, aDest.aStart.Row() + nDRow );
}
commit dd209b77391903cb6f9f04c44e10a05f31076f4a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Jul 6 02:04:21 2012 +0200
add a import test for control shapes
Change-Id: I2ac5e1bdd1c681c8ba58edded3ab1b57ac30c512
diff --git a/sc/qa/unit/data/xlsx/singlecontrol.xlsx b/sc/qa/unit/data/xlsx/singlecontrol.xlsx
new file mode 100644
index 0000000..513c05b
Binary files /dev/null and b/sc/qa/unit/data/xlsx/singlecontrol.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 62a9970..2fab37a 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -45,6 +45,12 @@
#include <dbdata.hxx>
#include "validat.hxx"
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
#define CALC_DEBUG_OUTPUT 0
#define TEST_BUG_FILES 0
@@ -127,6 +133,8 @@ public:
void testPasswordNew();
void testPasswordOld();
+ //test shape import
+ void testControlImport();
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testRangeNameXLS);
@@ -154,6 +162,7 @@ public:
#endif
CPPUNIT_TEST(testSharedFormulaXLSX);
CPPUNIT_TEST(testCellValueXLSX);
+ CPPUNIT_TEST(testControlImport);
//disable testPassword on MacOSX due to problems with libsqlite3
//also crashes on DragonFly due to problems with nss/nspr headers
@@ -1060,6 +1069,30 @@ void ScFiltersTest::testPasswordOld()
testPassword_Impl(aFileNameBase);
}
+void ScFiltersTest::testControlImport()
+{
+ const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("singlecontrol."));
+ rtl::OUString aFileExtension(aFileFormats[XLSX].pName, strlen(aFileFormats[XLSX].pName), RTL_TEXTENCODING_UTF8 );
+ rtl::OUString aFilterName(aFileFormats[XLSX].pFilterName, strlen(aFileFormats[XLSX].pFilterName), RTL_TEXTENCODING_UTF8) ;
+ rtl::OUString aFileName;
+ createFileURL(aFileNameBase, aFileExtension, aFileName);
+ rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8);
+ std::cout << aFileFormats[XLSX].pName << " Test" << std::endl;
+ ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType);
+
+ CPPUNIT_ASSERT_MESSAGE("Failed to load cell-value.xlsx", xDocSh.Is());
+
+ uno::Reference< frame::XModel > xModel = xDocSh->GetModel();
+ uno::Reference< sheet::XSpreadsheetDocument > xDoc(xModel, UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIA(xDoc->getSheets(), UNO_QUERY_THROW);
+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( xIA->getByIndex(0), UNO_QUERY_THROW);
+ uno::Reference< container::XIndexAccess > xIA_DrawPage(xDrawPageSupplier->getDrawPage(), UNO_QUERY_THROW);
+ uno::Reference< drawing::XControlShape > xControlShape(xIA_DrawPage->getByIndex(0), UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT(xControlShape.is());
+ xDocSh->DoClose();
+}
+
ScFiltersTest::ScFiltersTest()
: m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data"))
{
More information about the Libreoffice-commits
mailing list