[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - 47 commits - basebmp/inc binaryurp/source cppuhelper/source desktop/Library_sofficeapp.mk desktop/qa desktop/source framework/source include/cppuhelper include/LibreOfficeKit include/oox include/vcl jurt/com officecfg/registry oox/source sal/osl sc/CppunitTest_sc_tiledrendering.mk sc/Module_sc.mk sc/qa sc/sdi sc/source sd/qa sd/source sfx2/source smoketest/libtest.cxx svx/source sw/inc sw/source vcl/generic vcl/source
Matus Uzak
matus.uzak at gmail.com
Sun Jun 12 21:21:46 UTC 2016
basebmp/inc/polypolygonrenderer.hxx | 9
binaryurp/source/bridge.cxx | 2
binaryurp/source/writer.cxx | 32 +
cppuhelper/source/defaultbootstrap.cxx | 22 -
cppuhelper/source/gcc3.map | 1
cppuhelper/source/servicemanager.cxx | 111 +++++
cppuhelper/source/servicemanager.hxx | 2
desktop/Library_sofficeapp.mk | 1
desktop/qa/data/hidden-row.ods |binary
desktop/qa/desktop_lib/test_desktop_lib.cxx | 35 +
desktop/source/lib/init.cxx | 198 ++++++---
framework/source/helper/persistentwindowstate.cxx | 4
framework/source/loadenv/loadenv.cxx | 6
framework/source/services/substitutepathvars.cxx | 8
include/LibreOfficeKit/LibreOfficeKit.hxx | 5
include/cppuhelper/bootstrap.hxx | 14
include/oox/ppt/slidepersist.hxx | 3
include/vcl/bmpacc.hxx | 2
jurt/com/sun/star/lib/uno/environments/remote/Job.java | 4
jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java | 94 +++-
jurt/com/sun/star/lib/uno/environments/remote/Message.java | 37 +
officecfg/registry/schema/org/openoffice/Office/Common.xcs | 4
oox/source/ppt/pptshapegroupcontext.cxx | 9
oox/source/ppt/slidefragmenthandler.cxx | 3
oox/source/ppt/slidepersist.cxx | 3
sal/osl/all/log.cxx | 3
sal/osl/unx/file_url.cxx | 7
sc/CppunitTest_sc_tiledrendering.mk | 62 ++
sc/Module_sc.mk | 1
sc/qa/unit/tiledrendering/data/select-row-cols.ods |binary
sc/qa/unit/tiledrendering/data/sort-range.ods |binary
sc/qa/unit/tiledrendering/tiledrendering.cxx | 260 ++++++++++++
sc/sdi/scalc.sdi | 4
sc/source/ui/docshell/docsh.cxx | 8
sc/source/ui/docshell/docsh3.cxx | 8
sc/source/ui/inc/tabview.hxx | 17
sc/source/ui/unoobj/docuno.cxx | 2
sc/source/ui/view/cellsh2.cxx | 7
sc/source/ui/view/cellsh4.cxx | 31 +
sc/source/ui/view/gridwin.cxx | 13
sc/source/ui/view/gridwin4.cxx | 11
sc/source/ui/view/tabview.cxx | 3
sc/source/ui/view/tabview3.cxx | 39 +
sd/qa/unit/data/pptx/tdf93868.pptx |binary
sd/qa/unit/import-tests.cxx | 14
sd/qa/unit/tiledrendering/data/insert-delete.odp |binary
sd/qa/unit/tiledrendering/tiledrendering.cxx | 123 +++++
sd/source/core/drawdoc2.cxx | 14
sd/source/core/stlsheet.cxx | 13
sd/source/ui/func/fuinsert.cxx | 14
sd/source/ui/slidesorter/model/SlideSorterModel.cxx | 8
sd/source/ui/table/tablefunction.cxx | 20
sd/source/ui/unoidl/unomodel.cxx | 8
sfx2/source/control/unoctitm.cxx | 11
smoketest/libtest.cxx | 24 +
svx/source/table/tablecontroller.cxx | 20
sw/inc/view.hxx | 10
sw/source/uibase/uiview/view.cxx | 3
sw/source/uibase/uiview/viewport.cxx | 10
sw/source/uibase/uno/unotxdoc.cxx | 3
vcl/generic/fontmanager/fontmanager.cxx | 21
vcl/source/app/svdata.cxx | 4
vcl/source/app/svmain.cxx | 31 +
63 files changed, 1300 insertions(+), 136 deletions(-)
New commits:
commit 6b7bbca3415b5020e8964c41675633f599a339a8
Author: Matus Uzak <matus.uzak at gmail.com>
Date: Tue Mar 8 21:44:21 2016 +0100
tdf#93868: PPTX import: Incorrect inheritance of shape fill properties
DrawingML: The useBgFill attribute specifies that the shape fill
should be set to that of the slide background.
Reviewed-on: https://gerrit.libreoffice.org/23039
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit f3d1ac75c4b7fa63022e54a9cbff46ba99535076)
Change-Id: I8b568e730f00326d51e7b604579f4ff990b26f8a
diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
index 3c08f68..1a61603 100644
--- a/include/oox/ppt/slidepersist.hxx
+++ b/include/oox/ppt/slidepersist.hxx
@@ -83,7 +83,7 @@ public:
oox::drawingml::ClrMapPtr getClrMap() const { return mpClrMapPtr; }
void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr& rFillPropertiesPtr ){ mpBackgroundPropertiesPtr = rFillPropertiesPtr; }
- oox::drawingml::Color& getBackgroundColor() { return maBackgroundColor; }
+ const oox::drawingml::FillPropertiesPtr getBackgroundProperties() const { return mpBackgroundPropertiesPtr; }
bool isMasterPage() const { return mbMaster; }
bool isNotesPage() const { return mbNotes; }
@@ -127,7 +127,6 @@ private:
SlidePersistPtr mpMasterPagePtr;
oox::drawingml::ShapePtr maShapesPtr;
- oox::drawingml::Color maBackgroundColor;
oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr;
::std::list< std::shared_ptr< TimeNode > > maTimeNodeList;
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx
index 3b3d20c..d02acab 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -98,11 +98,10 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken
std::shared_ptr<PPTShape> pShape( new PPTShape( meShapeLocation, "com.sun.star.drawing.CustomShape" ) );
if( rAttribs.getBool( XML_useBgFill, false ) )
{
- ::oox::drawingml::FillProperties &aFill = pShape->getFillProperties();
- aFill.moFillType = XML_solidFill;
- // This is supposed to fill with slide (background) color, but
- // TODO: We are using white here, because thats the closest we can assume (?)
- aFill.maFillColor.setSrgbClr( API_RGB_WHITE );
+ const oox::drawingml::FillPropertiesPtr pBackgroundPropertiesPtr = mpSlidePersistPtr->getBackgroundProperties();
+ if ( pBackgroundPropertiesPtr ) {
+ pShape->getFillProperties().assignUsed( *pBackgroundPropertiesPtr );
+ }
}
pShape->setModelId(rAttribs.getString( XML_modelId ).get());
return new PPTShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, pShape );
diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx
index 2d75afc..d8c4735 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -166,9 +166,8 @@ SlideFragmentHandler::~SlideFragmentHandler()
if( mpSlidePersistPtr->getTheme() )
pFillProperties = mpSlidePersistPtr->getTheme()->getFillStyle( rAttribs.getInteger( XML_idx, -1 ) );
FillPropertiesPtr pFillPropertiesPtr( pFillProperties ? new FillProperties( *pFillProperties ) : new FillProperties() );
- ContextHandlerRef ret = new ColorContext( *this, mpSlidePersistPtr->getBackgroundColor() );
mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr );
- return ret;
+ return this;
}
break;
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index d6e3f99..f527868 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -166,8 +166,7 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase )
{
if ( mpBackgroundPropertiesPtr )
{
- sal_Int32 nPhClr = maBackgroundColor.isUsed() ?
- maBackgroundColor.getColor( rFilterBase.getGraphicHelper() ) : API_RGB_TRANSPARENT;
+ sal_Int32 nPhClr = mpBackgroundPropertiesPtr->getBestSolidColor().getColor( rFilterBase.getGraphicHelper() );
::oox::drawingml::ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() );
mpBackgroundPropertiesPtr->pushToPropMap( aPropMap, rFilterBase.getGraphicHelper(), 0, nPhClr );
diff --git a/sd/qa/unit/data/pptx/tdf93868.pptx b/sd/qa/unit/data/pptx/tdf93868.pptx
new file mode 100644
index 0000000..f54fb04
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf93868.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index fca3a8a..eb039b2 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -112,6 +112,7 @@ public:
void testTdf93830();
void testTdf93097();
void testTdf93124();
+ void testTdf93868();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -155,6 +156,7 @@ public:
CPPUNIT_TEST(testTdf93830);
CPPUNIT_TEST(testTdf93097);
CPPUNIT_TEST(testTdf93124);
+ CPPUNIT_TEST(testTdf93868);
CPPUNIT_TEST_SUITE_END();
};
@@ -1218,6 +1220,18 @@ void SdImportTest::testTdf93124()
#endif
}
+void SdImportTest::testTdf93868()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/tdf93868.pptx"), PPTX);
+
+ const SdrPage *pPage = &(GetPage( 1, xDocShRef )->TRG_GetMasterPage());
+ CPPUNIT_ASSERT_EQUAL(size_t(5), pPage->GetObjCount());
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, dynamic_cast<const XFillStyleItem&>(pPage->GetObj(0)->GetMergedItem(XATTR_FILLSTYLE)).GetValue());
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, dynamic_cast<const XFillStyleItem&>(pPage->GetObj(1)->GetMergedItem(XATTR_FILLSTYLE)).GetValue());
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
commit e529dd401d435a62b4a340161d61ae2e771d14d4
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date: Mon Mar 7 08:45:54 2016 +0400
tdf#94760 Better default values for graphics cache
Changed Total Graphic Cache Size to 64 Mb.
Changed Object Cache Size to 12 Mb.
Change-Id: I772b92f9412ccbf40c1df4e4182dcff6d634b7de
Reviewed-on: https://gerrit.libreoffice.org/22967
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
(cherry picked from commit 75c272c146045235783e1dfe26a162a8f4dee493)
(cherry picked from commit 8d0455e4bba7516550227326c32c46273ffa00da)
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 8662cfc..fef43d6 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -1486,7 +1486,7 @@
objects.</desc>
<label>Total Graphic Cache Size</label>
</info>
- <value>22000000</value>
+ <value>67110000</value>
</prop>
<prop oor:name="ObjectCacheSize" oor:type="xs:int" oor:nillable="false">
<info>
@@ -1494,7 +1494,7 @@
object.</desc>
<label>Graphic Object Cache Size</label>
</info>
- <value>5500000</value>
+ <value>12600000</value>
</prop>
<prop oor:name="ObjectReleaseTime" oor:type="xs:int" oor:nillable="false">
<info>
commit 22dc6c8cc00ef1f3330ffbfe6455115de846e25c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Mar 25 20:26:52 2016 +0100
use the ScRefCellValue already available, tdf#97989
Change-Id: Iccfff23f72d33ee012f91a230f2598b8fe3131cf
Reviewed-on: https://gerrit.libreoffice.org/23514
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
(cherry picked from commit 007b317fef91aa809deff8380a9e62c350eaf511)
(cherry picked from commit 3dae33bd19062c2328464f6d48a9ee0869679b58)
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 452a03a..c80425b 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1982,7 +1982,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
if ( bFixedWidth || bSaveAsShown )
{
Color* pDummy;
- aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &aDocument);
bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat);
}
else
@@ -1997,7 +1997,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
{
sal_uInt32 nFormat = aDocument.GetNumberFormat(aPos);
Color* pDummy;
- aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &aDocument);
}
else
aString = pCell->mpFormula->GetString().getString();
@@ -2010,7 +2010,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
{
sal_uInt32 nFormat = aDocument.GetNumberFormat(aPos);
Color* pDummy;
- aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &aDocument);
}
else
aString = pCell->mpString->getString();
@@ -2032,7 +2032,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
if ( bFixedWidth || bSaveAsShown )
{
Color* pDummy;
- aString = ScCellFormat::GetString(aDocument, aPos, nFormat, &pDummy, rFormatter);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &aDocument);
bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat);
}
else
commit 29eefe96ee9602ca6ddf286e2514001c0aa40ebd
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue Apr 19 09:23:30 2016 +0100
tdf#99387 - protect LOK document size API from corner-cases.
Change-Id: I5dd1d37ea783a65f0c8f3ad9c3c9cabf72ae036d
(cherry picked from commit 10448704b50a5cb24d38602a76656c266f8e0366)
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 8025a4b..0a26a84 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2352,7 +2352,13 @@ Size SdXImpressDocument::getDocumentSize()
if (!pViewSh)
return Size();
- SdrPageView* pCurPageView = pViewSh->GetView()->GetSdrPageView();
+ SdrView *pSdrView = pViewSh->GetView();
+ if (!pSdrView)
+ return Size();
+
+ SdrPageView* pCurPageView = pSdrView->GetSdrPageView();
+ if (!pCurPageView)
+ return Size();
Size aSize = pCurPageView->GetPageRect().GetSize();
// Convert the size in 100th mm to TWIP
commit 3d9295da60f44ca48efa5d1f26ee6ed8f757fd71
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Apr 13 17:19:57 2016 +0100
Unit test hook for online / fonts.
Change-Id: I2ae50c826f7fc66367a379447ab3b99cd1f29b4d
(cherry picked from commit 205b2be73a970508fda071310f26c0e1156da057)
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index f8cbc7d..3a7c60d 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -2218,4 +2218,25 @@ std::list< sal_Unicode > PrintFontManager::getUnicodeFromAdobeName( const OStri
return aRet;
}
+/// used by online unit tests via dlopen.
+extern "C" {
+SAL_DLLPUBLIC_EXPORT const char * unit_online_get_fonts(void)
+{
+ std::list< fontID > aFontIDs;
+ PrintFontManager &rMgr = PrintFontManager::get();
+ rMgr.getFontList(aFontIDs);
+ OStringBuffer aBuf;
+ aBuf.append( (sal_Int32)aFontIDs.size() );
+ aBuf.append( " PS fonts.\n" );
+ for( auto nId : aFontIDs )
+ {
+ const OUString& rName = rMgr.getPSName( nId );
+ aBuf.append( OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ) );
+ aBuf.append( "\n" );
+ }
+ static OString aResult = aBuf.makeStringAndClear();
+ return aResult.getStr();
+}
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 39af786db06e8b754e857494dbcf5f5904ab064a
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Fri Apr 1 15:27:52 2016 +0100
Java debugging agro.
(cherry picked from commit 964787c6b9cf834639298081b0168dd1593ee4e1)
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
index a25e31a..5c52bc1 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
@@ -19,6 +19,7 @@
package com.sun.star.lib.uno.environments.remote;
import java.text.*;
+import java.util.*;
import com.sun.star.lang.DisposedException;
/**
@@ -85,6 +86,24 @@ public class JobQueue {
}
}
+ public static void printTrace()
+ {
+ Map<Thread, StackTraceElement[]> trace = Thread.getAllStackTraces();
+ Set<Thread> set = trace.keySet();
+ Iterator<Thread> i = set.iterator();
+ while(i.hasNext())
+ {
+ Thread key = i.next();
+ System.out.println("Trace information for the thread " + key);
+ StackTraceElement[] frames = trace.get(key);
+
+ for(int j = 0; j < frames.length; j++){
+ System.err.println(frames[j]);
+ }
+ System.err.println();
+ }
+ }
+
/**
* A thread for dispatching jobs.
*/
@@ -288,13 +307,16 @@ public class JobQueue {
int count = 0;
for (Job i = _head; i != null; i = i._next)
{
- if (i.isRequest())
+ if (!i.isRequest())
multipleReturns = true;
count++;
}
if (multipleReturns)
- printDebug("ERROR: MULTIPLE RETURNS");
+ {
+ printDebug("ERROR: MULTIPLE RETURNS.patch.2");
+ printTrace();
+ }
if(DEBUG) printDebug("##### " + getClass().getName() + ".putJob to queue of " + count);
printDebug("new job : " + job.toString());
for (Job i = _head; i != null; i = i._next)
commit 6883f204cafe89e65d6d234ceca47dc5f94e6d95
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Mar 31 12:26:54 2016 +0200
sd lok bccu#1525: Don't rely on the window size in the LOK case.
Otherwise the table is inserted in the top left corner.
Change-Id: Ia5d7099d4bace6f18cd7e8d3409427119240b756
(cherry picked from commit ee246512cb0103f22f8afc0de245ea7f82143776)
diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index 7535798..e3354bf 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+#include <comphelper/lok.hxx>
#include <cppuhelper/basemutex.hxx>
#include <vcl/svapp.hxx>
@@ -149,16 +150,25 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
Size aSize( 14100, 2000 );
Point aPos;
- Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
+ Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel());
aWinRect = GetActiveWindow()->PixelToLogic(aWinRect);
// make sure that the default size of the table fits on the paper and is inside the viewing area.
// if zoomed in close, don't make the table bigger than the viewing window.
Size aMaxSize = getCurrentPage()->GetSize();
- if( aMaxSize.Height() > aWinRect.getHeight() )
- aMaxSize.setHeight( aWinRect.getHeight() );
- if( aMaxSize.Width() > aWinRect.getWidth() )
- aMaxSize.setWidth( aWinRect.getWidth() );
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ // aWinRect is nonsensical in the LOK case
+ aWinRect = Rectangle(aPos, aMaxSize);
+ }
+ else
+ {
+ if( aMaxSize.Height() > aWinRect.getHeight() )
+ aMaxSize.setHeight( aWinRect.getHeight() );
+ if( aMaxSize.Width() > aWinRect.getWidth() )
+ aMaxSize.setWidth( aWinRect.getWidth() );
+ }
if( aSize.Width() > aMaxSize.getWidth() )
aSize.setWidth( aMaxSize.getWidth() );
commit ede915c1d9ff8fb7c0aabff533946dee427f8e36
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Mon Mar 28 22:08:25 2016 +0100
handle failure to expand ~ in path elements.
This can occur in some online corner-cases.
Change-Id: Id8b419179d775a21110d682ba76d8a02f45eb828
(cherry picked from commit 24f351bda04a0a6198336981c54c5438c6dad723)
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index 3bf6c89..3460223 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -820,9 +820,8 @@ OUString SubstitutePathVariables::GetHomeVariableValue() const
OUString SubstitutePathVariables::GetPathVariableValue() const
{
-
OUString aRetStr;
- const char* pEnv = getenv( "PATH" );
+ const char* pEnv = getenv( "PATH" );
if ( pEnv )
{
@@ -836,9 +835,10 @@ OUString SubstitutePathVariables::GetPathVariableValue() const
do
{
OUString sToken = aPathList.getToken(0, SAL_PATHSEPARATOR, nToken);
- if (!sToken.isEmpty())
+ if (!sToken.isEmpty() &&
+ osl::FileBase::getFileURLFromSystemPath( sToken, aTmp ) ==
+ osl::FileBase::RC::E_None )
{
- osl::FileBase::getFileURLFromSystemPath( sToken, aTmp );
if ( bAppendSep )
aPathStrBuffer.append( ";" ); // Office uses ';' as path separator
aPathStrBuffer.append( aTmp );
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index cc9907a..6c279f5 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -257,20 +257,23 @@ oslFileError SAL_CALL osl_getFileURLFromSystemPath( rtl_uString *ustrSystemPath,
if( '~' == ustrSystemPath->buffer[0] )
{
/* check if another user is specified */
- if( ( 1 == ustrSystemPath->length ) || ( '/' == ustrSystemPath->buffer[1] ) )
+ if( ( 1 == ustrSystemPath->length ) ||
+ ( '/' == ustrSystemPath->buffer[1] ) )
{
/* osl_getHomeDir returns file URL */
oslSecurity pSecurity = osl_getCurrentSecurity();
osl_getHomeDir( pSecurity , &pTmp );
osl_freeSecurityHandle( pSecurity );
+ if (!pTmp)
+ return osl_File_E_INVAL;
+
/* remove "file://" prefix */
rtl_uString_newFromStr_WithLength( &pTmp, pTmp->buffer + 7, pTmp->length - 7 );
/* replace '~' in original string */
rtl_uString_newReplaceStrAt( &pTmp, ustrSystemPath, 0, 1, pTmp );
}
-
else
{
/* FIXME: replace ~user with users home directory */
commit 7f09682826bb29d5a4355cdb04cb22fa0e904385
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Wed Jan 27 23:49:51 2016 +0100
Cleanup previous commit etc.
(cherry picked from commit ec60e33dd83b1bdec01b2c4a1dbaa15e92c9f6b5)
diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx
index a2d68e7..d24221d 100644
--- a/binaryurp/source/bridge.cxx
+++ b/binaryurp/source/bridge.cxx
@@ -286,7 +286,7 @@ void Bridge::terminate(bool final) {
}
w = writer_;
joinW = !isThread(writer_.get());
- assert(!final || joinW);
+ assert(!final || joinW); // horror crash here ? ....
if (joinW) {
writer_.clear();
}
diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx
index b63e737..63187c4 100644
--- a/binaryurp/source/writer.cxx
+++ b/binaryurp/source/writer.cxx
@@ -118,7 +118,7 @@ void Writer::queueRequest(
items_.set();
SAL_DEBUG("writer::queueRequest tid " << getAsString(tid) <<
- " type " << OUString(type.get()->pTypeName) <<
+// " type " << OUString(type.get()->pTypeName) <<
" member " << OUString(member.get()->pTypeName));
}
@@ -215,10 +215,10 @@ void Writer::sendRequest(
css::uno::UnoInterfaceReference const & currentContext)
{
SAL_DEBUG("writer::sendRequest tid " << getAsString(tid) <<
- " type " << OUString(type.get()->pTypeName) <<
+// " type " << OUString(type.get()->pTypeName) <<
" member " << OUString(member.get()->pTypeName) <<
- " cctx mode? " << currentContextMode <<
- " cur ctx " << currentContext.get());
+ " cctx mode? " << currentContextMode);
+// " cur ctx " << currentContext.get()); - currentContext ref -> null
OSL_ASSERT(tid.getLength() != 0 && !oid.isEmpty() && member.is());
css::uno::TypeDescription t(type);
commit a59f5fdfb5b2cbb61bd13519d77afc9c1b9df23d
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Tue Jan 26 17:09:53 2016 +0000
Write-queue timestamped debugging.
(cherry picked from commit 436745ea87a642789b5960eae7efd8d1e09eb512)
diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx
index 7558f82..b63e737 100644
--- a/binaryurp/source/writer.cxx
+++ b/binaryurp/source/writer.cxx
@@ -35,6 +35,17 @@
#include "currentcontext.hxx"
#include "specialfunctionids.hxx"
#include "writer.hxx"
+#include <rtl/ustrbuf.hxx>
+
+namespace {
+ OUString getAsString(const rtl::ByteSequence &tid)
+ {
+ OUStringBuffer aStr;
+ for (sal_Int32 i = 0; i < tid.getLength(); ++i)
+ aStr.append((sal_Int32)tid[i], 16);
+ return aStr.makeStringAndClear();
+ }
+}
namespace binaryurp {
@@ -105,6 +116,10 @@ void Writer::queueRequest(
osl::MutexGuard g(mutex_);
queue_.push_back(Item(tid, oid, type, member, inArguments, cc));
items_.set();
+
+ SAL_DEBUG("writer::queueRequest tid " << getAsString(tid) <<
+ " type " << OUString(type.get()->pTypeName) <<
+ " member " << OUString(member.get()->pTypeName));
}
void Writer::queueReply(
@@ -119,6 +134,12 @@ void Writer::queueReply(
tid, member, setter, exception, returnValue, outArguments,
setCurrentContextMode));
items_.set();
+
+ SAL_DEBUG("writer::queueReply tid " << getAsString(tid) <<
+ " member " << OUString(member.get()->pTypeName) <<
+ " exception? " << exception <<
+ " setter " << setter <<
+ " setCurrentContextMode " << setCurrentContextMode);
}
void Writer::unblock() {
@@ -193,6 +214,12 @@ void Writer::sendRequest(
std::vector< BinaryAny > const & inArguments, bool currentContextMode,
css::uno::UnoInterfaceReference const & currentContext)
{
+ SAL_DEBUG("writer::sendRequest tid " << getAsString(tid) <<
+ " type " << OUString(type.get()->pTypeName) <<
+ " member " << OUString(member.get()->pTypeName) <<
+ " cctx mode? " << currentContextMode <<
+ " cur ctx " << currentContext.get());
+
OSL_ASSERT(tid.getLength() != 0 && !oid.isEmpty() && member.is());
css::uno::TypeDescription t(type);
sal_Int32 functionId = 0;
@@ -341,6 +368,11 @@ void Writer::sendReply(
bool exception, BinaryAny const & returnValue,
std::vector< BinaryAny > const & outArguments)
{
+ SAL_DEBUG("writer::sendReply tid " << getAsString(tid) <<
+ " member " << OUString(member.get()->pTypeName) <<
+ " exception? " << exception <<
+ " setter " << setter);
+
OSL_ASSERT(tid.getLength() != 0 && member.is() && member.get()->bComplete);
std::vector< unsigned char > buf;
bool newTid = tid != lastTid_;
diff --git a/sal/osl/all/log.cxx b/sal/osl/all/log.cxx
index 994169a..fe17931 100644
--- a/sal/osl/all/log.cxx
+++ b/sal/osl/all/log.cxx
@@ -240,6 +240,9 @@ void log(
syslog(prio, "%s", s.str().c_str());
#endif
} else {
+ TimeValue pTime = { 0, 0 };
+ osl_getSystemTime(&pTime);
+ std::fprintf(stderr, "T%ld.%.9ld - ", (long)pTime.Seconds, (long)pTime.Nanosec);
std::fputs(s.str().c_str(), stderr);
std::fflush(stderr);
}
commit 2a0a87516fb17bc63515aaeb90e948b0256ac77b
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Fri Jan 22 11:13:57 2016 +0000
Implement jurt message and job printing ...
(cherry picked from commit 1d875b385f125542c12b3935561f5b3fef72c956)
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Job.java b/jurt/com/sun/star/lib/uno/environments/remote/Job.java
index a9cd28d..f2043f3 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/Job.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/Job.java
@@ -139,6 +139,10 @@ public class Job {
return _iMessage.isSynchronous();
}
+ public String toString() {
+ return _iMessage.toString();
+ }
+
public void dispose() {
// _oId = null;
// _iReceiver = null;
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
index f6ff174..a25e31a 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java
@@ -18,6 +18,7 @@
package com.sun.star.lib.uno.environments.remote;
+import java.text.*;
import com.sun.star.lang.DisposedException;
/**
@@ -40,7 +41,7 @@ public class JobQueue {
/**
* When set to true, enables various debugging output.
*/
- private static final boolean DEBUG = false;
+ private static final boolean DEBUG = true;
protected Job _head; // the head of the job list
protected Job _tail; // the tail of the job list
@@ -62,6 +63,28 @@ public class JobQueue {
protected JavaThreadPoolFactory _javaThreadPoolFactory;
+ public static String getTime()
+ {
+ try {
+ DecimalFormat df = new DecimalFormat("000000.000000000");
+ return "T" + df.format((double)System.currentTimeMillis()/1000) + " ";
+ } catch (Exception e) {
+ return "Texcept " + e;
+ }
+ }
+
+ public static void printDebug(String str)
+ {
+ if (DEBUG)
+ {
+
+ String print = getTime() + " [" +
+ Thread.currentThread().getId() + "] " + str;
+ System.err.println(print);
+ System.err.flush();
+ }
+ }
+
/**
* A thread for dispatching jobs.
*/
@@ -71,7 +94,7 @@ public class JobQueue {
JobDispatcher(Object disposeId) {
super("JobDispatcher");
- if(DEBUG) System.err.println("JobQueue$JobDispatcher.<init>:" + _threadId);
+ if(DEBUG) printDebug("JobQueue$JobDispatcher.<init>:" + _threadId);
_disposeId = disposeId;
}
@@ -82,13 +105,13 @@ public class JobQueue {
@Override
public void run() {
- if(DEBUG) System.err.println("ThreadPool$JobDispatcher.run: " + Thread.currentThread());
+ if(DEBUG) printDebug("ThreadPool$JobDispatcher.run");
try {
enter(2000, _disposeId);
} catch(Throwable throwable) {
if(_head != null || _active) { // there was a job in progress, so give a stack
- System.err.println(getClass().getName() + " - exception occurred:" + throwable);
+ printDebug(getClass().getName() + " - exception occurred:" + throwable);
throwable.printStackTrace(System.err);
}
}
@@ -96,7 +119,7 @@ public class JobQueue {
release();
}
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".run - exit:" + _threadId);
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".run - exit:" + _threadId);
}
}
@@ -125,7 +148,7 @@ public class JobQueue {
acquire();
- if(DEBUG) System.err.println("##### " + getClass().getName() + " - init:" + _threadId);
+ if(DEBUG) printDebug("##### " + getClass().getName() + " - init:" + _threadId);
}
/**
@@ -141,7 +164,7 @@ public class JobQueue {
_createThread = createThread;
_createThread_now = createThread;
- if(DEBUG) System.err.println("##### " + getClass().getName() + " - init:" + _threadId + " " + createThread);
+ if(DEBUG) printDebug("##### " + getClass().getName() + " - init:" + _threadId + " " + createThread);
}
/**
@@ -185,7 +208,7 @@ public class JobQueue {
* @return a job or null if timed out.
*/
private Job removeJob(int waitTime) {
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId);
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".removeJob:" + _head + " " + _threadId);
Job job = null;
synchronized (this) {
@@ -230,7 +253,7 @@ public class JobQueue {
synchronized(_async_jobQueue) {
// wait for async queue to be empty and last job to be done
while(_async_jobQueue._active || _async_jobQueue._head != null) {
- if(DEBUG) System.err.println("waiting for async:" + _async_jobQueue._head + " " + _async_jobQueue._worker_thread);
+ if(DEBUG) printDebug("waiting for async:" + _async_jobQueue._head + " " + _async_jobQueue._worker_thread);
if(_doDispose == _disposeId) {
_doDispose = null;
@@ -247,6 +270,9 @@ public class JobQueue {
}
}
+ if(DEBUG)
+ printDebug("##### " + getClass().getName() + ".removeJob: - returns job: " + job);
+
return job;
}
@@ -257,7 +283,23 @@ public class JobQueue {
* @param disposeId a dispose id.
*/
synchronized void putJob(Job job, Object disposeId) {
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".putJob todoes: " + " job:" + job);
+
+ boolean multipleReturns = false;
+ int count = 0;
+ for (Job i = _head; i != null; i = i._next)
+ {
+ if (i.isRequest())
+ multipleReturns = true;
+ count++;
+ }
+
+ if (multipleReturns)
+ printDebug("ERROR: MULTIPLE RETURNS");
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".putJob to queue of " + count);
+ printDebug("new job : " + job.toString());
+ for (Job i = _head; i != null; i = i._next)
+ printDebug("queued : " + i.toString());
+ printDebug("");
if(_tail != null)
_tail._next = job;
@@ -296,7 +338,7 @@ public class JobQueue {
* @return the result of the final job (reply).
*/
Object enter(int waitTime, Object disposeId) throws Throwable {
- if(DEBUG) System.err.println("#####" + getClass().getName() + ".enter: " + _threadId);
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".enter: " + _threadId);
boolean quit = false;
@@ -332,11 +374,9 @@ public class JobQueue {
}
else
quit = true;
-
-
}
finally { // ensure that this queue becomes disposed, if necessary
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".enter leaving: " + _threadId + " " + _worker_thread + " " + hold_worker_thread + " " + result);
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".enter leaving: " + _threadId + " " + _worker_thread + " " + hold_worker_thread + " " + result);
synchronized(this) {
if(job != null || (quit && _head == null)) {
@@ -356,6 +396,8 @@ public class JobQueue {
}
}
+ if(DEBUG) printDebug("##### " + getClass().getName() + ".enter: returns " + result + " on thread: " + _threadId);
+
return result;
}
@@ -370,7 +412,7 @@ public class JobQueue {
_throwable = throwable;
// get thread out of wait and let it throw the throwable
- if(DEBUG) System.err.println(getClass().getName() + ".dispose - notifying thread");
+ if(DEBUG) printDebug(getClass().getName() + ".dispose - notifying thread");
notifyAll();
}
diff --git a/jurt/com/sun/star/lib/uno/environments/remote/Message.java b/jurt/com/sun/star/lib/uno/environments/remote/Message.java
index cfdd1f3..67803ed 100644
--- a/jurt/com/sun/star/lib/uno/environments/remote/Message.java
+++ b/jurt/com/sun/star/lib/uno/environments/remote/Message.java
@@ -173,6 +173,43 @@ public class Message {
return arguments;
}
+ public final String toString()
+ {
+ String aResult;
+ aResult = request ? "request: " : "reply: ";
+ aResult = aResult + (synchronous ? "sync " : "async ");
+ if (abnormalTermination)
+ aResult = aResult + "!abnormal! ";
+ aResult = aResult + "tid: " + threadId + " ";
+ aResult = aResult + "oid: " + objectId + " ";
+
+ if (type != null)
+ aResult = aResult + type.getTypeName() + " ";
+ else
+ aResult = aResult + "<null type> ";
+
+ if (method != null)
+ aResult = aResult + method.getName() + " ";
+ else
+ aResult = aResult + "<null method> ";
+
+ if (arguments != null)
+ {
+ aResult = aResult + "( ";
+ for (int i = 0; i < arguments.length; ++i)
+ aResult = aResult + arguments[i] + ", ";
+ aResult = aResult + ") ";
+ }
+ else
+ aResult = aResult + "<nullargs> ";
+
+ if (result != null)
+ aResult = aResult + "result " + result;
+ else
+ aResult = aResult + "<noresult> ";
+ return aResult;
+ }
+
private final ThreadId threadId;
private final boolean request;
private final String objectId;
commit 9d1fefaa6c14810915720c36416a61a8debe8faf
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Mar 22 14:06:15 2016 +0200
Some more sanity asserts can't hurt
Change-Id: I9b2f70ea98968aa98498cb754c2ebe494b6ecda7
(cherry picked from commit 6a215542794b71acc2a76984f2ab485876825c34)
diff --git a/include/vcl/bmpacc.hxx b/include/vcl/bmpacc.hxx
index 4e9c44f..e2efa91 100644
--- a/include/vcl/bmpacc.hxx
+++ b/include/vcl/bmpacc.hxx
@@ -351,7 +351,9 @@ inline Scanline BitmapReadAccess::GetScanline(long nY) const
inline BitmapColor BitmapReadAccess::GetPixel(long nY, long nX) const
{
assert(mpBuffer && mpScanBuf && "Access is not valid!");
+ assert(nX >= 0 && "x-coordinate out of range!");
assert(nX < mpBuffer->mnWidth && "x-coordinate out of range!");
+ assert(nY >= 0 && "y-coordinate out of range!");
assert(nY < mpBuffer->mnHeight && "y-coordinate out of range!");
return mFncGetPixel(mpScanBuf[nY], nX, maColorMask );
commit 6de58f5c7ff0e5ee0f7d942cf2fc9ae73b5bb3f9
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Sep 7 17:21:38 2015 -0400
preInitBootstrap call takes context
Change-Id: I85b951f7d28d3d8af40b7d5f86b310021a079428
(cherry picked from commit 1c565696231ae5296a47bbb9df78d80d2da031f4)
(cherry picked from commit df63131bfa652328f5b46bd638eb6f88deeeadf6)
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 075cb4f..2148d33 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1851,7 +1851,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
{
InitVCL();
// pre-load all component libraries.
- cppu::preInitBootstrap();
+ cppu::preInitBootstrap(xContext);
// Release Solar Mutex, lo_startmain thread should acquire it.
Application::ReleaseSolarMutex();
}
commit 1ce3fbfa868bda383b89ea1e54a37b8bc44c7be5
Author: Henry Castro <hcastro at collabora.com>
Date: Sat Sep 12 12:11:43 2015 -0400
vcl: desktop terminate, to dispose objects
In the preinit stage, the Desktop terminate() method is never called
when lo_startmain thread is disposing objects. This produces debug
assertions and osl assertions.
It is forced to call terminate() method, when a tiled rendering case is
active then it has a clean disposing objects process.
However DBGGUI_DEINIT_SOLARMUTEXCHECK() check is moved at the end to
prevent debug assertions solar mutex complains.
Change-Id: I4a9b6398296d9150ab748a8d48868a08e7232909
(cherry picked from commit ba29b6ddf4c079a93a8484e95aa42daf2b54a54b)
(cherry picked from commit 58c4cd90d34aab5eb13380ef05d67ea7d2aaa225)
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index e6f4be1..e59f73d 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -28,6 +28,7 @@
#include "tools/resmgr.hxx"
#include "comphelper/processfactory.hxx"
+#include "comphelper/lok.hxx"
#include "unotools/syslocaleoptions.hxx"
#include "vcl/svapp.hxx"
@@ -449,8 +450,6 @@ void DeInitVCL()
}
pSVData->mpDefaultWin.disposeAndClear();
- DBGGUI_DEINIT_SOLARMUTEXCHECK();
-
if ( pSVData->mpUnoWrapper )
{
try
@@ -458,6 +457,12 @@ void DeInitVCL()
uno::Reference<frame::XDesktop2> const xDesktop = frame::Desktop::create(
comphelper::getProcessComponentContext() );
xDesktop->addEventListener(new VCLUnoWrapperDeleter());
+
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ SAL_WARN_IF(!xDesktop.is(), "desktop.app", "No Desktop interface");
+ xDesktop->terminate();
+ }
}
catch (uno::Exception const&)
{
@@ -577,6 +582,8 @@ void DeInitVCL()
}
EmbeddedFontsHelper::clearTemporaryFontFiles();
+
+ DBGGUI_DEINIT_SOLARMUTEXCHECK();
}
// only one call is allowed
commit 0da9ee6aa521b8a5c8606f45d17e796a7e2b1f57
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Sep 7 17:43:04 2015 -0400
vcl: assign NULL after deleting
In the preinit stage, the VCL initialization is done by the parent process
and when the lo_startmain thread de-initialize the VCL, some services are
disposed early, and it causes segmentation violation.
So it is ensured that pointers to service objetcs is set NULL after the
delete.
Change-Id: I65ecfc2d2694a981ec2986988efabdfd28d0cce4
(cherry picked from commit fca0980ec866279cc40ed1233bbddb2e4abe2fae)
(cherry picked from commit 48eac22cce93c08d13022a7215b9549379453695)
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index fbde610..b830f83 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -100,10 +100,10 @@ void ImplDeInitSVData()
// delete global instance data
if( pSVData->mpSettingsConfigItem )
- delete pSVData->mpSettingsConfigItem;
+ delete pSVData->mpSettingsConfigItem, pSVData->mpSettingsConfigItem = NULL;
if( pSVData->mpDockingManager )
- delete pSVData->mpDockingManager;
+ delete pSVData->mpDockingManager, pSVData->mpDockingManager = NULL;
if( pSVData->maCtrlData.mpFieldUnitStrings )
delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = nullptr;
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index d2c13f7..e6f4be1 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -394,7 +394,7 @@ void DeInitVCL()
delete pSVData->mpSettingsConfigItem, pSVData->mpSettingsConfigItem = nullptr;
if ( pSVData->maAppData.mpIdleMgr )
- delete pSVData->maAppData.mpIdleMgr;
+ delete pSVData->maAppData.mpIdleMgr, pSVData->maAppData.mpIdleMgr = NULL;
Scheduler::ImplDeInitScheduler();
if ( pSVData->maWinData.mpMsgBoxImgList )
@@ -564,7 +564,11 @@ void DeInitVCL()
pSVData->mpSalTimer = nullptr;
// Deinit Sal
- DestroySalInstance( pSVData->mpDefInst );
+ if (pSVData->mpDefInst)
+ {
+ DestroySalInstance( pSVData->mpDefInst );
+ pSVData->mpDefInst = NULL;
+ }
if( pOwnSvApp )
{
commit 77e5a301643ff13b02246083945eb3216c79726d
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Sep 7 17:33:09 2015 -0400
vcl: add isInitVCL, to not initialize twice
In the preinit stage, the VCL is initialized in the parent process
and when the lo_startmain thread is started, the thread initialize
VCL again.
It is not necessary to initialize twice.
Change-Id: I819cf0125afe7760c3f4d91c420d36a3a383902c
(cherry picked from commit f0f7eb475ba402ceafa1d6f1956e7dfe7779615d)
(cherry picked from commit 19349554e77a23c0cb551b886f51e854ca174df0)
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 41243b6..d2c13f7 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -92,6 +92,8 @@
using namespace ::com::sun::star;
+bool isInitVCL();
+
oslSignalAction SAL_CALL VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo* pInfo)
{
static bool bIn = false;
@@ -161,7 +163,7 @@ int ImplSVMain()
int nReturn = EXIT_FAILURE;
- bool bInit = InitVCL();
+ bool bInit = (!isInitVCL() ? InitVCL() : true);
if( bInit )
{
@@ -244,6 +246,14 @@ uno::Any SAL_CALL DesktopEnvironmentContext::getValueByName( const OUString& Nam
return retVal;
}
+bool isInitVCL()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ return pExceptionHandler != NULL &&
+ pSVData->mpApp != NULL &&
+ pSVData->mpDefInst != NULL;
+}
+
bool InitVCL()
{
if( pExceptionHandler != nullptr )
commit 074a0b78b14c69f713e6d1840ea1e62c4ce38906
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Sep 7 17:17:22 2015 -0400
cppuhelper: add preInitBootstrap symbol
In the preinit stage, the preInitBootstrap is called to load
implementations for each service registered by the service manager.
All service requests are: initial Component Context and the process
service factory is set.
However, some services require that VCL is properly initialized.
(cherry picked from commit 78df8373b6442ee3d3b09101988817cf621c189b)
Change-Id: Ib116e3da172b860f2df4d672f6181b5de0b7e6b2
diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx
index 6720434..5a46ed4 100644
--- a/cppuhelper/source/defaultbootstrap.cxx
+++ b/cppuhelper/source/defaultbootstrap.cxx
@@ -42,19 +42,6 @@ rtl::OUString getBootstrapVariable(
}
return v;
}
-
-void default_preInitBootstrap(rtl::OUString const & aUri)
-{
- rtl::Bootstrap bsUri(aUri);
- if (bsUri.getHandle() == 0)
- throw css::uno::DeploymentException("Cannot open uno ini " + aUri);
-
- // create the service manager
- rtl::Reference< cppuhelper::ServiceManager > aManager(new cppuhelper::ServiceManager);
- // read rdb files
- aManager->init(getBootstrapVariable(bsUri, "UNO_SERVICES"));
- aManager->loadImplementations();
-}
}
css::uno::Reference< css::uno::XComponentContext >
@@ -120,8 +107,24 @@ cppu::defaultBootstrap_InitialComponentContext()
}
void
-cppu::preInitBootstrap()
+cppu::preInitBootstrap(css::uno::Reference< css::uno::XComponentContext > const & xContext)
{
- default_preInitBootstrap(getUnoIniUri());
+ if (!xContext.is())
+ throw css::uno::DeploymentException("preInit: XComponentContext is not created");
+
+ css::uno::Reference< css::uno::XInterface > xService;
+ xContext->getValueByName("/singletons/com.sun.star.lang.theServiceManager") >>= xService;
+ if (!xService.is())
+ throw css::uno::DeploymentException("preInit: XMultiComponentFactory is not created");
+
+ rtl::Reference<cppuhelper::ServiceManager> aService(reinterpret_cast<cppuhelper::ServiceManager*>(xService.get()));
+
+ // pre-requisites:
+ // In order to load implementations and invoke
+ // component factory it is required:
+ // 1) defaultBootstrap_InitialComponentContext()
+ // 2) comphelper::setProcessServiceFactory(xSFactory);
+ // 3) InitVCL()
+ aService->loadImplementations();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index 3d7a5c6..6344bc2 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -423,7 +423,7 @@ global:
# enableChangeListenerNotification
_ZN4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
_ZThn*_N4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
- _ZN4cppu16preInitBootstrapEv;
+ _ZN4cppu16preInitBootstrapERKN3com3sun4star3uno9ReferenceINS3_17XComponentContextEEE;
} UDK_3.7;
LIBO_UDK_3.9 { # LibO 3.7
diff --git a/include/cppuhelper/bootstrap.hxx b/include/cppuhelper/bootstrap.hxx
index 0330d46..67335ad 100644
--- a/include/cppuhelper/bootstrap.hxx
+++ b/include/cppuhelper/bootstrap.hxx
@@ -57,6 +57,16 @@ CPPUHELPER_DLLPUBLIC sal_Bool SAL_CALL installTypeDescriptionManager(
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL
defaultBootstrap_InitialComponentContext();
+/** preload component shared library with service manager upon
+ information from bootstrap variables.
+
+ This function tries to find its parameters via these bootstrap variables:
+
+ - UNO_SERVICES -- a space separated list of file urls of service rdbs
+
+*/
+CPPUHELPER_DLLPUBLIC void SAL_CALL
+preInitBootstrap(css::uno::Reference< css::uno::XComponentContext > const & xContext);
/** Bootstraps an initial component context with service manager upon
information from an ini file.
@@ -72,6 +82,7 @@ defaultBootstrap_InitialComponentContext();
@param iniFile ini filename to get bootstrap variables
@return component context
*/
+
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL
defaultBootstrap_InitialComponentContext(const ::rtl::OUString & iniFile);
commit bcfef8da178cbb4bd1015ca34e4a25612090b4d6
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Sep 7 17:11:45 2015 -0400
cppuhelper: method 1, load implementations to invoke component factory
In the preinit stage, for each library that is registered by the service
manager, is loaded with the flag SAL_LOADMODULE_NOW and the component
factory is invoked to initialize its data.
Change-Id: Ie6f6d769b611c8440ddab802545e6bdc482d1476
(cherry picked from commit 0e008a27e7f4e9b08a7b2bbd33702df336f1bca4)
(cherry picked from commit 194f58dc19743e4f21789e09ff8220ce3ce68383)
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 5ad7b69..2cdc724 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -33,6 +33,8 @@
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/shlib.hxx>
#include <osl/file.hxx>
#include <rtl/ref.hxx>
#include <rtl/uri.hxx>
@@ -880,13 +882,16 @@ void cppuhelper::ServiceManager::loadImplementations()
{
rtl::OUString aUri;
osl::MutexGuard g(rBHelper.rMutex);
+ css::uno::Environment aSourceEnv(css::uno::Environment::getCurrent());
+ // loop all implementations
for (Data::NamedImplementations::const_iterator iterator(
data_.namedImplementations.begin());
iterator != data_.namedImplementations.end(); ++iterator)
{
try
{
+ // expand absolute URI implementation component library
aUri = cppu::bootstrap_expandUri(iterator->second->info->uri);
}
catch (css::lang::IllegalArgumentException& aError)
@@ -899,13 +904,84 @@ void cppuhelper::ServiceManager::loadImplementations()
if (iterator->second->info->loader == "com.sun.star.loader.SharedLibrary" &&
iterator->second->status != Data::Implementation::STATUS_LOADED)
{
- oslModule aModule = osl_loadModule( aUri.pData, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL );
- SAL_INFO("lok", "loaded component library " << aUri << ( aModule ? " ok" : " no"));
+ // load component library
+ osl::Module aModule(aUri, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL);
+ SAL_INFO("lok", "loaded component library " << aUri << ( aModule.is() ? " ok" : " no"));
- // leak aModule
- // osl_unloadModule(aModule);
- if ( aModule )
+ if (aModule.is() &&
+ !iterator->second->info->environment.isEmpty())
+ {
+ OUString aSymFactory;
+ oslGenericFunction fpFactory;
+ css::uno::Environment aTargetEnv;
+ css::uno::Reference<css::uno::XInterface> xFactory;
+
+ if(iterator->second->info->constructor.isEmpty())
+ {
+ // expand full name component factory symbol
+ if (iterator->second->info->prefix == "direct")
+ aSymFactory = iterator->second->info->name.replace('.', '_') + "_" COMPONENT_GETFACTORY;
+ else if (!iterator->second->info->prefix.isEmpty())
+ aSymFactory = iterator->second->info->prefix + "_" COMPONENT_GETFACTORY;
+ else
+ aSymFactory = COMPONENT_GETFACTORY;
+
+ // get function symbol component factory
+ fpFactory = aModule.getFunctionSymbol(aSymFactory);
+ if (fpFactory == 0)
+ {
+ throw css::loader::CannotActivateFactoryException(
+ ("no factory symbol \"" + aSymFactory + "\" in component library :" + aUri),
+ css::uno::Reference<css::uno::XInterface>());
+ }
+
+ aTargetEnv = cppuhelper::detail::getEnvironment(iterator->second->info->environment, iterator->second->info->name);
+ component_getFactoryFunc fpComponentFactory = reinterpret_cast<component_getFactoryFunc>(fpFactory);
+
+ if (aSourceEnv.get() == aTargetEnv.get())
+ {
+ // invoke function component factory
+ OString aImpl(rtl::OUStringToOString(iterator->second->info->name, RTL_TEXTENCODING_ASCII_US));
+ xFactory.set(css::uno::Reference<css::uno::XInterface>(static_cast<css::uno::XInterface *>(
+ (*fpComponentFactory)(aImpl.getStr(), this, 0)), SAL_NO_ACQUIRE));
+ }
+ }
+ else
+ {
+ // get function symbol component factory
+ fpFactory = aModule.getFunctionSymbol(iterator->second->info->constructor);
+ }
+
+ css::uno::Reference<css::lang::XSingleComponentFactory> xSCFactory;
+ css::uno::Reference<css::lang::XSingleServiceFactory> xSSFactory;
+
+ // query interface XSingleComponentFactory or XSingleServiceFactory
+ if (xFactory.is())
+ {
+ xSCFactory.set(xFactory, css::uno::UNO_QUERY);
+ if (!xSCFactory.is())
+ {
+ xSSFactory.set(xFactory, css::uno::UNO_QUERY);
+ if (!xSSFactory.is())
+ {
+ throw css::uno::DeploymentException(
+ ("Implementation " + iterator->second->info->name
+ + " does not provide a constructor or factory"),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ }
+ }
+
+ if (!iterator->second->info->constructor.isEmpty() && fpFactory)
+ iterator->second->constructor = reinterpret_cast<ImplementationConstructorFn *>(fpFactory);
+
+ iterator->second->factory1 = xSCFactory;
+ iterator->second->factory2 = xSSFactory;
iterator->second->status = Data::Implementation::STATUS_LOADED;
+
+ }
+ // leak aModule
+ aModule.release();
}
}
}
commit 9d4e7e7f0242819eeaefddc452893c8d644dc0c0
Author: Andras Timar <andras.timar at collabora.com>
Date: Sun Jun 12 22:06:14 2016 +0200
build fix
Change-Id: I86ba87c7022bbfa45bff45576a9a65ad65e8e7a8
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 6549784..1843357 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -97,7 +97,7 @@ ScModelObj* ScTiledRenderingTest::createDoc(const char* pName)
{
if (mxComponent.is())
mxComponent->dispose();
- mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName), "com.sun.star.sheet.SpreadsheetDocument");
+ mxComponent = loadFromDesktop(getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName), "com.sun.star.sheet.SpreadsheetDocument");
ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
CPPUNIT_ASSERT(pModelObj);
pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
commit 49fbe72f326423fdedfa511cca1df69858d6e78e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Thu Jan 28 18:31:03 2016 -0500
Restoring preinit
(cherry picked from commit 62a2d525a7db09c7223a21907e1a0f4989398c15)
Change-Id: I65341c57d00308d246ec90deab8050b2c4bb3e61
diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx
index bede6b5..6720434 100644
--- a/cppuhelper/source/defaultbootstrap.cxx
+++ b/cppuhelper/source/defaultbootstrap.cxx
@@ -43,6 +43,18 @@ rtl::OUString getBootstrapVariable(
return v;
}
+void default_preInitBootstrap(rtl::OUString const & aUri)
+{
+ rtl::Bootstrap bsUri(aUri);
+ if (bsUri.getHandle() == 0)
+ throw css::uno::DeploymentException("Cannot open uno ini " + aUri);
+
+ // create the service manager
+ rtl::Reference< cppuhelper::ServiceManager > aManager(new cppuhelper::ServiceManager);
+ // read rdb files
+ aManager->init(getBootstrapVariable(bsUri, "UNO_SERVICES"));
+ aManager->loadImplementations();
+}
}
css::uno::Reference< css::uno::XComponentContext >
@@ -107,4 +119,9 @@ cppu::defaultBootstrap_InitialComponentContext()
return defaultBootstrap_InitialComponentContext(getUnoIniUri());
}
+void
+cppu::preInitBootstrap()
+{
+ default_preInitBootstrap(getUnoIniUri());
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map
index 12c29834a..3d7a5c6 100644
--- a/cppuhelper/source/gcc3.map
+++ b/cppuhelper/source/gcc3.map
@@ -423,6 +423,7 @@ global:
# enableChangeListenerNotification
_ZN4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
_ZThn*_N4cppu19OPropertySetHelper232enableChangeListenerNotificationEh;
+ _ZN4cppu16preInitBootstrapEv;
} UDK_3.7;
LIBO_UDK_3.9 { # LibO 3.7
diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx
index 9f93d70..5ad7b69 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -40,6 +40,7 @@
#include <rtl/strbuf.hxx>
#include <sal/log.hxx>
#include <uno/environment.hxx>
+#include <osl/module.hxx>
#include "loadsharedlibcomponentfactory.hxx"
@@ -875,6 +876,40 @@ void cppuhelper::ServiceManager::loadImplementation(
}
}
+void cppuhelper::ServiceManager::loadImplementations()
+{
+ rtl::OUString aUri;
+ osl::MutexGuard g(rBHelper.rMutex);
+
+ for (Data::NamedImplementations::const_iterator iterator(
+ data_.namedImplementations.begin());
+ iterator != data_.namedImplementations.end(); ++iterator)
+ {
+ try
+ {
+ aUri = cppu::bootstrap_expandUri(iterator->second->info->uri);
+ }
+ catch (css::lang::IllegalArgumentException& aError)
+ {
+ throw css::uno::DeploymentException(
+ "Cannot expand URI" + iterator->second->info->uri + ": " + aError.Message,
+ static_cast< cppu::OWeakObject * >(this));
+ }
+
+ if (iterator->second->info->loader == "com.sun.star.loader.SharedLibrary" &&
+ iterator->second->status != Data::Implementation::STATUS_LOADED)
+ {
+ oslModule aModule = osl_loadModule( aUri.pData, SAL_LOADMODULE_NOW | SAL_LOADMODULE_GLOBAL );
+ SAL_INFO("lok", "loaded component library " << aUri << ( aModule ? " ok" : " no"));
+
+ // leak aModule
+ // osl_unloadModule(aModule);
+ if ( aModule )
+ iterator->second->status = Data::Implementation::STATUS_LOADED;
+ }
+ }
+}
+
void cppuhelper::ServiceManager::disposing() {
std::vector< css::uno::Reference<css::lang::XComponent> > sngls;
std::vector< css::uno::Reference< css::lang::XComponent > > comps;
diff --git a/cppuhelper/source/servicemanager.hxx b/cppuhelper/source/servicemanager.hxx
index d7f8f90..8da1927 100644
--- a/cppuhelper/source/servicemanager.hxx
+++ b/cppuhelper/source/servicemanager.hxx
@@ -203,6 +203,8 @@ public:
css::uno::Reference< css::uno::XComponentContext > const & context,
std::shared_ptr< Data::Implementation > & implementation);
+ void loadImplementations();
+
private:
virtual ~ServiceManager() {}
diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index ef95ecf..b041233 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -60,6 +60,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
ucbhelper \
utl \
vcl \
+ xmlreader \
$(gb_UWINAPI) \
))
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 20beed9..075cb4f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -47,6 +47,8 @@
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/util/URLTransformer.hpp>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
@@ -1710,6 +1712,7 @@ static bool initialize_uno(const OUString& aAppProgramURL)
#endif
xContext = cppu::defaultBootstrap_InitialComponentContext();
+
if (!xContext.is())
{
gImpl->maLastExceptionMsg = "XComponentContext could not be created";
@@ -1742,6 +1745,9 @@ static void lo_startmain(void*)
{
osl_setThreadName("lo_startmain");
+ if (GetpApp())
+ Application::GetSolarMutex().tryToAcquire();
+
soffice_main();
}
@@ -1770,20 +1776,39 @@ static void lo_status_indicator_callback(void *data, comphelper::LibreOfficeKit:
static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfilePath)
{
+ enum {
+ PRE_INIT, // setup shared data in master process
+ SECOND_INIT, // complete init. after fork
+ FULL_INIT // do a standard complete init.
+ } eStage;
+
+ // Did we do a pre-initialize
+ static bool bPreInited = false;
+
+ // What stage are we at ?
+ if (pThis == NULL)
+ eStage = PRE_INIT;
+ else if (bPreInited)
+ eStage = SECOND_INIT;
+ else
+ eStage = FULL_INIT;
+
LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis);
if (bInitialized)
return 1;
- comphelper::LibreOfficeKit::setActive();
+ if (eStage != SECOND_INIT)
+ comphelper::LibreOfficeKit::setActive();
static bool bViewCallback = getenv("LOK_VIEW_CALLBACK");
comphelper::LibreOfficeKit::setViewCallback(bViewCallback);
- comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib);
+ if (eStage != PRE_INIT)
+ comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib);
- if (pUserProfilePath)
- rtl::Bootstrap::set("UserInstallation", OUString(pUserProfilePath, strlen(pUserProfilePath), RTL_TEXTENCODING_UTF8));
+ if (eStage != SECOND_INIT && pUserProfilePath)
+ rtl::Bootstrap::set(OUString("UserInstallation"), OUString(pUserProfilePath, strlen(pUserProfilePath), RTL_TEXTENCODING_UTF8));
OUString aAppPath;
if (pAppPath)
@@ -1805,22 +1830,34 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
try
{
- SAL_INFO("lok", "Attempting to initalize UNO");
- if (!initialize_uno(aAppURL))
+ if (eStage != SECOND_INIT)
{
- return false;
- }
- force_c_locale();
+ SAL_INFO("lok", "Attempting to initalize UNO");
+
+ if (!initialize_uno(aAppURL))
+ return false;
- // Force headless -- this is only for bitmap rendering.
- rtl::Bootstrap::set("SAL_USE_VCLPLUGIN", "svp");
+ // Force headless -- this is only for bitmap rendering.
+ rtl::Bootstrap::set("SAL_USE_VCLPLUGIN", "svp");
- // We specifically need to make sure we have the "headless"
- // command arg set (various code specifically checks via
- // CommandLineArgs):
- desktop::Desktop::GetCommandLineArgs().setHeadless();
+ // We specifically need to make sure we have the "headless"
+ // command arg set (various code specifically checks via
+ // CommandLineArgs):
+ desktop::Desktop::GetCommandLineArgs().setHeadless();
- Application::EnableHeadlessMode(true);
+ Application::EnableHeadlessMode(true);
+
+ if (eStage == PRE_INIT)
+ {
+ InitVCL();
+ // pre-load all component libraries.
+ cppu::preInitBootstrap();
+ // Release Solar Mutex, lo_startmain thread should acquire it.
+ Application::ReleaseSolarMutex();
+ }
+
+ force_c_locale();
+ }
// This is horrible crack. I really would want to go back to simply just call
// InitVCL() here. The OfficeIPCThread thing is just horrible.
@@ -1841,27 +1878,34 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// the Thread from wherever (it's done again in Desktop::Main), and can
// then use it to wait until we're definitely ready to continue.
- SAL_INFO("lok", "Enabling OfficeIPCThread");
- OfficeIPCThread::EnableOfficeIPCThread();
- SAL_INFO("lok", "Starting soffice_main");
- pLib->maThread = osl_createThread(lo_startmain, nullptr);
- SAL_INFO("lok", "Waiting for OfficeIPCThread");
- OfficeIPCThread::WaitForReady();
- SAL_INFO("lok", "OfficeIPCThread ready -- continuing");
-
- // If the Thread has been disabled again that indicates that a
- // restart is required (or in any case we don't have a useable
- // process around).
- if (!OfficeIPCThread::IsEnabled())
+ if (eStage != PRE_INIT)
{
- fprintf(stderr, "LOK init failed -- restart required\n");
- return false;
+ SAL_INFO("lok", "Enabling OfficeIPCThread");
+ OfficeIPCThread::EnableOfficeIPCThread();
+ SAL_INFO("lok", "Starting soffice_main");
+ pLib->maThread = osl_createThread(lo_startmain, NULL);
+ SAL_INFO("lok", "Waiting for OfficeIPCThread");
+ OfficeIPCThread::WaitForReady();
+ SAL_INFO("lok", "OfficeIPCThread ready -- continuing");
+
+ // If the Thread has been disabled again that indicates that a
+ // restart is required (or in any case we don't have a useable
+ // process around).
+ if (!OfficeIPCThread::IsEnabled())
+ {
+ fprintf(stderr, "LOK init failed -- restart required\n");
+ return false;
+ }
}
- ErrorHandler::RegisterDisplay(aBasicErrorFunc);
+ if (eStage != SECOND_INIT)
+ ErrorHandler::RegisterDisplay(aBasicErrorFunc);
SAL_INFO("lok", "LOK Initialized");
- bInitialized = true;
+ if (eStage == PRE_INIT)
+ bPreInited = true;
+ else
+ bInitialized = true;
}
catch (css::uno::Exception& exception)
{
@@ -1909,6 +1953,12 @@ LibreOfficeKit *libreofficekit_hook(const char* install_path)
return libreofficekit_hook_2(install_path, nullptr);
}
+SAL_JNI_EXPORT
+int lok_preinit(const char* install_path, const char* user_profile_path)
+{
+ return lo_initialize(NULL, install_path, user_profile_path);
+}
+
static void lo_destroy(LibreOfficeKit* pThis)
{
bool bSuccess = false;
diff --git a/include/cppuhelper/bootstrap.hxx b/include/cppuhelper/bootstrap.hxx
index e9a0c2d..0330d46 100644
--- a/include/cppuhelper/bootstrap.hxx
+++ b/include/cppuhelper/bootstrap.hxx
@@ -75,6 +75,9 @@ defaultBootstrap_InitialComponentContext();
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL
defaultBootstrap_InitialComponentContext(const ::rtl::OUString & iniFile);
+CPPUHELPER_DLLPUBLIC void SAL_CALL
+preInitBootstrap();
+
/**
* An exception indicating a bootstrap error.
*
diff --git a/smoketest/libtest.cxx b/smoketest/libtest.cxx
index b720525..ed4546c 100644
--- a/smoketest/libtest.cxx
+++ b/smoketest/libtest.cxx
@@ -83,7 +83,29 @@ int main (int argc, char **argv)
return 1;
// coverity[tainted_string] - build time test tool
- Office *pOffice = lok_cpp_init( argv[1] );
+ char *install_path = argv[1];
+
+ if( argc > 4 )
+ {
+ fprintf( stderr, "testing preinit\n");
+ char *imp_lib;
+ void *dlhandle;
+ dlhandle = lok_dlopen( install_path, &imp_lib );
+ if( !dlhandle )
+ {
+ fprintf( stderr, "Failed to link '%s'\n", lok_dlerror() );
+ return -1;
+ }
+ LokHookPreInit *preinit = (LokHookPreInit *) lok_dlsym( dlhandle, "lok_preinit" );
+ if( !preinit )
+ {
+ fprintf( stderr, "Failed to find pre-init symbol: %s\n", lok_dlerror() );
+ return -1;
+ }
+ preinit( install_path, NULL );
+ }
+
+ Office *pOffice = lok_cpp_init( install_path );
if( !pOffice )
{
fprintf( stderr, "Failed to initialize\n" );
commit c503f7ec7fa6d4ebd3f7dff07a9573a83f22145c
Author: Pranav Kant <pranavk at collabora.com>
Date: Wed Mar 16 22:13:08 2016 +0530
sc tiled rendering: Unit test for extended .uno:SelectRow/Column
Change-Id: I0ab89598af28e12bebc271f7bce1e6166cb83b1d
(cherry picked from commit 3cbdfeeb2b1765d6399ae7656a7b9ff91290bb7b)
diff --git a/sc/qa/unit/tiledrendering/data/select-row-cols.ods b/sc/qa/unit/tiledrendering/data/select-row-cols.ods
new file mode 100644
index 0000000..83cb8f1
Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/select-row-cols.ods differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index e5154d8..6549784 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -46,11 +46,13 @@ public:
virtual void tearDown() SAL_OVERRIDE;
#if !defined(WNT) && !defined(MACOSX)
+ void testRowColumnSelections();
void testSortAscendingDescending();
#endif
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
#if !defined(WNT) && !defined(MACOSX)
+ CPPUNIT_TEST(testRowColumnSelections);
CPPUNIT_TEST(testSortAscendingDescending);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -144,6 +146,73 @@ void ScTiledRenderingTest::callbackImpl(int /*nType*/, const char* /*pPayload*/)
//}
}
+void ScTiledRenderingTest::testRowColumnSelections()
+{
+ comphelper::LibreOfficeKit::setActive();
+ ScModelObj* pModelObj = createDoc("select-row-cols.ods");
+ //ScDocument* pDoc = pModelObj->GetDocument();
+
+ uno::Sequence<beans::PropertyValue> aArgs(2);
+
+ // Select the 5th row with no modifier
+ aArgs[0].Name = OUString::fromUtf8("Row");
+ aArgs[0].Value <<= static_cast<sal_Int32>(5 - 1);
+ aArgs[1].Name = OUString::fromUtf8("Modifier");
+ aArgs[1].Value <<= static_cast<sal_uInt16>(0);
+ comphelper::dispatchCommand(".uno:SelectRow", aArgs);
+
+ // Check if it is selected
+ OString aUsedMimeType;
+ OString aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType);
+ OString aExpected("1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n");
+ CPPUNIT_ASSERT_EQUAL(aExpected, aResult);
+
+ // Select the 10th row with shift modifier
+ aArgs[0].Name = OUString::fromUtf8("Row");
+ aArgs[0].Value <<= static_cast<sal_Int32>(10 - 1);
+ aArgs[1].Name = OUString::fromUtf8("Modifier");
+ aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_SHIFT);
+ comphelper::dispatchCommand(".uno:SelectRow", aArgs);
+
+ // Check if all the rows from 5th to 10th get selected
+ aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType);
+ aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\n3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\n4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\n5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\n6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\t26\n";
+ CPPUNIT_ASSERT_EQUAL(aExpected, aResult);
+
+ // Select the 10th row with ctrl modifier
+ aArgs[0].Name = OUString::fromUtf8("Row");
+ aArgs[0].Value <<= static_cast<sal_Int32>(13 - 1);
+ aArgs[1].Name = OUString::fromUtf8("Modifier");
+ aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1);
+ comphelper::dispatchCommand(".uno:SelectRow", aArgs);
+
+ // When we copy this, we don't get anything useful, but we must not crash
+ // (used to happen)
+ aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType);
+ CPPUNIT_ASSERT_EQUAL(OString(), aResult);
+
+ // TODO check that we really selected what we wanted here
+
+ // Select Column 5 with ctrl modifier
+ aArgs[0].Name = OUString::fromUtf8("Col");
+ aArgs[0].Value <<= static_cast<sal_Int32>(5 - 1);
+ aArgs[1].Name = OUString::fromUtf8("Modifier");
+ aArgs[1].Value <<= static_cast<sal_uInt16>(KEY_MOD1);
+ comphelper::dispatchCommand(".uno:SelectColumn", aArgs);
+
+ // When we copy this, we don't get anything useful, but we must not crash
+ // (used to happen)
+ aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType);
+ CPPUNIT_ASSERT_EQUAL(OString(), aResult);
+
+ // TODO check that we really selected what we wanted here
+
+ // TODO: Add test for negative selection: .uno:SelectRow/Column on already
+ // selected row/column should deselect it.
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
void ScTiledRenderingTest::testSortAscendingDescending()
{
comphelper::LibreOfficeKit::setActive();
commit 06b4ed6ef10a6cdf2f51e9d0d8c205637363b6cf
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Mar 18 16:23:26 2016 +0100
sc lok bccu#1602: Don't crash when the copy functionality is not allowed.
Change-Id: I0fe5871782d5892f9eda201be042648a45b9f9d4
(cherry picked from commit 9fa5e2b62e45843eafac3f34bbea1e57ad36078d)
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 5227750..e81336a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -752,7 +752,7 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy
else
aFlavor.DataType = cppu::UnoType< uno::Sequence<sal_Int8> >::get();
- if (!xTransferable->isDataFlavorSupported(aFlavor))
+ if (!xTransferable.is() || !xTransferable->isDataFlavorSupported(aFlavor))
return OString();
uno::Any aAny(xTransferable->getTransferData(aFlavor));
commit 4d606b3d02d39b5b310bd39df1de523b95df705c
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Mar 18 15:52:55 2016 +0100
sc lok bccu#1519: More general solution to detecting cell resizes.
This covers even the row height updates when the text in the cell changes etc.
Change-Id: Idb570fa2c3c4d3c6bcdb381f8ce07a0311354083
(cherry picked from commit e35ae1b6726166f443e8309b8ce96bc243c8a355)
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index efcf435..a805c01 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -63,6 +63,9 @@
#include "markdata.hxx"
#include <memory>
+#include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
// Redraw - Benachrichtigungen
void ScDocShell::PostEditView( ScEditEngineDefaulter* pEditEngine, const ScAddress& rCursorPos )
@@ -159,6 +162,11 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uI
}
Broadcast(ScPaintHint(aPaintRanges.Combine(), nPart));
+
+ // LOK: we are supposed to update the row / columns headers (and actually
+ // the document size too - cell size affects that, obviously)
+ if ((nPart & (PAINT_TOP | PAINT_LEFT)) && comphelper::LibreOfficeKit::isActive() && aDocument.GetDrawLayer())
+ aDocument.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
}
void ScDocShell::PostPaintGridAll()
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 33d89c7..4c64e57 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -157,9 +157,6 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
if ( bPaint && bAnyChanged )
pDocSh->UpdateOle(&GetViewData());
- if (bAnyChanged && comphelper::LibreOfficeKit::isActive() && rDoc.GetDrawLayer())
- rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
-
return bAnyChanged;
}
commit 2430551d2e815f982940b37f956f44783cd6ae76
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Mar 17 19:53:40 2016 +0100
sc: Improve documentation, and a cosmetic change.
Change-Id: Id99b963602816710a2c6767795343a9518833b43
(cherry picked from commit 6ed0bbf32160386ac1287e77279105b11f25ff50)
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 748e430..0e21f09 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -475,19 +475,21 @@ public:
void MarkRows();
/**
- * @brief Called to select a full column
+ * Called to select the specified full column.
*
* @param nCol: Column number to do operation on
- * @param nModifier:
+ * @param nModifier: 0, KEY_SHIFT, KEY_MOD1, KEY_SHIFT | KEY_MOD1
*/
+
void MarkColumns(SCCOL nCol, sal_Int16 nModifier);
/**
- * @brief Called to select a full row
+ * Called to select the specified full row.
*
* @param nRow: Row number to do operation on
- * @param nModifier:
+ * @param nModifier: 0, KEY_SHIFT, KEY_MOD1, KEY_SHIFT | KEY_MOD1
*/
void MarkRows(SCROW nRow, sal_Int16 nModifier);
+
void MarkDataArea( bool bIncludeCursor = true );
void MarkMatrixFormula();
void Unmark();
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index cd6d39a..0e592b4 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1402,12 +1402,10 @@ void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 nModifier)
SCTAB nTab = aViewData.GetTabNo();
bool bTestNeg = true;
- switch( nModifier )
+ if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
{
- case KEY_SHIFT:
- case KEY_MOD1 + KEY_SHIFT:
- nStartCol = aViewData.GetCurX();
- bTestNeg = false;
+ nStartCol = aViewData.GetCurX();
+ bTestNeg = false;
}
DoneBlockMode( nModifier != 0 );
@@ -1423,12 +1421,10 @@ void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
SCTAB nTab = aViewData.GetTabNo();
bool bTestNeg = true;
- switch ( nModifier )
+ if ((nModifier & KEY_SHIFT) == KEY_SHIFT)
{
- case KEY_SHIFT:
- case KEY_MOD1 + KEY_SHIFT:
- nStartRow = aViewData.GetCurY();
- bTestNeg = false;
+ nStartRow = aViewData.GetCurY();
+ bTestNeg = false;
}
DoneBlockMode( nModifier != 0 );
commit 705ac2f604c533425c8e4516729ae8f3562f0a29
Author: Pranav Kant <pranavk at collabora.com>
Date: Tue Mar 15 15:35:27 2016 +0530
sc lok: Extend uno commands: .uno:SelectRow/Column
Now also accepts a row/column index with modifier key to do various
selection/block selection/negative selection operations
Change-Id: Idfb56b94ca2eb4553eb9388b786f5d1e89448ec2
Reviewed-on: https://gerrit.libreoffice.org/23256
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
(cherry picked from commit ede2f9fb6dc7131970581eaac1a8d7d34947aeab)
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 75f0233..4746117 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6291,7 +6291,7 @@ SfxVoidItem SelectOLE SID_OLE_SELECT
SfxVoidItem SelectColumn SID_SELECT_COL
-()
+(SfxInt32Item Col FN_PARAM_1,SfxInt16Item Modifier FN_PARAM_2)
[
/* flags: */
AutoUpdate = FALSE,
@@ -6540,7 +6540,7 @@ SfxObjectItem Selection SID_SC_SELECTION
SfxVoidItem SelectRow SID_SELECT_ROW
-()
+(SfxInt32Item Row FN_PARAM_1,SfxInt16Item Modifier FN_PARAM_2)
[
/* flags: */
AutoUpdate = FALSE,
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 244073f..748e430 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -473,6 +473,21 @@ public:
void MarkColumns();
void MarkRows();
+
+ /**
+ * @brief Called to select a full column
+ *
+ * @param nCol: Column number to do operation on
+ * @param nModifier:
+ */
+ void MarkColumns(SCCOL nCol, sal_Int16 nModifier);
+ /**
+ * @brief Called to select a full row
+ *
+ * @param nRow: Row number to do operation on
+ * @param nModifier:
+ */
+ void MarkRows(SCROW nRow, sal_Int16 nModifier);
void MarkDataArea( bool bIncludeCursor = true );
void MarkMatrixFormula();
void Unmark();
diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index 5fe24c6..aa8442d 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -275,6 +275,7 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq )
{
ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell();
sal_uInt16 nSlotId = rReq.GetSlot();
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
if(nSlotId != SID_CURSORTOPOFSCREEN && nSlotId != SID_CURSORENDOFSCREEN)
pTabViewShell->ExecuteInputDirect();
@@ -316,11 +317,37 @@ void ScCellShell::ExecuteMove( SfxRequest& rReq )
break;
case SID_SELECT_COL:
- pTabViewShell->MarkColumns();
+ {
+ const SfxPoolItem* pColItem;
+ const SfxPoolItem* pModifierItem;
+ if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pColItem ) &&
+ pReqArgs->HasItem( FN_PARAM_2, &pModifierItem ) )
+ {
+ SCCOL nCol = static_cast<SCCOL>(static_cast<const SfxInt16Item*>(pColItem)->GetValue());;
+ sal_Int16 nModifier = static_cast<sal_Int16>(static_cast<const SfxInt16Item*>(pModifierItem)->GetValue());
+
+ pTabViewShell->MarkColumns( nCol, nModifier );
+ }
+ else
+ pTabViewShell->MarkColumns();
+ }
break;
case SID_SELECT_ROW:
- pTabViewShell->MarkRows();
+ {
+ const SfxPoolItem* pRowItem;
+ const SfxPoolItem* pModifierItem;
+ if ( pReqArgs && pReqArgs->HasItem( FN_PARAM_1, &pRowItem ) &&
+ pReqArgs->HasItem( FN_PARAM_2, &pModifierItem ) )
+ {
+ SCROW nRow = static_cast<SCROW>(static_cast<const SfxInt32Item*>(pRowItem)->GetValue());;
+ sal_Int16 nModifier = static_cast<sal_Int16>(static_cast<const SfxInt16Item*>(pModifierItem)->GetValue());
+
+ pTabViewShell->MarkRows( nRow, nModifier );
+ }
+ else
+ pTabViewShell->MarkRows();
+ }
break;
case SID_SELECT_NONE:
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 731c560..2aec1cb 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1621,6 +1621,17 @@ void ScGridWindow::GetSelectionRects( ::std::vector< Rectangle >& rPixelRects )
if (nY2 > nYBottom)
nY2 = nYBottom;
}
+ else
+ {
+ SCCOL nMaxTiledCol;
+ SCROW nMaxTiledRow;
+ pDoc->GetTiledRenderingArea( nTab, nMaxTiledCol, nMaxTiledRow );
+
+ if (nX2 > nMaxTiledCol)
+ nX2 = nMaxTiledCol;
+ if (nY2 > nMaxTiledRow)
+ nY2 = nMaxTiledRow;
+ }
double nPPTX = pViewData->GetPPTX();
double nPPTY = pViewData->GetPPTY();
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index d6e31a5..cd6d39a 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1395,6 +1395,49 @@ void ScTabView::MarkRows()
SelectionChanged();
}
+
+void ScTabView::MarkColumns(SCCOL nCol, sal_Int16 nModifier)
+{
+ SCCOL nStartCol = nCol;
+ SCTAB nTab = aViewData.GetTabNo();
+ bool bTestNeg = true;
+
+ switch( nModifier )
+ {
+ case KEY_SHIFT:
+ case KEY_MOD1 + KEY_SHIFT:
+ nStartCol = aViewData.GetCurX();
+ bTestNeg = false;
+ }
+
+ DoneBlockMode( nModifier != 0 );
+ InitBlockMode( nStartCol, 0, nTab, bTestNeg, true, false );
+ MarkCursor( nCol, MAXROW, nTab );
+ SetCursor( nCol, 0 );
+ SelectionChanged();
+}
+
+void ScTabView::MarkRows(SCROW nRow, sal_Int16 nModifier)
+{
+ SCROW nStartRow = nRow;
+ SCTAB nTab = aViewData.GetTabNo();
+ bool bTestNeg = true;
+
+ switch ( nModifier )
+ {
+ case KEY_SHIFT:
+ case KEY_MOD1 + KEY_SHIFT:
+ nStartRow = aViewData.GetCurY();
+ bTestNeg = false;
+ }
+
+ DoneBlockMode( nModifier != 0 );
+ InitBlockMode( 0, nStartRow, nTab, bTestNeg, false, true );
+ MarkCursor( MAXCOL, nRow, nTab );
+ SetCursor( 0, nRow );
+ SelectionChanged();
+}
+
void ScTabView::MarkDataArea( bool bIncludeCursor )
{
ScDocument* pDoc = aViewData.GetDocument();
commit 6715a7c2eb0b48e59511c3ade5d543345a641289
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Mar 11 16:15:16 2016 +0000
Resolves: tdf#94392 huge negative Y causes length exception
because this rendering stuff is deleted in later versions
of LibreOffice and replaced with cairo rendering, just bodge
this case to give up and go home.
Change-Id: I4e60184b0919dc719edfe223ebb2d8ef684608e8
Reviewed-on: https://gerrit.libreoffice.org/23154
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: David Tardon <dtardon at redhat.com>
(cherry picked from commit 93772371096b4caf542146e673a44d8d346a09ab)
(cherry picked from commit 0c4ee554c04a38ff0c6d2ac22e559baa95dddaf5)
diff --git a/basebmp/inc/polypolygonrenderer.hxx b/basebmp/inc/polypolygonrenderer.hxx
index fef2f7f..a23ab84 100644
--- a/basebmp/inc/polypolygonrenderer.hxx
+++ b/basebmp/inc/polypolygonrenderer.hxx
@@ -161,7 +161,14 @@ namespace basebmp
return; // really, nothing to do then.
detail::VectorOfVectorOfVertices aGET; // the Global Edge Table
- aGET.resize( nMaxY - nMinY + 1 );
+ try
+ {
+ aGET.resize( nMaxY - nMinY + 1 );
+ }
+ catch (...)
+ {
+ return;
+ }
sal_uInt32 const nVertexCount(
detail::setupGlobalEdgeTable( aGET, rPoly, nMinY ) );
commit a839c01356c28f23c7e45f9b3babfa36b50c4182
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed Mar 16 15:35:49 2016 +0100
sc lok bccu#1519: Broadcast cell size changes, they affect the document size.
Change-Id: Icd42c0252c28a24ac9c6c535a146a2f3b3beda17
(cherry picked from commit 9b504d41523ceabbff1235f7ffc1ef409cca504a)
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 4c64e57..33d89c7 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -157,6 +157,9 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
if ( bPaint && bAnyChanged )
pDocSh->UpdateOle(&GetViewData());
+ if (bAnyChanged && comphelper::LibreOfficeKit::isActive() && rDoc.GetDrawLayer())
+ rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
+
return bAnyChanged;
}
commit 54028fe68ba34d373259de6f60d76c065d8decd0
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Mar 11 20:45:02 2016 +0100
lok: Avoid dereferencing nullptr.
Change-Id: I40a53cf08e2a789299cd7a05d531b4f920653989
(cherry picked from commit 97c872d015350810fb0180ffdb10de7f039363a4)
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index beb75e0..718b500 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -245,9 +245,17 @@ bool SvxTableController::onKeyInput(const KeyEvent& rKEvt, vcl::Window* pWindow
return executeAction( nAction, rKEvt.GetKeyCode().IsShift(), pWindow );
}
+namespace {
-// css::awt::XMouseClickHandler:
+Point pixelToLogic(const Point& rPoint, vcl::Window* pWindow)
+{
+ if (!pWindow)
+ return rPoint;
+ return pWindow->PixelToLogic(rPoint);
+}
+
+}
bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWindow )
{
@@ -268,7 +276,7 @@ bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window*
if( !rMEvt.IsRight() && mpView->PickAnything(rMEvt,SdrMouseEventKind::BUTTONDOWN, aVEvt) == SDRHIT_HANDLE )
return false;
- TableHitKind eHit = static_cast< SdrTableObj* >(mxTableObj.get())->CheckTableHit( pWindow->PixelToLogic(rMEvt.GetPosPixel()), maMouseDownPos.mnCol, maMouseDownPos.mnRow, 0 );
+ TableHitKind eHit = static_cast< SdrTableObj* >(mxTableObj.get())->CheckTableHit(pixelToLogic(rMEvt.GetPosPixel(), pWindow), maMouseDownPos.mnCol, maMouseDownPos.mnRow, 0);
mbLeftButtonDown = (rMEvt.GetClicks() == 1) && rMEvt.IsLeft();
@@ -286,11 +294,7 @@ bool SvxTableController::onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window*
{
RemoveSelection();
- Point aPnt(rMEvt.GetPosPixel());
- if (pWindow!=nullptr)
- aPnt=pWindow->PixelToLogic(aPnt);
-
- SdrHdl* pHdl = mpView->PickHandle(aPnt);
+ SdrHdl* pHdl = mpView->PickHandle(pixelToLogic(rMEvt.GetPosPixel(), pWindow));
if( pHdl )
{
@@ -356,7 +360,7 @@ bool SvxTableController::onMouseMove(const MouseEvent& rMEvt, vcl::Window* pWind
SdrTableObj* pTableObj = dynamic_cast< SdrTableObj* >( mxTableObj.get() );
CellPos aPos;
- if( mbLeftButtonDown && pTableObj && pTableObj->CheckTableHit( pWindow->PixelToLogic(rMEvt.GetPosPixel()), aPos.mnCol, aPos.mnRow, 0 ) != SDRTABLEHIT_NONE )
+ if (mbLeftButtonDown && pTableObj && pTableObj->CheckTableHit(pixelToLogic(rMEvt.GetPosPixel(), pWindow), aPos.mnCol, aPos.mnRow, 0 ) != SDRTABLEHIT_NONE)
{
if(aPos != maMouseDownPos)
{
commit 8049caf981fd4169d9bd4ca2d46134e2d6383ff5
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Mar 10 18:50:54 2016 +0100
sc lok: Don't interact with the user during .uno:SortAscending or Descending.
Change-Id: Ib3679413ba59e86438dac83abfa9b624e291e5a9
(cherry picked from commit 235136c17868627412db8dda148d3c4103907c0c)
diff --git a/sc/CppunitTest_sc_tiledrendering.mk b/sc/CppunitTest_sc_tiledrendering.mk
new file mode 100644
index 0000000..995cdc8
--- /dev/null
+++ b/sc/CppunitTest_sc_tiledrendering.mk
@@ -0,0 +1,62 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sc_tiledrendering))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sc_tiledrendering, \
+ sc/qa/unit/tiledrendering/tiledrendering \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sc_tiledrendering, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ editeng \
+ sal \
+ sfx \
+ svl \
+ svt \
+ svxcore \
+ sc \
+ scui \
+ test \
+ unotest \
+ vcl \
+ tl \
+ utl \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,sc_tiledrendering,\
+ boost_headers \
+ libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sc_tiledrendering,\
+ -I$(SRCDIR)/sc/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sc_tiledrendering,\
+ offapi \
+ udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,sc_tiledrendering))
+$(eval $(call gb_CppunitTest_use_vcl,sc_tiledrendering))
+
+$(eval $(call gb_CppunitTest_use_rdb,sc_tiledrendering,services))
+
+$(eval $(call gb_CppunitTest_use_configuration,sc_tiledrendering))
+
+$(call gb_CppunitTest_get_target,sc_tiledrendering) : $(call gb_AllLangResTarget_get_target,sc)
+
+# vim: set noet sw=4 ts=4:
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 3dcb39a..d656f71 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -46,6 +46,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
CppunitTest_sc_filters_test \
CppunitTest_sc_rangelst_test \
CppunitTest_sc_core \
+ CppunitTest_sc_tiledrendering \
))
$(eval $(call gb_Module_add_slowcheck_targets,sc, \
diff --git a/sc/qa/unit/tiledrendering/data/sort-range.ods b/sc/qa/unit/tiledrendering/data/sort-range.ods
new file mode 100644
index 0000000..cd9e4e4
Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/sort-range.ods differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
new file mode 100644
index 0000000..e5154d8
--- /dev/null
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -0,0 +1,191 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+#include <test/xmltesttools.hxx>
+#include <boost/property_tree/json_parser.hpp>
+
+#define LOK_USE_UNSTABLE_API
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <comphelper/dispatchcommand.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
+#include <comphelper/string.hxx>
+#include <editeng/editids.hrc>
+#include <editeng/editview.hxx>
+#include <editeng/outliner.hxx>
+#include <osl/conditn.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/srchitem.hxx>
+
+#include <comphelper/lok.hxx>
+
+#include <document.hxx>
+#include <docuno.hxx>
+
+using namespace css;
+
+#if !defined(WNT) && !defined(MACOSX)
+static const char* DATA_DIRECTORY = "/sc/qa/unit/tiledrendering/data/";
+#endif
+
+class ScTiledRenderingTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
+{
+public:
+ ScTiledRenderingTest();
+ virtual void setUp() SAL_OVERRIDE;
+ virtual void tearDown() SAL_OVERRIDE;
+
+#if !defined(WNT) && !defined(MACOSX)
+ void testSortAscendingDescending();
+#endif
+
+ CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
+#if !defined(WNT) && !defined(MACOSX)
+ CPPUNIT_TEST(testSortAscendingDescending);
+#endif
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+#if !defined(WNT) && !defined(MACOSX)
+ ScModelObj* createDoc(const char* pName);
+ static void callback(int nType, const char* pPayload, void* pData);
+ void callbackImpl(int nType, const char* pPayload);
+#endif
+
+ uno::Reference<lang::XComponent> mxComponent;
+#if !defined(WNT) && !defined(MACOSX)
+ // TODO various test-related members - when needed
+#endif
+};
+
+ScTiledRenderingTest::ScTiledRenderingTest()
+#if !defined(WNT) && !defined(MACOSX)
+ // TODO various test-related members - when needed
+#endif
+{
+}
+
+void ScTiledRenderingTest::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ mxDesktop.set(css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
+}
+
+void ScTiledRenderingTest::tearDown()
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+#if !defined(WNT) && !defined(MACOSX)
+ScModelObj* ScTiledRenderingTest::createDoc(const char* pName)
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+ mxComponent = loadFromDesktop(m_directories.getURLFromSrc(DATA_DIRECTORY) + OUString::createFromAscii(pName), "com.sun.star.sheet.SpreadsheetDocument");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ pModelObj->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
+ return pModelObj;
+}
+
+void ScTiledRenderingTest::callback(int nType, const char* pPayload, void* pData)
+{
+ static_cast<ScTiledRenderingTest*>(pData)->callbackImpl(nType, pPayload);
+}
+
+/* TODO when needed...
+static std::vector<OUString> lcl_convertSeparated(const OUString& rString, sal_Unicode nSeparator)
+{
+ std::vector<OUString> aRet;
+
+ sal_Int32 nIndex = 0;
+ do
+ {
+ OUString aToken = rString.getToken(0, nSeparator, nIndex);
+ aToken = aToken.trim();
+ if (!aToken.isEmpty())
+ aRet.push_back(aToken);
+ }
+ while (nIndex >= 0);
+
+ return aRet;
+}
+
+static void lcl_convertRectangle(const OUString& rString, Rectangle& rRectangle)
+{
+ uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(rString);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), aSeq.getLength());
+ rRectangle.setX(aSeq[0].toInt32());
+ rRectangle.setY(aSeq[1].toInt32());
+ rRectangle.setWidth(aSeq[2].toInt32());
+ rRectangle.setHeight(aSeq[3].toInt32());
+}
+*/
+
+void ScTiledRenderingTest::callbackImpl(int /*nType*/, const char* /*pPayload*/)
+{
+ // TODO when needed...
+ //switch (nType)
+ //{
+ //}
+}
+
+void ScTiledRenderingTest::testSortAscendingDescending()
+{
+ comphelper::LibreOfficeKit::setActive();
+ ScModelObj* pModelObj = createDoc("sort-range.ods");
+ ScDocument* pDoc = pModelObj->GetDocument();
+
+ // select the values in the first column
+ pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, 551, 129, 1);
+ pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, 820, 1336, 1);
+ pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, 820, 1359, 1);
+
+ // sort ascending
+ uno::Sequence<beans::PropertyValue> aArgs;
+ comphelper::dispatchCommand(".uno:SortAscending", aArgs);
+
+ // check it's sorted
+ for (SCROW r = 0; r < 6; ++r)
+ {
+ CPPUNIT_ASSERT_EQUAL(double(r + 1), pDoc->GetValue(ScAddress(0, r, 0)));
+ }
+
+ // sort descending
+ comphelper::dispatchCommand(".uno:SortDescending", aArgs);
+
+ // check it's sorted
+ for (SCROW r = 0; r < 6; ++r)
+ {
+ CPPUNIT_ASSERT_EQUAL(double(6 - r), pDoc->GetValue(ScAddress(0, r, 0)));
+ }
+
+ // nothing else was sorted
+ CPPUNIT_ASSERT_EQUAL(double(1), pDoc->GetValue(ScAddress(1, 0, 0)));
+ CPPUNIT_ASSERT_EQUAL(double(3), pDoc->GetValue(ScAddress(1, 1, 0)));
+ CPPUNIT_ASSERT_EQUAL(double(2), pDoc->GetValue(ScAddress(1, 2, 0)));
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
+#endif
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 354ae1f..ca73059 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -20,6 +20,7 @@
#include <config_features.h>
#include "scitems.hxx"
+#include <comphelper/lok.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/app.hxx>
#include <sfx2/request.hxx>
@@ -164,8 +165,10 @@ static bool lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam )
aExternalRange.aEnd.SetRow( nEndRow );
aExternalRange.aEnd.SetCol( nEndCol );
- if(( rSortParam.nCol1 == rSortParam.nCol2 && aExternalRange.aStart.Col() != aExternalRange.aEnd.Col() ) ||
- ( rSortParam.nRow1 == rSortParam.nRow2 && aExternalRange.aStart.Row() != aExternalRange.aEnd.Row() ) )
+ // with LibreOfficeKit, don't try to interact with the user
+ if (!comphelper::LibreOfficeKit::isActive() &&
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list