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

2021-07-24 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/inc/RemoteServer.hxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 4e511cc7dfbf14b6176ce352db8125c16eefeebf
Author: Andrzej Hunt 
AuthorDate: Sat Jul 24 14:23:10 2021 +0200
Commit: Andrzej Hunt 
CommitDate: Sat Jul 24 16:05:19 2021 +0200

sdremote: remove useless comment

It's been there since the beginning, but doesn't help us much:
  e4239e041468 (Initial checkin of remote control., 2012-07-09)

Change-Id: I57425001cd0b9d0d035916405bd6d94329964b4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119466
Tested-by: Jenkins
Reviewed-by: Andrzej Hunt 

diff --git a/sd/source/ui/inc/RemoteServer.hxx 
b/sd/source/ui/inc/RemoteServer.hxx
index d5dba8c092f0..e676087899d9 100644
--- a/sd/source/ui/inc/RemoteServer.hxx
+++ b/sd/source/ui/inc/RemoteServer.hxx
@@ -8,7 +8,6 @@
  */
 #pragma once
 
-// SERVER
 #include 
 #include 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-24 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/remotecontrol/BufferedStreamSocket.cxx |4 
 sd/source/ui/remotecontrol/BufferedStreamSocket.hxx |5 -
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 2855f12072023930a15ea852e40d05de4a6be164
Author: Andrzej Hunt 
AuthorDate: Sat Jul 17 09:42:47 2021 +0200
Commit: Andrzej Hunt 
CommitDate: Sat Jul 24 09:51:36 2021 +0200

sdremote: close BufferedStreamSocket on destruction

This follows the pattern in osl::Socket which also cleans up on
destruction if necessary.

By closing on destruction we can avoid leaking the underlying socket or
filedescriptor in the numerous scenarios where we throw away the socket
without bothering to call close(). This isn't a big deal in normal
usage - we don't use many sockets in the first place - but you can
quickly run out of filedescriptors when running sufficiently complex
tests.

We also need to make BufferedStreamSocket final to avoid triggering
loplugin:fragiledestructor - BufferedStreamSocket probably should
have been final anyway, so there's no reason not to do so.

Change-Id: I90c271df4b598a6c2b326fde13543e6b27d7a110
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119093
Tested-by: Jenkins
Reviewed-by: Andrzej Hunt 

diff --git a/sd/source/ui/remotecontrol/BufferedStreamSocket.cxx 
b/sd/source/ui/remotecontrol/BufferedStreamSocket.cxx
index b3a9cc154e37..58adb13ca7bf 100644
--- a/sd/source/ui/remotecontrol/BufferedStreamSocket.cxx
+++ b/sd/source/ui/remotecontrol/BufferedStreamSocket.cxx
@@ -47,6 +47,10 @@ BufferedStreamSocket::BufferedStreamSocket( int aSocket ):
 {
 }
 
+BufferedStreamSocket::~BufferedStreamSocket() {
+close();
+}
+
 void BufferedStreamSocket::getPeerAddr(osl::SocketAddr& rAddr)
 {
 assert ( !usingCSocket );
diff --git a/sd/source/ui/remotecontrol/BufferedStreamSocket.hxx 
b/sd/source/ui/remotecontrol/BufferedStreamSocket.hxx
index 08a81cf002f6..6abf7ec1bf8d 100644
--- a/sd/source/ui/remotecontrol/BufferedStreamSocket.hxx
+++ b/sd/source/ui/remotecontrol/BufferedStreamSocket.hxx
@@ -25,7 +25,7 @@ namespace sd
  * returned to being a StreamSocket wrapper if/when Bluetooth is
  * integrated into osl Sockets.
  */
-class BufferedStreamSocket :
+class BufferedStreamSocket final :
 public IBluetoothSocket,
 private ::osl::StreamSocket
 {
@@ -40,6 +40,9 @@ namespace sd
  */
 explicit BufferedStreamSocket( int aSocket );
 BufferedStreamSocket( const BufferedStreamSocket  );
+
+~BufferedStreamSocket();
+
 /**
  * Blocks until a line is read.
  * Returns whatever the last call of recv returned, i.e. 0 or less
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sd/source

2021-07-21 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/inc/RemoteServer.hxx |2 
 sd/source/ui/remotecontrol/Server.cxx |  116 ++
 2 files changed, 64 insertions(+), 54 deletions(-)

New commits:
commit 7d93272c6ad0a7209c1e5212484ee44970de850f
Author: Andrzej Hunt 
AuthorDate: Fri Jul 16 18:52:57 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 21 08:42:33 2021 +0200

sdremote: avoid infinite loop if client disconnects during handshake

The following loop can turn into an infinite loop if the client
disconnects at the wrong point in time, because pSocket->readLine()
returns 0 (indicating disconnection), aLine remains empty (no data
was read), and we just keep looping because we never bothered to check
the return value:
  do
  {
  pSocket->readLine( aLine );
  }
   while ( aLine.getLength() > 0 );

Aside from spinning unnecessarily, this infinite loop also stops the
server from being able to accept any new incoming connections - in
effect this causes a DOS of the server.

Hence we need to start checking readLine's return value, and break out
of this loop - and in fact break of the surrounding outer loop too
(because we discard this connection and want to wait for another
 connection to arrive).

Because of the nested looping it's hard to come up with a clean solution
that only involves changing this loop - we'd probably need to introduce
a temporary to remember that the client has disconnected, and check that
temporary after the do...while - letting us 'continue' the outer loop.

Therefore we first extract the code that handles newly accepted clients
into a separate method, which then lets us simplify the implementation
by returning at those points that we know a client has disappeared. That
unfortunately makes this bug-fix patch a little more noisy than
expected, but it is a refactoring that we'd want to make anyway.

(There are further improvement we can make here, but I'll put those in a
 separate commit to simplify cherry-picking of just this fix. Examples
 include moving to smart pointers instead of new/delete, introducing an
 early return instead of the really long if statement, etc.)

Change-Id: I13c6efa622a1b1de10b72757ea07e5f4660749fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119083
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit fcc4d8e01360baa9ba0bf20eb5e7a1c9af793a02)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119184

diff --git a/sd/source/ui/inc/RemoteServer.hxx 
b/sd/source/ui/inc/RemoteServer.hxx
index 65bc523ad274..d5dba8c092f0 100644
--- a/sd/source/ui/inc/RemoteServer.hxx
+++ b/sd/source/ui/inc/RemoteServer.hxx
@@ -28,6 +28,7 @@ namespace com::sun::star::uno { template  class Reference;
 
 namespace sd
 {
+class BufferedStreamSocket;
 class Communicator;
 
 struct ClientInfo
@@ -81,6 +82,7 @@ namespace sd
 ::std::vector< std::shared_ptr< ClientInfoInternal > > 
mAvailableClients;
 
 void execute() override;
+void handleAcceptedConnection( BufferedStreamSocket *pSocket ) ;
 };
 }
 
diff --git a/sd/source/ui/remotecontrol/Server.cxx 
b/sd/source/ui/remotecontrol/Server.cxx
index d3f1ac67f904..b1be49b45dce 100644
--- a/sd/source/ui/remotecontrol/Server.cxx
+++ b/sd/source/ui/remotecontrol/Server.cxx
@@ -110,73 +110,81 @@ void RemoteServer::execute()
 return; // Closed, or other issue.
 }
 BufferedStreamSocket *pSocket = new BufferedStreamSocket( aSocket);
-OString aLine;
-if ( pSocket->readLine( aLine)
-&& aLine == "LO_SERVER_CLIENT_PAIR"
-&& pSocket->readLine( aLine ) )
-{
-OString aName( aLine );
+handleAcceptedConnection( pSocket );
+}
+SAL_INFO( "sdremote", "shutting down RemoteServer" );
+spServer = nullptr; // Object is destroyed when Thread::execute() ends.
+}
 
-if ( ! pSocket->readLine( aLine ) )
-{
-delete pSocket;
-continue;
-}
-OString aPin( aLine );
+void RemoteServer::handleAcceptedConnection( BufferedStreamSocket *pSocket )
+{
+OString aLine;
+if ( pSocket->readLine( aLine)
+&& aLine == "LO_SERVER_CLIENT_PAIR"
+&& pSocket->readLine( aLine ) )
+{
+OString aName( aLine );
 
-SocketAddr aClientAddr;
-pSocket->getPeerAddr( aClientAddr );
+if ( ! pSocket->readLine( aLine ) )
+{
+delete pSocket;
+return;
+}
+OString aPin( aLine );
 
-MutexGuard aGuard( sDataMutex );
-std::shared_ptr< ClientInfoInternal > pClient =
-std::make_shared(
-

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sd/source

2021-07-20 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/remotecontrol/Transmitter.cxx |   16 +---
 sd/source/ui/remotecontrol/Transmitter.hxx |   11 ---
 2 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit a4360b155bef02cf3da41e3f05c56d42feef7926
Author: Andrzej Hunt 
AuthorDate: Sun Jul 11 17:17:27 2021 +0200
Commit: Michael Stahl 
CommitDate: Tue Jul 20 11:22:42 2021 +0200

sdremote: fix race condition in Transmitter shutdown to plug leak

We need to acquire the mutex in notifyFinished() to avoid a race between
notifyFinished() and the loop in run(). And we also need to check
mFinishRequested) while holding the mutex to avoid the same race
condition. While we're here, rename the mutex to make it more obvious
that it's not only protecting the queues.

The race can happen because the loop in run() blocks until
mQueuesNotEmpty is set. It also resets mQueuesNotEmpty at the end of
each iteration if the queues are empty. So if someone sets
mQueuesNotEmpty in the middle of an iteration, and the loop later resets
it, the loop won't continue iterating. But we're actually using
mQueuesNotEmpty to indicate either that the queues have data OR that we
might want to finish transmission.

And the problem is that notifyFinished() sets mFinishRequested, followed
by setting mQueuesNotEmpty in an attempt to get the loop to process
mFinishRequested (at which point the loop should finish and return).
But as described above, we can easily get into a situation where the
loop resets mQueuesNotEmpty again (at least if there's no more pending
data in the queues). In this scenario, the loop blocks forever
(we won't receive any new messages after notifyFinished()), causing a
leak of both Transmitter and any resources it's using - e.g. the
StreamSocket.

The easiest way to fix this is to make it clear that the mutex protects
all internal state, followed by using it to protect all internal state.

This issue is not a big deal in normal usage - it's a tiny leak, and
users won't connect enough clients for accumulated leaks to pose
any issues. But it's ugly, and potentially problematic for long-running
tests which could run out of filedescriptors because of the socket leak.

I will rename mQueuesNotEmpty to something more obvious (possibly
mProcessingRequired) in a separate commit.

Change-Id: I2e22087054f3f6a02e05c568b1832ccc5a8b47a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118751
Reviewed-by: Andrzej Hunt 
Tested-by: Jenkins
(cherry picked from commit 8e6cdb02450a876b5c684eb621e1c9383fb1c428)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118917
Reviewed-by: Michael Stahl 

diff --git a/sd/source/ui/remotecontrol/Transmitter.cxx 
b/sd/source/ui/remotecontrol/Transmitter.cxx
index 8f3b7d24c184..76cda8feae55 100644
--- a/sd/source/ui/remotecontrol/Transmitter.cxx
+++ b/sd/source/ui/remotecontrol/Transmitter.cxx
@@ -17,8 +17,8 @@ using namespace sd;
 Transmitter::Transmitter( IBluetoothSocket* aSocket )
   : pStreamSocket( aSocket ),
 mQueuesNotEmpty(),
-mFinishRequested(),
-mQueueMutex(),
+mMutex(),
+mFinishRequested( false ),
 mLowPriority(),
 mHighPriority()
 {
@@ -32,10 +32,11 @@ void SAL_CALL Transmitter::run()
 {
 mQueuesNotEmpty.wait();
 
-if ( mFinishRequested.check() )
-return;
+::osl::MutexGuard aGuard( mMutex );
 
-::osl::MutexGuard aQueueGuard( mQueueMutex );
+if ( mFinishRequested ) {
+return;
+}
 if ( !mHighPriority.empty() )
 {
 OString aMessage( mHighPriority.front() );
@@ -60,7 +61,8 @@ void SAL_CALL Transmitter::run()
 
 void Transmitter::notifyFinished()
 {
-mFinishRequested.set();
+::osl::MutexGuard aGuard( mMutex );
+mFinishRequested = true;
 mQueuesNotEmpty.set();
 }
 
@@ -70,7 +72,7 @@ Transmitter::~Transmitter()
 
 void Transmitter::addMessage( const OString& aMessage, const Priority 
aPriority )
 {
-::osl::MutexGuard aQueueGuard( mQueueMutex );
+::osl::MutexGuard aGuard( mMutex );
 switch ( aPriority )
 {
 case PRIORITY_LOW:
diff --git a/sd/source/ui/remotecontrol/Transmitter.hxx 
b/sd/source/ui/remotecontrol/Transmitter.hxx
index 8acebfeff7e8..1cd94ea26712 100644
--- a/sd/source/ui/remotecontrol/Transmitter.hxx
+++ b/sd/source/ui/remotecontrol/Transmitter.hxx
@@ -37,11 +37,16 @@ private:
 ::sd::IBluetoothSocket* pStreamSocket;
 
 ::osl::Condition mQueuesNotEmpty;
-::osl::Condition mFinishRequested;
-
-::osl::Mutex mQueueMutex;
 
+::osl::Mutex mMutex;
+/**
+ * Used to indicate that we're done and the transmitter loop should exit.
+ * All access must be guarded my `mMutex`.
+ */
+bool mFinishRequested;
+/// Queue for low priority messages. All access must be guarded my 
`mMutex`.
 std::q

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

2021-07-17 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/remotecontrol/Server.cxx |  100 +-
 1 file changed, 51 insertions(+), 49 deletions(-)

New commits:
commit 137744a25b26d86b9be16a107b3bd011f6ab4b07
Author: Andrzej Hunt 
AuthorDate: Fri Jul 16 18:58:10 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 17 11:50:08 2021 +0200

sdremote: introduce early return to improve handleAcceptedConnection

This should make it easier to understand the handshake sequence.

Change-Id: If06e98cdfe7295ed00efae61815a8696a90e9533
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119085
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sd/source/ui/remotecontrol/Server.cxx 
b/sd/source/ui/remotecontrol/Server.cxx
index e3576bacd52e..83a80e9916df 100644
--- a/sd/source/ui/remotecontrol/Server.cxx
+++ b/sd/source/ui/remotecontrol/Server.cxx
@@ -112,67 +112,69 @@ void RemoteServer::execute()
 void RemoteServer::handleAcceptedConnection( BufferedStreamSocket *pSocket )
 {
 OString aLine;
-if ( pSocket->readLine( aLine)
-&& aLine == "LO_SERVER_CLIENT_PAIR"
-&& pSocket->readLine( aLine ) )
+if ( ! ( pSocket->readLine( aLine)
+ && aLine == "LO_SERVER_CLIENT_PAIR"
+ && pSocket->readLine( aLine ) ) )
 {
-OString aName( aLine );
+SAL_INFO( "sdremote", "client failed to send LO_SERVER_CLIENT_PAIR, 
ignoring" );
+delete pSocket;
+return;
+}
 
-if ( ! pSocket->readLine( aLine ) )
-{
+OString aName( aLine );
+
+if ( ! pSocket->readLine( aLine ) )
+{
+delete pSocket;
+return;
+}
+OString aPin( aLine );
+
+SocketAddr aClientAddr;
+pSocket->getPeerAddr( aClientAddr );
+
+do
+{
+// Read off any additional non-empty lines
+// We know that we at least have the empty termination line to read.
+if ( ! pSocket->readLine( aLine ) ) {
 delete pSocket;
 return;
 }
-OString aPin( aLine );
+}
+while ( aLine.getLength() > 0 );
 
-SocketAddr aClientAddr;
-pSocket->getPeerAddr( aClientAddr );
+MutexGuard aGuard( sDataMutex );
+std::shared_ptr< ClientInfoInternal > pClient =
+std::make_shared(
+OStringToOUString( aName, RTL_TEXTENCODING_UTF8 ),
+pSocket, OStringToOUString( aPin, RTL_TEXTENCODING_UTF8 ) );
+mAvailableClients.push_back( pClient );
 
-do
+// Check if we already have this server.
+Reference< XNameAccess > const xConfig = 
officecfg::Office::Impress::Misc::AuthorisedRemotes::get();
+const Sequence< OUString > aNames = xConfig->getElementNames();
+for ( const auto& rName : aNames )
+{
+if ( rName == pClient->mName )
 {
-// Read off any additional non-empty lines
-// We know that we at least have the empty termination line to 
read.
-if ( ! pSocket->readLine( aLine ) ) {
-delete pSocket;
+Reference xSetItem( xConfig->getByName(rName), 
UNO_QUERY );
+Any axPin(xSetItem->getByName("PIN"));
+OUString sPin;
+axPin >>= sPin;
+
+if ( sPin == pClient->mPin ) {
+SAL_INFO( "sdremote", "client found on validated list -- 
connecting" );
+connectClient( pClient, sPin );
 return;
 }
 }
-while ( aLine.getLength() > 0 );
-
-MutexGuard aGuard( sDataMutex );
-std::shared_ptr< ClientInfoInternal > pClient =
-std::make_shared(
-OStringToOUString( aName, RTL_TEXTENCODING_UTF8 ),
-pSocket, OStringToOUString( aPin, RTL_TEXTENCODING_UTF8 ) );
-mAvailableClients.push_back( pClient );
-
-// Check if we already have this server.
-Reference< XNameAccess > const xConfig = 
officecfg::Office::Impress::Misc::AuthorisedRemotes::get();
-const Sequence< OUString > aNames = xConfig->getElementNames();
-for ( const auto& rName : aNames )
-{
-if ( rName == pClient->mName )
-{
-Reference xSetItem( xConfig->getByName(rName), 
UNO_QUERY );
-Any axPin(xSetItem->getByName("PIN"));
-OUString sPin;
-axPin >>= sPin;
-
-if ( sPin == pClient->mPin ) {
-SAL_INFO( "sdremote", "client found on validated list -- 
connecting" );
-connectClient( pClient, sPin );
-return;
-}
-}
-}
-// Pin not found so inform the client.
-SAL_INFO( "sdremote", &q

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

2021-07-17 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/remotecontrol/Server.cxx |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit d6078e02832d13054e6552c6e20277fd1f3e83f6
Author: Andrzej Hunt 
AuthorDate: Fri Jul 16 18:55:19 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 17 11:49:20 2021 +0200

sdremote: clean up now-unneeded "found" flag

Since ???, this code now lives in a standalone method, allowing
us to return as soon as know that the handshake is complete. This
lets us remove aFound and simplify the code a little.

Change-Id: I51d5281492d2e4280a101e67d606073f4d064c29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119084
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sd/source/ui/remotecontrol/Server.cxx 
b/sd/source/ui/remotecontrol/Server.cxx
index 6a1716b22e86..e3576bacd52e 100644
--- a/sd/source/ui/remotecontrol/Server.cxx
+++ b/sd/source/ui/remotecontrol/Server.cxx
@@ -149,7 +149,6 @@ void RemoteServer::handleAcceptedConnection( 
BufferedStreamSocket *pSocket )
 // Check if we already have this server.
 Reference< XNameAccess > const xConfig = 
officecfg::Office::Impress::Misc::AuthorisedRemotes::get();
 const Sequence< OUString > aNames = xConfig->getElementNames();
-bool aFound = false;
 for ( const auto& rName : aNames )
 {
 if ( rName == pClient->mName )
@@ -162,18 +161,14 @@ void RemoteServer::handleAcceptedConnection( 
BufferedStreamSocket *pSocket )
 if ( sPin == pClient->mPin ) {
 SAL_INFO( "sdremote", "client found on validated list -- 
connecting" );
 connectClient( pClient, sPin );
-aFound = true;
-break;
+return;
 }
 }
 }
 // Pin not found so inform the client.
-if ( !aFound )
-{
-SAL_INFO( "sdremote", "client not found on validated list" );
-pSocket->write( "LO_SERVER_VALIDATING_PIN\n\n",
+SAL_INFO( "sdremote", "client not found on validated list" );
+pSocket->write( "LO_SERVER_VALIDATING_PIN\n\n",
 strlen( "LO_SERVER_VALIDATING_PIN\n\n" ) );
-}
 } else {
 SAL_INFO( "sdremote", "client failed to send LO_SERVER_CLIENT_PAIR, 
ignoring" );
 delete pSocket;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-17 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/inc/RemoteServer.hxx |2 
 sd/source/ui/remotecontrol/Server.cxx |  116 ++
 2 files changed, 64 insertions(+), 54 deletions(-)

New commits:
commit fcc4d8e01360baa9ba0bf20eb5e7a1c9af793a02
Author: Andrzej Hunt 
AuthorDate: Fri Jul 16 18:52:57 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 17 11:48:37 2021 +0200

sdremote: avoid infinite loop if client disconnects during handshake

The following loop can turn into an infinite loop if the client
disconnects at the wrong point in time, because pSocket->readLine()
returns 0 (indicating disconnection), aLine remains empty (no data
was read), and we just keep looping because we never bothered to check
the return value:
  do
  {
  pSocket->readLine( aLine );
  }
   while ( aLine.getLength() > 0 );

Aside from spinning unnecessarily, this infinite loop also stops the
server from being able to accept any new incoming connections - in
effect this causes a DOS of the server.

Hence we need to start checking readLine's return value, and break out
of this loop - and in fact break of the surrounding outer loop too
(because we discard this connection and want to wait for another
 connection to arrive).

Because of the nested looping it's hard to come up with a clean solution
that only involves changing this loop - we'd probably need to introduce
a temporary to remember that the client has disconnected, and check that
temporary after the do...while - letting us 'continue' the outer loop.

Therefore we first extract the code that handles newly accepted clients
into a separate method, which then lets us simplify the implementation
by returning at those points that we know a client has disappeared. That
unfortunately makes this bug-fix patch a little more noisy than
expected, but it is a refactoring that we'd want to make anyway.

(There are further improvement we can make here, but I'll put those in a
 separate commit to simplify cherry-picking of just this fix. Examples
 include moving to smart pointers instead of new/delete, introducing an
 early return instead of the really long if statement, etc.)

Change-Id: I13c6efa622a1b1de10b72757ea07e5f4660749fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119083
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sd/source/ui/inc/RemoteServer.hxx 
b/sd/source/ui/inc/RemoteServer.hxx
index 65bc523ad274..d5dba8c092f0 100644
--- a/sd/source/ui/inc/RemoteServer.hxx
+++ b/sd/source/ui/inc/RemoteServer.hxx
@@ -28,6 +28,7 @@ namespace com::sun::star::uno { template  class Reference;
 
 namespace sd
 {
+class BufferedStreamSocket;
 class Communicator;
 
 struct ClientInfo
@@ -81,6 +82,7 @@ namespace sd
 ::std::vector< std::shared_ptr< ClientInfoInternal > > 
mAvailableClients;
 
 void execute() override;
+void handleAcceptedConnection( BufferedStreamSocket *pSocket ) ;
 };
 }
 
diff --git a/sd/source/ui/remotecontrol/Server.cxx 
b/sd/source/ui/remotecontrol/Server.cxx
index 36e052dd006f..6a1716b22e86 100644
--- a/sd/source/ui/remotecontrol/Server.cxx
+++ b/sd/source/ui/remotecontrol/Server.cxx
@@ -103,73 +103,81 @@ void RemoteServer::execute()
 return; // Closed, or other issue.
 }
 BufferedStreamSocket *pSocket = new BufferedStreamSocket( aSocket);
-OString aLine;
-if ( pSocket->readLine( aLine)
-&& aLine == "LO_SERVER_CLIENT_PAIR"
-&& pSocket->readLine( aLine ) )
-{
-OString aName( aLine );
+handleAcceptedConnection( pSocket );
+}
+SAL_INFO( "sdremote", "shutting down RemoteServer" );
+spServer = nullptr; // Object is destroyed when Thread::execute() ends.
+}
 
-if ( ! pSocket->readLine( aLine ) )
-{
-delete pSocket;
-continue;
-}
-OString aPin( aLine );
+void RemoteServer::handleAcceptedConnection( BufferedStreamSocket *pSocket )
+{
+OString aLine;
+if ( pSocket->readLine( aLine)
+&& aLine == "LO_SERVER_CLIENT_PAIR"
+&& pSocket->readLine( aLine ) )
+{
+OString aName( aLine );
 
-SocketAddr aClientAddr;
-pSocket->getPeerAddr( aClientAddr );
+if ( ! pSocket->readLine( aLine ) )
+{
+delete pSocket;
+return;
+}
+OString aPin( aLine );
 
-MutexGuard aGuard( sDataMutex );
-std::shared_ptr< ClientInfoInternal > pClient =
-std::make_shared(
-OStringToOUString( aName, RTL_TEXTENCODING_UTF8 ),
-pSocket, OStringToOUString( aPin, RTL_TEXTEN

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

2021-07-17 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/remotecontrol/Server.cxx |7 ---
 1 file changed, 7 deletions(-)

New commits:
commit 34309e232c13017c9d178627c652e5ffdeb3
Author: Andrzej Hunt 
AuthorDate: Sat Jul 17 08:44:22 2021 +0200
Commit: Andrzej Hunt 
CommitDate: Sat Jul 17 11:31:03 2021 +0200

sdremote: remove commented out experimental check

The entire if statement was introduced only to check for experimental
mode in the following commit - the xContext check is seemingly only
needed for null safety:
  79c1b16a96a6 (sdremote: make it possible to have only bluetooth enabled, 
2012-11-27)

Later, the epxerimental mode check was disabled in:
  b9d2671ae11d (merge WiFi support into remote control feature toggle, 
2013-08-01)

Given that the remote is clearly no longer experimental, it's
time to remove the commented code entirely - and I think it's also
safe to remove the xContext check too. (Note: the remote IS still
controlled by the EnableSdRemote option, and IS disabled by default.)

Change-Id: Id118924021d5029b4f15df9cbb3eba28f3b902c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119091
Tested-by: Jenkins
Reviewed-by: Andrzej Hunt 

diff --git a/sd/source/ui/remotecontrol/Server.cxx 
b/sd/source/ui/remotecontrol/Server.cxx
index d3f1ac67f904..36e052dd006f 100644
--- a/sd/source/ui/remotecontrol/Server.cxx
+++ b/sd/source/ui/remotecontrol/Server.cxx
@@ -78,13 +78,6 @@ RemoteServer::~RemoteServer()
 void RemoteServer::execute()
 {
 SAL_INFO( "sdremote", "RemoteServer::execute called" );
-uno::Reference< uno::XComponentContext > xContext = 
comphelper::getProcessComponentContext();
-if (!xContext.is()/* || 
!officecfg::Office::Common::Misc::ExperimentalMode::get(xContext)*/)
-{
-// SAL_INFO("sdremote", "not in experimental mode, disabling TCP 
server");
-spServer = nullptr;
-return;
-}
 osl::SocketAddr aAddr( "0.0.0.0", PORT );
 if ( !mSocket.bind( aAddr ) )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-15 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/remotecontrol/Transmitter.cxx |   14 +++---
 sd/source/ui/remotecontrol/Transmitter.hxx |2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit f4ea1e6095ff751cbecf10061c4eff9934ffd520
Author: Andrzej Hunt 
AuthorDate: Sun Jul 11 17:22:54 2021 +0200
Commit: Andrzej Hunt 
CommitDate: Fri Jul 16 07:20:36 2021 +0200

sdremote: Transmitter: s/mQueuesNotEmpty/mProcessingRequired/

Make mProcessingRequired's name a bit more self-explanatory to make it
clear what we're actually using it for. See also a 8e6cdb0 which
fixed a race condition caused by incorrect use of this Condition.

Change-Id: I6ad63dbd5ae8ed767f42ea22e568ac47a4d08642
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118752
Tested-by: Jenkins
Reviewed-by: Andrzej Hunt 

diff --git a/sd/source/ui/remotecontrol/Transmitter.cxx 
b/sd/source/ui/remotecontrol/Transmitter.cxx
index 76cda8feae55..f00f15502a45 100644
--- a/sd/source/ui/remotecontrol/Transmitter.cxx
+++ b/sd/source/ui/remotecontrol/Transmitter.cxx
@@ -16,7 +16,7 @@ using namespace sd;
 
 Transmitter::Transmitter( IBluetoothSocket* aSocket )
   : pStreamSocket( aSocket ),
-mQueuesNotEmpty(),
+mProcessingRequired(),
 mMutex(),
 mFinishRequested( false ),
 mLowPriority(),
@@ -30,7 +30,7 @@ void SAL_CALL Transmitter::run()
 
 while ( true )
 {
-mQueuesNotEmpty.wait();
+mProcessingRequired.wait();
 
 ::osl::MutexGuard aGuard( mMutex );
 
@@ -52,9 +52,9 @@ void SAL_CALL Transmitter::run()
 pStreamSocket->write( aMessage.getStr(), aMessage.getLength() );
 }
 
-if ( mLowPriority.empty() && mHighPriority.empty() )
+if ( mLowPriority.empty() && mHighPriority.empty())
 {
-mQueuesNotEmpty.reset();
+mProcessingRequired.reset();
 }
 }
 }
@@ -63,7 +63,7 @@ void Transmitter::notifyFinished()
 {
 ::osl::MutexGuard aGuard( mMutex );
 mFinishRequested = true;
-mQueuesNotEmpty.set();
+mProcessingRequired.set();
 }
 
 Transmitter::~Transmitter()
@@ -82,9 +82,9 @@ void Transmitter::addMessage( const OString& aMessage, const 
Priority aPriority
 mHighPriority.push( aMessage );
 break;
 }
-if ( !mQueuesNotEmpty.check() )
+if ( !mProcessingRequired.check() )
 {
-mQueuesNotEmpty.set();
+mProcessingRequired.set();
 }
 }
 
diff --git a/sd/source/ui/remotecontrol/Transmitter.hxx 
b/sd/source/ui/remotecontrol/Transmitter.hxx
index 1cd94ea26712..c24f5a5a46fe 100644
--- a/sd/source/ui/remotecontrol/Transmitter.hxx
+++ b/sd/source/ui/remotecontrol/Transmitter.hxx
@@ -36,7 +36,7 @@ private:
 
 ::sd::IBluetoothSocket* pStreamSocket;
 
-::osl::Condition mQueuesNotEmpty;
+::osl::Condition mProcessingRequired;
 
 ::osl::Mutex mMutex;
 /**
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-14 Thread Andrzej Hunt (via logerrit)
 sd/source/ui/remotecontrol/Transmitter.cxx |   16 +---
 sd/source/ui/remotecontrol/Transmitter.hxx |   11 ---
 2 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit 8e6cdb02450a876b5c684eb621e1c9383fb1c428
Author: Andrzej Hunt 
AuthorDate: Sun Jul 11 17:17:27 2021 +0200
Commit: Andrzej Hunt 
CommitDate: Wed Jul 14 21:02:03 2021 +0200

sdremote: fix race condition in Transmitter shutdown to plug leak

We need to acquire the mutex in notifyFinished() to avoid a race between
notifyFinished() and the loop in run(). And we also need to check
mFinishRequested) while holding the mutex to avoid the same race
condition. While we're here, rename the mutex to make it more obvious
that it's not only protecting the queues.

The race can happen because the loop in run() blocks until
mQueuesNotEmpty is set. It also resets mQueuesNotEmpty at the end of
each iteration if the queues are empty. So if someone sets
mQueuesNotEmpty in the middle of an iteration, and the loop later resets
it, the loop won't continue iterating. But we're actually using
mQueuesNotEmpty to indicate either that the queues have data OR that we
might want to finish transmission.

And the problem is that notifyFinished() sets mFinishRequested, followed
by setting mQueuesNotEmpty in an attempt to get the loop to process
mFinishRequested (at which point the loop should finish and return).
But as described above, we can easily get into a situation where the
loop resets mQueuesNotEmpty again (at least if there's no more pending
data in the queues). In this scenario, the loop blocks forever
(we won't receive any new messages after notifyFinished()), causing a
leak of both Transmitter and any resources it's using - e.g. the
StreamSocket.

The easiest way to fix this is to make it clear that the mutex protects
all internal state, followed by using it to protect all internal state.

This issue is not a big deal in normal usage - it's a tiny leak, and
users won't connect enough clients for accumulated leaks to pose
any issues. But it's ugly, and potentially problematic for long-running
tests which could run out of filedescriptors because of the socket leak.

I will rename mQueuesNotEmpty to something more obvious (possibly
mProcessingRequired) in a separate commit.

Change-Id: I2e22087054f3f6a02e05c568b1832ccc5a8b47a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118751
Reviewed-by: Andrzej Hunt 
Tested-by: Jenkins

diff --git a/sd/source/ui/remotecontrol/Transmitter.cxx 
b/sd/source/ui/remotecontrol/Transmitter.cxx
index 8f3b7d24c184..76cda8feae55 100644
--- a/sd/source/ui/remotecontrol/Transmitter.cxx
+++ b/sd/source/ui/remotecontrol/Transmitter.cxx
@@ -17,8 +17,8 @@ using namespace sd;
 Transmitter::Transmitter( IBluetoothSocket* aSocket )
   : pStreamSocket( aSocket ),
 mQueuesNotEmpty(),
-mFinishRequested(),
-mQueueMutex(),
+mMutex(),
+mFinishRequested( false ),
 mLowPriority(),
 mHighPriority()
 {
@@ -32,10 +32,11 @@ void SAL_CALL Transmitter::run()
 {
 mQueuesNotEmpty.wait();
 
-if ( mFinishRequested.check() )
-return;
+::osl::MutexGuard aGuard( mMutex );
 
-::osl::MutexGuard aQueueGuard( mQueueMutex );
+if ( mFinishRequested ) {
+return;
+}
 if ( !mHighPriority.empty() )
 {
 OString aMessage( mHighPriority.front() );
@@ -60,7 +61,8 @@ void SAL_CALL Transmitter::run()
 
 void Transmitter::notifyFinished()
 {
-mFinishRequested.set();
+::osl::MutexGuard aGuard( mMutex );
+mFinishRequested = true;
 mQueuesNotEmpty.set();
 }
 
@@ -70,7 +72,7 @@ Transmitter::~Transmitter()
 
 void Transmitter::addMessage( const OString& aMessage, const Priority 
aPriority )
 {
-::osl::MutexGuard aQueueGuard( mQueueMutex );
+::osl::MutexGuard aGuard( mMutex );
 switch ( aPriority )
 {
 case PRIORITY_LOW:
diff --git a/sd/source/ui/remotecontrol/Transmitter.hxx 
b/sd/source/ui/remotecontrol/Transmitter.hxx
index 8acebfeff7e8..1cd94ea26712 100644
--- a/sd/source/ui/remotecontrol/Transmitter.hxx
+++ b/sd/source/ui/remotecontrol/Transmitter.hxx
@@ -37,11 +37,16 @@ private:
 ::sd::IBluetoothSocket* pStreamSocket;
 
 ::osl::Condition mQueuesNotEmpty;
-::osl::Condition mFinishRequested;
-
-::osl::Mutex mQueueMutex;
 
+::osl::Mutex mMutex;
+/**
+ * Used to indicate that we're done and the transmitter loop should exit.
+ * All access must be guarded my `mMutex`.
+ */
+bool mFinishRequested;
+/// Queue for low priority messages. All access must be guarded my 
`mMutex`.
 std::queue mLowPriority;
+/// Queue for high priority messages. All access must be guarded my 
`mMutex`.
 std::queue mHighPrio

[Libreoffice-commits] core.git: configure.ac

2021-07-04 Thread Andrzej Hunt (via logerrit)
 configure.ac |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e1d3c8438ade045aab4452dd59000d27f810ca91
Author: Andrzej Hunt 
AuthorDate: Sun Jul 4 14:54:43 2021 +0200
Commit: Caolán McNamara 
CommitDate: Sun Jul 4 20:35:03 2021 +0200

Fix LIB_FUZZING_ENGINE not-empty check

Switch to '-z $LIB_FUZZING_ENGINE' to check if LIB_FUZZING_ENGINE is
set. The previous version evaluates to false when LIB_FUZZING_ENGINE is
not set, meaning you would not be warned at configure time when using
-enable_fuzzers without setting LIB_FUZZING_ENGINE.

Original broken version landed in:
44b36a0602b04342566362bce3f6bed7d2b096e4
( https://gerrit.libreoffice.org/c/core/+/111691 )

Change-Id: Ic2174777ebf724e471cd605ba54b245e4e804705
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118372
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/configure.ac b/configure.ac
index 7a9eaf39b24b..b2ca6f8d4edd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10637,7 +10637,7 @@ AC_MSG_CHECKING([whether to enable fuzzers])
 if test "$enable_fuzzers" != yes; then
 AC_MSG_RESULT([no])
 else
-if test $LIB_FUZZING_ENGINE == ""; then
+if test -z $LIB_FUZZING_ENGINE; then
   AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using 
--enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
 fi
 AC_MSG_RESULT([yes])
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: config_host.mk.in configure.ac vcl/Executable_602fuzzer.mk vcl/Executable_bmpfuzzer.mk vcl/Executable_cgmfuzzer.mk vcl/Executable_diffuzzer.mk vcl/Executable_docxfuzzer

2021-02-28 Thread Andrzej Hunt (via logerrit)
 config_host.mk.in |1 +
 configure.ac  |4 
 vcl/Executable_602fuzzer.mk   |2 +-
 vcl/Executable_bmpfuzzer.mk   |2 +-
 vcl/Executable_cgmfuzzer.mk   |2 +-
 vcl/Executable_diffuzzer.mk   |2 +-
 vcl/Executable_docxfuzzer.mk  |2 +-
 vcl/Executable_dxffuzzer.mk   |2 +-
 vcl/Executable_epsfuzzer.mk   |2 +-
 vcl/Executable_fodpfuzzer.mk  |2 +-
 vcl/Executable_fodsfuzzer.mk  |2 +-
 vcl/Executable_fodtfuzzer.mk  |2 +-
 vcl/Executable_giffuzzer.mk   |2 +-
 vcl/Executable_htmlfuzzer.mk  |2 +-
 vcl/Executable_hwpfuzzer.mk   |2 +-
 vcl/Executable_jpgfuzzer.mk   |2 +-
 vcl/Executable_lwpfuzzer.mk   |2 +-
 vcl/Executable_metfuzzer.mk   |2 +-
 vcl/Executable_mmlfuzzer.mk   |2 +-
 vcl/Executable_mtpfuzzer.mk   |2 +-
 vcl/Executable_olefuzzer.mk   |2 +-
 vcl/Executable_pcdfuzzer.mk   |2 +-
 vcl/Executable_pctfuzzer.mk   |2 +-
 vcl/Executable_pcxfuzzer.mk   |2 +-
 vcl/Executable_pngfuzzer.mk   |2 +-
 vcl/Executable_ppmfuzzer.mk   |2 +-
 vcl/Executable_pptfuzzer.mk   |2 +-
 vcl/Executable_pptxfuzzer.mk  |2 +-
 vcl/Executable_psdfuzzer.mk   |2 +-
 vcl/Executable_qpwfuzzer.mk   |2 +-
 vcl/Executable_rasfuzzer.mk   |2 +-
 vcl/Executable_rtffuzzer.mk   |2 +-
 vcl/Executable_scrtffuzzer.mk |2 +-
 vcl/Executable_sftfuzzer.mk   |2 +-
 vcl/Executable_slkfuzzer.mk   |2 +-
 vcl/Executable_svmfuzzer.mk   |2 +-
 vcl/Executable_tgafuzzer.mk   |2 +-
 vcl/Executable_tiffuzzer.mk   |2 +-
 vcl/Executable_wksfuzzer.mk   |2 +-
 vcl/Executable_wmffuzzer.mk   |2 +-
 vcl/Executable_ww2fuzzer.mk   |2 +-
 vcl/Executable_ww6fuzzer.mk   |2 +-
 vcl/Executable_ww8fuzzer.mk   |2 +-
 vcl/Executable_xbmfuzzer.mk   |2 +-
 vcl/Executable_xlsfuzzer.mk   |2 +-
 vcl/Executable_xlsxfuzzer.mk  |2 +-
 vcl/Executable_xpmfuzzer.mk   |2 +-
 47 files changed, 50 insertions(+), 45 deletions(-)

New commits:
commit 44b36a0602b04342566362bce3f6bed7d2b096e4
Author: Andrzej Hunt 
AuthorDate: Sat Feb 27 14:21:56 2021 +0100
Commit: Caolán McNamara 
CommitDate: Sun Feb 28 19:46:58 2021 +0100

Upgrade fuzzers to LIB_FUZZING_ENGINE

And check that LIB_FUZZING_ENGINE is set during configure.

Because:
1. It's easier to build locally this way (you don't need to build or hack a
   libFuzzingEngine.a - instead you can just specify
   LIB_FUZZING_ENGINE=-fsanitize=fuzzer to produce a valid build).
2. Using -lFuzzingEngine is deprecated [1] for various reasons [2].

The old behaviour can be emulated if desired by setting
LIB_FUZZING_ENGINE=-lFuzzingEngine .

This patch was tested as follows:
- Building LO within oss-fuzz via:
python infra/helper.py build_fuzzers --sanitizer address libreoffice 

python infra/helper.py check_build libreoffice
- Building LO fuzzers standalone via:
export CC="clang-11"
export CXX="clang++-11 -stdlib=libc++"
export CFLAGS="-fsanitize=address -fsanitize-address-use-after-scope 
-fsanitize=fuzzer-no-link -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
export CXXFLAGS="$CFLAGS -stdlib=libc++"
export LDFLAGS="$CFLAGS -Wl,--compress-debug-sections,zlib -lpthread"
export LIB_FUZZING_ENGINE=-fsanitize=fuzzer
./autogen.sh --with-distro=LibreOfficeOssFuzz  --with-system-libxml
make fuzzers
  (--with-system-libxml only appears to be needed because of issues
  specific to my build environment/Suse 15.2. I'm invoking clang-11 simply
  because that's the most modern clang I have installed, plain clang should
  also work on most sufficiently modern systems).

[1]

https://github.com/google/oss-fuzz/blob/481280c65048fd12fb2141b9225af511a9ef7ed2/infra/presubmit.py#L46
[2] https://github.com/google/oss-fuzz/issues/2164

Change-Id: Iddb577c30a39620e72372ef6c2d3fda67f8aabdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111691
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/config_host.mk.in b/config_host.mk.in
index c6c9b7eae351..2f52785b840a 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -353,6 +353,7 @@ export LIBLAYOUT_JAR=@LIBLAYOUT_JAR@
 export LIBLOADER_JAR=@LIBLOADER_JAR@
 export LIBNUMBERTEXT_CFLAGS=$(gb_SPACE)@LIBNUMBERTEXT_CFLAGS@
 export LIBNUMBERTEXT_LIBS=$(gb_SPACE)@LIBNUMBERTEXT_LIBS@
+export LIB_FUZZING_ENGINE=@LIB_FUZZING_ENGINE@
 export LIBO_BIN_FOLDER=@LIBO_BIN_FOLDER@
 export LIBO_BIN_FOLDER_FOR_BUILD=@LIBO_BIN_FOLDER_FOR_BUILD@
 export LIBO_ETC_FOLDER=@LIBO_ETC_FOLDER@
diff --git a/configure.ac b/configure.ac
index 9e0085370d2b..90b0cf01633b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10396,11 +10396,15 @@ AC_MSG_CHECKING([whether to enable fuzzers])
 if test "$enable_fuzzers" != yes; then
   

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - desktop/qa sc/source

2016-05-08 Thread Andrzej Hunt
 desktop/qa/desktop_lib/test_desktop_lib.cxx |   20 
 sc/source/ui/view/gridwin.cxx   |7 ++-
 2 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit ebf654c44a92a1becb88982da0f68861b444a3da
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Fri Nov 6 18:09:34 2015 +0100

sc lok: Add initial test for .uno:CellCursor

This should be extended with checking that we receive "EMPTY"
when there is no cursor shown - that would require e.g. simulating
keyboard input to hide the cell cursor.

Reviewed-on: https://gerrit.libreoffice.org/19828
Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
Tested-by: Andrzej Hunt <andr...@ahunt.org>
(cherry picked from commit 2f13f051c3c39f77d5f65ff0e3f4a476ccb95f1a)

Change-Id: Ia7be5ec3e158f21967b4c307ac10abb2b5e2a56a
Reviewed-on: https://gerrit.libreoffice.org/24724
Reviewed-by: Ashod Nakashian <ashnak...@gmail.com>
Tested-by: Ashod Nakashian <ashnak...@gmail.com>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index e89caae..4009920 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -95,6 +95,7 @@ public:
 void testPasteWriter();
 void testPasteWriterJPEG();
 void testRowColumnHeaders();
+void testCellCursor();
 void testHiddenRowHeaders();
 void testCommandResult();
 void testWriterComments();
@@ -115,6 +116,7 @@ public:
 CPPUNIT_TEST(testPasteWriter);
 CPPUNIT_TEST(testPasteWriterJPEG);
 CPPUNIT_TEST(testRowColumnHeaders);
+CPPUNIT_TEST(testCellCursor);
 CPPUNIT_TEST(testHiddenRowHeaders);
 CPPUNIT_TEST(testCommandResult);
 CPPUNIT_TEST(testWriterComments);
@@ -536,6 +538,24 @@ void DesktopLOKTest::testRowColumnHeaders()
 }
 }
 
+void DesktopLOKTest::testCellCursor()
+{
+LibLODocument_Impl* pDocument = loadDoc("search.ods");
+
+boost::property_tree::ptree aTree;
+
+char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, 
".uno:CellCursor?tileWidth=1=1=1=1");
+
+std::stringstream aStream(pJSON);
+free(pJSON);
+CPPUNIT_ASSERT(!aStream.str().empty());
+
+boost::property_tree::read_json(aStream, aTree);
+
+OString aRectangle(aTree.get("commandValues").c_str());
+CPPUNIT_ASSERT_EQUAL(aRectangle, OString("0, 0, 1278, 254"));
+}
+
 void DesktopLOKTest::testHiddenRowHeaders()
 {
 LibLODocument_Impl* pDocument = loadDoc("hidden-row.ods");
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index a3f13d5..e163f61 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5803,13 +5803,10 @@ OString ScGridWindow::getCellCursor( int nOutputWidth, 
int nOutputHeight,
 }
 
 OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& 
rZoomY) {
-ScDocument* pDoc = pViewData->GetDocument();
-ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
-
-// GridWindows stores a shown cell cursor in mpOOCursors, hence
+// GridWindow stores a shown cell cursor in mpOOCursors, hence
 // we can use that to determine whether we would want to be showing
 // one (client-side) for tiled rendering too.
-if (!pDrawLayer->isTiledRendering() || !mpOOCursors.get())
+if (!mpOOCursors.get())
 {
 return OString("EMPTY");
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Re: Firebird doesn't support MSVC 2015

2016-03-04 Thread Andrzej Hunt
Having spent some more time using SQLite recent I don't think it would be a bad 
choice for the default embedded DB. Yes it lacks type checking, but it's well 
tested, seems to be easier to build, and is much more widely used.

The reason we wanted a new DB was to allow using Base without the Java 
dependency, i.e. to allow more people to try Base easily. The reason we went 
for firebird instead of SQLite was the lack of type checking/dynamic type 
system that SQLite has. In hindsight I feel like this isn't actually a huge 
issue for the average user who probably just wants to build something simple in 
Base. (A bunch of well known of real life applications rely on SQLite without 
issues.)

Note: if someone is truly concerned about the underlying database I suspect 
they should be running their own external DB, which lets them choose from a 
large number of DBs (I'm not a base expert though, don't quote me on this...). 
All we're doing here is setting the default DB when you create a .odb work an 
embedded DB.

One issue that would need investigating is forwards compatibility - which I 
discovered potentially doesn't exist between eg SQLite 3.8 and 3.6. So maybe 
this isn't actually a good solution either, unless we'd stick to one version of 
SQLite across LO versions.

- Andrzej

On 3 March 2016 09:53:40 GMT-08:00, Jonathan Aquilina  
wrote:
>Instead of reinventing the wheel why not look at SQLite or there is a
>nosql
>db couchdb as well but not sure how easy that would be to integrate
>with LO
>
>This email has been sent from a virus-free computer protected by Avast.
>www.avast.com
>
><#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
>Jonathan Aquilina
>
>On Thu, Mar 3, 2016 at 6:50 PM, Wols Lists 
>wrote:
>
>> On 02/03/16 12:12, Noel Grandin wrote:
>> >
>> >
>> > On 2016/03/02 2:11 PM, Michael Stahl wrote:
>> >>
>> >> personally i'd be inclined towards alternatives that are less
>likely to
>> >> trigger toolchain problems - maybe there's a SQL database
>implemented
>> >> in, say, Java somewhere...
>> >>
>> >
>> > Maybe even one that shares a committer with LO ?
>> >
>> :-)
>>
>> Sounds like I ought to get my finger out :-)
>>
>> I want to write a NoSQL database (a Pick derivative) and the plan is
>to
>> do it and make it part of LibreOffice. Problem is, as a carer, I find
>it
>> very hard to get the time available to concentrate, and I also don't
>> have all the skills I need.
>>
>> Anyways, I will try and have a crack at it - life seems to be getting
>a
>> bit easier at the moment - and see where it takes us.
>>
>> For those who know me, I am very much anti relational practice - imho
>> it's impossible to write an efficient truly relational database - the
>> theory has technical flaws that seriously impact any FNF engine.
>> Basically, that (in contravention of Einstein's dictum) the engine is
>> *too* *simple*, which means that any applications *must* be *overly*
>> *complex*. I'll wax lyrical if you like but you'd be wise not to get
>me
>> started :-)
>>
>> My main problem is that a Pick database is actually a complete
>operating
>> environment. Fundamental to its operation is its language, called
>> DATABASIC, and while I could probably write the database engine
>without
>> too much difficulty, writing the language compiler is a step too far
>at
>> the moment.
>>
>> Anyways, here's to having a go - if anyone's mad enough to join me,
>great!
>>
>> Cheers,
>> Wol
>> ___
>> LibreOffice mailing list
>> LibreOffice@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/libreoffice
>>
>
>
>
>
>___
>LibreOffice mailing list
>LibreOffice@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/libreoffice
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2016-01-06 Thread Andrzej Hunt
 desktop/source/deployment/registry/component/dp_component.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 65650d64324580e3b0abf6e0ca6ef270c730cf88
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 23 15:12:33 2015 -0800

Use OUStringBuffer when constructing string in loop

Change-Id: Ic29e301d0162d41ea5e38070e296610115735983
Reviewed-on: https://gerrit.libreoffice.org/20191
Reviewed-by: Noel Grandin <noelgran...@gmail.com>
Tested-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/desktop/source/deployment/registry/component/dp_component.cxx 
b/desktop/source/deployment/registry/component/dp_component.cxx
index f739a67..b591ec3 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -1108,10 +1108,10 @@ Reference raise_uno_process(
 url, comphelper::containerToSequence(args) );
 }
 catch (...) {
-OUString sMsg = "error starting process: " + url;
+OUStringBuffer sMsg = "error starting process: " + url;
 for(const auto& arg : args)
-sMsg += " " + arg;
-throw uno::RuntimeException(sMsg);
+sMsg.append(" ").append(arg);
+throw uno::RuntimeException(sMsg.makeStringAndClear());
 }
 try {
 return Reference(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: canvas/source comphelper/source compilerplugins/clang cui/source dbaccess/source desktop/source pyuno/source sc/source sd/source slideshow/source sw/source unotools/sou

2016-01-05 Thread Andrzej Hunt
 canvas/source/vcl/spritecanvashelper.cxx  |2 
 comphelper/source/misc/accessiblewrapper.cxx  |2 
 compilerplugins/clang/rangedforcopy.cxx   |   66 ++
 cui/source/options/personalization.cxx|4 
 dbaccess/source/ui/dlg/queryorder.cxx |4 
 dbaccess/source/ui/querydesign/JoinTableView.cxx  |2 
 dbaccess/source/ui/querydesign/QueryTableView.cxx |4 
 dbaccess/source/ui/querydesign/TableWindowTitle.cxx   |2 
 desktop/source/deployment/registry/component/dp_component.cxx |2 
 pyuno/source/module/pyuno_struct.cxx  |2 
 sc/source/filter/oox/worksheetbuffer.cxx  |2 
 sc/source/ui/dbgui/pfiltdlg.cxx   |6 
 sc/source/ui/miscdlgs/optsolver.cxx   |8 -
 sc/source/ui/view/gridwin.cxx |5 
 sd/source/filter/eppt/pptx-epptooxml.cxx  |2 
 sd/source/ui/animations/SlideTransitionPane.cxx   |   10 -
 slideshow/source/engine/slideshowimpl.cxx |2 
 sw/source/core/doc/notxtfrm.cxx   |2 
 sw/source/core/frmedt/tblsel.cxx  |2 
 sw/source/core/unocore/unostyle.cxx   |2 
 sw/source/core/unocore/unotbl.cxx |2 
 sw/source/ui/table/tabledlg.cxx   |2 
 unotools/source/misc/ServiceDocumenter.cxx|4 
 23 files changed, 104 insertions(+), 35 deletions(-)

New commits:
commit 9d0b06e9f728d01a2d2908e1e56cb4220cd414d5
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Sat Nov 21 08:14:05 2015 -0800

new loplugin rangedforcopy - use reference in range based for

Inspired by 6e6ae9803796b120e95f6e89575e03c5fd0ed3c2

Change-Id: Ia0f264d3a6bbf076aa5080e3398683e50bc6ef01
Reviewed-on: https://gerrit.libreoffice.org/20190
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/canvas/source/vcl/spritecanvashelper.cxx 
b/canvas/source/vcl/spritecanvashelper.cxx
index bba2e05..892b241 100644
--- a/canvas/source/vcl/spritecanvashelper.cxx
+++ b/canvas/source/vcl/spritecanvashelper.cxx
@@ -375,7 +375,7 @@ namespace vclcanvas
 // opaque sprite content)
 
 // repaint all affected sprites directly to output device
-for( const auto rComponent : rUpdateArea.maComponentList )
+for( const auto& rComponent : rUpdateArea.maComponentList )
 {
 const ::canvas::Sprite::Reference& rSprite( 
rComponent.second.getSprite() );
 
diff --git a/comphelper/source/misc/accessiblewrapper.cxx 
b/comphelper/source/misc/accessiblewrapper.cxx
index 5e52621..2bb538f 100644
--- a/comphelper/source/misc/accessiblewrapper.cxx
+++ b/comphelper/source/misc/accessiblewrapper.cxx
@@ -137,7 +137,7 @@ namespace comphelper
 void OWrappedAccessibleChildrenManager::dispose()
 {
 // dispose our children
-for( const auto rChild : m_aChildrenMap )
+for( const auto& rChild : m_aChildrenMap )
 {
 Reference< XComponent > xComp( rChild.first, UNO_QUERY );
 if( xComp.is() )
diff --git a/compilerplugins/clang/rangedforcopy.cxx 
b/compilerplugins/clang/rangedforcopy.cxx
new file mode 100644
index 000..4c86fe3
--- /dev/null
+++ b/compilerplugins/clang/rangedforcopy.cxx
@@ -0,0 +1,66 @@
+
+/* -*- 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 
+#include 
+
+#include "plugin.hxx"
+#include "compat.hxx"
+#include "clang/AST/CXXInheritance.h"
+
+// Check that we're not unnecessarily copying variables in a range based for 
loop
+// e.g. "for (OUString a: aList)" results in a copy of each string being made,
+// whereas "for (const OUString& a: aList)" does not.
+
+namespace
+{
+
+class RangedForCopy:
+public RecursiveASTVisitor, public loplugin::Plugin
+{
+public:
+explicit RangedForCopy(InstantiationData const & data): Plugin(data) {}
+
+virtual void run() override {
+TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
+}
+
+bool VisitCXXForRangeStmt( const CXXForRangeStmt* stmt );
+};
+
+bool RangedForCopy::VisitCXXForRangeStmt( const CXXForRangeStmt* stmt )
+{
+if (ignoreLocation( stmt ))
+return true;
+
+const VarDecl* varDecl = stmt->getLoopVariable();
+if (!varDecl)
+  ret

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

2016-01-03 Thread Andrzej Hunt
 cppu/source/typelib/typelib.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4a8c0d313540bd78c9c381edd548b976c580ca9a
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Sun Jan 3 17:37:35 2016 -0800

loplugin:implicitboolconversion

Change-Id: I2ef26c34a424e653d85597c85baa736c19004313

diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index e105bfe..760f996 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -383,10 +383,10 @@ static inline void typelib_typedescription_initTables(
 {
 typelib_InterfaceTypeDescription * pITD = 
reinterpret_cast(pTD);
 
-std::vector aReadWriteAttributes(pITD->nAllMembers);
+std::vector aReadWriteAttributes(pITD->nAllMembers);
 for ( sal_Int32 i = pITD->nAllMembers; i--; )
 {
-aReadWriteAttributes[i] = sal_False;
+aReadWriteAttributes[i] = false;
 if( typelib_TypeClass_INTERFACE_ATTRIBUTE == 
pITD->ppAllMembers[i]->eTypeClass )
 {
 typelib_TypeDescription * pM = nullptr;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: 3 commits - loleaflet/build loleaflet/dist loleaflet/src loolwsd/bundled loolwsd/LOOLSession.cpp

2015-12-02 Thread Andrzej Hunt
 loleaflet/build/deps.js |2 
 loleaflet/dist/leaflet.css  |7 +
 loleaflet/src/control/Control.ColRowHeader.js   |   69 
 loleaflet/src/control/Control.ColumnHeader.js   |   13 +--
 loleaflet/src/control/Control.RowHeader.js  |   12 +-
 loleaflet/src/layer/tile/TileLayer.js   |   12 +-
 loolwsd/LOOLSession.cpp |   12 ++
 loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h |3 
 8 files changed, 113 insertions(+), 17 deletions(-)

New commits:
commit db02f8795b346c76a3ddbdfc55016a92207a0e98
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 30 12:15:52 2015 -0800

loleaflet: add column/row-header selection support

(cherry picked from commit 264761ca18406b414080ccae31554b8ea1128dfd)

diff --git a/loleaflet/build/deps.js b/loleaflet/build/deps.js
index 9f433ac..657ad69 100644
--- a/loleaflet/build/deps.js
+++ b/loleaflet/build/deps.js
@@ -284,6 +284,7 @@ var deps = {
 
 ControlColumnHeader: {
 src: ['control/Control.js',
+  'control/Control.ColRowHeader.js',
   'control/Control.ColumnHeader.js'],
 heading: 'Controls',
 desc: 'Column Header bar'
@@ -291,6 +292,7 @@ var deps = {
 
 ControlRowHeader: {
 src: ['control/Control.js',
+  'control/Control.ColRowHeader.js',
   'control/Control.RowHeader.js'],
 heading: 'Controls',
 desc: 'Row Header bar'
diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index d31be8a..1c44072 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -785,6 +785,13 @@ a.leaflet-control-buttons:hover:first-child {
 overflow: hidden;
 }
 
+.spreadsheet-table-noselect {
+-webkit-user-select: none;
+-moz-user-select: none;
+ user-select: none;
+-webkit-user-drag: none;
+}
+
 .spreadsheet-table-column {
 table-layout: fixed;
 left: 0px;
diff --git a/loleaflet/src/control/Control.ColRowHeader.js 
b/loleaflet/src/control/Control.ColRowHeader.js
new file mode 100644
index 000..2068d69
--- /dev/null
+++ b/loleaflet/src/control/Control.ColRowHeader.js
@@ -0,0 +1,69 @@
+/*
+ * L.Control.ColRowHeader
+ * 
+ * Provides common methods for the column and row headers.
+ */
+
+L.Control.ColRowHeader = L.Control.extend({
+
+   LOButtons: {
+   left: 1,
+   middle: 2,
+   right: 4
+   },
+
+   JSButtons: {
+   left: 0,
+   middle: 1,
+   right: 2
+   },
+
+   _initializeColRowBar: function(type) {
+   this._type = type;
+   L.DomEvent.on(this._table, 'mousedown', this._onMouseEvent, this);
+   L.DomEvent.on(this._table, 'mouseup', this._onMouseEvent, this);
+   },
+   
+   // Avoid sending mouse move events when we don't have a button down 
(they are just
+   // ignored client side).
+   _enableMouseMove: function(enable) {
+   if (enable === false) {
+   L.DomEvent.off(this._table, 'mousemove', this._onMouseEvent, 
this);
+   } else {
+   L.DomEvent.on(this._table, 'mousemove', this._onMouseEvent, 
this);
+   }
+   },
+
+   _onMouseEvent: function(e) {
+   var docLayer = this._map._docLayer;
+   if (!docLayer) {
+   return;
+   }
+
+   var mousePos = 
docLayer._latLngToTwips(this._map.containerPointToLatLng(this._map.mouseEventToContainerPoint(e)));
+   var modifier = this._map.keyboard.modifier;
+   if (e.type === 'mousemove') {
+   docLayer._postMouseEvent('move', mousePos.x, mousePos.y, 1, 
this._cachedButtons, modifier, this._type);
+   return;
+   }
+
+   var buttons = 0;
+   buttons |= e.button === this.JSButtons.left ? this.LOButtons.left : 
0;
+   buttons |= e.button === this.JSButtons.middle ? 
this.LOButtons.middle : 0;
+   buttons |= e.button === this.JSButtons.right ? this.LOButtons.right 
: 0;
+
+   if (e.type === 'mousedown') {
+   this._enableMouseMove(true);
+   this._cachedButtons = buttons;
+   docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 
1, buttons, modifier, this._type);
+   } else if (e.type === 'mouseup') {
+   this._enableMouseMove(false);
+   docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 
buttons, modifier, this._type);
+   }
+   },
+
+});
+
+L.colrowheader = function (options) {
+   return new L.ColRowHeader(options);
+};
\ No newline at end of file
diff --git a/loleaflet/src/control/Control.ColumnHeader.js 
b/loleaflet/src/control/Control.ColumnHeader.js

[Libreoffice-commits] online.git: Changes to 'feature/calc-rowcolumn-selection'

2015-11-30 Thread Andrzej Hunt
New branch 'feature/calc-rowcolumn-selection' available with the following 
commits:
commit 264761ca18406b414080ccae31554b8ea1128dfd
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 30 12:15:52 2015 -0800

loleaflet: add column/row-header selection support

commit b45e3fa5becf8fcbf106cb6b944c8f4709563d43
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 30 12:14:33 2015 -0800

loolwsd: add support for postMouseEvent's targetwindow

commit 49cddd1efb93d8f03a1696f64cf79f96839e1d6b
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 30 12:15:07 2015 -0800

loolwsd: update bundled headers

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


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

2015-11-25 Thread Andrzej Hunt
 svx/source/tbxctrls/tbcontrl.cxx|6 +++---
 unotools/source/config/eventcfg.cxx |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 1abd8d9e00497940c45ed70154ecb10dd806fe7b
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Sat Nov 21 08:15:32 2015 -0800

Convert to range based for

(This was also used for testing loplugin:rangedforcopy)

Change-Id: I246994feb7bf66d337b76e3f02d7fea2cb13d42a

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index ce7d877..ae696ae 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2025,7 +2025,7 @@ struct SvxStyleToolBoxControl::Impl
 Reference xParaStyles;
 
xStylesSupplier->getStyleFamilies()->getByName("ParagraphStyles") >>=
 xParaStyles;
-static const sal_Char* aWriterStyles[] =
+static const std::vector aWriterStyles =
 {
 "Text body",
 "Quotations",
@@ -2035,12 +2035,12 @@ struct SvxStyleToolBoxControl::Impl
 "Heading 2",
 "Heading 3"
 };
-for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / 
sizeof( sal_Char*); ++nStyle )
+for( const OUString& aStyle: aWriterStyles )
 {
 try
 {
 Reference< beans::XPropertySet > xStyle;
-xParaStyles->getByName( OUString::createFromAscii( 
aWriterStyles[nStyle] )) >>= xStyle;
+xParaStyles->getByName( aStyle ) >>= xStyle;
 OUString sName;
 xStyle->getPropertyValue("DisplayName") >>= sName;
 if( !sName.isEmpty() )
commit 96ee91aea6710dcc1797d677f8faef453ba919b2
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 25 12:04:17 2015 -0800

add const in ranged for

Change-Id: I0f55705e101e39e9e6e5286f21cad8ccb96e7fad

diff --git a/unotools/source/config/eventcfg.cxx 
b/unotools/source/config/eventcfg.cxx
index eda8048..06e7a9f 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -112,7 +112,7 @@ GlobalEventConfig_Impl::GlobalEventConfig_Impl()
 :   ConfigItem( ROOTNODE_EVENTS, ConfigItemMode::ImmediateUpdate )
 {
 // the supported event names
-for (GlobalEventId id : o3tl::enumrange())
+for (const GlobalEventId id : o3tl::enumrange())
 m_supportedEvents[id] = OUString::createFromAscii( 
pEventAsciiNames[id] );
 
 initBindingInfo();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/src

2015-11-16 Thread Andrzej Hunt
 loleaflet/src/layer/tile/CalcTileLayer.js |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 4e2bf06674dcca178624c48e6d7cd9cbb0d1f133
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Mon Nov 16 14:43:06 2015 +0100

loleaflet: update client zoom before ViewRowColumnHeaders

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js 
b/loleaflet/src/layer/tile/CalcTileLayer.js
index 227050a..bf3ba5d 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -125,6 +125,11 @@ L.CalcTileLayer = L.TileLayer.extend({
 
_onZoomRowColumns: function () {
this._isZoomend = true;
+   this._updateClientZoom();
+   if (this._clientZoom) {
+   L.Socket.sendMessage('clientzoom ' + this._clientZoom);
+   this._clientZoom = null;
+   }
L.Socket.sendMessage('commandvalues 
command=.uno:ViewRowColumnHeaders');
},
 
@@ -169,7 +174,8 @@ L.CalcTileLayer = L.TileLayer.extend({
}
}
 
-   L.Socket.sendMessage('commandvalues 
command=.uno:ViewRowColumnHeaders');
+   // Force fetching of row/column headers
+   this._onZoomRowColumns();
},
 
_onCommandValuesMsg: function (textMsg) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - desktop/qa sc/source

2015-11-16 Thread Andrzej Hunt
 desktop/qa/desktop_lib/test_desktop_lib.cxx |3 +++
 sc/source/ui/unoobj/docuno.cxx  |5 +
 2 files changed, 8 insertions(+)

New commits:
commit bbbe7f57d3af266a4e922b4f007472d5139647ee
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 16 15:30:53 2015 +0100

sc lok: use client zoom for ViewRowColumnHeaders

Change-Id: I85000851f82ea7cdc4b536683adbc8570de9af7e
(cherry picked from commit 396b5f411f7ecc7d600efdc0bb2381a7d1ed6d88)

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index f7c3196..e289be8 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -409,6 +409,9 @@ void DesktopLOKTest::testRowColumnHeaders()
  * "text" has the header label in UTF-8
  */
 LibLODocument_Impl* pDocument = loadDoc("search.ods");
+
+pDocument->pClass->initializeForRendering(pDocument);
+
 boost::property_tree::ptree aTree;
 char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, 
".uno:ViewRowColumnHeaders");
 std::stringstream aStream(pJSON);
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 5b0caaa..2fc376c 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -867,9 +867,14 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int 
nTilePixelHeight_, int
 OUString ScModelObj::getRowColumnHeaders(const Rectangle& rRectangle)
 {
 ScViewData* pViewData = ScDocShell::GetViewData();
+
 if (!pViewData)
 return OUString();
 
+// update the aLogicMode in ScViewData to something predictable
+pViewData->SetZoom(Fraction(nTilePixelWidth * TWIPS_PER_PIXEL, 
nTileTwipWidth),
+   Fraction(nTilePixelHeight * TWIPS_PER_PIXEL, 
nTileTwipHeight), true);
+
 ScTabView* pTabView = pViewData->GetView();
 if (!pTabView)
 return OUString();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/qa sc/source

2015-11-16 Thread Andrzej Hunt
 desktop/qa/desktop_lib/test_desktop_lib.cxx |3 +++
 sc/source/ui/unoobj/docuno.cxx  |5 +
 2 files changed, 8 insertions(+)

New commits:
commit 396b5f411f7ecc7d600efdc0bb2381a7d1ed6d88
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 16 15:30:53 2015 +0100

sc lok: use client zoom for ViewRowColumnHeaders

Change-Id: I85000851f82ea7cdc4b536683adbc8570de9af7e

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 5ca573d..3b7e274 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -405,6 +405,9 @@ void DesktopLOKTest::testRowColumnHeaders()
  * "text" has the header label in UTF-8
  */
 LibLODocument_Impl* pDocument = loadDoc("search.ods");
+
+pDocument->pClass->initializeForRendering(pDocument);
+
 boost::property_tree::ptree aTree;
 char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, 
".uno:ViewRowColumnHeaders");
 std::stringstream aStream(pJSON);
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 01ca52d..4729cea 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -884,9 +884,14 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int 
nTilePixelHeight_, int
 OUString ScModelObj::getRowColumnHeaders(const Rectangle& rRectangle)
 {
 ScViewData* pViewData = ScDocShell::GetViewData();
+
 if (!pViewData)
 return OUString();
 
+// update the aLogicMode in ScViewData to something predictable
+pViewData->SetZoom(Fraction(nTilePixelWidth * TWIPS_PER_PIXEL, 
nTileTwipWidth),
+   Fraction(nTilePixelHeight * TWIPS_PER_PIXEL, 
nTileTwipHeight), true);
+
 ScTabView* pTabView = pViewData->GetView();
 if (!pTabView)
 return OUString();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-13 Thread Andrzej Hunt
 sc/source/ui/view/gridwin.cxx |   14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit 54e54c381fc067b700514b6305f0fe4a1ac7f0c4
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Fri Nov 13 11:31:52 2015 +0100

Remove outdated comment

This has now been merged as:
LOK: setClientZoom() - sets the client zoom level
96cd2abd748ed24e5aba50cc4c300cf06e512db3

Change-Id: I519a752dd9f18bb719a43f75f1ad3105f58418d9

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e001e06..5eca603 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5824,8 +5824,6 @@ void ScGridWindow::updateLibreOfficeKitCellCursor()
 {
 ScDocument* pDoc = pViewData->GetDocument();
 ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
-// TODO: the zoom levels here should be replaced by the setClientZoom 
values
-// in a patch currently in gerrit 
(https://gerrit.libreoffice.org/#/c/19822/)
 OString aCursor = getCellCursor(pViewData->GetZoomX(), 
pViewData->GetZoomY());
 pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, 
aCursor.getStr());
 }
commit e77668eb1e7abe522493235dadfca08ca451ad99
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Fri Nov 13 11:17:43 2015 +0100

sc lok: during tiled rendering the cell-cursor is always visible

Change-Id: Ia802c19f5bfd2fe2e9909e3c611047c529a64200

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 94b0be9..e001e06 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -6010,7 +6010,9 @@ void ScGridWindow::UpdateCursorOverlay()
 
 const ScPatternAttr* pPattern = pDoc->GetPattern(nX,nY,nTab);
 
-if (!maVisibleRange.isInside(nX, nY))
+ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+
+if (!pDrawLayer->isTiledRendering() && !maVisibleRange.isInside(nX, nY))
 {
 if (maVisibleRange.mnCol2 < nX || maVisibleRange.mnRow2 < nY)
 return; // no further check needed, nothing visible
@@ -6029,13 +6031,11 @@ void ScGridWindow::UpdateCursorOverlay()
 }
 
 //  don't show the cursor in overlapped cells
-
 const ScMergeFlagAttr& rMergeFlag = static_cast( 
pPattern->GetItem(ATTR_MERGE_FLAG) );
 bool bOverlapped = rMergeFlag.IsOverlapped();
 
 //  left or above of the screen?
-
-bool bVis = ( nX>=pViewData->GetPosX(eHWhich) && 
nY>=pViewData->GetPosY(eVWhich) );
+bool bVis = pDrawLayer->isTiledRendering() || ( 
nX>=pViewData->GetPosX(eHWhich) && nY>=pViewData->GetPosY(eVWhich) );
 if (!bVis)
 {
 SCCOL nEndX = nX;
@@ -6065,7 +6065,7 @@ void ScGridWindow::UpdateCursorOverlay()
 }
 
 // in the tiled rendering case, don't limit to the screen size
-if (bMaybeVisible)
+if (bMaybeVisible || pDrawLayer->isTiledRendering())
 {
 long nSizeXPix;
 long nSizeYPix;
@@ -6108,8 +6108,6 @@ void ScGridWindow::UpdateCursorOverlay()
 }
 }
 
-ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
-
 if ( !aPixelRects.empty() )
 {
 if (pDrawLayer->isTiledRendering()) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loolwsd/LOOLSession.cpp

2015-11-13 Thread Andrzej Hunt
 loolwsd/LOOLSession.cpp |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 0ab556075812e5f9af919c0a49cfbf0779e17908
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Fri Nov 13 11:24:44 2015 +0100

loolwsd: re-add erronously remove break

Seems to have been removed accidentally in:
c1efc7c0120f180e2f613ec494a65f2db4c486f5

diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 25a6267..c65b6ab 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -902,6 +902,7 @@ extern "C"
 break;
 case LOK_CALLBACK_MOUSE_POINTER:
 srv->sendTextFrame("mousepointer: " + std::string(pPayload));
+break;
 case LOK_CALLBACK_HYPERLINK_CLICKED:
 srv->sendTextFrame("hyperlinkclicked: " + std::string(pPayload));
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: 3 commits - loleaflet/src

2015-11-12 Thread Andrzej Hunt
 loleaflet/src/control/Control.ColumnHeader.js |8 ++--
 loleaflet/src/control/Control.RowHeader.js|8 ++--
 loleaflet/src/layer/tile/TileLayer.js |2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit e97afd38771abc302115e81de87983d31a865fcf
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Thu Nov 12 12:24:20 2015 +0100

loleaflet: row size is also sum of widths

diff --git a/loleaflet/src/control/Control.RowHeader.js 
b/loleaflet/src/control/Control.RowHeader.js
index 02625ae..de28ec2 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -39,27 +39,31 @@ L.Control.RowHeader = L.Control.extend({
 var iterator, twip, height, row, cell;
 
 this.clearRows();
+var totalHeight = -1;
 for (iterator = 0; iterator < rows.length; iterator++) {
 twip = new L.Point(parseInt(rows[iterator].size),
parseInt(rows[iterator].size));
-height =  Math.round(converter.call(context, twip).y) 
- 2;
+height =  Math.round(converter.call(context, twip).y) 
- 2 - totalHeight;
 row  = L.DomUtil.create('tr', '', this._rows);
 cell = L.DomUtil.create('th', 
'spreadsheet-table-row-cell', row);
 cell.innerHTML  = rows[iterator].text;
 cell.twipHeight = rows[iterator].size;
 cell.height = height + "px";
+totalHeight += height + 1;
 }
 },
 
 updateRows: function (converter, context) {
 var iterator, twip, height, row;
 
+var totalHeight = -1;
 for (iterator = 0; iterator < this._rows.childNodes.length; 
iterator++) {
 row  = this._rows.childNodes[iterator].firstChild;
 twip = new L.Point(parseInt(row.twipHeight),
parseInt(row.twipHeight));
-height =  Math.round(converter.call(context, twip).y) 
- 1;
+height =  Math.round(converter.call(context, twip).y) 
- 2 - totalHeight;
 row.height = height + "px";
+totalHeight += height + 1;
 }
 }
 })
commit a7d74ed5ee6f90ca7e47e72cc946f3c279cde050
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Thu Nov 12 12:23:33 2015 +0100

loleaflet: don't delete non-existing marker

Previously there were spurious warnings when trying to delete
a non-existing marker.

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index eddb2bb..88f7752 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -798,7 +798,7 @@ L.TileLayer = L.GridLayer.extend({
}
this._map.addLayer(this._cellCursorMarker);
}
-   else if (this._cellCursor) {
+   else if (this._cellCursorMarker) {
this._map.removeLayer(this._cellCursorMarker);
}
},
commit eaf5a65e8b8441eb7a8a6e2ce3fb45a3c4839066
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Thu Nov 12 11:31:49 2015 +0100

loleaflet: column size is actually sum of widths

diff --git a/loleaflet/src/control/Control.ColumnHeader.js 
b/loleaflet/src/control/Control.ColumnHeader.js
index 7c3934c..b2f9af4 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -45,25 +45,29 @@ L.Control.ColumnHeader = L.Control.extend({
 var twip, width, column;
 
 this.clearColumns();
+var totalWidth = -1; // beginning offset 1 due to lack of 
previous column
 for (iterator = 0; iterator < columns.length; iterator++) {
 twip = new L.Point(parseInt(columns[iterator].size),
parseInt(columns[iterator].size));
-width =  Math.round(converter.call(context, twip).x) - 
1;
+width =  Math.round(converter.call(context, twip).x) - 
2 - totalWidth;
 column = L.DomUtil.create('th', 
'spreadsheet-table-column-cell', this._columns);
 column.innerHTML = columns[iterator].text;
 column.twipWidth = columns[iterator].size;
 column.width = width + "px";
+totalWidth += width + 1;
 }
 },
 
 updateColumns: function (converter, context) {
 var iterator, twip, width, column;
+var tota

[Libreoffice-commits] online.git: loleaflet/src

2015-11-12 Thread Andrzej Hunt
 loleaflet/src/control/Control.Styles.js |   17 ++---
 loleaflet/src/control/Toolbar.js|6 +++---
 2 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit e103a0b59a6741b0bb94f15d2c41dec340b7bea8
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Thu Nov 12 13:55:55 2015 +0100

loleaflet: support commands list instead of ClearStyle

This allows further commands to be added purely server-side.

diff --git a/loleaflet/src/control/Control.Styles.js 
b/loleaflet/src/control/Control.Styles.js
index 31b0dac..da1c4ca 100644
--- a/loleaflet/src/control/Control.Styles.js
+++ b/loleaflet/src/control/Control.Styles.js
@@ -53,11 +53,14 @@ L.Control.Styles = L.Control.extend({
styles = e.commandValues['CellStyles'];
}
 
-   this._addSeparator();
-   if (e.commandValues['ClearStyle']) {
-   var item = L.DomUtil.create('option', '', 
container);
-   item.value = 'ClearStyle';
-   item.innerHTML = e.commandValues['ClearStyle'];
+   var commands = e.commandValues['Commands'];
+   if (commands && commands.length > 0) {
+   this._addSeparator();
+   commands.forEach(function (command) {
+   var item = L.DomUtil.create('option', 
'', container);
+   item.value = command.command;
+   item.innerHTML = command.name;
+   });
}
 
if (topStyles.length > 0) {
@@ -96,8 +99,8 @@ L.Control.Styles = L.Control.extend({
if (style === this.options.info) {
return;
}
-   if (style === 'ClearStyle') {
-   this._map.clearStyle();
+   if (style.startsWith('.uno:')) {
+   this._map.sendUnoCommand(style);
}
else if (this._map.getDocType() === 'text') {
this._map.applyStyle(style, 'ParagraphStyles');
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index 52d7f7a..45fe3ef 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -77,9 +77,9 @@ L.Map.include({
}
},
 
-   clearStyle: function () {
+   sendUnoCommand: function (command) {
if (this._docLayer._permission === 'edit') {
-   L.Socket.sendMessage('uno .uno:ResetAttributes');
+   L.Socket.sendMessage('uno ' + command);
}
},
 
@@ -88,7 +88,7 @@ L.Map.include({
if (!unoState.startsWith('.uno:')) {
unoState = '.uno:' + unoState;
}
-   L.Socket.sendMessage('uno ' + unoState);
+   sendUnoCommand(unoState);
}
},
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 4 commits - desktop/qa desktop/source

2015-11-12 Thread Andrzej Hunt
 desktop/qa/desktop_lib/test_desktop_lib.cxx |2 -
 desktop/source/lib/init.cxx |   51 +---
 2 files changed, 41 insertions(+), 12 deletions(-)

New commits:
commit bd4f17848f439913c048dc688322740b9e36b33f
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Thu Nov 12 14:48:55 2015 +0100

sw lok: filter out defalt styles to avoid duplicates

Change-Id: Iff84c2f16844a507d30f30c1fd4b23d807ded466
(cherry picked from commit 0b3fbf8299c51767689b4e7656bbf4c331450b98)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4a37c51..1ab5dc8 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1272,7 +1272,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 "Heading 3"
 };
 
-// static const std::vector aList = { "", "bbb" };
+// We need to keep a list of the default style names
+// in order to filter these out later when processing
+// the full list of styles.
+std::set aDefaultStyleNames;
 
 boost::property_tree::ptree aValues;
 for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); 
++nStyleFam)
@@ -1295,6 +1298,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 xStyle->getPropertyValue("DisplayName") >>= sName;
 if( !sName.isEmpty() )
 {
+aDefaultStyleNames.insert( sName );
+
 boost::property_tree::ptree aChild;
 aChild.put("", sName.toUtf8());
 aChildren.push_back(std::make_pair("", aChild));
@@ -1305,9 +1310,14 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 uno::Sequence aStyles = xStyleFamily->getElementNames();
 for ( OUString aStyle: aStyles )
 {
-boost::property_tree::ptree aChild;
-aChild.put("", aStyles[nInd]);
-aChildren.push_back(std::make_pair("", aChild));
+// Filter out the default styles - they are already at the top
+// of the list
+if (aDefaultStyleNames.find(aStyle) == aDefaultStyleNames.end())
+{
+boost::property_tree::ptree aChild;
+aChild.put("", aStyle);
+aChildren.push_back(std::make_pair("", aChild));
+}
 }
 aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren);
 }
commit 572ab72c98673537c032b83a78c3c297e56a3d63
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Thu Nov 12 14:41:02 2015 +0100

More range based for

Change-Id: I9cdcd8dca413981389cd4db3059a420131e5f839
(cherry picked from commit 6e6ae9803796b120e95f6e89575e03c5fd0ed3c2)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c977af6..4a37c51 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1303,7 +1303,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 }
 
 uno::Sequence aStyles = xStyleFamily->getElementNames();
-for (sal_Int32 nInd = 0; nInd < aStyles.getLength(); ++nInd)
+for ( OUString aStyle: aStyles )
 {
 boost::property_tree::ptree aChild;
 aChild.put("", aStyles[nInd]);
commit 6a44e4a4d5ae37d8237f3061ce362e7052ca6de0
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Thu Nov 12 14:30:40 2015 +0100

Use std::vector instead of an array of strings

This makes the code much more readable / sane.

Change-Id: I1d60f4102b6c619fa2fefac4a3644b7f04c0b9c0
(cherry picked from commit d5545979fb27e317cce4d374a5a913790d8a2adf)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 14315d0..c977af6 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1261,7 +1261,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 uno::Reference 
xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
 uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames();
 
-static const sal_Char* aWriterStyles[] =
+static const std::vector aWriterStyles =
 {
 "Text body",
 "Quotations",
@@ -1272,6 +1272,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 "Heading 3"
 };
 
+// static const std::vector aList = { "", "bbb" };
+
 boost::property_tree::ptree aValues;
 for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); 
++nStyleFam)
 {
@@ -1285,10 +1287,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 if (sStyleFam == "ParagraphStyles"

[Libreoffice-commits] online.git: loleaflet/src

2015-11-12 Thread Andrzej Hunt
 loleaflet/src/control/Control.Styles.js |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c56cd9715989625b5cdcf0c7ff3a7a2fd0162857
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Thu Nov 12 15:05:43 2015 +0100

loleaflet: update styles commands format

This actually corresponds to what was implemented server side.

diff --git a/loleaflet/src/control/Control.Styles.js 
b/loleaflet/src/control/Control.Styles.js
index da1c4ca..d98a534 100644
--- a/loleaflet/src/control/Control.Styles.js
+++ b/loleaflet/src/control/Control.Styles.js
@@ -58,8 +58,8 @@ L.Control.Styles = L.Control.extend({
this._addSeparator();
commands.forEach(function (command) {
var item = L.DomUtil.create('option', 
'', container);
-   item.value = command.command;
-   item.innerHTML = command.name;
+   item.value = command.id;
+   item.innerHTML = command.text;
});
}
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 4 commits - desktop/qa desktop/source

2015-11-12 Thread Andrzej Hunt
 desktop/qa/desktop_lib/test_desktop_lib.cxx |2 -
 desktop/source/lib/init.cxx |   51 +---
 2 files changed, 41 insertions(+), 12 deletions(-)

New commits:
commit 0b3fbf8299c51767689b4e7656bbf4c331450b98
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Thu Nov 12 14:48:55 2015 +0100

sw lok: filter out defalt styles to avoid duplicates

Change-Id: Iff84c2f16844a507d30f30c1fd4b23d807ded466

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b4992cc..bc25f3e 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1263,7 +1263,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 "Heading 3"
 };
 
-// static const std::vector aList = { "", "bbb" };
+// We need to keep a list of the default style names
+// in order to filter these out later when processing
+// the full list of styles.
+std::set aDefaultStyleNames;
 
 boost::property_tree::ptree aValues;
 for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); 
++nStyleFam)
@@ -1286,6 +1289,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 xStyle->getPropertyValue("DisplayName") >>= sName;
 if( !sName.isEmpty() )
 {
+aDefaultStyleNames.insert( sName );
+
 boost::property_tree::ptree aChild;
 aChild.put("", sName.toUtf8());
 aChildren.push_back(std::make_pair("", aChild));
@@ -1296,9 +1301,14 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 uno::Sequence aStyles = xStyleFamily->getElementNames();
 for ( OUString aStyle: aStyles )
 {
-boost::property_tree::ptree aChild;
-aChild.put("", aStyles[nInd]);
-aChildren.push_back(std::make_pair("", aChild));
+// Filter out the default styles - they are already at the top
+// of the list
+if (aDefaultStyleNames.find(aStyle) == aDefaultStyleNames.end())
+{
+boost::property_tree::ptree aChild;
+aChild.put("", aStyle);
+aChildren.push_back(std::make_pair("", aChild));
+}
 }
 aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren);
 }
commit 6e6ae9803796b120e95f6e89575e03c5fd0ed3c2
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Thu Nov 12 14:41:02 2015 +0100

More range based for

Change-Id: I9cdcd8dca413981389cd4db3059a420131e5f839

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index b205cf0..b4992cc 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1294,7 +1294,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 }
 
 uno::Sequence aStyles = xStyleFamily->getElementNames();
-for (sal_Int32 nInd = 0; nInd < aStyles.getLength(); ++nInd)
+for ( OUString aStyle: aStyles )
 {
 boost::property_tree::ptree aChild;
 aChild.put("", aStyles[nInd]);
commit d5545979fb27e317cce4d374a5a913790d8a2adf
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Thu Nov 12 14:30:40 2015 +0100

Use std::vector instead of an array of strings

This makes the code much more readable / sane.

Change-Id: I1d60f4102b6c619fa2fefac4a3644b7f04c0b9c0

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 048215e..b205cf0 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1252,7 +1252,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 uno::Reference 
xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
 uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames();
 
-static const sal_Char* aWriterStyles[] =
+static const std::vector aWriterStyles =
 {
 "Text body",
 "Quotations",
@@ -1263,6 +1263,8 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 "Heading 3"
 };
 
+// static const std::vector aList = { "", "bbb" };
+
 boost::property_tree::ptree aValues;
 for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); 
++nStyleFam)
 {
@@ -1276,10 +1278,10 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 if (sStyleFam == "ParagraphStyles"
 && doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT)
 {
-for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / 
sizeof( sal_Char*); ++nStyle )
+

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - sd/source

2015-11-11 Thread Andrzej Hunt
 sd/source/ui/unoidl/unomodel.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 6b71b2a7bc0634811675f20bda02a59239d3b85b
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Nov 10 19:45:13 2015 +0100

sd lok: ccu#1295 force async image swap

This helps ensure that images are swapped in when we actually
render tiles. Previously we'd sometimes have placeholders
instead of the image, which results in either an invalidate
(+rerender of that tile) once the image is swapped in (for
normal tiles) or a permanently missing image in the preview tiles.

Change-Id: I1a16a913faf9fad20e40a5d1aad3de187038c7a2
Reviewed-on: https://gerrit.libreoffice.org/19890
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
    Tested-by: Andrzej Hunt <andr...@ahunt.org>

diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index d2c6b5e..9475ff5 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2380,14 +2380,21 @@ void SdXImpressDocument::initializeForTiledRendering()
 
 mpDoc->setTiledRendering(true);
 
-// Disable map mode, so that it's possible to send mouse event coordinates
-// in logic units.
 if (DrawViewShell* pViewShell = GetViewShell())
 {
+// Disable map mode, so that it's possible to send mouse event 
coordinates
+// in logic units.
 if (sd::Window* pWindow = pViewShell->GetActiveWindow())
 {
 pWindow->EnableMapMode(false);
 }
+
+// Forces all images to be swapped in synchronously, this
+// ensures that images are available when paintTile is called
+// (whereas with async loading images start being loaded after
+//  we have painted the tile, resulting in an invalidate, followed
+//  by the tile being rerendered - which is wasteful and ugly).
+pViewShell->GetDrawView()->SetSwapAsynchron(false);
 }
 // tdf#93154: in tiled rendering LO doesn't always detect changes
 SvtMiscOptions aMiscOpt;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/source include/LibreOfficeKit include/vcl sc/inc sc/source sd/source sw/inc sw/source

2015-11-11 Thread Andrzej Hunt
 desktop/source/lib/init.cxx  |   69 +++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |9 +++
 include/vcl/ITiledRenderable.hxx |3 +
 sc/inc/docuno.hxx|3 +
 sc/source/ui/unoobj/docuno.cxx   |   15 +
 sd/source/ui/inc/unomodel.hxx|2 
 sd/source/ui/unoidl/unomodel.cxx |   14 +
 sw/inc/unotxdoc.hxx  |2 
 sw/source/uibase/uno/unotxdoc.cxx|   11 
 9 files changed, 127 insertions(+), 1 deletion(-)

New commits:
commit 81b8ca683d44ba9c37f2dc8c74470a86ce70513f
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 11 10:05:25 2015 +0100

Implement LOK_CALLBACK_MOUSE_POINTER

Change-Id: I8d1f63208baf277b0a9d15908f3ea7ff3b56bf10
Reviewed-on: https://gerrit.libreoffice.org/19883
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
    Tested-by: Andrzej Hunt <andr...@ahunt.org>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4523675..6d7d079 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -66,6 +66,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -174,6 +175,58 @@ static const ExtensionMap aDrawExtensionMap[] =
 { nullptr, nullptr }
 };
 
+/*
+ * Map directly to css cursor styles to avoid further mapping in the client.
+ * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles.
+ *
+ * This was created partially with help of the mappings in gtkdata.cxx.
+ * The list is incomplete as some cursor style simply aren't supported
+ * by css, it might turn out to be worth mapping some of these missing cursors
+ * to available cursors?
+ */
+static const std::map <PointerStyle, OString> aPointerMap {
+{ PointerStyle::Arrow, "default" },
+// PointerStyle::Null ?
+{ PointerStyle::Wait, "wait" },
+{ PointerStyle::Text, "text" },
+{ PointerStyle::Help, "help" },
+{ PointerStyle::Cross, "crosshair" },
+{ PointerStyle::Move, "move" },
+{ PointerStyle::NSize, "n-resize" },
+{ PointerStyle::SSize, "s-resize" },
+{ PointerStyle::WSize, "w-resize" },
+{ PointerStyle::ESize, "e-resize" },
+{ PointerStyle::NWSize, "ne-resize" },
+{ PointerStyle::NESize, "ne-resize" },
+{ PointerStyle::SWSize, "sw-resize" },
+{ PointerStyle::SESize, "se-resize" },
+// WindowNSize through WindowSESize
+{ PointerStyle::HSplit, "col-resize" },
+{ PointerStyle::VSplit, "row-resize" },
+{ PointerStyle::HSizeBar, "col-resize" },
+{ PointerStyle::VSizeBar, "row-resize" },
+{ PointerStyle::Hand, "grab" },
+{ PointerStyle::RefHand, "grabbing" },
+// Pen, Magnify, Fill, Rotate
+// HShear, VShear
+// Mirror, Crook, Crop, MovePoint, MoveBezierWeight
+// MoveData
+{ PointerStyle::CopyData, "copy" },
+{ PointerStyle::LinkData, "alias" },
+// MoveDataLink, CopyDataLink
+//MoveFile, CopyFile, LinkFile
+// MoveFileLink, CopyFileLink, MoveFiless, CopyFiles
+{ PointerStyle::NotAllowed, "not-allowed" },
+// DrawLine through DrawCaption
+// Chart, Detective, PivotCol, PivotRow, PivotField, Chain, ChainNotAllowed
+// TimeEventMove, TimeEventSize
+// AutoScrollN through AutoScrollNSWE
+// Airbrush
+{ PointerStyle::TextVertical, "vertical-text" }
+// Pivot Delete, TabSelectS through TabSelectSW
+// PaintBrush, HideWhiteSpace, ShowWhiteSpace
+};
+
 static OUString getUString(const char* pString)
 {
 if (pString == nullptr)
@@ -1040,6 +1093,22 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* 
pThis, int nType, int nX,
 }
 
 pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier);
+
+Pointer aPointer = pDoc->getPointer();
+
+// We don't map all possible pointers hence we need a default
+OString aPointerString = "default";
+auto aIt = aPointerMap.find(aPointer.GetStyle());
+if (aIt != aPointerMap.end())
+{
+aPointerString = aIt->second;
+}
+
+LibLODocument_Impl* pLib = static_cast<LibLODocument_Impl*>(pThis);
+if (pLib->mpCallback && pLib->mpCallbackData)
+{
+pLib->mpCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr(), 
pLib->mpCallbackData);
+}
 }
 
 static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int 
nX, int nY)
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index bf62675..37837ea 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -202,7 +202,14 @@

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

2015-11-11 Thread Andrzej Hunt
 libreofficekit/source/gtk/lokdocview.cxx |   11 +++
 1 file changed, 11 insertions(+)

New commits:
commit cc920bc27a0c37233d65ee1b20712e3ac6896c9a
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Nov 10 11:40:41 2015 +0100

lokdocview: support LOK_CALLBACK_MOUSE_POINTER

Change-Id: I2052e39fa2e25988a40f293389d5a183a625acd4
Reviewed-on: https://gerrit.libreoffice.org/19903
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
    Tested-by: Andrzej Hunt <andr...@ahunt.org>

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index cff7889..550a922 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -282,6 +282,8 @@ callbackTypeToString (int nType)
 return "LOK_CALLBACK_CELL_CURSOR";
 case LOK_CALLBACK_HYPERLINK_CLICKED:
 return "LOK_CALLBACK_HYPERLINK_CLICKED";
+case LOK_CALLBACK_MOUSE_POINTER:
+return "LOK_CALLBACK_MOUSE_POINTER";
 case LOK_CALLBACK_STATE_CHANGED:
 return "LOK_CALLBACK_STATE_CHANGED";
 case LOK_CALLBACK_STATUS_INDICATOR_START:
@@ -736,6 +738,15 @@ callback (gpointer pData)
 priv->m_bCursorVisible = pCallback->m_aPayload == "true";
 }
 break;
+case LOK_CALLBACK_MOUSE_POINTER:
+{
+// The gtk docs claim that most css cursors should be supported, 
however
+// on my system at least this is not true and many cursors are 
unsupported.
+// In this case pCursor = null, which results in the default cursor 
being set.
+GdkCursor* pCursor = 
gdk_cursor_new_from_name(gtk_widget_get_display(GTK_WIDGET(pDocView)), 
pCallback->m_aPayload.c_str());
+gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(pDocView)), 
pCursor);
+}
+break;
 case LOK_CALLBACK_GRAPHIC_SELECTION:
 {
 if (pCallback->m_aPayload != "EMPTY")
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: 4 commits - loleaflet/src loolwsd/bundled loolwsd/LOKitClient.cpp loolwsd/LOOLSession.cpp

2015-11-11 Thread Andrzej Hunt
 loleaflet/src/layer/tile/TileLayer.js|   12 +--
 loleaflet/src/map/handler/Map.Mouse.js   |8 +++
 loolwsd/LOKitClient.cpp  |1 
 loolwsd/LOOLSession.cpp  |3 ++
 loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h |9 +++-
 5 files changed, 30 insertions(+), 3 deletions(-)

New commits:
commit 72c407e0ed5c3a9ffd2ae518f9f5d4407e1f5d61
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Tue Nov 10 11:44:50 2015 +0100

loleaflet: support mouse cursor calback

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 8f446ea..eddb2bb 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -241,6 +241,9 @@ L.TileLayer = L.GridLayer.extend({
msg += 'height=' + this._docHeightTwips;
this._onInvalidateTilesMsg(msg);
}
+   else if (textMsg.startsWith('mousepointer:')) {
+   this._onMousePointerMsg(textMsg);
+   }
else if (textMsg.startsWith('partpagerectangles:')) {
this._onPartPageRectanglesMsg(textMsg);
}
@@ -376,6 +379,11 @@ L.TileLayer = L.GridLayer.extend({
this._onUpdateCellCursor();
},
 
+   _onMousePointerMsg: function (textMsg) {
+   textMsg = textMsg.substring(14); // "mousepointer: "
+   this._map._container.style.cursor = textMsg;
+   },
+
_onHyperlinkClickedMsg: function (textMsg) {
var link = textMsg.substring(18);
window.open(link, '_blank');
diff --git a/loleaflet/src/map/handler/Map.Mouse.js 
b/loleaflet/src/map/handler/Map.Mouse.js
index 6477be4..82c8c83 100644
--- a/loleaflet/src/map/handler/Map.Mouse.js
+++ b/loleaflet/src/map/handler/Map.Mouse.js
@@ -157,6 +157,14 @@ L.Map.Mouse = L.Handler.extend({
this._map.fire('handleautoscroll', { pos: 
e.containerPoint, map: this._map });
}
}
+   else if (e.type === 'mousemove' && !this._mouseDown) {
+   clearTimeout(this._mouseOverTimeout);
+   mousePos = docLayer._latLngToTwips(e.latlng);
+   this._mouseOverTimeout = setTimeout(L.bind(function() {
+   docLayer._postMouseEvent('move', mousePos.x, 
mousePos.y, 1, 0, modifier);
+ }, this),
+ 100);
+   }
else if (e.type === 'dblclick' || e.type === 'trplclick' || 
e.type === 'qdrplclick') {
mousePos = docLayer._latLngToTwips(e.latlng);
var clicks = {
commit 74edae8703d1e3533260009f931709f64f997574
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Tue Nov 10 11:42:56 2015 +0100

loolwsd: support LOK_CALLBACK_MOUSE_POINTER

diff --git a/loolwsd/LOKitClient.cpp b/loolwsd/LOKitClient.cpp
index 481c3be..f72f8e6 100644
--- a/loolwsd/LOKitClient.cpp
+++ b/loolwsd/LOKitClient.cpp
@@ -53,6 +53,7 @@ extern "C"
 CASE(GRAPHIC_SELECTION);
 CASE(CELL_CURSOR);
 CASE(HYPERLINK_CLICKED);
+CASE(MOUSE_POINTER);
 CASE(STATE_CHANGED);
 CASE(STATUS_INDICATOR_START);
 CASE(STATUS_INDICATOR_SET_VALUE);
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 7565470..1edd3fa 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -891,6 +891,9 @@ extern "C"
 case LOK_CALLBACK_CELL_CURSOR:
 srv->sendTextFrame("cellcursor: " + std::string(pPayload));
 break;
+case LOK_CALLBACK_MOUSE_POINTER:
+srv->sendTextFrame("mousepointer: " + std::string(pPayload));
+break;
 case LOK_CALLBACK_HYPERLINK_CLICKED:
 srv->sendTextFrame("hyperlinkclicked: " + std::string(pPayload));
 break;
commit 69325ce576cd04d4c1c950d42310fec4860d8317
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Tue Nov 10 11:42:38 2015 +0100

loolwsd: update bundled headers to contain LOK_CALLBACK_MOUSE_POINTER

diff --git a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h 
b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
index bf62675..37837ea 100644
--- a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -202,7 +202,14 @@ typedef enum
  *
  * Rectangle format is the same as LOK_CALLBACK_INVALIDATE_TILES.
  */
-LOK_CALLBACK_CELL_CURSOR
+LOK_CALLBACK_CELL_CURSOR,
+
+/**
+ * The current mouse pointer style.
+ *
+ * Payload is a c

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 2 commits - desktop/source include/LibreOfficeKit include/vcl sc/inc sc/source sd/source sw/inc sw/source

2015-11-11 Thread Andrzej Hunt
 desktop/source/lib/init.cxx  |   69 +++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |9 +++
 include/vcl/ITiledRenderable.hxx |3 +
 sc/inc/docuno.hxx|3 +
 sc/source/ui/inc/gridwin.hxx |8 ---
 sc/source/ui/unoobj/docuno.cxx   |   15 +
 sc/source/ui/view/gridwin.cxx|4 +
 sc/source/ui/view/gridwin4.cxx   |6 +-
 sd/source/ui/inc/unomodel.hxx|2 
 sd/source/ui/unoidl/unomodel.cxx |   14 +
 sw/inc/unotxdoc.hxx  |2 
 sw/source/uibase/uno/unotxdoc.cxx|   11 
 12 files changed, 133 insertions(+), 13 deletions(-)

New commits:
commit c34df1dadcec05c9a45ede4bab8e2fea9d3c0720
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 11 10:05:25 2015 +0100

Implement LOK_CALLBACK_MOUSE_POINTER

Reviewed-on: https://gerrit.libreoffice.org/19883
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
    Tested-by: Andrzej Hunt <andr...@ahunt.org>
(cherry picked from commit 81b8ca683d44ba9c37f2dc8c74470a86ce70513f)

Conflicts:
sc/inc/docuno.hxx
sd/source/ui/inc/unomodel.hxx
sw/inc/unotxdoc.hxx

Change-Id: I8d1f63208baf277b0a9d15908f3ea7ff3b56bf10

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index dfb37b9..b672525 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -73,6 +73,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -183,6 +184,58 @@ static const ExtensionMap aDrawExtensionMap[] =
 { NULL, NULL }
 };
 
+/*
+ * Map directly to css cursor styles to avoid further mapping in the client.
+ * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles.
+ *
+ * This was created partially with help of the mappings in gtkdata.cxx.
+ * The list is incomplete as some cursor style simply aren't supported
+ * by css, it might turn out to be worth mapping some of these missing cursors
+ * to available cursors?
+ */
+static const std::map <PointerStyle, OString> aPointerMap {
+{ PointerStyle::Arrow, "default" },
+// PointerStyle::Null ?
+{ PointerStyle::Wait, "wait" },
+{ PointerStyle::Text, "text" },
+{ PointerStyle::Help, "help" },
+{ PointerStyle::Cross, "crosshair" },
+{ PointerStyle::Move, "move" },
+{ PointerStyle::NSize, "n-resize" },
+{ PointerStyle::SSize, "s-resize" },
+{ PointerStyle::WSize, "w-resize" },
+{ PointerStyle::ESize, "e-resize" },
+{ PointerStyle::NWSize, "ne-resize" },
+{ PointerStyle::NESize, "ne-resize" },
+{ PointerStyle::SWSize, "sw-resize" },
+{ PointerStyle::SESize, "se-resize" },
+// WindowNSize through WindowSESize
+{ PointerStyle::HSplit, "col-resize" },
+{ PointerStyle::VSplit, "row-resize" },
+{ PointerStyle::HSizeBar, "col-resize" },
+{ PointerStyle::VSizeBar, "row-resize" },
+{ PointerStyle::Hand, "grab" },
+{ PointerStyle::RefHand, "grabbing" },
+// Pen, Magnify, Fill, Rotate
+// HShear, VShear
+// Mirror, Crook, Crop, MovePoint, MoveBezierWeight
+// MoveData
+{ PointerStyle::CopyData, "copy" },
+{ PointerStyle::LinkData, "alias" },
+// MoveDataLink, CopyDataLink
+//MoveFile, CopyFile, LinkFile
+// MoveFileLink, CopyFileLink, MoveFiless, CopyFiles
+{ PointerStyle::NotAllowed, "not-allowed" },
+// DrawLine through DrawCaption
+// Chart, Detective, PivotCol, PivotRow, PivotField, Chain, ChainNotAllowed
+// TimeEventMove, TimeEventSize
+// AutoScrollN through AutoScrollNSWE
+// Airbrush
+{ PointerStyle::TextVertical, "vertical-text" }
+// Pivot Delete, TabSelectS through TabSelectSW
+// PaintBrush, HideWhiteSpace, ShowWhiteSpace
+};
+
 static OUString getUString(const char* pString)
 {
 if (pString == NULL)
@@ -1048,6 +1101,22 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* 
pThis, int nType, int nX,
 }
 
 pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier);
+
+Pointer aPointer = pDoc->getPointer();
+
+// We don't map all possible pointers hence we need a default
+OString aPointerString = "default";
+auto aIt = aPointerMap.find(aPointer.GetStyle());
+if (aIt != aPointerMap.end())
+{
+aPointerString = aIt->second;
+}
+
+LibLODocument_Impl* pLib = static_cast<LibLODocument_Impl*>(pThis);
+if (pLib->mpCallback && pLib->mpCallbackData)
+{
+pLib->mpCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr(), 
pLib->mpCallbackData);
+}
 }
 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 2 commits - desktop/Library_sofficeapp.mk desktop/qa desktop/source

2015-11-11 Thread Andrzej Hunt
 desktop/Library_sofficeapp.mk   |1 
 desktop/qa/desktop_lib/test_desktop_lib.cxx |8 -
 desktop/source/lib/init.cxx |   41 
 3 files changed, 48 insertions(+), 2 deletions(-)

New commits:
commit 533958c02d22bbca2af9c332392bafbdfe7a0309
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 11 21:07:13 2015 +0100

lok sw: Place default styles at top of style selector

The order/list of default styles for Writer should be hardcoded,
(by default the list contains 100+ items), it makes most sense to
place these at the start of the list, allowing the client to then
select how many styles they actually want to show.

Change-Id: I491a426397e06b3502cee7484c5f8adfd9d9cdf2
Reviewed-on: https://gerrit.libreoffice.org/19918
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
    Tested-by: Andrzej Hunt <andr...@ahunt.org>
(cherry picked from commit 5c6119eeaaaed322c884504a53bb558258233fe9)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 32570df..20bc654 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1261,12 +1261,45 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 uno::Reference 
xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
 uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames();
 
+static const sal_Char* aWriterStyles[] =
+{
+"Text body",
+"Quotations",
+"Title",
+"Subtitle",
+"Heading 1",
+"Heading 2",
+"Heading 3"
+};
+
 boost::property_tree::ptree aValues;
 for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); 
++nStyleFam)
 {
 boost::property_tree::ptree aChildren;
 OUString sStyleFam = aStyleFamilies[nStyleFam];
 uno::Reference 
xStyleFamily(xStyleFamilies->getByName(sStyleFam), uno::UNO_QUERY);
+
+// Writer provides a huge number of styles, we have a list of 7 
"default" styles which
+// should be shown in the normal dropdown, which we should add to the 
start of the list
+// to simplify their selection.
+if (sStyleFam == "ParagraphStyles"
+&& doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT)
+{
+for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / 
sizeof( sal_Char*); ++nStyle )
+{
+uno::Reference< beans::XPropertySet > xStyle;
+xStyleFamily->getByName( OUString::createFromAscii( 
aWriterStyles[nStyle] )) >>= xStyle;
+OUString sName;
+xStyle->getPropertyValue("DisplayName") >>= sName;
+if( !sName.isEmpty() )
+{
+boost::property_tree::ptree aChild;
+aChild.put("", sName.toUtf8());
+aChildren.push_back(std::make_pair("", aChild));
+}
+}
+}
+
 uno::Sequence aStyles = xStyleFamily->getElementNames();
 for (sal_Int32 nInd = 0; nInd < aStyles.getLength(); ++nInd)
 {
commit 030318a39b3057a56f9f5f6332d7f8c763e2e505
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 11 17:09:47 2015 +0100

lok: add Clear formatting to getStyles()

This requires client-side support too.

Change-Id: I5197ed3ed2b8244b50f7faf84a1cadde6a61b2cb
Reviewed-on: https://gerrit.libreoffice.org/19917
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
Tested-by: Andrzej Hunt <andr...@ahunt.org>
(cherry picked from commit 0b5991e4862501f0fa8e34f1b403aca40e51436f)

diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index f0faf21..ed5057b 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
 sb \
 sfx \
 svl \
+svxcore \
 svt \
 tk \
 tl \
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 5170785..981e546 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -185,14 +185,18 @@ void DesktopLOKTest::testGetStyles()
 CPPUNIT_ASSERT( aValues.size() > 0 );
 for (const std::pair<std::string, boost::property_tree::ptree>& rPair : 
aValues)
 {
-CPPUNIT_ASSERT( rPair.second.size() > 0);
+if( rPair.first != "ClearStyle")
+{
+CPPUNIT_ASSERT( rPair.second.size() > 0);
+}
 if (rPair.first != "CharacterStyles" &&
 rPair.first != "ParagraphStyles" &a

[Libreoffice-commits] core.git: desktop/Library_sofficeapp.mk desktop/qa desktop/source

2015-11-11 Thread Andrzej Hunt
 desktop/Library_sofficeapp.mk   |1 +
 desktop/qa/desktop_lib/test_desktop_lib.cxx |8 ++--
 desktop/source/lib/init.cxx |8 
 3 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 0b5991e4862501f0fa8e34f1b403aca40e51436f
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 11 17:09:47 2015 +0100

lok: add Clear formatting to getStyles()

This requires client-side support too.

Change-Id: I5197ed3ed2b8244b50f7faf84a1cadde6a61b2cb
Reviewed-on: https://gerrit.libreoffice.org/19917
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
    Tested-by: Andrzej Hunt <andr...@ahunt.org>

diff --git a/desktop/Library_sofficeapp.mk b/desktop/Library_sofficeapp.mk
index 0254b74..274bb1a 100644
--- a/desktop/Library_sofficeapp.mk
+++ b/desktop/Library_sofficeapp.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_Library_use_libraries,sofficeapp,\
 sb \
 sfx \
 svl \
+svxcore \
 svt \
 tk \
 tl \
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index f32f4bd..2351c7b 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -181,14 +181,18 @@ void DesktopLOKTest::testGetStyles()
 CPPUNIT_ASSERT( aValues.size() > 0 );
 for (const std::pair<std::string, boost::property_tree::ptree>& rPair : 
aValues)
 {
-CPPUNIT_ASSERT( rPair.second.size() > 0);
+if( rPair.first != "ClearStyle")
+{
+CPPUNIT_ASSERT( rPair.second.size() > 0);
+}
 if (rPair.first != "CharacterStyles" &&
 rPair.first != "ParagraphStyles" &&
 rPair.first != "FrameStyles" &&
 rPair.first != "PageStyles" &&
 rPair.first != "NumberingStyles" &&
 rPair.first != "CellStyles" &&
-rPair.first != "ShapeStyles")
+rPair.first != "ShapeStyles" &&
+rPair.first != "ClearStyle")
 {
 CPPUNIT_FAIL("Unknown style family: " + rPair.first);
 }
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 6d7d079..78e08f0 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -59,6 +59,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1265,6 +1267,12 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 }
 aValues.add_child(sStyleFam.toUtf8().getStr(), aChildren);
 }
+
+boost::property_tree::ptree aChildClearFormat;
+OUString sClearFormat = SVX_RESSTR( RID_SVXSTR_CLEARFORM );
+aChildClearFormat.put("", sClearFormat.toUtf8());
+aValues.add_child("ClearStyle", aChildClearFormat);
+
 aTree.add_child("commandValues", aValues);
 std::stringstream aStream;
 boost::property_tree::write_json(aStream, aTree);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: 3 commits - loleaflet/src

2015-11-11 Thread Andrzej Hunt
 loleaflet/src/control/Control.Styles.js |   58 +++-
 loleaflet/src/control/Toolbar.js|6 +++
 2 files changed, 55 insertions(+), 9 deletions(-)

New commits:
commit 4d03af151745c7e9b3114b4424f03e722f943b75
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Wed Nov 11 21:17:45 2015 +0100

loleaflet: show calc cell styles in selector too

diff --git a/loleaflet/src/control/Control.Styles.js 
b/loleaflet/src/control/Control.Styles.js
index d15c061..31b0dac 100644
--- a/loleaflet/src/control/Control.Styles.js
+++ b/loleaflet/src/control/Control.Styles.js
@@ -49,6 +49,9 @@ L.Control.Styles = L.Control.extend({
   this._map.getDocType() === 'drawing') {
styles = e.commandValues['Default'];
}
+   else if (this._map.getDocType() === 'spreadsheet' ) {
+   styles = e.commandValues['CellStyles'];
+   }
 
this._addSeparator();
if (e.commandValues['ClearStyle']) {
commit e484716ac3bc46b3c3a2e9cf57b924efd6223cf0
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Wed Nov 11 21:17:27 2015 +0100

loleaflet: separate the top UI styles

The topStyles are equivalent to the default styles shown
in the writer styles selector. The remainder of the list
is the full list of available styles (shown under "more"
in the desktop style selector), however this probably
too overwhelming, hence instead we just show a small selection
of styles.

diff --git a/loleaflet/src/control/Control.Styles.js 
b/loleaflet/src/control/Control.Styles.js
index b8d24ea..d15c061 100644
--- a/loleaflet/src/control/Control.Styles.js
+++ b/loleaflet/src/control/Control.Styles.js
@@ -35,15 +35,20 @@ L.Control.Styles = L.Control.extend({
var container = this._container;
var first = L.DomUtil.create('option', '', container);
first.innerHTML = this.options.info;
+
+   var styles = [];
+   var topStyles = [];
if (this._map.getDocType() === 'text') {
-   var styles = 
e.commandValues['ParagraphStyles'].slice(0, 12);
+   // The list contains a total of 100+ styles, 
the first 7 are
+   // the default styles (as shown on desktop 
writer), we then
+   // also show a selection of 12 more styles.
+   styles = 
e.commandValues['ParagraphStyles'].slice(7, 19);
+   topStyles = 
e.commandValues['ParagraphStyles'].slice(0, 7);
}
-   else if (this._map.getDocType() === 'presentation') {
+   else if (this._map.getDocType() === 'presentation' ||
+  this._map.getDocType() === 'drawing') {
styles = e.commandValues['Default'];
}
-   else {
-   styles = [];
-   }
 
this._addSeparator();
if (e.commandValues['ClearStyle']) {
@@ -51,11 +56,26 @@ L.Control.Styles = L.Control.extend({
item.value = 'ClearStyle';
item.innerHTML = e.commandValues['ClearStyle'];
}
-   styles.forEach(function (style) {
-   var item = L.DomUtil.create('option', '', 
container);
-   item.value = style;
-   item.innerHTML = style;
-   });
+
+   if (topStyles.length > 0) {
+   this._addSeparator();
+
+   topStyles.forEach(function (style) {
+   var item = L.DomUtil.create('option', 
'', container);
+   item.value = style;
+   item.innerHTML = style;
+   });
+   }
+
+   if (styles.length > 0) {
+   this._addSeparator();
+
+   styles.forEach(function (style) {
+   var item = L.DomUtil.create('option', 
'', container);
+   item.value = style;
+   item.innerHTML = style;
+   });
+   }
}
},
 
commit c560a04e06e1d617428e36ce527387a82adb49fa
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Wed Nov 11 21:15:26 2015 +0100

  

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

2015-11-11 Thread Andrzej Hunt
 desktop/source/lib/init.cxx |   33 +
 1 file changed, 33 insertions(+)

New commits:
commit 5c6119eeaaaed322c884504a53bb558258233fe9
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 11 21:07:13 2015 +0100

lok sw: Place default styles at top of style selector

The order/list of default styles for Writer should be hardcoded,
(by default the list contains 100+ items), it makes most sense to
place these at the start of the list, allowing the client to then
select how many styles they actually want to show.

Change-Id: I491a426397e06b3502cee7484c5f8adfd9d9cdf2
Reviewed-on: https://gerrit.libreoffice.org/19918
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
    Tested-by: Andrzej Hunt <andr...@ahunt.org>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 78e08f0..4b76082 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1252,12 +1252,45 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 uno::Reference 
xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
 uno::Sequence aStyleFamilies = xStyleFamilies->getElementNames();
 
+static const sal_Char* aWriterStyles[] =
+{
+"Text body",
+"Quotations",
+"Title",
+"Subtitle",
+"Heading 1",
+"Heading 2",
+"Heading 3"
+};
+
 boost::property_tree::ptree aValues;
 for (sal_Int32 nStyleFam = 0; nStyleFam < aStyleFamilies.getLength(); 
++nStyleFam)
 {
 boost::property_tree::ptree aChildren;
 OUString sStyleFam = aStyleFamilies[nStyleFam];
 uno::Reference 
xStyleFamily(xStyleFamilies->getByName(sStyleFam), uno::UNO_QUERY);
+
+// Writer provides a huge number of styles, we have a list of 7 
"default" styles which
+// should be shown in the normal dropdown, which we should add to the 
start of the list
+// to simplify their selection.
+if (sStyleFam == "ParagraphStyles"
+&& doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT)
+{
+for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / 
sizeof( sal_Char*); ++nStyle )
+{
+uno::Reference< beans::XPropertySet > xStyle;
+xStyleFamily->getByName( OUString::createFromAscii( 
aWriterStyles[nStyle] )) >>= xStyle;
+OUString sName;
+xStyle->getPropertyValue("DisplayName") >>= sName;
+if( !sName.isEmpty() )
+{
+boost::property_tree::ptree aChild;
+aChild.put("", sName.toUtf8());
+aChildren.push_back(std::make_pair("", aChild));
+}
+}
+}
+
 uno::Sequence aStyles = xStyleFamily->getElementNames();
 for (sal_Int32 nInd = 0; nInd < aStyles.getLength(); ++nInd)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-11 Thread Andrzej Hunt
 sd/source/ui/unoidl/unomodel.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 9125dbaf5db5bfb07f93be2cfedf43452a28ae32
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Nov 10 19:45:13 2015 +0100

sd lok: ccu#1295 force async image swap

This helps ensure that images are swapped in when we actually
render tiles. Previously we'd sometimes have placeholders
instead of the image, which results in either an invalidate
(+rerender of that tile) once the image is swapped in (for
normal tiles) or a permanently missing image in the preview tiles.

Change-Id: I1a16a913faf9fad20e40a5d1aad3de187038c7a2
Reviewed-on: https://gerrit.libreoffice.org/19890
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
    Tested-by: Andrzej Hunt <andr...@ahunt.org>

diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 896ba6c..f064a38 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2370,14 +2370,21 @@ void SdXImpressDocument::initializeForTiledRendering()
 
 mpDoc->setTiledRendering(true);
 
-// Disable map mode, so that it's possible to send mouse event coordinates
-// in logic units.
 if (DrawViewShell* pViewShell = GetViewShell())
 {
+// Disable map mode, so that it's possible to send mouse event 
coordinates
+// in logic units.
 if (sd::Window* pWindow = pViewShell->GetActiveWindow())
 {
 pWindow->EnableMapMode(false);
 }
+
+// Forces all images to be swapped in synchronously, this
+// ensures that images are available when paintTile is called
+// (whereas with async loading images start being loaded after
+//  we have painted the tile, resulting in an invalidate, followed
+//  by the tile being rerendered - which is wasteful and ugly).
+pViewShell->GetDrawView()->SetSwapAsynchron(false);
 }
 // tdf#93154: in tiled rendering LO doesn't always detect changes
 SvtMiscOptions aMiscOpt;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: desktop/qa sc/source

2015-11-08 Thread Andrzej Hunt
 desktop/qa/desktop_lib/test_desktop_lib.cxx |   20 
 sc/source/ui/view/gridwin.cxx   |7 ++-
 2 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit 2f13f051c3c39f77d5f65ff0e3f4a476ccb95f1a
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Fri Nov 6 18:09:34 2015 +0100

sc lok: Add initial test for .uno:CellCursor

This should be extended with checking that we receive "EMPTY"
when there is no cursor shown - that would require e.g. simulating
keyboard input to hide the cell cursor.

Change-Id: Ia7be5ec3e158f21967b4c307ac10abb2b5e2a56a
Reviewed-on: https://gerrit.libreoffice.org/19828
Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Andrzej Hunt <andr...@ahunt.org>
Tested-by: Andrzej Hunt <andr...@ahunt.org>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 0e66678..17002b7 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -68,6 +68,7 @@ public:
 void testSaveAsCalc();
 void testPasteWriter();
 void testRowColumnHeaders();
+void testCellCursor();
 void testCommandResult();
 
 CPPUNIT_TEST_SUITE(DesktopLOKTest);
@@ -82,6 +83,7 @@ public:
 CPPUNIT_TEST(testSaveAsCalc);
 CPPUNIT_TEST(testPasteWriter);
 CPPUNIT_TEST(testRowColumnHeaders);
+CPPUNIT_TEST(testCellCursor);
 CPPUNIT_TEST(testCommandResult);
 CPPUNIT_TEST_SUITE_END();
 
@@ -435,6 +437,24 @@ void DesktopLOKTest::testRowColumnHeaders()
 }
 }
 
+void DesktopLOKTest::testCellCursor()
+{
+LibLODocument_Impl* pDocument = loadDoc("search.ods");
+
+boost::property_tree::ptree aTree;
+
+char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, 
".uno:CellCursor?tileWidth=1=1=1=1");
+
+std::stringstream aStream(pJSON);
+free(pJSON);
+CPPUNIT_ASSERT(!aStream.str().empty());
+
+boost::property_tree::read_json(aStream, aTree);
+
+OString aRectangle(aTree.get("commandValues").c_str());
+CPPUNIT_ASSERT_EQUAL(aRectangle, OString("0, 0, 1278, 254"));
+}
+
 void DesktopLOKTest::testCommandResult()
 {
 LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 3ab0f738..9d6639b 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5789,13 +5789,10 @@ OString ScGridWindow::getCellCursor( int nOutputWidth, 
int nOutputHeight,
 }
 
 OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& 
rZoomY) {
-ScDocument* pDoc = pViewData->GetDocument();
-ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
-
-// GridWindows stores a shown cell cursor in mpOOCursors, hence
+// GridWindow stores a shown cell cursor in mpOOCursors, hence
 // we can use that to determine whether we would want to be showing
 // one (client-side) for tiled rendering too.
-if (!pDrawLayer->isTiledRendering() || !mpOOCursors.get())
+if (!mpOOCursors.get())
 {
 return OString("EMPTY");
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-11-06 Thread Andrzej Hunt
 sc/source/ui/inc/gridwin.hxx   |9 -
 sc/source/ui/view/gridwin.cxx  |4 +++-
 sc/source/ui/view/gridwin4.cxx |6 +++---
 3 files changed, 6 insertions(+), 13 deletions(-)

New commits:
commit 064fb1f73abbc103226a8fce8a46b7e8b8347dac
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Fri Nov 6 17:36:18 2015 +0100

Revert "sc lok: Cache viewdata zoom and reuse for cursor callback"

This reverts fab3c48a0cd5a0517025993502a04358308fe5ef for now.
The correct solution is to have the client "hint" at the current
resolution, which is still being developed
(gerrit-id: I34b5afcdcc06a671a8ac92c03e87404e42adf4cd).
For now the cursor will be wrongly positioned when moved as the result
of a mouse click.

Change-Id: I68d56eac958e607e8e2e3ad16aff4e1a7dd0b6dd
Reviewed-on: https://gerrit.libreoffice.org/19827
    Tested-by: Andrzej Hunt <andr...@ahunt.org>
Reviewed-by: Andrzej Hunt <andr...@ahunt.org>

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index f02d09a..4f82167 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -199,15 +199,6 @@ class ScGridWindow : public vcl::Window, public 
DropTargetHelper, public DragSou
 boolbAutoMarkVisible:1;
 boolbListValButton:1;
 
-// We cache the tiled rendering zoom level in order to be able to
-// calculate the correct cell cursor position (which is dependent
-// on the zoom level). The caching is necessary since
-// ScModelObj::postMouseEvent resets the zoom level to the default,
-// which means we have the default zoom level set during the
-// cell cursor position calculations in updateLibreOfficeKitCellCursor().
-FractionmTiledZoomX;
-FractionmTiledZoomY;
-
 DECL_LINK_TYPED( PopupModeEndHdl, FloatingWindow*, void );
 DECL_LINK_TYPED( PopupSpellingHdl, SpellCallbackInfo&, void );
 
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 1636a34..3ab0f738 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5827,7 +5827,9 @@ void ScGridWindow::updateLibreOfficeKitCellCursor()
 {
 ScDocument* pDoc = pViewData->GetDocument();
 ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
-OString aCursor = getCellCursor(mTiledZoomX, mTiledZoomY);
+// TODO: the zoom levels here should be replaced by the setClientZoom 
values
+// in a patch currently in gerrit 
(https://gerrit.libreoffice.org/#/c/19822/)
+OString aCursor = getCellCursor(pViewData->GetZoomX(), 
pViewData->GetZoomY());
 pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, 
aCursor.getStr());
 }
 
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e0f0a51..51ae5fd 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -953,11 +953,11 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
 // Similarly to Writer, we should set the mapmode once on the rDevice, and
 // not care about any zoom settings.
 
-mTiledZoomX = Fraction(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth);
-mTiledZoomY = Fraction(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight);
+Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth);
+Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight);
 
 // page break zoom, and aLogicMode in ScViewData
-pViewData->SetZoom(mTiledZoomX, mTiledZoomY, true);
+pViewData->SetZoom(aFracX, aFracY, true);
 
 double fTilePosXPixel = static_cast(nTilePosX) * nOutputWidth / 
nTileWidth;
 double fTilePosYPixel = static_cast(nTilePosY) * nOutputHeight / 
nTileHeight;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 5 commits - desktop/source include/LibreOfficeKit include/vcl libreofficekit/source sc/inc sc/source

2015-11-05 Thread Andrzej Hunt
 desktop/source/lib/init.cxx  |   54 +++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |9 +
 include/vcl/ITiledRenderable.hxx |   12 ++
 libreofficekit/source/gtk/lokdocview.cxx |   30 ++
 sc/inc/docuno.hxx|6 +
 sc/source/ui/inc/gridwin.hxx |   19 
 sc/source/ui/unoobj/docuno.cxx   |   17 +++
 sc/source/ui/view/gridwin.cxx|  128 ---
 sc/source/ui/view/gridwin4.cxx   |6 -
 9 files changed, 244 insertions(+), 37 deletions(-)

New commits:
commit e7e0d46dba7b1016968a10bca23a4bf668ec
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Thu Nov 5 10:31:06 2015 +0100

sc lok: update parameter syntax for .uno:CellCursor

This follows the syntax for .uno:ViewRowColumnHeaders
(which was implemented somewhat concurrentl with CellCursor)

Change-Id: I8ef03a969abc1716a0e95d95fb7043d75910c828

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f45445c..aaa5492 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1274,7 +1274,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* 
pThis, const char* pCo
 strcpy(pMemory, aString.getStr());
 return pMemory;
 }
-else if (aCommand.startsWith(aCellCursor)
+else if (aCommand.startsWith(aCellCursor))
 {
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -1283,29 +1283,40 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 return 0;
 }
 
-OString aString;
-OString aParams = 
aCommand.copy(OString(".uno:CellCursor:").getLength());
-
-sal_Int32 nIndex = 0;
-OString aOutputWidth = aParams.getToken(0,  ',',  nIndex);
-OString aOutputHeight = aParams.getToken(0,  ',',  nIndex);
-OString aTileWidth = aParams.getToken(0,  ',',  nIndex);
-OString aTileHeight = aParams.getToken(0,  ',',  nIndex);
-
-int nOutputWidth, nOutputHeight;
-long nTileWidth, nTileHeight;
-if (!(comphelper::string::getTokenCount(aParams, ',') == 4
-  && !aOutputWidth.isEmpty()
-  && (nOutputWidth = aOutputWidth.toInt32()) != 0
-  && !aOutputHeight.isEmpty()
-  && (nOutputHeight = aOutputHeight.toInt32()) != 0
-  && !aTileWidth.isEmpty()
-  && (nTileWidth = aTileWidth.toInt64()) != 0
-  && !aTileHeight.isEmpty()
-  && (nTileHeight = aTileHeight.toInt64()) != 0))
+// Command has parameters.
+int nOutputWidth = 0;
+int nOutputHeight = 0;
+long nTileWidth = 0;
+long nTileHeight = 0;
+if (aCommand.getLength() > aCellCursor.getLength())
 {
-gImpl->maLastExceptionMsg = "Can't parse arguments for 
.uno:CellCursor, no cursor returned";
-return NULL;
+OString aArguments = aCommand.copy(aCellCursor.getLength() + 1);
+sal_Int32 nParamIndex = 0;
+do
+{
+OString aParamToken = aArguments.getToken(0, '&', nParamIndex);
+sal_Int32 nIndex = 0;
+OString aKey;
+OString aValue;
+do
+{
+OString aToken = aParamToken.getToken(0, '=', nIndex);
+if (!aKey.getLength())
+aKey = aToken;
+else
+aValue = aToken;
+}
+while (nIndex >= 0);
+if (aKey == "outputWidth")
+nOutputWidth = aValue.toInt32();
+else if (aKey == "outputHeight")
+nOutputHeight = aValue.toInt32();
+else if (aKey == "tileWidth")
+nTileWidth = aValue.toInt64();
+else if (aKey == "tileHeight")
+nTileHeight = aValue.toInt64();
+}
+while (nParamIndex >= 0);
 }
 
 OString aString = pDoc->getCellCursor(nOutputWidth, nOutputHeight, 
nTileWidth, nTileHeight);
commit 2bcaffd12263e8f3c2a2fbf8ccc4b9bba2642146
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 4 17:24:15 2015 +0100

sc lok: tdf#94605 introduce uno:CellCursor

This allows the client to rerequest the current cursor position,
which is necessary e.g. on zoom-level changes.

Conflicts:
desktop/source/lib/init.cxx
sc/inc/docuno.hxx

Change-Id: I10d81e220a56a36e2ec0c59005cd1d4f134857d5

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bcc215b..f45445c 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source

[Libreoffice-commits] online.git: 5 commits - loleaflet/src loolwsd/bundled loolwsd/LOKitClient.cpp loolwsd/LOOLSession.cpp

2015-11-05 Thread Andrzej Hunt
 loleaflet/src/layer/tile/TileLayer.js|   72 ++-
 loolwsd/LOKitClient.cpp  |1 
 loolwsd/LOOLSession.cpp  |5 
 loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h |9 +
 4 files changed, 84 insertions(+), 3 deletions(-)

New commits:
commit 96965bec95370e595eb213ed76e8c10ea5c47556
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Thu Nov 5 09:57:29 2015 +0100

loleaflet: update .uno:CellCursor parameter format

This mirrors the parameter format for .uno:ViewRowColumnHeaders

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 60fadd9..3cdf098 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -943,11 +943,11 @@ L.TileLayer = L.GridLayer.extend({
// hence we need to request an updated cell cursor position for this 
level.
_onCellCursorShift: function (bForce) {
if (this._cellCursorMarker || bForce) {
-   L.Socket.sendMessage('commandvalues 
command=.uno:CellCursor:'
-+ '' + this._tileSize + ','
-+ '' + this._tileSize + ','
-+ '' + this._tileWidthTwips + ','
-+ '' + this._tileHeightTwips );
+   L.Socket.sendMessage('commandvalues 
command=.uno:CellCursor'
++ '?outputHeight=' + this._tileSize
++ '=' + this._tileSize
++ '=' + 
this._tileWidthTwips
++ '=' + 
this._tileHeightTwips );
}
},
 
commit d9d0d47514fef09d0606abcf7dc48b6b977c8987
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Wed Nov 4 15:44:29 2015 +0100

loleaflet: tdf#94605 Show cell cursor

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 6dc4d1f..60fadd9 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -66,6 +66,10 @@ L.TileLayer = L.GridLayer.extend({
this._graphicSelectionTwips = new L.bounds(new L.point(0, 0), 
new L.point(0, 0));
// Rectangle graphic selection
this._graphicSelection = new L.LatLngBounds(new L.LatLng(0, 0), 
new L.LatLng(0, 0));
+   // Original rectangle of cell cursor in twips
+   this._cellCursorTwips = new L.bounds(new L.point(0, 0), new 
L.point(0, 0));
+   // Rectangle for cell cursor
+   this._cellCursor = new L.LatLngBounds(new L.LatLng(0, 0), new 
L.LatLng(0, 0));
// Position and size of the selection start (as if there would 
be a cursor caret there).
 
this._lastValidPart = -1;
@@ -110,10 +114,21 @@ L.TileLayer = L.GridLayer.extend({
map.on('paste', this._onPaste, this);
map.on('zoomend', this._onUpdateCursor, this);
map.on('zoomend', this._onUpdatePartPageRectangles, this);
+   map.on('zoomend', this._onCellCursorShift, this);
map.on('dragstart', this._onDragStart, this);
map.on('requestloksession', this._onRequestLOKSession, this);
map.on('error', this._mapOnError, this);
map.on('resize', this._fitDocumentHorizontally, this);
+   // Retrieve the initial cell cursor position (as LOK only sends 
us an
+   // updated cell cursor when the selected cell is changed and 
not the initial
+   // cell).
+   map.on('statusindicator',
+  function (e) {
+if (e.statusType === 'alltilesloaded') {
+  this._onCellCursorShift(true);
+}
+  },
+  this);
for (var key in this._selectionHandles) {
this._selectionHandles[key].on('drag dragend', 
this._onSelectionHandleDrag, this);
}
@@ -204,6 +219,9 @@ L.TileLayer = L.GridLayer.extend({
else if (textMsg.startsWith('graphicselection:')) {
this._onGraphicSelectionMsg(textMsg);
}
+   else if (textMsg.startsWith('cellcursor:')) {
+   this._onCellCursorMsg(textMsg);
+   }
else if (textMsg.startsWith('hyperlinkclicked:')) {
this._onHyperlinkClickedMsg(textMsg);
}
@@ -264,7 +282,9 @@ L.TileLayer = L.GridLayer.extend({
 
_onCommandValuesMsg: function (textMsg) {
var obj = JSON.parse(textMsg.substring(tex

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 5 commits - desktop/source include/LibreOfficeKit include/vcl sc/inc sc/source

2015-11-05 Thread Andrzej Hunt
 desktop/source/lib/init.cxx  |   54 +++
 include/LibreOfficeKit/LibreOfficeKitEnums.h |9 +
 include/vcl/ITiledRenderable.hxx |   12 ++
 sc/inc/docuno.hxx|6 +
 sc/source/ui/inc/gridwin.hxx |   18 +++
 sc/source/ui/unoobj/docuno.cxx   |   17 +++
 sc/source/ui/view/gridwin.cxx|  128 ---
 sc/source/ui/view/gridwin4.cxx   |6 -
 8 files changed, 213 insertions(+), 37 deletions(-)

New commits:
commit bfe4af27e930108942f0e1af2bffd436588286dd
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Thu Nov 5 10:31:06 2015 +0100

sc lok: update parameter syntax for .uno:CellCursor

This follows the syntax for .uno:ViewRowColumnHeaders
(which was implemented somewhat concurrentl with CellCursor)

Change-Id: I8ef03a969abc1716a0e95d95fb7043d75910c828
(cherry picked from commit e7e0d46dba7b1016968a10bca23a4bf668ec)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 49189eb..dfb37b9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1282,7 +1282,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* 
pThis, const char* pCo
 strcpy(pMemory, aString.getStr());
 return pMemory;
 }
-else if (aCommand.startsWith(aCellCursor)
+else if (aCommand.startsWith(aCellCursor))
 {
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -1291,29 +1291,40 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 return 0;
 }
 
-OString aString;
-OString aParams = 
aCommand.copy(OString(".uno:CellCursor:").getLength());
-
-sal_Int32 nIndex = 0;
-OString aOutputWidth = aParams.getToken(0,  ',',  nIndex);
-OString aOutputHeight = aParams.getToken(0,  ',',  nIndex);
-OString aTileWidth = aParams.getToken(0,  ',',  nIndex);
-OString aTileHeight = aParams.getToken(0,  ',',  nIndex);
-
-int nOutputWidth, nOutputHeight;
-long nTileWidth, nTileHeight;
-if (!(comphelper::string::getTokenCount(aParams, ',') == 4
-  && !aOutputWidth.isEmpty()
-  && (nOutputWidth = aOutputWidth.toInt32()) != 0
-  && !aOutputHeight.isEmpty()
-  && (nOutputHeight = aOutputHeight.toInt32()) != 0
-  && !aTileWidth.isEmpty()
-  && (nTileWidth = aTileWidth.toInt64()) != 0
-  && !aTileHeight.isEmpty()
-  && (nTileHeight = aTileHeight.toInt64()) != 0))
+// Command has parameters.
+int nOutputWidth = 0;
+int nOutputHeight = 0;
+long nTileWidth = 0;
+long nTileHeight = 0;
+if (aCommand.getLength() > aCellCursor.getLength())
 {
-gImpl->maLastExceptionMsg = "Can't parse arguments for 
.uno:CellCursor, no cursor returned";
-return NULL;
+OString aArguments = aCommand.copy(aCellCursor.getLength() + 1);
+sal_Int32 nParamIndex = 0;
+do
+{
+OString aParamToken = aArguments.getToken(0, '&', nParamIndex);
+sal_Int32 nIndex = 0;
+OString aKey;
+OString aValue;
+do
+{
+OString aToken = aParamToken.getToken(0, '=', nIndex);
+if (!aKey.getLength())
+aKey = aToken;
+else
+aValue = aToken;
+}
+while (nIndex >= 0);
+if (aKey == "outputWidth")
+nOutputWidth = aValue.toInt32();
+else if (aKey == "outputHeight")
+nOutputHeight = aValue.toInt32();
+else if (aKey == "tileWidth")
+nTileWidth = aValue.toInt64();
+else if (aKey == "tileHeight")
+nTileHeight = aValue.toInt64();
+}
+while (nParamIndex >= 0);
 }
 
 OString aString = pDoc->getCellCursor(nOutputWidth, nOutputHeight, 
nTileWidth, nTileHeight);
commit 7020080f693ed8e6843c5099f742887395099477
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 4 17:24:15 2015 +0100

sc lok: tdf#94605 introduce uno:CellCursor

This allows the client to rerequest the current cursor position,
which is necessary e.g. on zoom-level changes.

Conflicts:
desktop/source/lib/init.cxx
sc/inc/docuno.hxx

(cherry picked from commit 2bcaffd12263e8f3c2a2fbf8ccc4b9bba2642146)

Conflicts:
sc/inc/docuno.hxx

Change-Id: I10d81e220a56a36e2ec0c59005cd1d4f134857d5

diff --git a/desktop/source/

[Libreoffice-commits] core.git: Branch 'feature/lok_cellcursor' - desktop/source include/vcl sc/inc sc/source

2015-11-04 Thread Andrzej Hunt
 desktop/source/lib/init.cxx  |   39 ---
 include/vcl/ITiledRenderable.hxx |   12 
 sc/inc/docuno.hxx|6 ++
 sc/source/ui/inc/gridwin.hxx |9 +
 sc/source/ui/unoobj/docuno.cxx   |   17 +
 sc/source/ui/view/gridwin.cxx|   36 +++-
 6 files changed, 111 insertions(+), 8 deletions(-)

New commits:
commit e076820bb7a9537a2427f1e4f1d4d35812ef9aae
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Nov 4 15:54:36 2015 +0100

sc lok: tdf#94605 introduce uno:CellCursor

This allows the client to rerequest the current cursor position,
which is necessary e.g. on zoom-level changes.

Change-Id: I10d81e220a56a36e2ec0c59005cd1d4f134857d5

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index acd..16c4379 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1141,6 +1142,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, 
const char* pCommand)
 
 static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* 
pCommand)
 {
+OString aCommand(pCommand);
 if (!strcmp(pCommand, ".uno:CharFontName"))
 {
 return getFonts(pCommand);
@@ -1149,7 +1151,7 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* 
pThis, const char* pCo
 {
 return getStyles(pThis, pCommand);
 }
-else if (OString(pCommand) == ".uno:ViewRowColumnHeaders")
+else if (aCommand == ".uno:ViewRowColumnHeaders" || 
aCommand.startsWith(".uno:CellCursor"))
 {
 ITiledRenderable* pDoc = getTiledRenderable(pThis);
 if (!pDoc)
@@ -1158,8 +1160,39 @@ static char* 
doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
 return 0;
 }
 
-OUString aHeaders = pDoc->getRowColumnHeaders();
-OString aString = OUStringToOString(aHeaders, RTL_TEXTENCODING_UTF8);
+OString aString;
+if (aCommand == ".uno:ViewRowColumnHeaders")
+{
+OUString aValue = pDoc->getRowColumnHeaders();
+aString = OUStringToOString(aValue, RTL_TEXTENCODING_UTF8);
+}
+else if (aCommand.startsWith(".uno:CellCursor:"))
+{
+OString aParams = 
aCommand.copy(OString(".uno:CellCursor:").getLength());
+
+sal_Int32 nIndex = 0;
+OString aOutputWidth = aParams.getToken(0,  ',',  nIndex);
+OString aOutputHeight = aParams.getToken(0,  ',',  nIndex);
+OString aTileWidth = aParams.getToken(0,  ',',  nIndex);
+OString aTileHeight = aParams.getToken(0,  ',',  nIndex);
+
+int nOutputWidth, nOutputHeight;
+long nTileWidth, nTileHeight;
+if (!(comphelper::string::getTokenCount(aParams, ',') == 4
+  && !aOutputWidth.isEmpty()
+  && (nOutputWidth = aOutputWidth.toInt32()) != 0
+  && !aOutputHeight.isEmpty()
+  && (nOutputHeight = aOutputHeight.toInt32()) != 0
+  && !aTileWidth.isEmpty()
+  && (nTileWidth = aTileWidth.toInt64()) != 0
+  && !aTileHeight.isEmpty()
+  && (nTileHeight = aTileHeight.toInt64()) != 0))
+{
+gImpl->maLastExceptionMsg = "Can't parse arguments for 
.uno:CellCursor, no cursor returned";
+return NULL;
+}
+aString = pDoc->getCellCursor(nOutputWidth, nOutputHeight, 
nTileWidth, nTileHeight);
+}
 char* pMemory = static_cast<char*>(malloc(aString.getLength() + 1));
 strcpy(pMemory, aString.getStr());
 return pMemory;
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 48a13ff..01c0dd2 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -156,6 +156,18 @@ public:
 return OUString();
 }
 
+/**
+ * Get position and size of cell cursor in Calc.
+ * (This could maybe also be used for tables in Writer/Impress in future?)
+ */
+virtual OString getCellCursor(int /*nOutputWidth*/,
+  int /*nOutputHeight*/,
+  long /*nTileWidth*/,
+  long /*nTileHeight*/)
+{
+return OString();
+}
+
 /// Sets the clipboard of the component.
 virtual void setClipboard(const 
css::uno::Reference& xClipboard) = 0;
 
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index e2a2dbc..2c168a1 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -407,6 +407,12 @@ public:
 
 /// @see vcl::ITiledRenderable::

[Libreoffice-commits] core.git: Changes to 'feature/lok_cellcursor'

2015-11-03 Thread Andrzej Hunt
New branch 'feature/lok_cellcursor' available with the following commits:
commit 406ae94057eecec7fe6e7e085eca2d7bd0928b73
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Nov 3 10:14:02 2015 +0100

sc lok: make cell cursor behaviour consistent with desktop

I.e. single click selects cell, typing activates the EditView
(and hides the cell cursor). (Previously: single click activates
the edit view, text cursor is shown, and no clean way of hiding
the cell cursor again.)

Change-Id: I184630277e8935e9f8a97a856191497ec5d62111

commit cdc8b002740b0cb49e90db923cc6881c68c83c5e
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 2 13:57:51 2015 +0100

sc lok: Use cached zoom level for calc text cursor callback too

Previously the text cursor (as opposed to cell cursor) would be
placed incorrectly if a cell was selected by clicking, due to the
incorrect zoom level being used. (Note: in gtktiledviewer
this was only visible when selecting cells after zooming in.)

Change-Id: I87c210c8c4a108e11f762445354fc323fd496da7

commit ad8791f2e2530309eae8df321d05bee644052790
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 2 13:24:12 2015 +0100

sc lok: Cache viewdata zoom and reuse for cursor callback

As of a1605d6860e3c4510177c42ab6d2fda569506f57 we reset the zoom
level to the default when processing LOK mouse events. The exact
cell cursor position is dependent on the zoom level (due to the
rounding in the cell position summing calculations), hence we need
to make sure we have the correct zoom level for those calculations
(or else the rounding errors will result in incorrect cell cursor
positions). Caching the zoom level and reusing it only here seems
to be the most efficient way of solving this for now.

(An alternative would be to only send the cell ID in the callback,
 and have the frontend then request the pixel positions together
 with the current frontend zoom level - however especially for
 LOOL minimising the number of trips is probably wise.)

Change-Id: Iae3aabfd7ea9bec7057be7b63670885766870c4f

commit 24112a233626416e554f97420cb5f5c235b05b28
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Nov 2 11:43:05 2015 +0100

sc lok: Cell Cursor callback

This only works correctly for the default zoom level - since
the updateLibreOfficeKitCellCursor call happens during the
internal / hidden rendering, it uses the internal zoom values,
which can differ from the tiled-rendering zoom values.

Change-Id: Ie4f344fe771078fca10ad9d6f7a93e88fb93880a

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


[Libreoffice-commits] online.git: loleaflet/src

2015-10-30 Thread Andrzej Hunt
 loleaflet/src/control/Control.Scroll.js |2 +-
 loleaflet/src/dom/Draggable.js  |2 +-
 loleaflet/src/layer/tile/TileLayer.js   |8 
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit a815a96ab2855f57c2c3d663c699570d998ab445
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Fri Oct 30 13:54:49 2015 +0100

loleaflet: fix autoscroll on chrome

DomRect doesn't officially contain x and y, instead we should
use left and top (Firefox's DomRect however does contain these).

diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index a869951..e750e80 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -104,7 +104,7 @@ L.Control.Scroll = L.Control.extend({
}
if (e.pos.x > e.map._size.x - 50) {
vx = 50;
-   } else if (e.pos.x < 50 + 
e.map._container.getBoundingClientRect().x) {
+   } else if (e.pos.x < 50) {
vx = -50;
}
 
diff --git a/loleaflet/src/dom/Draggable.js b/loleaflet/src/dom/Draggable.js
index 7b65378..3eaafa7 100644
--- a/loleaflet/src/dom/Draggable.js
+++ b/loleaflet/src/dom/Draggable.js
@@ -72,7 +72,7 @@ L.Draggable = L.Evented.extend({
// We don't use this internally, but it is needed for external
// manipulation of the cursor position, e.g. when adjusting
// for scrolling during cursor dragging.
-   this.startOffset = this._startPoint.subtract(new 
L.Point(startBoundingRect.x, startBoundingRect.y));
+   this.startOffset = this._startPoint.subtract(new 
L.Point(startBoundingRect.left, startBoundingRect.top));
 
L.DomEvent
.on(document, L.Draggable.MOVE[e.type], this._onMove, this)
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 16271d1..aa0a88b 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -658,8 +658,7 @@ L.TileLayer = L.GridLayer.extend({
 
// Onscreen position of the cursor, i.e. relative to 
the browser window
var boundingrect = 
e.target._icon.getBoundingClientRect();
-   var cursorPos = L.point(boundingrect.x - 
e.target._icon.offsetLeft,
- boundingrect.y - 
e.target._icon.offsetTop);
+   var cursorPos = L.point(boundingrect.left, 
boundingrect.top);
 
var expectedPos = L.point(e.originalEvent.pageX, 
e.originalEvent.pageY).subtract(e.target.dragging._draggable.startOffset);
 
@@ -675,9 +674,10 @@ L.TileLayer = L.GridLayer.extend({
e.target.dragging._draggable._updatePosition();
}
 
-   var containerPos = new L.point(expectedPos.x - 
this._map._container.getBoundingClientRect().x,
-   expectedPos.y - 
this._map._container.getBoundingClientRect().y);
+   var containerPos = new L.point(expectedPos.x - 
this._map._container.getBoundingClientRect().left,
+   expectedPos.y - 
this._map._container.getBoundingClientRect().top);
 
+   containerPos = 
containerPos.add(e.target.dragging._draggable.startOffset);
this._map.fire('handleautoscroll', { pos: containerPos, 
map: this._map });
}
if (e.type === 'dragend') {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: loleaflet/src

2015-10-30 Thread Andrzej Hunt
 loleaflet/src/map/Map.js |4 
 1 file changed, 4 insertions(+)

New commits:
commit 3c792c655f51b2b4fada2422422cfe51d0a80b83
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Fri Oct 30 20:03:18 2015 +0100

loleaflet: tdf#94599 Disable irrelevant context menu

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index effe453..0609337 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -53,6 +53,10 @@ L.Map = L.Evented.extend({
}
this._addLayers(this.options.layers);
L.Socket.connect(this);
+
+   // Inhibit the context menu - the browser thinks that the 
document
+   // is just a bunch of images, hence the context menu is useless 
(tdf#94599)
+   this.on('contextmenu', function() {});
},
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-10-30 Thread Andrzej Hunt
 sw/source/uibase/docvw/edtwin.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a461ab5fd60068202189a2f426490b95b68efa3c
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Fri Oct 30 20:27:20 2015 +0100

Correct typo in comment

Change-Id: I61a372e297eeeb67f1dcadbfc5017b0cc157d065

diff --git a/sw/source/uibase/docvw/edtwin.cxx 
b/sw/source/uibase/docvw/edtwin.cxx
index 0ec6422..d1c9c6b 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -3352,7 +3352,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 if ( rSh.IsExtMode() || rSh.IsBlockMode() )
 return;
 
-// select work, AdditionalMode if applicable
+// select word, AdditionalMode if applicable
 if ( KEY_MOD1 == rMEvt.GetModifier() && 
!rSh.IsAddMode() )
 {
 rSh.EnterAddMode();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: Changes to 'feature/contextmenu'

2015-10-30 Thread Andrzej Hunt
New branch 'feature/contextmenu' available with the following commits:
commit 23f1e4600a7914e5d2804c465cdb7b04b49d662e
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Fri Oct 30 19:45:09 2015 +0100

loleaflet: Implement context menu with 'copy' command

We also have a dummy paste button, however this doesn't
actually work - it's possible that this might work in IE,
but is unsupported in most other browsers for security reasons.

commit bc3cd2ce8c1358d897331c4765f009f1ca69eb64
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Fri Oct 30 19:37:47 2015 +0100

loleaflet: contextmenu plugin: don't override items list

The plugin seems to assume that we pass the items list
into map externally, however in loleaflet we extend options
internally - since the plugin is loaded later it then tried to
overwrite our items list with it's default empty list, which
should be avoided.

commit 794052bd998514b1867d435920f653b80251f28b
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Thu Oct 29 19:55:40 2015 +0100

loleaflet: Add Leaflet.contextmenu plugin

This is a plugin allowing simple creation of contextmenus.

Source code: https://github.com/aratcliffe/Leaflet.contextmenu
Licence: MIT

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


[Libreoffice-commits] online.git: 3 commits - loleaflet/build loleaflet/src

2015-10-29 Thread Andrzej Hunt
 loleaflet/build/deps.js  |3 -
 loleaflet/src/dom/DomEvent.MultiClick.js |   66 +++
 loleaflet/src/dom/DomEvent.js|6 ++
 loleaflet/src/map/Map.js |2 
 loleaflet/src/map/handler/Map.Mouse.js   |   31 +++---
 5 files changed, 99 insertions(+), 9 deletions(-)

New commits:
commit b394f337c7aa3a2650fe5abdbcfd849c5829ca57
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Thu Oct 29 15:26:01 2015 +0100

loleaflet: tdf#94609 Support triple and quadruple click selection

Currently probably only supported on desktop (clicking) browsers.

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index f79ace4..effe453 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -573,7 +573,7 @@ L.Map = L.Evented.extend({
var onOff = remove ? 'off' : 'on';
 
L.DomEvent[onOff](this._container, 'click dblclick mousedown 
mouseup ' +
-   'mouseover mouseout mousemove contextmenu keydown 
keypress keyup', this._handleDOMEvent, this);
+   'mouseover mouseout mousemove contextmenu keydown 
keypress keyup trplclick qdrplclick', this._handleDOMEvent, this);
L.DomEvent[onOff](this._textArea, 'copy paste keydown keypress 
keyup', this._handleDOMEvent, this);
 
if (this.options.trackResize) {
diff --git a/loleaflet/src/map/handler/Map.Mouse.js 
b/loleaflet/src/map/handler/Map.Mouse.js
index 4d03770..6477be4 100644
--- a/loleaflet/src/map/handler/Map.Mouse.js
+++ b/loleaflet/src/map/handler/Map.Mouse.js
@@ -14,12 +14,12 @@ L.Map.Mouse = L.Handler.extend({
},
 
addHooks: function () {
-   this._map.on('mousedown mouseup mouseover mouseout mousemove 
dblclick',
+   this._map.on('mousedown mouseup mouseover mouseout mousemove 
dblclick trplclick qdrplclick',
this._onMouseEvent, this);
},
 
removeHooks: function () {
-   this._map.off('mousedown mouseup mouseover mouseout mousemove 
dblclick',
+   this._map.off('mousedown mouseup mouseover mouseout mousemove 
dblclick trplclick qdrplclick',
this._onMouseEvent, this);
},
 
@@ -81,10 +81,22 @@ L.Map.Mouse = L.Handler.extend({
if (this._clickTime && Date.now() - this._clickTime <= 
250) {
// double click, a click was sent already
this._mouseEventsQueue = [];
+   this._clickCount++;
+   if (this._clickCount < 4) {
+   // Reset the timer in order to keep 
resetting until
+   // we could have sent through a 
quadruple click. After this revert
+   // to normal behaviour so that a 
following single-click is treated
+   // as a separate click, in order to 
match LO desktop behaviour.
+   // (Clicking five times results in 
paragraph selection after 4 clicks,
+   // followed by resetting to a single 
cursor and no selection on the
+   // fifth click.)
+   this._clickTime = Date.now();
+   }
return;
}
else {
this._clickTime = Date.now();
+   this._clickCount = 1;
mousePos = docLayer._latLngToTwips(e.latlng);
var timeOut = 250;
if (docLayer._permission === 'edit') {
@@ -145,10 +157,17 @@ L.Map.Mouse = L.Handler.extend({
this._map.fire('handleautoscroll', { pos: 
e.containerPoint, map: this._map });
}
}
-   else if (e.type === 'dblclick') {
+   else if (e.type === 'dblclick' || e.type === 'trplclick' || 
e.type === 'qdrplclick') {
mousePos = docLayer._latLngToTwips(e.latlng);
-   docLayer._postMouseEvent('buttondown', mousePos.x, 
mousePos.y, 2, buttons, modifier);
-   docLayer._postMouseEvent('buttonup', mousePos.x, 
mousePos.y, 2, buttons, modifier);
+   var clicks = {
+   dblclick: 2,
+   trplclick: 3,
+   qdrplclick: 4
+   };
+   var count = clicks[e.type];
+
+   docLayer._postMouseEvent('buttondown', mousePos.x, 
mousePos.y, count, buttons, modifier);
+   docLayer._postMouseEvent('b

[Libreoffice-commits] online.git: 3 commits - loleaflet/src

2015-10-28 Thread Andrzej Hunt
 loleaflet/src/control/Control.Scroll.js |   34 +++
 loleaflet/src/dom/Draggable.js  |6 
 loleaflet/src/layer/tile/TileLayer.js   |   40 +---
 loleaflet/src/map/handler/Map.Mouse.js  |5 
 4 files changed, 82 insertions(+), 3 deletions(-)

New commits:
commit acb39fc057db157b988f2cabf50809ab7a582dcd
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Wed Oct 28 11:26:09 2015 +0100

fdo#94610 autoscroll document for selection

This works for both the selection "handles"/cursors, and also
for normal (desktop-like?) click+drag selection.

diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index 8115292..a869951 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -12,6 +12,7 @@ L.Control.Scroll = L.Control.extend({
map.on('scrollto', this._onScrollTo, this);
map.on('scrollby', this._onScrollBy, this);
map.on('scrollvelocity', this._onScrollVelocity, this);
+   map.on('handleautoscroll', this._onHandleAutoScroll, this);
map.on('docsize', this._onUpdateSize, this);
map.on('updatescrolloffset', this._onUpdateScrollOffset, this);
 
@@ -92,6 +93,24 @@ L.Control.Scroll = L.Control.extend({
}
},
 
+   _onHandleAutoScroll: function (e) {
+   var vx = 0;
+   var vy = 0;
+
+   if (e.pos.y > e.map._size.y - 50) {
+   vy = 50;
+   } else if (e.pos.y < 50) {
+   vy = -50;
+   }
+   if (e.pos.x > e.map._size.x - 50) {
+   vx = 50;
+   } else if (e.pos.x < 50 + 
e.map._container.getBoundingClientRect().x) {
+   vx = -50;
+   }
+
+   this._onScrollVelocity({vx: vx, vy: vy});
+   },
+
_onUpdateSize: function (e) {
this._ignoreScroll = true;
setTimeout(L.bind(function() {this._ignoreScroll = null;}, 
this), 200);
diff --git a/loleaflet/src/dom/Draggable.js b/loleaflet/src/dom/Draggable.js
index 3df1342..7b65378 100644
--- a/loleaflet/src/dom/Draggable.js
+++ b/loleaflet/src/dom/Draggable.js
@@ -67,6 +67,12 @@ L.Draggable = L.Evented.extend({
 
this._startPoint = new L.Point(first.clientX, first.clientY);
this._startPos = this._newPos = 
L.DomUtil.getPosition(this._element);
+   var startBoundingRect = this._element.getBoundingClientRect();
+   // Store offset between mouse selection position, and top left
+   // We don't use this internally, but it is needed for external
+   // manipulation of the cursor position, e.g. when adjusting
+   // for scrolling during cursor dragging.
+   this.startOffset = this._startPoint.subtract(new 
L.Point(startBoundingRect.x, startBoundingRect.y));
 
L.DomEvent
.on(document, L.Draggable.MOVE[e.type], this._onMove, this)
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 99a5199..16271d1 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -605,7 +605,11 @@ L.TileLayer = L.GridLayer.extend({
center = 
center.subtract(this._map.getSize().divideBy(2));
center.x = Math.round(center.x < 0 ? 0 : center.x);
center.y = Math.round(center.y < 0 ? 0 : center.y);
-   this._map.fire('scrollto', {x: center.x, y: center.y});
+
+   if (!(this._selectionHandles.start && 
this._selectionHandles.start.isDragged) &&
+   !(this._selectionHandles.end && 
this._selectionHandles.end.isDragged)) {
+   this._map.fire('scrollto', {x: center.x, y: 
center.y});
+   }
}
 
if (this._permission === 'edit' && this._isCursorVisible && 
this._isCursorOverlayVisible
@@ -657,16 +661,10 @@ L.TileLayer = L.GridLayer.extend({
var cursorPos = L.point(boundingrect.x - 
e.target._icon.offsetLeft,
  boundingrect.y - 
e.target._icon.offsetTop);
 
-   var expectedPos = L.point(e.originalEvent.pageX, 
e.originalEvent.pageY);
+   var expectedPos = L.point(e.originalEvent.pageX, 
e.originalEvent.pageY).subtract(e.target.dragging._draggable.startOffset);
 
// If the map has been scrolled, but the cursor hasn't 
been updated yet, then
// the current mouse position differs.
-   // In reality there should be a small offset

[Libreoffice-commits] online.git: Changes to 'private/ajrhunt/selection'

2015-10-27 Thread Andrzej Hunt
New branch 'private/ajrhunt/selection' available with the following commits:
commit 0f3c45b2b67ffa1442053cdc9e14a08fe9aa8ca3
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Oct 27 19:27:31 2015 +0100

PROTOTYPE fdo#94610 autoscroll document for selection

This works for both the selection "handles"/cursors, and also
for normal (desktop-like?) click+drag selection.

commit 70aaba619a21f73f41325b214a38e817c7e9fb2f
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Oct 27 19:24:50 2015 +0100

Implement scrollvelocity

This is needed for e.g. fdo#94610

commit c948daf2703de88784abc6cab3837a121f41303c
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Oct 27 15:11:37 2015 +0100

Make currently dragged cursor follow map scroll

Previously the cursor would become offset from the mouse position
if the window was scrolled during dragging.

Related: fdo#94610

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


[Libreoffice-commits] online.git: loleaflet/src

2015-10-26 Thread Andrzej Hunt
 loleaflet/src/control/Control.Scroll.js |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 8ab0b885509298fee61bf3edf61407db870e3155
Author: Andrzej Hunt <andrzej.h...@collabora.com>
Date:   Mon Oct 26 10:36:51 2015 +0100

loleaflet: onScrollBy: add support for horizontal scrolling too

diff --git a/loleaflet/src/control/Control.Scroll.js 
b/loleaflet/src/control/Control.Scroll.js
index 315f575..7b4c4d2 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -69,7 +69,12 @@ L.Control.Scroll = L.Control.extend({
if (e.y < 0) {
y = '-=' + Math.abs(e.y);
}
-   $('.scroll-container').mCustomScrollbar('scrollTo', [y, '+=0']);
+   e.x *= (-1);
+   var x = '+=' + e.x;
+   if (e.x < 0) {
+   x = '-=' + Math.abs(e.x);
+   }
+   $('.scroll-container').mCustomScrollbar('scrollTo', [y, x]);
},
 
_onUpdateSize: function (e) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 1961 commits - accessibility/inc accessibility/source android/Bootstrap android/CustomTarget_lo_android.mk android/.gitignore android/Makefil

2015-10-21 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit 0d7d7f22337c56623da15ad3003bceae2c1a063c
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Wed Oct 21 14:24:44 2015 +0200

unit-verification: more convert Link<> to typed

Change-Id: I8f330dbfb3b5a0a7409475a5a8802c3640e6bb31

diff --git a/sc/source/ui/inc/unitsconversiondlg.hxx 
b/sc/source/ui/inc/unitsconversiondlg.hxx
index cda8f83..d5a1f3c 100644
--- a/sc/source/ui/inc/unitsconversiondlg.hxx
+++ b/sc/source/ui/inc/unitsconversiondlg.hxx
@@ -85,11 +85,11 @@ private:
 void PerformConversion();
 
 DECL_LINK_TYPED( OkClicked, Button*, void );
-DECL_LINK( GetFocusHandler, Control* );
-DECL_LINK( LoseFocusHandler,void* );
-DECL_LINK( OutputUnitsModified, void* );
-DECL_LINK( OutputUnitsGetFocusHandler,  void* );
-DECL_LINK( OutputUnitsLoseFocusHandler, void* );
+DECL_LINK_TYPED( GetFocusHandler,   Control&, void );
+DECL_LINK_TYPED( LoseFocusHandler,  Control&, void );
+DECL_LINK_TYPED( OutputUnitsModified,   Edit&, void );
+DECL_LINK_TYPED( OutputUnitsGetFocusHandler,  Control&, void );
+DECL_LINK_TYPED( OutputUnitsLoseFocusHandler, Control&, void );
 };
 
 #endif // INCLUDED_SC_SOURCE_UI_INC_UNITSCONVERSIONDLG_HXX
diff --git a/sc/source/ui/miscdlgs/unitsconversiondlg.cxx 
b/sc/source/ui/miscdlgs/unitsconversiondlg.cxx
index cea5405..0e6e922 100644
--- a/sc/source/ui/miscdlgs/unitsconversiondlg.cxx
+++ b/sc/source/ui/miscdlgs/unitsconversiondlg.cxx
@@ -75,7 +75,7 @@ void ScUnitsConversionDialog::dispose()
 
 void ScUnitsConversionDialog::Init()
 {
-Link<> aLink = LINK( this, ScUnitsConversionDialog, GetFocusHandler );
+Link<Control&, void> aLink = LINK( this, ScUnitsConversionDialog, 
GetFocusHandler );
 mpInputRangeEdit->SetGetFocusHdl( aLink );
 mpInputRangeButton->SetGetFocusHdl( aLink );
 
@@ -206,38 +206,34 @@ IMPL_LINK_TYPED( ScUnitsConversionDialog, OkClicked, 
Button*, /*pButton*/, void
 Close();
 }
 
-IMPL_LINK( ScUnitsConversionDialog, GetFocusHandler, Control*, pCtrl )
+IMPL_LINK_TYPED( ScUnitsConversionDialog, GetFocusHandler, Control&, rCtrl, 
void )
 {
 Edit* pEdit = NULL;
 
-if( (pCtrl == mpInputRangeEdit.get()) || (pCtrl == 
mpInputRangeButton.get()) ) {
+if ( (  == static_cast<Control*>( mpInputRangeEdit ) ) ||
+ (  == static_cast<Control*>( mpInputRangeButton ) ) ) {
 pEdit = mpInputRangeEdit;
 }
 
-if( pEdit ) {
+if ( pEdit ) {
 pEdit->SetSelection( Selection( 0, SELECTION_MAX ) );
 }
-
-return 0;
 }
 
-IMPL_LINK_NOARG( ScUnitsConversionDialog, LoseFocusHandler )
+IMPL_LINK_NOARG_TYPED( ScUnitsConversionDialog, LoseFocusHandler, Control&, 
void )
 {
 mbDialogLostFocus = !IsActive();
-return 0;
 }
 
-IMPL_LINK_NOARG( ScUnitsConversionDialog, OutputUnitsGetFocusHandler )
+IMPL_LINK_NOARG_TYPED( ScUnitsConversionDialog, OutputUnitsGetFocusHandler, 
Control&, void )
 {
 // The warning box may have been enabled because of an incompatible unit,
 // however we should disable it during editing (it will then be reenabled
 // if needed once the user completes editing their desired output unit).
 mpIncompatibleOutputBox->Show( false );
-
-return 0;
 }
 
-IMPL_LINK_NOARG( ScUnitsConversionDialog, OutputUnitsModified )
+IMPL_LINK_NOARG_TYPED( ScUnitsConversionDialog, OutputUnitsModified, Edit&, 
void )
 {
 OUString sOutputUnit = mpOutputUnitsEdit->GetText();
 
@@ -251,15 +247,11 @@ IMPL_LINK_NOARG( ScUnitsConversionDialog, 
OutputUnitsModified )
 mpOutputUnitsEdit->SetControlForeground( Color( COL_BLACK ) );
 mpOutputUnitsEdit->set_font_attribute( "underline", "false" );
 }
-
-return 0;
 }
 
-IMPL_LINK_NOARG( ScUnitsConversionDialog, OutputUnitsLoseFocusHandler )
+IMPL_LINK_NOARG_TYPED( ScUnitsConversionDialog, OutputUnitsLoseFocusHandler, 
Control&, void )
 {
 mpIncompatibleOutputBox->Show( !CheckUnitsAreConvertible() );
-
-    return 0;
 }
 
 void ScUnitsConversionDialog::PerformConversion()
commit f54a180271349de75b6c3e5dc80a58e91b5b289b
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Oct 20 22:04:46 2015 +0200

ScreenSaverInhibitor: Don't depend on glib type definitions

We also include this header from the kde and tde backends,
it seems to be saner just to use the base definitions of these
types rather than depending on glib there.

Change-Id: Ib270fd33290f9c213dea72a8e20618007470d882

diff --git a/vcl/inc/unx/screensaverinhibitor.hxx 
b/vcl/inc/unx/screensaverinhibitor.hxx
index 286c18d..7b5af6d 100644
--- a/vcl/inc/unx/screensaverinhibitor.hxx
+++ b/vcl/inc/unx/screensaverinhibitor.hxx
@@ -21,19 +21,20 @@
 
 #include 
 
-#include 
-
 class VCL_PLUGIN_PUBLIC ScreenSaverInhibitor
 {
 public:
 void inhibit( bool bInh

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

2015-10-21 Thread Andrzej Hunt
 compilerplugins/clang/badvectorinit.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 7276c346678c2cb51c14f6011659376890bbabea
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Oct 20 21:23:42 2015 +0200

Ignore the default constructor for loplugin:badvectorinit too

The default constructor doesn't necessarily have 0 parameters,
hence we need to explicitly test for this too.

Change-Id: I685c44ab373ec8234a86824a77cc523a355c8b05
Reviewed-on: https://gerrit.libreoffice.org/19496
Reviewed-by: Noel Grandin <noelgran...@gmail.com>
Tested-by: Noel Grandin <noelgran...@gmail.com>

diff --git a/compilerplugins/clang/badvectorinit.cxx 
b/compilerplugins/clang/badvectorinit.cxx
index 005726e..709a65d 100644
--- a/compilerplugins/clang/badvectorinit.cxx
+++ b/compilerplugins/clang/badvectorinit.cxx
@@ -172,7 +172,10 @@ bool BadVectorInit::VisitCXXConstructExpr(const 
CXXConstructExpr* expr)
 const CXXConstructorDecl *consDecl = expr->getConstructor();
 consDecl = consDecl->getCanonicalDecl();
 
-if (consDecl->param_size() == 0)
+// The default constructor can potentially have a parameter, e.g.
+// in glibcxx-debug the default constructor is:
+// explicit vector(const _Allocator& __a = _Allocator())
+if (consDecl->param_size() == 0 || consDecl->isDefaultConstructor())
 return true;
 
 std::string aParentName = 
consDecl->getParent()->getQualifiedNameAsString();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/screensaverinhibit-update' - 693 commits - accessibility/inc accessibility/source android/Bootstrap android/CustomTarget_lo_android.mk android/.gitignor

2015-10-20 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit ef56cb5b986857d067f3745c37c15adb60bf9e42
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Oct 20 17:24:44 2015 +0200

Add org.mate.SessionManager support

This is valid for Mate <= 1.10
(As of writing, 1.10 is the current stable release - so we'll have
 to keep shipping this for quite a few years to come.)

Change-Id: I4d1f81c50923148e710eac22f5428b2a1c41f0e9

diff --git a/vcl/inc/unx/screensaverinhibitor.hxx 
b/vcl/inc/unx/screensaverinhibitor.hxx
index f00e61f..286c18d 100644
--- a/vcl/inc/unx/screensaverinhibitor.hxx
+++ b/vcl/inc/unx/screensaverinhibitor.hxx
@@ -33,6 +33,7 @@ private:
 boost::optional mnFDOCookie; // FDO ScreenSaver Inhibit
 boost::optional mnFDOPMCookie; // FDO PowerManagement Inhibit
 boost::optional mnGSMCookie;
+boost::optional mnMSMCookie;
 
 boost::optional mnXScreenSaverTimeout;
 
@@ -53,11 +54,14 @@ private:
 // FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ?
 //(KDE: doesn't inhibit screensaver, but does inhibit 
PowerManagement)
 // GSM: org.gnome.SessionManager::Inhibit - gnome 3
+// MSM: org.mate.Sessionmanager::Inhibit - Mate <= 1.10, is identical to 
GSM
+//   (This is replaced by the GSM interface from Mate 1.12 onwards)
 //
 // Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs 
GSM (Uninhibit)
 void inhibitFDO( bool bInhibit, const gchar* appname, const gchar* reason 
);
 void inhibitFDOPM( bool bInhibit, const gchar* appname, const gchar* 
reason );
 void inhibitGSM( bool bInhibit, const gchar* appname, const gchar* reason, 
const guint xid );
+void inhibitMSM( bool bInhibit, const gchar* appname, const gchar* reason, 
const guint xid );
 
 void inhibitXScreenSaver( bool bInhibit, Display* pDisplay );
 static void inhibitXAutoLock( bool bInhibit, Display* pDisplay );
diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx 
b/vcl/unx/generic/window/screensaverinhibitor.cxx
index e26b17d..5346ac4 100644
--- a/vcl/unx/generic/window/screensaverinhibitor.cxx
+++ b/vcl/unx/generic/window/screensaverinhibitor.cxx
@@ -29,6 +29,11 @@
 #define GSM_DBUS_SERVICE"org.gnome.SessionManager"
 #define GSM_DBUS_PATH   "/org/gnome/SessionManager"
 #define GSM_DBUS_INTERFACE  "org.gnome.SessionManager"
+
+// Mate <= 1.10 uses org.mate.SessionManager, > 1.10 will use 
org.gnome.SessionManager
+#define MSM_DBUS_SERVICE"org.mate.SessionManager"
+#define MSM_DBUS_PATH   "/org/mate/SessionManager"
+#define MSM_DBUS_INTERFACE  "org.mate.SessionManager"
 #endif
 
 #include 
@@ -54,6 +59,7 @@ void ScreenSaverInhibitor::inhibit( bool bInhibit, const 
OUString& sReason,
 if ( xid != boost::none )
 {
 inhibitGSM( bInhibit, appname, aReason.getStr(), xid.get() );
+inhibitMSM( bInhibit, appname, aReason.getStr(), xid.get() );
 }
 }
 }
@@ -198,6 +204,31 @@ void ScreenSaverInhibitor::inhibitGSM( bool bInhibit, 
const gchar* appname, cons
  mnGSMCookie );
 }
 
+void ScreenSaverInhibitor::inhibitMSM( bool bInhibit, const gchar* appname, 
const gchar* reason, const guint xid )
+{
+dbusInhibit( bInhibit,
+ MSM_DBUS_SERVICE, MSM_DBUS_PATH, MSM_DBUS_INTERFACE,
+ [appname, reason, xid] ( DBusGProxy *proxy, guint& nCookie, 
GError*& error ) -> bool {
+ return dbus_g_proxy_call( proxy,
+   "Inhibit", ,
+   G_TYPE_STRING, appname,
+   G_TYPE_UINT, xid,
+   G_TYPE_STRING, reason,
+   G_TYPE_UINT, 8, //Inhibit the 
session being marked as idle
+   G_TYPE_INVALID,
+   G_TYPE_UINT, ,
+   G_TYPE_INVALID );
+ },
+ [] ( DBusGProxy *proxy, const guint nCookie, GError*& error ) 
-> bool {
+ return dbus_g_proxy_call( proxy,
+   "Uninhibit", ,
+   G_TYPE_UINT, nCookie,
+   G_TYPE_INVALID,
+   G_TYPE_INVALID );
+ },
+ mnMSMCookie );
+}
+
 /**
  * Disable screensavers using the XSetScreenSaver/XGetScreenSaver API.
  *
commit 9be320262f87f0e9e08e7d91835bee592f3cc81c
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Oct 20 16:36:33 2015 +0200

Add support for org.freedesktop.PowerManagement.Inhibit too

Th

[Libreoffice-commits] core.git: 9 commits - vcl/inc vcl/Library_vcl.mk vcl/unx

2015-10-20 Thread Andrzej Hunt
 vcl/Library_vcl.mk  |8 
 vcl/inc/unx/gtk/gtkframe.hxx|5 
 vcl/inc/unx/salframe.h  |3 
 vcl/inc/unx/screensaverinhibitor.hxx|   73 +
 vcl/unx/generic/window/salframe.cxx |  180 -
 vcl/unx/generic/window/screensaverinhibitor.cxx |  332 
 vcl/unx/gtk/window/gtksalframe.cxx  |  195 --
 7 files changed, 440 insertions(+), 356 deletions(-)

New commits:
commit 68570131013cfcf29f4c934a727053c2903e35b1
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Oct 20 17:24:44 2015 +0200

Add org.mate.SessionManager support

This is valid for Mate <= 1.10
(As of writing, 1.10 is the current stable release - so we'll have
 to keep shipping this for quite a few years to come.)

Change-Id: I4d1f81c50923148e710eac22f5428b2a1c41f0e9

diff --git a/vcl/inc/unx/screensaverinhibitor.hxx 
b/vcl/inc/unx/screensaverinhibitor.hxx
index f00e61f..286c18d 100644
--- a/vcl/inc/unx/screensaverinhibitor.hxx
+++ b/vcl/inc/unx/screensaverinhibitor.hxx
@@ -33,6 +33,7 @@ private:
 boost::optional mnFDOCookie; // FDO ScreenSaver Inhibit
 boost::optional mnFDOPMCookie; // FDO PowerManagement Inhibit
 boost::optional mnGSMCookie;
+boost::optional mnMSMCookie;
 
 boost::optional mnXScreenSaverTimeout;
 
@@ -53,11 +54,14 @@ private:
 // FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ?
 //(KDE: doesn't inhibit screensaver, but does inhibit 
PowerManagement)
 // GSM: org.gnome.SessionManager::Inhibit - gnome 3
+// MSM: org.mate.Sessionmanager::Inhibit - Mate <= 1.10, is identical to 
GSM
+//   (This is replaced by the GSM interface from Mate 1.12 onwards)
 //
 // Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs 
GSM (Uninhibit)
 void inhibitFDO( bool bInhibit, const gchar* appname, const gchar* reason 
);
 void inhibitFDOPM( bool bInhibit, const gchar* appname, const gchar* 
reason );
 void inhibitGSM( bool bInhibit, const gchar* appname, const gchar* reason, 
const guint xid );
+void inhibitMSM( bool bInhibit, const gchar* appname, const gchar* reason, 
const guint xid );
 
 void inhibitXScreenSaver( bool bInhibit, Display* pDisplay );
 static void inhibitXAutoLock( bool bInhibit, Display* pDisplay );
diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx 
b/vcl/unx/generic/window/screensaverinhibitor.cxx
index e26b17d..5346ac4 100644
--- a/vcl/unx/generic/window/screensaverinhibitor.cxx
+++ b/vcl/unx/generic/window/screensaverinhibitor.cxx
@@ -29,6 +29,11 @@
 #define GSM_DBUS_SERVICE"org.gnome.SessionManager"
 #define GSM_DBUS_PATH   "/org/gnome/SessionManager"
 #define GSM_DBUS_INTERFACE  "org.gnome.SessionManager"
+
+// Mate <= 1.10 uses org.mate.SessionManager, > 1.10 will use 
org.gnome.SessionManager
+#define MSM_DBUS_SERVICE"org.mate.SessionManager"
+#define MSM_DBUS_PATH   "/org/mate/SessionManager"
+#define MSM_DBUS_INTERFACE  "org.mate.SessionManager"
 #endif
 
 #include 
@@ -54,6 +59,7 @@ void ScreenSaverInhibitor::inhibit( bool bInhibit, const 
OUString& sReason,
 if ( xid != boost::none )
 {
 inhibitGSM( bInhibit, appname, aReason.getStr(), xid.get() );
+inhibitMSM( bInhibit, appname, aReason.getStr(), xid.get() );
 }
 }
 }
@@ -198,6 +204,31 @@ void ScreenSaverInhibitor::inhibitGSM( bool bInhibit, 
const gchar* appname, cons
  mnGSMCookie );
 }
 
+void ScreenSaverInhibitor::inhibitMSM( bool bInhibit, const gchar* appname, 
const gchar* reason, const guint xid )
+{
+dbusInhibit( bInhibit,
+ MSM_DBUS_SERVICE, MSM_DBUS_PATH, MSM_DBUS_INTERFACE,
+ [appname, reason, xid] ( DBusGProxy *proxy, guint& nCookie, 
GError*& error ) -> bool {
+ return dbus_g_proxy_call( proxy,
+   "Inhibit", ,
+   G_TYPE_STRING, appname,
+   G_TYPE_UINT, xid,
+   G_TYPE_STRING, reason,
+   G_TYPE_UINT, 8, //Inhibit the 
session being marked as idle
+   G_TYPE_INVALID,
+   G_TYPE_UINT, ,
+   G_TYPE_INVALID );
+ },
+ [] ( DBusGProxy *proxy, const guint nCookie, GError*& error ) 
-> bool {
+ return dbus_g_proxy_call( proxy,
+   "Uninhibit", ,
+   G_TYPE_UINT, nCookie,
+ 

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

2015-10-20 Thread Andrzej Hunt
 vcl/inc/unx/screensaverinhibitor.hxx |   23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 00a78f6102bf17b8f723467be4d1e8eac05962a5
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Oct 20 22:04:46 2015 +0200

ScreenSaverInhibitor: Don't depend on glib type definitions

We also include this header from the kde and tde backends,
it seems to be saner just to use the base definitions of these
types rather than depending on glib there.

Change-Id: Ib270fd33290f9c213dea72a8e20618007470d882

diff --git a/vcl/inc/unx/screensaverinhibitor.hxx 
b/vcl/inc/unx/screensaverinhibitor.hxx
index 286c18d..7b5af6d 100644
--- a/vcl/inc/unx/screensaverinhibitor.hxx
+++ b/vcl/inc/unx/screensaverinhibitor.hxx
@@ -21,19 +21,20 @@
 
 #include 
 
-#include 
-
 class VCL_PLUGIN_PUBLIC ScreenSaverInhibitor
 {
 public:
 void inhibit( bool bInhibit, const rtl::OUString& sReason,
-  bool bIsX11, const boost::optional xid, 
boost::optional<Display*> pDisplay );
+  bool bIsX11, const boost::optional xid, 
boost::optional<Display*> pDisplay );
 
 private:
-boost::optional mnFDOCookie; // FDO ScreenSaver Inhibit
-boost::optional mnFDOPMCookie; // FDO PowerManagement Inhibit
-boost::optional mnGSMCookie;
-boost::optional mnMSMCookie;
+// These are all used as guint, however this header may be included
+// in kde/tde/etc backends, where we would ideally avoid having
+// any glib dependencies, hence the direct use of unsigned int.
+boost::optional mnFDOCookie; // FDO ScreenSaver Inhibit
+boost::optional mnFDOPMCookie; // FDO PowerManagement Inhibit
+boost::optional mnGSMCookie;
+boost::optional mnMSMCookie;
 
 boost::optional mnXScreenSaverTimeout;
 
@@ -58,10 +59,10 @@ private:
 //   (This is replaced by the GSM interface from Mate 1.12 onwards)
 //
 // Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs 
GSM (Uninhibit)
-void inhibitFDO( bool bInhibit, const gchar* appname, const gchar* reason 
);
-void inhibitFDOPM( bool bInhibit, const gchar* appname, const gchar* 
reason );
-void inhibitGSM( bool bInhibit, const gchar* appname, const gchar* reason, 
const guint xid );
-void inhibitMSM( bool bInhibit, const gchar* appname, const gchar* reason, 
const guint xid );
+void inhibitFDO( bool bInhibit, const char* appname, const char* reason );
+void inhibitFDOPM( bool bInhibit, const char* appname, const char* reason 
);
+void inhibitGSM( bool bInhibit, const char* appname, const char* reason, 
const unsigned int xid );
+void inhibitMSM( bool bInhibit, const char* appname, const char* reason, 
const unsigned int xid );
 
 void inhibitXScreenSaver( bool bInhibit, Display* pDisplay );
 static void inhibitXAutoLock( bool bInhibit, Display* pDisplay );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'feature/screensaverinhibit-update'

2015-10-19 Thread Andrzej Hunt
New branch 'feature/screensaverinhibit-update' available with the following 
commits:
commit 704446d3ace0cfd20c7f44d2b86f180fa3f83fcd
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Oct 19 18:03:37 2015 +0200

Lambda'ise the almost identical FDO and GSM screensaver inhibition

This doesn't save us much for now, but could be useful when yet another
screensaver inhibition standard is introduced. (The GSM/gnome inhibition
currently requires passing the X11 window handle/id, which suggests that
at some point they will have to update their screensaver inhibition api.)

Change-Id: I4fa7bc15f089d112777fb166ab469045c002ae48

commit 50426cb43445d5872c587f019e3551efef36e017
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Oct 19 17:50:24 2015 +0200

Add comment on gsm vs fdo differences

Change-Id: I30d1c24e84f1b28fad9933407b362be886821864

commit ec12a76609a7472ca231e4fd6400082ad2bd58ce
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Oct 19 17:04:13 2015 +0200

Move org.gnome.SessionManager.Inhibit to ScreenSaverInhibitor

We should be using the same inhibition code irregardless of
vcl backend on Linux.

Change-Id: I996630666e32c40a52958edb248466c815a5e0e5

commit 862556b6efa8a6510827656273c57d4836a0f6a2
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Oct 19 17:01:02 2015 +0200

Implement org.freedesktop.ScreenSaver inhibition

This is required for screensaver inhibition on kde (this might
also be supported on further desktops).

It would appear to make sense to move all screensaver inhibiting
code here into one location, since it should be shared across
the generic unx, and gtk vcl backends - currently we have completely
independent implementations for gtk/gtk3 (which only supports
XSetScreenSaver, and gnome's dbus inhibition), and the generic backend
for all other plugins, which supports XSetScreenSaver, xautolock, DPMS,
but no dbus inhibition.

Change-Id: I9c5af8021b0b49b5c93ed75a7d25e3208d5e9629

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


[Libreoffice-commits] core.git: Branch 'feature/screensaverinhibit-update' - vcl/inc vcl/unx

2015-10-19 Thread Andrzej Hunt
 vcl/inc/unx/gtk/gtkframe.hxx|1 
 vcl/inc/unx/screensaverinhibitor.hxx|9 ++
 vcl/unx/generic/window/salframe.cxx |   76 
 vcl/unx/generic/window/screensaverinhibitor.cxx |   44 -
 vcl/unx/gtk/window/gtksalframe.cxx  |   39 +++-
 5 files changed, 61 insertions(+), 108 deletions(-)

New commits:
commit daa61470c6726b723c9aec11bf0334c80163cc70
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Oct 19 20:11:53 2015 +0200

Deduplicate XAutoLock inhibition and move to ScreenSaverInhibitor

(Successfully tested with xautolock 2.2)

Change-Id: I55a3703322dd6792689ff3c3e85b27840ee2bc55

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 8f6d60e..4552684 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -263,7 +263,6 @@ class GtkSalFrame : public SalFrame, public 
X11WindowProvider
 
 voidCenter();
 voidSetDefaultSize();
-voidsetAutoLock( bool bLock );
 
 voiddoKeyCallback( guint state,
guint keyval,
diff --git a/vcl/inc/unx/screensaverinhibitor.hxx 
b/vcl/inc/unx/screensaverinhibitor.hxx
index b1c742f..b95f7df 100644
--- a/vcl/inc/unx/screensaverinhibitor.hxx
+++ b/vcl/inc/unx/screensaverinhibitor.hxx
@@ -10,6 +10,10 @@
 #ifndef INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
 #define INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -20,7 +24,8 @@
 class VCL_PLUGIN_PUBLIC ScreenSaverInhibitor
 {
 public:
-void inhibit( bool bInhibit, const rtl::OUString& sReason, bool bIsX11, 
const boost::optional xid );
+void inhibit( bool bInhibit, const rtl::OUString& sReason,
+  bool bIsX11, const boost::optional xid, 
boost::optional<Display*> pDisplay );
 
 private:
 boost::optional mnFDOCookie;
@@ -29,6 +34,8 @@ private:
 // Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs 
GSM (Uninhibit)
 void inhibitFDO( bool bInhibit, const gchar* appname, const gchar* reason 
);
 void inhibitGSM( bool bInhibit, const gchar* appname, const gchar* reason, 
const guint xid );
+
+static void inhibitXAutoLock( bool bInhibit, Display* pDisplay );
 };
 
 #endif // INCLUDED_VCL_INC_UNX_SCREENSAVERINHIBITOR_HXX
diff --git a/vcl/unx/generic/window/salframe.cxx 
b/vcl/unx/generic/window/salframe.cxx
index cf8420f..a0c7b00 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -2189,87 +2189,15 @@ void X11SalFrame::ShowFullScreen( bool bFullScreen, 
sal_Int32 nScreen )
 }
 }
 
-/* -
-   the xautolock pseudo screen saver needs special treatment since it
-   doesn't cooperate with XxxxScreenSaver settings
-   --- */
-
-static Bool
-IsRunningXAutoLock( Display *p_display, ::Window a_window )
-{
-const char *p_atomname = "XAUTOLOCK_SEMAPHORE_PID";
-Atoma_pidatom;
-
-// xautolock interns this atom
-a_pidatom= XInternAtom( p_display, p_atomname, True );
-if ( a_pidatom == None )
-return False;
-
-Atom  a_type;
-int   n_format;
-unsigned long n_items;
-unsigned long n_bytes_after;
-pid_t*p_pid;
-pid_t n_pid;
-// get pid of running xautolock
-XGetWindowProperty (p_display, a_window, a_pidatom, 0L, 2L, False,
-AnyPropertyType, _type, _format, _items, _bytes_after,
-reinterpret_cast(_pid) );
-n_pid = *p_pid;
-XFree( p_pid );
-
-  if ( a_type == XA_INTEGER )
-  {
-// check if xautolock pid points to a running process
-if ( kill(n_pid, 0) == -1 )
-return False;
-else
-return True;
-}
-
-return False;
-}
-
-/* definitions from xautolock.c (pl15) */
-#define XAUTOLOCK_DISABLE 1
-#define XAUTOLOCK_ENABLE  2
-
-static Bool
-MessageToXAutoLock( Display *p_display, int n_message )
-{
-const char *p_atomname = "XAUTOLOCK_MESSAGE" ;
-Atoma_messageatom;
-::Windowa_rootwindow;
-
-a_rootwindow = RootWindowOfScreen( ScreenOfDisplay(p_display, 0) );
-if ( ! IsRunningXAutoLock(p_display, a_rootwindow) )
-{
-// remove any pending messages
-a_messageatom = XInternAtom( p_display, p_atomname, True );
-if ( a_messageatom != None )
-XDeleteProperty( p_display, a_rootwindow, a_messageatom );
-return False;
-}
-
-a_messageatom = XInternAtom( p_display, p_atomname, False );
-XChangeProperty (p_display, a_rootwindow, a_messageatom, XA_INTEGER,
-8, PropModeReplace, reinterpret_cast(_message), 
sizeof(n_message) );
-
-return True;
-}
-
 void X11

[Libreoffice-commits] core.git: Branch 'feature/screensaverinhibit-update' - 5 commits - vcl/inc vcl/unx

2015-10-19 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit de9436a4a1f7a3a7c83bfe30f29bbcbd03110847
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Mon Oct 19 21:50:39 2015 +0200

Deduplicate XGet/SetScreenSaver, move to ScreenSaverInhibitor

I haven't been able to find anyone actually using this API,
however it's probably best not to remove it either?

Change-Id: I0ca11591bfd54f9882d8081a94b012f638936ce5

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 8a8dda4..cde7bb8 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -192,7 +192,6 @@ class GtkSalFrame : public SalFrame, public 
X11WindowProvider
 GdkCursor  *m_pCurrentCursor;
 GdkVisibilityState  m_nVisibility;
 PointerStylem_ePointerStyle;
-int m_nSavedScreenSaverTimeout;
 ScreenSaverInhibitorm_ScreenSaverInhibitor;
 int m_nWorkArea;
 boolm_bFullscreen;
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index 82b8879..ff97a9a 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -100,7 +100,6 @@ class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame, 
public X11WindowProvider
 int m_nWorkArea;
 boolm_bSetFocusOnMap;
 
-int nScreenSaversTimeout_;
 ScreenSaverInhibitor maScreenSaverInhibitor;
 Rectangle   maPaintRegion;
 
diff --git a/vcl/inc/unx/screensaverinhibitor.hxx 
b/vcl/inc/unx/screensaverinhibitor.hxx
index 56d1849..8c9ad54 100644
--- a/vcl/inc/unx/screensaverinhibitor.hxx
+++ b/vcl/inc/unx/screensaverinhibitor.hxx
@@ -30,10 +30,13 @@ private:
 boost::optional mnFDOCookie;
 boost::optional mnGSMCookie;
 
+boost::optional mnXScreenSaverTimeout;
+
 // Note: the Uninhibit call has different spelling in FDO (UnInhibit) vs 
GSM (Uninhibit)
 void inhibitFDO( bool bInhibit, const gchar* appname, const gchar* reason 
);
 void inhibitGSM( bool bInhibit, const gchar* appname, const gchar* reason, 
const guint xid );
 
+void inhibitXScreenSaver( bool bInhibit, Display* pDisplay );
 static void inhibitXAutoLock( bool bInhibit, Display* pDisplay );
 };
 
diff --git a/vcl/unx/generic/window/salframe.cxx 
b/vcl/unx/generic/window/salframe.cxx
index a0c7b00..b8aca70 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -803,7 +803,6 @@ X11SalFrame::X11SalFrame( SalFrame *pParent, 
SalFrameStyleFlags nSalFrameStyle,
 mbInShow= false;
 m_bXEmbed   = false;
 
-nScreenSaversTimeout_   = 0;
 
 mpInputContext  = NULL;
 mbInputFocus= False;
@@ -2219,7 +2218,7 @@ void X11SalFrame::StartPresentation( bool bStart )
 static CARD16 dpms_suspend_timeout=0;
 static CARD16 dpms_off_timeout=0;
 
-if( bStart || nScreenSaversTimeout_ || DPMSEnabled)
+if( bStart  || DPMSEnabled)
 {
 if( hPresentationWindow )
 {
@@ -2229,12 +2228,6 @@ void X11SalFrame::StartPresentation( bool bStart )
 int revert_to = 0;
 XGetInputFocus( GetXDisplay(), , _to );
 }
-int timeout, interval, prefer_blanking, allow_exposures;
-XGetScreenSaver( GetXDisplay(),
- ,
- ,
- _blanking,
- _exposures );
 
 // get the DPMS state right before the start
 if (DPMSExtensionAvailable)
@@ -2248,16 +2241,6 @@ void X11SalFrame::StartPresentation( bool bStart )
 }
 if( bStart ) // start show
 {
-if ( timeout )
-{
-nScreenSaversTimeout_ = timeout;
-XResetScreenSaver( GetXDisplay() );
-XSetScreenSaver( GetXDisplay(),
- 0,
- interval,
- prefer_blanking,
- allow_exposures );
-}
 #if !defined(SOLARIS) && !defined(AIX)
 if( DPMSEnabled )
 {
@@ -2274,15 +2257,6 @@ void X11SalFrame::StartPresentation( bool bStart )
 }
 else
 {
-if( nScreenSaversTimeout_ )
-{
-XSetScreenSaver( GetXDisplay(),
- nScreenSaversTimeout_,
- interval,
- prefer_blanking,
- allow_exposures );
-nScreenSaversTimeout_ = 0;
-}
 #if !defined(SOLARIS) && !defined(AIX)
 if ( DPMSEnabled )
 {
diff --git a/vcl/unx/generic/window/screensaverinhibitor.cxx 
b/vcl/unx/generic/window/screensaverinhibitor.cxx
index 0636b06..4add4bd 100644
--- a/vcl/unx/generic/window/screensaverinhib

[Libreoffice-commits] core.git: Changes to 'feature/inhibit-screensaver'

2015-10-18 Thread Andrzej Hunt
New branch 'feature/inhibit-screensaver' available with the following commits:
commit e2cf997829762274741d91d7a96b3b8349fff5b0
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Sun Oct 18 11:40:46 2015 +0200

Implement slideshow screensaver inhibition (on Windows)

Unfortunately we'll need a bunch of different implementations
for every single platform.

Change-Id: I4d3e6f0cc03ddc3f2334b29fc4f243d45d156fa5

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


Re: Should we make it harder to assign a bug to yourself?

2015-10-04 Thread Andrzej Hunt

On 04/10/15 09:36, Tor Lillqvist wrote:

I have recently noticed a rush of what looks like newbies assigning bugs
to themselves. (Those bugs that have their status changes sent to this
list.)

Doesn't experience show that in a large number of cases, this is wishful
thinking, and once they realise how hard it is, many of them will just
drop it and forget to assign back, so the bug stays assigned even if
nobody actually is working on it? That then might prevent somebody else
(who might me more skilled/motivated/lucky) from working on it.

>
> Should we make it harder to assign a bug to yourself?

FWIW Mozilla already block bug assignment privileges for new accounts - 
it doesn't seem like this has caused them any huge problems, so I think 
copying their approach would probably be a good idea.


New Mozilla contributors are still able to ask to have a bug assigned to 
them via the bug's comments, and usually this is only done after at 
least a preliminary patch has been submitted. To request bug editing 
(and assignment) permissions requires you to have submitted at least 2 
patches, or to have found 3 bugs requiring editing [1] - triaging 
permissions can be requested without any such requirements though.


This won't completely eliminate the problem (I'm guessing some people 
might give up after they've already uploaded a first, potentially 
broken, patch) - but it could help reduce the number of abandoned bugs 
somewhat.


Cheers,
Andrzej


[1] https://bugzilla.mozilla.org/page.cgi?id=get_permissions.html
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: Branch 'feature/unitver' - sc/uiconfig

2015-09-22 Thread Andrzej Hunt
 sc/uiconfig/scalc/ui/unitsconversiondialog.ui |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 0f80cdaaa72f7657f7212af2d99c20d22d54769e
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Sep 22 19:10:38 2015 +0200

Set default focus on output unit entry box

This allows the user to immediately enter their desired unit -
the input area selection is likely to be used only rarely.

Change-Id: I08de7718ed183db21513d1f46f346da27c3ebbf7

diff --git a/sc/uiconfig/scalc/ui/unitsconversiondialog.ui 
b/sc/uiconfig/scalc/ui/unitsconversiondialog.ui
index 3549282..f7ed3fe 100644
--- a/sc/uiconfig/scalc/ui/unitsconversiondialog.ui
+++ b/sc/uiconfig/scalc/ui/unitsconversiondialog.ui
@@ -243,7 +243,8 @@
 True
 
   
-False
+True
+True
   
 
   
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 2152 commits - accessibility/inc accessibility/source android/Bootstrap android/source avmedia/inc avmedia/source basctl/inc basctl/source ba

2015-09-22 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit c322176e067d97e47138949d3df3e0c1e721a658
Author: Andrzej Hunt <andr...@ahunt.org>
Date:   Tue Sep 22 14:02:33 2015 +0200

unit-verification: convert Link<> to typed

(fix build after rebasing on master)

Change-Id: Iecbdbf5a854de0b552f6c9074e72da3fa47d91a4

diff --git a/sc/source/ui/inc/unitsconversiondlg.hxx 
b/sc/source/ui/inc/unitsconversiondlg.hxx
index 01116d2..cda8f83 100644
--- a/sc/source/ui/inc/unitsconversiondlg.hxx
+++ b/sc/source/ui/inc/unitsconversiondlg.hxx
@@ -84,7 +84,7 @@ private:
 bool CheckUnitsAreConvertible();
 void PerformConversion();
 
-DECL_LINK( OkClicked,   PushButton* );
+DECL_LINK_TYPED( OkClicked, Button*, void );
 DECL_LINK( GetFocusHandler, Control* );
 DECL_LINK( LoseFocusHandler,void* );
 DECL_LINK( OutputUnitsModified, void* );
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 3377965..8bcbd27 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -371,14 +371,14 @@ private:
 voidNotifyUnitErrorInFormula( const ScAddress& rAddress,
   ScDocument* pDoc,
   const sc::units::FormulaStatus& 
rStatus);
-DECL_LINK( EditUnitErrorFormulaHandler, PushButton* );
+DECL_LINK_TYPED( EditUnitErrorFormulaHandler, Button*, void);
 
 voidNotifyUnitConversionRecommended( const ScAddress& 
rCellAddress,
  ScDocument* pDoc,
  const OUString& 
sHeaderUnit,
  const ScAddress& 
rHeaderAddress,
  const OUString& sCellUnit 
);
-DECL_LINK( UnitConversionRecommendedHandler, UnitConversionPushButton* );
+DECL_LINK_TYPED( UnitConversionRecommendedHandler, Button*, void);
 };
 
 #endif
diff --git a/sc/source/ui/miscdlgs/unitsconversiondlg.cxx 
b/sc/source/ui/miscdlgs/unitsconversiondlg.cxx
index a3a6744..cea5405 100644
--- a/sc/source/ui/miscdlgs/unitsconversiondlg.cxx
+++ b/sc/source/ui/miscdlgs/unitsconversiondlg.cxx
@@ -192,26 +192,25 @@ bool ScUnitsConversionDialog::CheckUnitsAreConvertible()
 return bCompatibleInputFound;
 }
 
-IMPL_LINK( ScUnitsConversionDialog, OkClicked, PushButton*, /*pButton*/ )
+IMPL_LINK_TYPED( ScUnitsConversionDialog, OkClicked, Button*, /*pButton*/, 
void )
 {
 if (!CheckUnitsAreConvertible())
 {
 // As we have now clicked on this button, the output units entry
 // box has lost focus, so the "no conversion possible" warning
 // will already be shown by the OutputUnitsComplete handler.
-return 0;
+return;
 }
 
 PerformConversion();
 Close();
-return 0;
 }
 
 IMPL_LINK( ScUnitsConversionDialog, GetFocusHandler, Control*, pCtrl )
 {
 Edit* pEdit = NULL;
 
-if( (pCtrl == (Control*) mpInputRangeEdit) || (pCtrl == (Control*) 
mpInputRangeButton) ) {
+if( (pCtrl == mpInputRangeEdit.get()) || (pCtrl == 
mpInputRangeButton.get()) ) {
 pEdit = mpInputRangeEdit;
 }
 
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index d1ce472..d3db634 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2897,9 +2897,8 @@ void ScViewFunc::NotifyUnitErrorInFormula( const 
ScAddress& rAddress, ScDocument
 pInfoBar->addButton( pButtonGotoCell);
 }
 
-IMPL_LINK( ScViewFunc, EditUnitErrorFormulaHandler, PushButton*, pButton )
+IMPL_LINK_TYPED( ScViewFunc, EditUnitErrorFormulaHandler, Button*, pButton, 
void )
 {
-
 OUString sAddress;
 {
 // keep pInfoBar within this scope only as we'll be deleting it just 
below (using RemoveInfoBar)
@@ -2920,8 +2919,6 @@ IMPL_LINK( ScViewFunc, EditUnitErrorFormulaHandler, 
PushButton*, pButton )
 // UI making it a bit easier to see where the data is coming from).
 ScModule* pScMod = SC_MOD();
 pScMod->SetInputMode( SC_INPUT_TABLE );
-
-return 0;
 }
 
 /*
@@ -2995,14 +2992,20 @@ void ScViewFunc::NotifyUnitConversionRecommended( const 
ScAddress& rCellAddress,
 pInfoBar->addButton( pButtonConvertCell );
 }
 
-IMPL_LINK( ScViewFunc, UnitConversionRecommendedHandler, 
UnitConversionPushButton*, pButton )
+IMPL_LINK_TYPED( ScViewFunc, UnitConversionRecommendedHandler, Button*, 
pButton, void )
 {
 // Do conversion first, and only then remove the infobar as we need data 
from the infobar
 // (specifically from the pushbutton) to do the conversion.
 #ifdef ENABLE_CALC_UNITVERIFICATION
+
+// We can't pass in a UnitConversionPushButton* as this would require 
template-parameter downcasting
+// (which is illegal) when setting pButtonConvertCell->SetClick

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

2015-08-25 Thread Andrzej Hunt
 sc/source/ui/condformat/condformatdlg.cxx |   34 +++---
 sc/source/ui/inc/condformatdlg.hxx|3 ++
 2 files changed, 30 insertions(+), 7 deletions(-)

New commits:
commit 14323c74935337775c05975f907a78bd692e8d44
Author: Andrzej Hunt andr...@ahunt.org
Date:   Thu May 14 16:50:46 2015 +0100

Update title of Conditional Format dialog when range modified

Previously the title was set during construction as e.g.
Conditional Format: A2:B245

However the selected range can be modified while the dialog is open,
hence we update it whenever the selected range is modified.

Change-Id: I63790108553102cedb51ca32d672a62477493660
Reviewed-on: https://gerrit.libreoffice.org/15711
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com

diff --git a/sc/source/ui/condformat/condformatdlg.cxx 
b/sc/source/ui/condformat/condformatdlg.cxx
index fec9373..059aaf9 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -450,13 +450,6 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, 
SfxChildWindow* pCW,
 get(mpCondFormList, list);
 mpCondFormList-init(mpViewData-GetDocument(), this, pFormat, rRange, 
rPos, eType);
 
-OUStringBuffer aTitle( GetText() );
-aTitle.append( );
-OUString aRangeString;
-rRange.Format(aRangeString, SCA_VALID, pViewData-GetDocument(),
-pViewData-GetDocument()-GetAddressConvention());
-aTitle.append(aRangeString);
-SetText(aTitle.makeStringAndClear());
 mpBtnOk-SetClickHdl(LINK(this, ScCondFormatDlg, BtnPressedHdl ) );
 mpBtnAdd-SetClickHdl( LINK( mpCondFormList, ScCondFormatList, AddBtnHdl ) 
);
 mpBtnRemove-SetClickHdl( LINK( mpCondFormList, ScCondFormatList, 
RemoveBtnHdl ) );
@@ -464,7 +457,20 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, 
SfxChildWindow* pCW,
 mpEdRange-SetModifyHdl( LINK( this, ScCondFormatDlg, EdRangeModifyHdl ) );
 mpEdRange-SetGetFocusHdl( LINK( this, ScCondFormatDlg, RangeGetFocusHdl ) 
);
 
+OUString aRangeString;
+rRange.Format(aRangeString, SCA_VALID, pViewData-GetDocument(),
+pViewData-GetDocument()-GetAddressConvention());
 mpEdRange-SetText(aRangeString);
+
+msBaseTitle = GetText();
+updateTitle();
+}
+
+void ScCondFormatDlg::updateTitle()
+{
+OUString aTitle = msBaseTitle +   + mpEdRange-GetText();
+
+SetText(aTitle);
 }
 
 ScCondFormatDlg::~ScCondFormatDlg()
@@ -500,6 +506,17 @@ void ScCondFormatDlg::SetActive()
 void ScCondFormatDlg::RefInputDone( bool bForced )
 {
 ScAnyRefDlg::RefInputDone(bForced);
+
+// ScAnyRefModalDlg::RefInputDone resets the title back
+// to it's original state.
+// I.e. if we open the dialog normally, and then click into the sheet
+// to modify the selection, the title is updated such that the range
+// is only a single cell (e.g. $A$1), after which the dialog switches
+// into the RefInput mode. During the RefInput mode the title is updated
+// as expected, however at the end RefInputDone overwrites the title
+// with the initial (now incorrect) single cell range. Hence we correct
+// it here.
+updateTitle();
 }
 
 bool ScCondFormatDlg::IsTableLocked() const
@@ -541,6 +558,7 @@ void ScCondFormatDlg::SetReference(const ScRange rRef, 
ScDocument*)
 OUString aRefStr(rRef.Format(n, mpViewData-GetDocument(),
 
ScAddress::Details(mpViewData-GetDocument()-GetAddressConvention(), 0, 0)));
 pEdit-SetRefString( aRefStr );
+updateTitle();
 }
 }
 
@@ -766,6 +784,8 @@ IMPL_LINK( ScCondFormatDlg, EdRangeModifyHdl, Edit*, pEdit )
 
pEdit-SetControlBackground(GetSettings().GetStyleSettings().GetWindowColor());
 else
 pEdit-SetControlBackground(COL_LIGHTRED);
+
+updateTitle();
 return 0;
 }
 
diff --git a/sc/source/ui/inc/condformatdlg.hxx 
b/sc/source/ui/inc/condformatdlg.hxx
index 1438510..531b8c1 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -116,6 +116,9 @@ private:
 
 VclPtrformula::RefEdit mpLastEdit;
 
+OUString msBaseTitle;
+void updateTitle();
+
 DECL_LINK( EdRangeModifyHdl, Edit* );
 protected:
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 3705 commits - accessibility/inc accessibility/source android/Bootstrap android/source animations/source avmedia/Library_avmediavlc.mk avmedi

2015-08-08 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit 8ce00654d39c6971cb57eb742547c3799bddef08
Author: Andrzej Hunt andr...@ahunt.org
Date:   Fri Aug 7 08:25:48 2015 +0100

Implement undoing conversion of individual locally annotated cells

Change-Id: I16b62f1105f7839b047a96fdab0e3e6089d400ee

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index ede086a..318c5bb 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1008,7 +1008,10 @@
 #define STR_UNITS_CONVERSION_RECOMMENDED (STR_START + 455)
 #define BT_UNITS_CONVERT_THIS_CELL  (STR_START + 456)
 #define BT_UNITS_CONV_ALL   (STR_START + 457)
-#define STR_END (BT_UNITS_CONV_ALL)
+
+#define STR_UNDO_UNITSCONVERSION (STR_START + 458)
+
+#define STR_END (STR_UNDO_UNITSCONVERSION)
 
 #define BMP_START   (STR_END)
 
diff --git a/sc/source/ui/src/units.src b/sc/source/ui/src/units.src
index d666923..bc9a315 100644
--- a/sc/source/ui/src/units.src
+++ b/sc/source/ui/src/units.src
@@ -55,4 +55,9 @@ PushButton BT_UNITS_CONV_ALL
 Text [ en-US ] = Convert (automatically for all cells needing $2) ;
 };
 
+String STR_UNDO_UNITSCONVERSION
+{
+Text [ en-US ] = Units conversion;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index a8386c5..45b85bb 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2982,8 +2982,7 @@ void ScViewFunc::NotifyUnitConversionRecommended( const 
ScAddress rCellAddress,

  rCellAddress,

  pDoc,

  rsHeaderUnit,
-   
  rsCellUnit,
-   
  pDocSh );
+   
  rsCellUnit );
 pButtonConvertCell-SetClickHdl( LINK( this, ScViewFunc, 
UnitConversionRecommendedHandler ) );
 
 OUString sConvertText = pButtonConvertCell-GetText();
@@ -3000,32 +2999,108 @@ IMPL_LINK( ScViewFunc, 
UnitConversionRecommendedHandler, UnitConversionPushButto
 #ifdef ENABLE_CALC_UNITVERIFICATION
 boost::shared_ptr Units  pUnits = Units::GetUnits();
 
-ScDocShell* pDocShell = 
static_castScDocShell*(pButton-mpDoc-GetDocumentShell());
+ScDocument* pDoc = pButton-mpDoc;
+ScDocShell* pDocShell = static_castScDocShell*(pDoc-GetDocumentShell());
 
 ScDocShellModificator aModificator( *pDocShell );
+bool bUndo = pDoc-IsUndoEnabled();
+ScCellValue aOldVal;
+ScDocument* pUndoDoc;
+ScMarkData aMark;
 
-OUString sOriginalValue = pButton-mpDoc-GetString( pButton-aCellAddress 
);
+svl::IUndoManager* pUndoManager;
+ScDrawLayer* pDrawLayer;
+
+if ( bUndo )
+{
+pUndoManager = pDocShell-GetUndoManager();
+
+aOldVal.assign( *pDoc, pButton-aCellAddress );
+
+aMark.SetMarkArea( pButton-aCellAddress );
+pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+pUndoDoc-InitUndo( pDoc, pButton-aCellAddress.Tab(), 
pButton-aCellAddress.Tab() );
+pDoc-CopyToDocument( ScRange( pButton-aCellAddress ), IDF_ATTRIB, 
false, pUndoDoc, aMark );
+
+// This commences logging of changes to the drawing layer
+// (i.e. notes) for storing in an undo. (See more below.)
+pDrawLayer = pDoc-GetDrawLayer();
+pDrawLayer-BeginCalcUndo(false);
+}
+
+OUString sOriginalValue = pDoc-GetString( pButton-aCellAddress );
 
 pUnits-convertCellToHeaderUnit( pButton-aCellAddress,
- pButton-mpDoc,
+ pDoc,
  pButton-sHeaderUnit,
  pButton-sCellUnit );
 
-ScPostIt* pNote = pButton-mpDoc-GetOrCreateNote( pButton-aCellAddress );
-OUString sCurrentNote = pNote-GetText();
-
-OUString sConversionNote(Original input:  + sOriginalValue);
+const OUString sCurrentNoteText = pDoc-GetOrCreateNote( 
pButton-aCellAddress )-GetText();
+const OUString sConversionNote(Original input:  + sOriginalValue);
+OUString sNewNoteText;
 
-if (sCurrentNote.isEmpty())
+if (sCurrentNoteText.isEmpty())
 {
-pNote-SetText( pButton-aCellAddress, sConversionNote );
+sNewNoteText = sConversionNote;
 }
 else
 {
-pNote-SetText( pButton-aCellAddress, sCurrentNote + \n\n + 
sConversionNote );
+sNewNoteText = sCurrentNoteText + \n\n + sConversionNote;
 }
 
+// ensure existing caption object before draw undo tracking starts
+ScPostIt* pOldNote = pDoc-ReleaseNote( pButton-aCellAddress );
+ScNoteData aOldNoteData = pOldNote-GetNoteData();
+delete pOldNote

[Libreoffice-commits] core.git: Branch 'feature/unitver' - 2 commits - sc/inc sc/source

2015-08-07 Thread Andrzej Hunt
 sc/inc/sc.hrc  |5 +
 sc/source/ui/inc/viewfunc.hxx  |3 -
 sc/source/ui/src/units.src |5 +
 sc/source/ui/view/viewfunc.cxx |  114 +
 4 files changed, 104 insertions(+), 23 deletions(-)

New commits:
commit 54fc383bee9fe07388a9f9d5b6ae13a1e0e9eca0
Author: Andrzej Hunt andr...@ahunt.org
Date:   Fri Aug 7 08:25:48 2015 +0100

Implement undoing conversion of individual locally annotated cells

Change-Id: I16b62f1105f7839b047a96fdab0e3e6089d400ee

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 42a0561..fe78cd8 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1005,7 +1005,10 @@
 #define STR_UNITS_CONVERSION_RECOMMENDED (STR_START + 455)
 #define BT_UNITS_CONVERT_THIS_CELL  (STR_START + 456)
 #define BT_UNITS_CONV_ALL   (STR_START + 457)
-#define STR_END (BT_UNITS_CONV_ALL)
+
+#define STR_UNDO_UNITSCONVERSION (STR_START + 458)
+
+#define STR_END (STR_UNDO_UNITSCONVERSION)
 
 #define BMP_START   (STR_END)
 
diff --git a/sc/source/ui/src/units.src b/sc/source/ui/src/units.src
index d666923..bc9a315 100644
--- a/sc/source/ui/src/units.src
+++ b/sc/source/ui/src/units.src
@@ -55,4 +55,9 @@ PushButton BT_UNITS_CONV_ALL
 Text [ en-US ] = Convert (automatically for all cells needing $2) ;
 };
 
+String STR_UNDO_UNITSCONVERSION
+{
+Text [ en-US ] = Units conversion;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 063a3a8..a6f66e7 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2976,8 +2976,7 @@ void ScViewFunc::NotifyUnitConversionRecommended( const 
ScAddress rCellAddress,

  rCellAddress,

  pDoc,

  rsHeaderUnit,
-   
  rsCellUnit,
-   
  pDocSh );
+   
  rsCellUnit );
 pButtonConvertCell-SetClickHdl( LINK( this, ScViewFunc, 
UnitConversionRecommendedHandler ) );
 
 OUString sConvertText = pButtonConvertCell-GetText();
@@ -2994,32 +2993,108 @@ IMPL_LINK( ScViewFunc, 
UnitConversionRecommendedHandler, UnitConversionPushButto
 #ifdef ENABLE_CALC_UNITVERIFICATION
 boost::shared_ptr Units  pUnits = Units::GetUnits();
 
-ScDocShell* pDocShell = 
static_castScDocShell*(pButton-mpDoc-GetDocumentShell());
+ScDocument* pDoc = pButton-mpDoc;
+ScDocShell* pDocShell = static_castScDocShell*(pDoc-GetDocumentShell());
 
 ScDocShellModificator aModificator( *pDocShell );
+bool bUndo = pDoc-IsUndoEnabled();
+ScCellValue aOldVal;
+ScDocument* pUndoDoc;
+ScMarkData aMark;
 
-OUString sOriginalValue = pButton-mpDoc-GetString( pButton-aCellAddress 
);
+svl::IUndoManager* pUndoManager;
+ScDrawLayer* pDrawLayer;
+
+if ( bUndo )
+{
+pUndoManager = pDocShell-GetUndoManager();
+
+aOldVal.assign( *pDoc, pButton-aCellAddress );
+
+aMark.SetMarkArea( pButton-aCellAddress );
+pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
+pUndoDoc-InitUndo( pDoc, pButton-aCellAddress.Tab(), 
pButton-aCellAddress.Tab() );
+pDoc-CopyToDocument( ScRange( pButton-aCellAddress ), IDF_ATTRIB, 
false, pUndoDoc, aMark );
+
+// This commences logging of changes to the drawing layer
+// (i.e. notes) for storing in an undo. (See more below.)
+pDrawLayer = pDoc-GetDrawLayer();
+pDrawLayer-BeginCalcUndo(false);
+}
+
+OUString sOriginalValue = pDoc-GetString( pButton-aCellAddress );
 
 pUnits-convertCellToHeaderUnit( pButton-aCellAddress,
- pButton-mpDoc,
+ pDoc,
  pButton-sHeaderUnit,
  pButton-sCellUnit );
 
-ScPostIt* pNote = pButton-mpDoc-GetOrCreateNote( pButton-aCellAddress );
-OUString sCurrentNote = pNote-GetText();
-
-OUString sConversionNote(Original input:  + sOriginalValue);
+const OUString sCurrentNoteText = pDoc-GetOrCreateNote( 
pButton-aCellAddress )-GetText();
+const OUString sConversionNote(Original input:  + sOriginalValue);
+OUString sNewNoteText;
 
-if (sCurrentNote.isEmpty())
+if (sCurrentNoteText.isEmpty())
 {
-pNote-SetText( pButton-aCellAddress, sConversionNote );
+sNewNoteText = sConversionNote;
 }
 else
 {
-pNote-SetText( pButton-aCellAddress, sCurrentNote + \n\n + 
sConversionNote );
+sNewNoteText = sCurrentNoteText + \n\n + sConversionNote

[Libreoffice-commits] core.git: Branch 'feature/unitver' - sc/qa

2015-08-05 Thread Andrzej Hunt
 sc/qa/unit/units.cxx |   12 
 1 file changed, 12 insertions(+)

New commits:
commit 6a75eeb0c3dc12844557027f0df443e1b57269c6
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed Aug 5 19:50:55 2015 +0100

Test for tdf#92455 (persist purely local annotations after conversion)

Change-Id: I3f0ed297ef4eb9ac7876a9e24e3c2f0c1ec0b521

diff --git a/sc/qa/unit/units.cxx b/sc/qa/unit/units.cxx
index 28cffa2..86efc22 100644
--- a/sc/qa/unit/units.cxx
+++ b/sc/qa/unit/units.cxx
@@ -948,6 +948,18 @@ void UnitsTest::testRangeConversion() {
 // TODO: we need to test:
 // 1. actual sensible ranges
 }
+
+// test purely local annotations (tdf#92455)
+ScAddress headerAddressCol4(3, 0, nTab);
+
+mpDoc-SetValue(headerAddressCol4, 3);
+setNumberFormatUnit(headerAddressCol4, m);
+
+aRange = ScRange(headerAddressCol4);
+CPPUNIT_ASSERT(mpUnitsImpl-convertCellUnits(aRange, mpDoc, cm));
+CPPUNIT_ASSERT_DOUBLES_EQUAL(mpDoc-GetValue(headerAddressCol4), 300, 
1e-7);
+
+CPPUNIT_ASSERT(UnitsImpl::extractUnitStringForCell(headerAddressCol4, 
mpDoc) == cm);
 }
 
 void UnitsTest::testConvertCellUnits()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - configure.ac

2015-07-16 Thread Andrzej Hunt
 configure.ac |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8c0ace56528cfd469d55c17a6e9b32c33e715ec0
Author: Andrzej Hunt andr...@ahunt.org
Date:   Thu Jun 4 14:02:05 2015 +0100

Fix using /opt/lo/bin/nasm on windows/cygwin

Change-Id: Ib3755598bfccffc2efd67816ae5fa5dc8903553e
Reviewed-on: https://gerrit.libreoffice.org/16083
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Michael Stahl mst...@redhat.com
(cherry picked from commit a3afa22ba4069212213009fc7304adc3c339b68b)
Reviewed-on: https://gerrit.libreoffice.org/17124
Reviewed-by: David Ostrovsky da...@ostrovsky.org
Tested-by: Katarina Behrens katarina.behr...@cib.de

diff --git a/configure.ac b/configure.ac
index 90b13c8..cf63d27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7459,7 +7459,7 @@ else
 if test -z $NASM -a $build_os = cygwin; then
 if test -n $LODE_HOME -a -x $LODE_HOME/opt/bin/nasm; then
 NASM=$LODE_HOME/opt/bin/nasm
-elif -x /opt/lo/bin/nasm; then
+elif test -x /opt/lo/bin/nasm; then
 NASM=/opt/lo/bin/nasm
 fi
 fi
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 2 commits - configure.ac external/udunits2

2015-06-05 Thread Andrzej Hunt
 configure.ac  |2 
 external/udunits2/ExternalPackage_udunits2.mk |2 
 external/udunits2/ExternalProject_udunits2.mk |   11 +
 external/udunits2/UnpackedTarball_udunits2.mk |6 
 external/udunits2/udunits2-windows-cygwin.patch.1 |  200 ++
 5 files changed, 218 insertions(+), 3 deletions(-)

New commits:
commit 07a5581b6958c1c4bf3b7039ebae5dbe2eeecbf7
Author: Andrzej Hunt andr...@ahunt.org
Date:   Fri Jun 5 10:33:08 2015 +0100

WIP: udunits2 build on windows

It now builds, but only produces a static library. libtool (which
udunits2 uses for building) doesn't like the inclusion of expat
as a static library and refuses to build a dll - I still need
to investigate more.

Change-Id: Id4ef089fa9ecbf5cac109bf164b3b3278ba74912

diff --git a/external/udunits2/ExternalPackage_udunits2.mk 
b/external/udunits2/ExternalPackage_udunits2.mk
index 3ac5920..b3d0261 100644
--- a/external/udunits2/ExternalPackage_udunits2.mk
+++ b/external/udunits2/ExternalPackage_udunits2.mk
@@ -12,7 +12,7 @@ $(eval $(call 
gb_ExternalPackage_ExternalPackage,udunits2,udunits2))
 $(eval $(call gb_ExternalPackage_use_external_project,udunits2,udunits2))
 
 ifeq ($(OS)-$(COM),WNT-MSC)
-$(eval $(call 
gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/iudunits2.dll,lib/.libs/iudunits2.dll))
+$(eval $(call 
gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/iudunits2.lib,lib/.libs/libudunits2.lib))
 else ifeq ($(OS),MACOSX)
 $(eval $(call 
gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/libudunits2.0.dylib,lib/.libs/libudunits2.0.dylib))
 else
diff --git a/external/udunits2/ExternalProject_udunits2.mk 
b/external/udunits2/ExternalProject_udunits2.mk
index ba6479e..83dd30b 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -13,6 +13,10 @@ $(eval $(call 
gb_ExternalProject_use_autoconf,udunits2,configure))
 
 $(eval $(call gb_ExternalProject_use_autoconf,udunits2,build))
 
+$(eval $(call gb_ExternalProject_use_externals,udunits2,\
+   expat \
+))
+
 $(eval $(call gb_ExternalProject_register_targets,udunits2,\
configure \
build \
@@ -28,8 +32,13 @@ $(call gb_ExternalProject_get_state_target,udunits2,build) : 
$(call gb_ExternalP
 
 $(call gb_ExternalProject_get_state_target,udunits2,configure) :
$(call gb_ExternalProject_run,configure,\
-   MAKE=$(MAKE) ./configure \
+   MAKE=$(MAKE) \
+   CFLAGS=$(if $(SYSTEM_EXPAT),,-I$(call 
gb_UnpackedTarball_get_dir,expat)/lib) \
+   LDFLAGS=$(if 
$(SYSTEM_EXPAT),,-L$(gb_StaticLibrary_WORKDIR)) \
+   ./configure \
$(if $(ENABLE_DEBUG),--enable-debug) \
+   $(ifeq ($(OS),WNT) --enable-shared) \
+   --enable-shared \
--build=$(if $(filter 
WNT,$(OS)),i686-pc-cygwin,$(BUILD_PLATFORM)) \
)
 
diff --git a/external/udunits2/UnpackedTarball_udunits2.mk 
b/external/udunits2/UnpackedTarball_udunits2.mk
index 820472e..0d68808 100644
--- a/external/udunits2/UnpackedTarball_udunits2.mk
+++ b/external/udunits2/UnpackedTarball_udunits2.mk
@@ -17,4 +17,10 @@ $(eval $(call gb_UnpackedTarball_add_patches,udunits2,\
 ))
 endif
 
+ifeq ($(OS),WNT)
+$(eval $(call gb_UnpackedTarball_add_patches,udunits2,\
+external/udunits2/udunits2-windows-cygwin.patch.1 \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/udunits2/udunits2-windows-cygwin.patch.1 
b/external/udunits2/udunits2-windows-cygwin.patch.1
new file mode 100644
index 000..3ed69aa
--- /dev/null
+++ b/external/udunits2/udunits2-windows-cygwin.patch.1
@@ -0,0 +1,200 @@
+diff -ur udunits2.org/configure udunits2/configure
+--- udunits2.org/configure 2015-06-04 07:14:02.996631200 -0700
 udunits2/configure 2015-06-04 09:34:57.354053000 -0700
+@@ -4704,12 +4704,12 @@
+ { $as_echo $as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dirname 5
+ $as_echo $ac_cv_search_dirname 6; }
+ ac_res=$ac_cv_search_dirname
+-if test $ac_res != no; then :
+-  test $ac_res = none required || LIBS=$ac_res $LIBS
+-
+-else
+-  as_fn_error $? cannot find function dirname $LINENO 5
+-fi
++#if test $ac_res != no; then :
++#  test $ac_res = none required || LIBS=$ac_res $LIBS
++#
++#else
++#  as_fn_error $? cannot find function dirname $LINENO 5
++#fi
+ 
+ { $as_echo $as_me:${as_lineno-$LINENO}: checking for library containing 
log10 5
+ $as_echo_n checking for library containing log10...  6; }
+@@ -4762,12 +4762,12 @@
+ { $as_echo $as_me:${as_lineno-$LINENO}: result: $ac_cv_search_log10 5
+ $as_echo $ac_cv_search_log10 6; }
+ ac_res=$ac_cv_search_log10
+-if test $ac_res != no; then :
+-  test $ac_res = none required || LIBS=$ac_res $LIBS
+-
+-else
+-  as_fn_error $? cannot find function log10 $LINENO 5
+-fi
++#if test $ac_res != no; then :
++#  test $ac_res = none required

[Libreoffice-commits] core.git: configure.ac

2015-06-04 Thread Andrzej Hunt
 configure.ac |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a3afa22ba4069212213009fc7304adc3c339b68b
Author: Andrzej Hunt andr...@ahunt.org
Date:   Thu Jun 4 14:02:05 2015 +0100

Fix using /opt/lo/bin/nasm on windows/cygwin

Change-Id: Ib3755598bfccffc2efd67816ae5fa5dc8903553e
Reviewed-on: https://gerrit.libreoffice.org/16083
Tested-by: Jenkins c...@libreoffice.org
Reviewed-by: Michael Stahl mst...@redhat.com

diff --git a/configure.ac b/configure.ac
index 85bbd22..c7483a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7458,7 +7458,7 @@ else
 if test -z $NASM -a $build_os = cygwin; then
 if test -n $LODE_HOME -a -x $LODE_HOME/opt/bin/nasm; then
 NASM=$LODE_HOME/opt/bin/nasm
-elif -x /opt/lo/bin/nasm; then
+elif test -x /opt/lo/bin/nasm; then
 NASM=/opt/lo/bin/nasm
 fi
 fi
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - download.lst

2015-06-04 Thread Andrzej Hunt
 download.lst |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0d21421210e222c07f700a753cb79d14dcef9cc3
Author: Andrzej Hunt andr...@ahunt.org
Date:   Thu Jun 4 09:14:24 2015 +0100

Upgrade to udunits 2.2.19

This has some fixes that should help the windows build

Change-Id: I71b17ee74d5d3a9b7c0eed4805fc0136b8db0607

diff --git a/download.lst b/download.lst
index 901553c..94bd3f9 100644
--- a/download.lst
+++ b/download.lst
@@ -139,8 +139,8 @@ export SERF_MD5SUM := 4f8e76c9c6567aee1d66aba49f76a58b
 export SERF_TARBALL := serf-1.2.1.tar.bz2
 export SWING_TARBALL := 35c94d2df8893241173de1d16b6034c0-swingExSrc.zip
 export UCPP_TARBALL := 0168229624cfac409e766913506961a8-ucpp-1.3.2.tar.gz
-export UDUNITS2_MD5SUM := a2492adfbd9ae2f05a331673a2067cab
-export UDUNITS2_TARBALL := udunits-2.2.17.tar.gz
+export UDUNITS2_MD5SUM := 12aeae488567622feb51458d62cf294c
+export UDUNITS2_TARBALL := udunits-2.2.19.tar.gz
 export VIGRA_TARBALL := d62650a6f908e85643e557a236ea989c-vigra1.6.0.tar.gz
 export VISIO_MD5SUM := 726c1f5be65eb7d649e0d48b63d920e7
 export VISIO_TARBALL := libvisio-0.1.1.tar.bz2
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - external/udunits2 RepositoryExternal.mk

2015-06-03 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit 1704ec6a8c576855398035da216faa5e66559d9f
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed Jun 3 21:28:24 2015 +0100

Possibly fix udunits2 loading on OSX

Change-Id: I048d23d647a6d6f38efddc11f7d3bde3b583e752

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 2f633bd..2e3b1ec 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -177,7 +177,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
 )
 else
 $(call gb_LinkTarget_add_libs,$(1),\
-   -L$(call gb_UnpackedTarball_get_dir,udunits2)/lib -ludunits2 \
+   -L$(call gb_UnpackedTarball_get_dir,udunits2)/lib/.libs -ludunits2 \
 )
 endif
 
diff --git a/external/udunits2/UnpackedTarball_udunits2.mk 
b/external/udunits2/UnpackedTarball_udunits2.mk
index db096ca..820472e 100644
--- a/external/udunits2/UnpackedTarball_udunits2.mk
+++ b/external/udunits2/UnpackedTarball_udunits2.mk
@@ -11,4 +11,10 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,udunits2))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,udunits2,$(UDUNITS2_TARBALL)))
 
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_UnpackedTarball_add_patches,udunits2,\
+   external/udunits2/udunits2-macosx.patch.1 \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/udunits2/udunits2-macosx.patch.1 
b/external/udunits2/udunits2-macosx.patch.1
new file mode 100644
index 000..0b6fb4e
--- /dev/null
+++ b/external/udunits2/udunits2-macosx.patch.1
@@ -0,0 +1,27 @@
+diff -ur udunits2.org/configure udunits2/configure
+--- udunits2.org/configure 2015-06-03 21:24:12.440541277 +0100
 udunits2/configure 2015-06-03 21:25:59.873829068 +0100
+@@ -10254,9 +10254,9 @@
+   esac
+   if test $_lt_dar_can_shared = yes; then
+ output_verbose_link_cmd=func_echo_all
+-archive_cmds=\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs 
\$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring 
$_lt_dar_single_mod${_lt_dsymutil}
++archive_cmds=\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs 
\$deplibs \$compiler_flags -install_name 
@__OOO/\$soname \$verstring 
$_lt_dar_single_mod${_lt_dsymutil}
+ module_cmds=\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs 
\$deplibs \$compiler_flags${_lt_dsymutil}
+-archive_expsym_cmds=sed 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags 
-install_name \$rpath/\$soname \$verstring 
${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}
++archive_expsym_cmds=sed 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags 
-install_name @__OOO/\$soname 
\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}
+ module_expsym_cmds=sed -e 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib 
-bundle \$libobjs \$deplibs 
\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}
+ 
+   else
+@@ -14000,9 +14000,9 @@
+   esac
+   if test $_lt_dar_can_shared = yes; then
+ output_verbose_link_cmd=func_echo_all
+-archive_cmds_FC=\$CC -dynamiclib \$allow_undefined_flag -o \$lib 
\$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring 
$_lt_dar_single_mod${_lt_dsymutil}
++archive_cmds_FC=\$CC -dynamiclib \$allow_undefined_flag -o \$lib 
\$libobjs \$deplibs \$compiler_flags -install_name 
@__OOO/\$soname \$verstring 
$_lt_dar_single_mod${_lt_dsymutil}
+ module_cmds_FC=\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs 
\$deplibs \$compiler_flags${_lt_dsymutil}
+-archive_expsym_cmds_FC=sed 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags 
-install_name \$rpath/\$soname \$verstring 
${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}
++archive_expsym_cmds_FC=sed 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags 
-install_name @__OOO/\$soname 
\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}
+ module_expsym_cmds_FC=sed -e 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib 
-bundle \$libobjs \$deplibs 
\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}
+ 
+   else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - external/udunits2 RepositoryExternal.mk

2015-06-03 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit e4cc9f887c982476c568a19b655421b794fe9203
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed Jun 3 21:28:24 2015 +0100

Fix udunits2 install_name on OSX

Change-Id: I048d23d647a6d6f38efddc11f7d3bde3b583e752

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 2f633bd..2e3b1ec 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -177,7 +177,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
 )
 else
 $(call gb_LinkTarget_add_libs,$(1),\
-   -L$(call gb_UnpackedTarball_get_dir,udunits2)/lib -ludunits2 \
+   -L$(call gb_UnpackedTarball_get_dir,udunits2)/lib/.libs -ludunits2 \
 )
 endif
 
diff --git a/external/udunits2/UnpackedTarball_udunits2.mk 
b/external/udunits2/UnpackedTarball_udunits2.mk
index db096ca..820472e 100644
--- a/external/udunits2/UnpackedTarball_udunits2.mk
+++ b/external/udunits2/UnpackedTarball_udunits2.mk
@@ -11,4 +11,10 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,udunits2))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,udunits2,$(UDUNITS2_TARBALL)))
 
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_UnpackedTarball_add_patches,udunits2,\
+   external/udunits2/udunits2-macosx.patch.1 \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/udunits2/udunits2-macosx.patch.1 
b/external/udunits2/udunits2-macosx.patch.1
new file mode 100644
index 000..0b6fb4e
--- /dev/null
+++ b/external/udunits2/udunits2-macosx.patch.1
@@ -0,0 +1,27 @@
+diff -ur udunits2.org/configure udunits2/configure
+--- udunits2.org/configure 2015-06-03 21:24:12.440541277 +0100
 udunits2/configure 2015-06-03 21:25:59.873829068 +0100
+@@ -10254,9 +10254,9 @@
+   esac
+   if test $_lt_dar_can_shared = yes; then
+ output_verbose_link_cmd=func_echo_all
+-archive_cmds=\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs 
\$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring 
$_lt_dar_single_mod${_lt_dsymutil}
++archive_cmds=\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs 
\$deplibs \$compiler_flags -install_name 
@__OOO/\$soname \$verstring 
$_lt_dar_single_mod${_lt_dsymutil}
+ module_cmds=\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs 
\$deplibs \$compiler_flags${_lt_dsymutil}
+-archive_expsym_cmds=sed 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags 
-install_name \$rpath/\$soname \$verstring 
${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}
++archive_expsym_cmds=sed 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags 
-install_name @__OOO/\$soname 
\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}
+ module_expsym_cmds=sed -e 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib 
-bundle \$libobjs \$deplibs 
\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}
+ 
+   else
+@@ -14000,9 +14000,9 @@
+   esac
+   if test $_lt_dar_can_shared = yes; then
+ output_verbose_link_cmd=func_echo_all
+-archive_cmds_FC=\$CC -dynamiclib \$allow_undefined_flag -o \$lib 
\$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring 
$_lt_dar_single_mod${_lt_dsymutil}
++archive_cmds_FC=\$CC -dynamiclib \$allow_undefined_flag -o \$lib 
\$libobjs \$deplibs \$compiler_flags -install_name 
@__OOO/\$soname \$verstring 
$_lt_dar_single_mod${_lt_dsymutil}
+ module_cmds_FC=\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs 
\$deplibs \$compiler_flags${_lt_dsymutil}
+-archive_expsym_cmds_FC=sed 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags 
-install_name \$rpath/\$soname \$verstring 
${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}
++archive_expsym_cmds_FC=sed 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib 
\$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags 
-install_name @__OOO/\$soname 
\$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}
+ module_expsym_cmds_FC=sed -e 's,^,_,'  \$export_symbols  
\$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib 
-bundle \$libobjs \$deplibs 
\$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}
+ 
+   else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - sc/source

2015-06-03 Thread Andrzej Hunt
 sc/source/core/units/unitsimpl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8144a4cf6d1ca4e80699e54ebc05c81fabab6e71
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed Jun 3 15:58:29 2015 +0100

Don't assert on unsupported opcode, return unknown instead

We should eventually support all opcodes, but crashing* isn't
really the correct response if not.

*or continuing with completely wrong behvaiour in non-debug builds.

Change-Id: I22d7746f4e809bdc3da62b8b6f741216504b3f22

diff --git a/sc/source/core/units/unitsimpl.cxx 
b/sc/source/core/units/unitsimpl.cxx
index c440df6..66f5019 100644
--- a/sc/source/core/units/unitsimpl.cxx
+++ b/sc/source/core/units/unitsimpl.cxx
@@ -162,7 +162,7 @@ UnitsResult UnitsImpl::getOutputUnitsForOpCode(stack 
RAUSItem  rStack, const
 break;
 default:
 SAL_INFO(sc.units, unit verification not supported for opcode: 
  nOpCode);
-assert(false);
+return { FormulaStatus::UNKNOWN, boost::none };
 }
 } else if (nOpCode = SC_OPCODE_START_2_PAR 
nOpCode  SC_OPCODE_STOP_2_PAR) {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - external/udunits2

2015-06-03 Thread Andrzej Hunt
 external/udunits2/ExternalProject_udunits2.mk |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit a07e4dfa9ddf3fbc4400418102db6c4c399b781a
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed Jun 3 16:07:53 2015 +0100

Possibly fix udunits2 loading on OSX

Change-Id: I048d23d647a6d6f38efddc11f7d3bde3b583e752

diff --git a/external/udunits2/ExternalProject_udunits2.mk 
b/external/udunits2/ExternalProject_udunits2.mk
index ba6479e..f5a05c0 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -21,7 +21,10 @@ $(eval $(call gb_ExternalProject_register_targets,udunits2,\
 $(call gb_ExternalProject_get_state_target,udunits2,build) : $(call 
gb_ExternalProject_get_state_target,udunits2,configure)
+$(call gb_ExternalProject_run,build,\
cd lib  \
-   $(MAKE) libudunits2.la  \
+   $(MAKE) libudunits2.la \
+   $(if $(filter MACOSX,$(OS)), $(PERL) \
+   $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl 
OOO \
+   
$(gb_Package_SOURCEDIR_udunits2)/lib/.lib/libudunits2.0.dylib)  \
mkdir udunits2  \
cp udunits2.h udunits2/ \
)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - external/udunits2

2015-06-03 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit 8b75bd5c1f9ad2ff3981fd909d07855530d28c2c
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed Jun 3 17:07:15 2015 +0100

Possibly fix udunits2 loading on OSX

Change-Id: I048d23d647a6d6f38efddc11f7d3bde3b583e752

diff --git a/external/udunits2/ExternalProject_udunits2.mk 
b/external/udunits2/ExternalProject_udunits2.mk
index ba6479e..0c7a7d7 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -21,9 +21,12 @@ $(eval $(call gb_ExternalProject_register_targets,udunits2,\
 $(call gb_ExternalProject_get_state_target,udunits2,build) : $(call 
gb_ExternalProject_get_state_target,udunits2,configure)
+$(call gb_ExternalProject_run,build,\
cd lib  \
-   $(MAKE) libudunits2.la  \
+   $(MAKE) libudunits2.la \
mkdir udunits2  \
cp udunits2.h udunits2/ \
+   $(if $(filter MACOSX,$(OS)), $(PERL) \
+   $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl 
OOO \
+   
$(gb_Package_SOURCEDIR_udunits2)/.lib/libudunits2.0.dylib) \
)
 
 $(call gb_ExternalProject_get_state_target,udunits2,configure) :
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - external/udunits2 RepositoryExternal.mk

2015-06-03 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit e0d7de574cadaed45f6988281e14c1385adaa03f
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed Jun 3 17:55:59 2015 +0100

Possibly fix udunits2 loading on OSX

Change-Id: I048d23d647a6d6f38efddc11f7d3bde3b583e752

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 2f633bd..2e3b1ec 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -177,7 +177,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
 )
 else
 $(call gb_LinkTarget_add_libs,$(1),\
-   -L$(call gb_UnpackedTarball_get_dir,udunits2)/lib -ludunits2 \
+   -L$(call gb_UnpackedTarball_get_dir,udunits2)/lib/.libs -ludunits2 \
 )
 endif
 
diff --git a/external/udunits2/ExternalProject_udunits2.mk 
b/external/udunits2/ExternalProject_udunits2.mk
index ba6479e..ad0da50 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -24,6 +24,9 @@ $(call gb_ExternalProject_get_state_target,udunits2,build) : 
$(call gb_ExternalP
$(MAKE) libudunits2.la  \
mkdir udunits2  \
cp udunits2.h udunits2/ \
+   $(if $(filter MACOSX,$(OS)), $(PERL) \
+   $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl 
OOO \
+   
$(gb_Package_SOURCEDIR_udunits2)/lib/.libs/libudunits2.0.dylib) \
)
 
 $(call gb_ExternalProject_get_state_target,udunits2,configure) :
diff --git a/external/udunits2/UnpackedTarball_udunits2.mk 
b/external/udunits2/UnpackedTarball_udunits2.mk
index db096ca..820472e 100644
--- a/external/udunits2/UnpackedTarball_udunits2.mk
+++ b/external/udunits2/UnpackedTarball_udunits2.mk
@@ -11,4 +11,10 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,udunits2))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,udunits2,$(UDUNITS2_TARBALL)))
 
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_UnpackedTarball_add_patches,udunits2,\
+   external/udunits2/udunits2-macosx.patch.1 \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/udunits2/udunits2-macosx.patch.1 
b/external/udunits2/udunits2-macosx.patch.1
new file mode 100644
index 000..8f5f207
--- /dev/null
+++ b/external/udunits2/udunits2-macosx.patch.1
@@ -0,0 +1,11 @@
+diff -ur udunits2.org/lib/Makefile.in udunits2/lib/Makefile.in
+--- udunits2.org/lib/Makefile.in   2015-06-03 17:51:56.955223787 +0100
 udunits2/lib/Makefile.in   2015-06-03 17:52:56.659947119 +0100
+@@ -94,6 +94,7 @@
+ libudunits2_la_OBJECTS = $(am_libudunits2_la_OBJECTS)
+ libudunits2_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+   $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
++  -install_name 
@__OOO/libudunits2.0.dylib \
+   $(libudunits2_la_LDFLAGS) $(LDFLAGS) -o $@
+ @ENABLE_UDUNITS_1_TRUE@@HAVE_CUNIT_TRUE@am__EXEEXT_1 =  \
+ @ENABLE_UDUNITS_1_TRUE@@HAVE_CUNIT_TRUE@  testUnits-1$(EXEEXT)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 2 commits - external/udunits2 RepositoryExternal.mk

2015-06-03 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit 869f0130f3fbab066ff03763099e59d83727f7ab
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed Jun 3 17:26:38 2015 +0100

Possibly fix udunits2 loading on OSX

Change-Id: I048d23d647a6d6f38efddc11f7d3bde3b583e752

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 2f633bd..2e3b1ec 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -177,7 +177,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
 )
 else
 $(call gb_LinkTarget_add_libs,$(1),\
-   -L$(call gb_UnpackedTarball_get_dir,udunits2)/lib -ludunits2 \
+   -L$(call gb_UnpackedTarball_get_dir,udunits2)/lib/.libs -ludunits2 \
 )
 endif
 
diff --git a/external/udunits2/ExternalProject_udunits2.mk 
b/external/udunits2/ExternalProject_udunits2.mk
index 2ff0187..ad0da50 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -26,7 +26,7 @@ $(call gb_ExternalProject_get_state_target,udunits2,build) : 
$(call gb_ExternalP
cp udunits2.h udunits2/ \
$(if $(filter MACOSX,$(OS)), $(PERL) \
$(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl 
OOO \
-   
$(gb_Package_SOURCEDIR_udunits2)/.libs/libudunits2.0.dylib) \
+   
$(gb_Package_SOURCEDIR_udunits2)/lib/.libs/libudunits2.0.dylib) \
)
 
 $(call gb_ExternalProject_get_state_target,udunits2,configure) :
commit 860576e8a77dbd946d8853f9e5f1e003299bd58e
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed Jun 3 17:14:57 2015 +0100

Possibly fix udunits2 loading on OSX

Change-Id: I048d23d647a6d6f38efddc11f7d3bde3b583e752

diff --git a/external/udunits2/ExternalProject_udunits2.mk 
b/external/udunits2/ExternalProject_udunits2.mk
index ba6479e..2ff0187 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -24,6 +24,9 @@ $(call gb_ExternalProject_get_state_target,udunits2,build) : 
$(call gb_ExternalP
$(MAKE) libudunits2.la  \
mkdir udunits2  \
cp udunits2.h udunits2/ \
+   $(if $(filter MACOSX,$(OS)), $(PERL) \
+   $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl 
OOO \
+   
$(gb_Package_SOURCEDIR_udunits2)/.libs/libudunits2.0.dylib) \
)
 
 $(call gb_ExternalProject_get_state_target,udunits2,configure) :
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 3 commits - external/udunits2 sc/inc sc/qa sc/source

2015-06-02 Thread Andrzej Hunt
 external/udunits2/ExternalPackage_udunits2.mk |2 -
 sc/inc/units.hxx  |2 -
 sc/qa/unit/units.cxx  |   24 ++--
 sc/source/core/units/unitsimpl.cxx|   50 +-
 sc/source/core/units/unitsimpl.hxx|9 
 sc/source/ui/view/viewfunc.cxx|2 -
 6 files changed, 41 insertions(+), 48 deletions(-)

New commits:
commit 5e1cd739dc61755cce62655a38a46004ba5192c7
Author: Andrzej Hunt andr...@ahunt.org
Date:   Tue Jun 2 12:34:16 2015 +0100

Enable udunits2 on OSX

My original guess of library was wrong, other than that no special
treatment is needed for the OSX build.

Change-Id: I2a697c65a6e272bfa3f8070a85b4bbd8b01b5e23

diff --git a/external/udunits2/ExternalPackage_udunits2.mk 
b/external/udunits2/ExternalPackage_udunits2.mk
index 4073463..3ac5920 100644
--- a/external/udunits2/ExternalPackage_udunits2.mk
+++ b/external/udunits2/ExternalPackage_udunits2.mk
@@ -14,7 +14,7 @@ $(eval $(call 
gb_ExternalPackage_use_external_project,udunits2,udunits2))
 ifeq ($(OS)-$(COM),WNT-MSC)
 $(eval $(call 
gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/iudunits2.dll,lib/.libs/iudunits2.dll))
 else ifeq ($(OS),MACOSX)
-$(eval $(call 
gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/libudunits2.dylib,lib/.libs/libudunits2.dylib))
+$(eval $(call 
gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/libudunits2.0.dylib,lib/.libs/libudunits2.0.dylib))
 else
 $(eval $(call 
gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/libudunits2.so,lib/.libs/libudunits2.so))
 $(eval $(call 
gb_ExternalPackage_add_file,udunits2,$(LIBO_LIB_FOLDER)/libudunits2.so.0,lib/.libs/libudunits2.so.0))
commit 17f1869709f1ae8a7cfce11ec5b55f585ddab5b7
Author: Andrzej Hunt andr...@ahunt.org
Date:   Mon Jun 1 22:12:54 2015 +0100

Rename VERIFIED-VALID for formula status.

Change-Id: I93a07e11546ebecf912449c72e57404731c346e9

diff --git a/sc/inc/units.hxx b/sc/inc/units.hxx
index 411fb84..1e0c5ea 100644
--- a/sc/inc/units.hxx
+++ b/sc/inc/units.hxx
@@ -45,7 +45,7 @@ struct RangeUnits {
  * is used).
  */
 enum class FormulaStatus {
-VERIFIED,
+VALID,
 UNKNOWN,
 ERROR_INPUT_SCALING,
 ERROR_INPUT_INCOMPATIBLE,
diff --git a/sc/qa/unit/units.cxx b/sc/qa/unit/units.cxx
index e2ad7cc..1dbf74f 100644
--- a/sc/qa/unit/units.cxx
+++ b/sc/qa/unit/units.cxx
@@ -221,7 +221,7 @@ void UnitsTest::testUnitVerification() {
 mpDoc-SetFormula(address, =A1+A2);
 pCell = mpDoc-GetFormulaCell(address);
 pTokens = pCell-GetCode();
-CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VERIFIED);
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VALID);
 
 // Test that addition of different units fails - incompatible types
 address = ScAddress(0, 6, 0);
@@ -235,14 +235,14 @@ void UnitsTest::testUnitVerification() {
 mpDoc-SetFormula(address, =A1*B1+A2*B2);
 pCell = mpDoc-GetFormulaCell(address);
 pTokens = pCell-GetCode();
-CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VERIFIED);
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VALID);
 
 // Test another combination (i.e. cm/s+'cm/s')
 address = ScAddress(0, 8, 0);
 mpDoc-SetFormula(address, =A1/C1+D1);
 pCell = mpDoc-GetFormulaCell(address);
 pTokens = pCell-GetCode();
-CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VERIFIED);
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VALID);
 
 // Test that another combination fails (cm*kg/s+'cm/s')
 address = ScAddress(0, 9, 0);
@@ -256,7 +256,7 @@ void UnitsTest::testUnitVerification() {
 mpDoc-SetFormula(address, =A1+100*E1);
 pCell = mpDoc-GetFormulaCell(address);
 pTokens = pCell-GetCode();
-CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VERIFIED);
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VALID);
 // 10cm + 100*1m = 110cm
 CPPUNIT_ASSERT_EQUAL(mpDoc-GetValue(address), 110.0);
 
@@ -287,7 +287,7 @@ void UnitsTest::testUnitVerification() {
 mpDoc-SetFormula(address, =SUM(B1:B3));
 pCell = mpDoc-GetFormulaCell(address);
 pTokens = pCell-GetCode();
-CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VERIFIED);
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VALID);
 
 // SUM(cmkg)
 address.IncRow();
@@ -315,14 +315,14 @@ void UnitsTest::testUnitVerification() {
 mpDoc-SetFormula(address, =SUM(A1:A3)/SUM(C1:C3)+SUM(D1:D3));
 pCell = mpDoc-GetFormulaCell(address);
 pTokens = pCell-GetCode();
-CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc

[Libreoffice-commits] core.git: Branch 'feature/unitver' - config_host.mk.in configure.ac external/udunits2 RepositoryExternal.mk sc/CppunitTest_sc_ucalc.mk sc/CppunitTest_sc_units.mk sc/Library_sc.mk

2015-06-02 Thread Andrzej Hunt
 RepositoryExternal.mk |   11 +++---
 config_host.mk.in |3 +
 configure.ac  |   46 ++
 external/udunits2/ExternalProject_udunits2.mk |5 ++
 sc/CppunitTest_sc_ucalc.mk|2 -
 sc/CppunitTest_sc_units.mk|2 -
 sc/Library_sc.mk  |2 -
 sc/source/core/units/unitsimpl.cxx|2 -
 sc/source/core/units/unitsimpl.hxx|2 -
 sc/source/core/units/util.cxx |2 -
 sc/source/core/units/utunit.hxx   |2 -
 11 files changed, 33 insertions(+), 46 deletions(-)

New commits:
commit d54cb9df9c81a0cc0d66b34eeb24ca163b1b0da6
Author: Andrzej Hunt andr...@ahunt.org
Date:   Tue Jun 2 13:53:55 2015 +0100

Enable --with-system-udunits2

We also have to move udunits2 headers to match the default system
installation location of ududnits2/udunits2.h (whereas udunits2 bundled
build puts the headers in lib/udunits2.h by default).

Change-Id: I1d314f6b3e016f90cfb8e19a143bb77ae98e7734

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 0bfc8bb..2f633bd 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -151,18 +151,21 @@ ifeq ($(ENABLE_CALC_UNITVERIFICATION),TRUE)
 
 ifneq ($(SYSTEM_UDUNITS2),)
 
-define gb_LinkTarget__use_libudunits2
+define gb_LinkTarget__use_udunits2
+$(call gb_LinkTarget_add_defs,$(1),\
+   -DSYSTEM_UDUNITS2 \
+)
 $(call gb_LinkTarget_set_include,$(1),\
$(UDUNITS2_CFLAGS) \
$$(INCLUDE) \
 )
-$(call gb_LinkTarget_add_libs,$(1),$(UDUNIT2_LIBS))
+$(call gb_LinkTarget_add_libs,$(1),$(UDUNITS2_LIBS))
 
 endef
 
 else # !SYSTEM_UDUNITS2
 
-define gb_LinkTarget__use_libudunits2
+define gb_LinkTarget__use_udunits2
 $(call gb_LinkTarget_use_package,$(1),udunits2)
 $(call gb_LinkTarget_set_include,$(1),\
$$(INCLUDE) \
@@ -184,7 +187,7 @@ endif # !SYSTEM_UDUNITS2
 
 else # !ENABLE_CALC_UNITVERIFICATION
 
-gb_LinkTarget__use_libudunits2 :=
+gb_LinkTarget__use_udunits2 :=
 
 endif # ENABLE_CALC_UNITVERIFICATION
 
diff --git a/config_host.mk.in b/config_host.mk.in
index 3e129c9..6f18d07 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -179,6 +179,9 @@ export ENABLE_TDE=@ENABLE_TDE@
 export ENABLE_TDEAB=@ENABLE_TDEAB@
 export ENABLE_TELEPATHY=@ENABLE_TELEPATHY@
 export ENABLE_CALC_UNITVERIFICATION=@ENABLE_CALC_UNITVERIFICATION@
+export SYSTEM_UDUNITS2=@SYSTEM_UDUNITS2@
+export UDUNITS2_CFLAGS=@UDUNITS2_CFLAGS@
+export UDUNITS2_LIBS=@UDUNITS2_LIBS@
 export ENABLE_VALGRIND=@ENABLE_VALGRIND@
 export ENABLE_VLC=@ENABLE_VLC@
 export ENABLE_WERROR=@ENABLE_WERROR@
diff --git a/configure.ac b/configure.ac
index d363ac5..e273f0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1693,7 +1693,7 @@ AC_ARG_WITH(system-firebird,
 
 AC_ARG_WITH(system-udunits2,
 AS_HELP_STRING([--with-system-udunits2],
-[Use udunits libraries already on system, for building calc 
unit-verification it.]),,
+[Use udunits libraries already on system, for building calc 
unit-verification with it.]),,
 [with_system_udunits2=$with_system_libs])
 
 AC_ARG_WITH(system-hsqldb,
@@ -8643,48 +8643,26 @@ if test x$enable_calc_unitverification = xyes; then
 if test $with_system_udunits2 = yes; then
 AC_MSG_RESULT([external])
 SYSTEM_UDUNITS2=TRUE
-AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
-if test -z $FIREBIRDCONFIG; then
-AC_MSG_NOTICE([No fb_config -- using pkg-config])
-PKG_CHECK_MODULES(FIREBIRD, fbembed)
-FIREBIRD_VERSION=`pkg-config --modversion fbembed`
-else
-AC_MSG_NOTICE([fb_config found])
-FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
-AC_MSG_CHECKING([for Firebird Client library])
-FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
-FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
-fi
-AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries 
`$FIREBIRD_LIBS'])
-AC_MSG_CHECKING([Firebird version])
-if test -n ${FIREBIRD_VERSION}; then
-FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d. -f1`
-FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d. -f2`
-if test $FIREBIRD_MAJOR -eq 2 -a $FIREBIRD_MINOR -eq 5; 
then
-AC_MSG_RESULT([OK])
-else
-AC_MSG_ERROR([Ensure firebird 2.5.x is installed])
-fi
-else
-__save_CFLAGS=${CFLAGS}
-CFLAGS=${CFLAGS} ${FIREBIRD_CFLAGS}
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include ibase.h
-#if defined(FB_API_VER)  FB_API_VER == 25
-#else
-#error Wrong Firebird API version
-#endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 2.5.x is 
installed]))
-CFLAGS=${__save_CFLAGS}
+
+PKG_CHECK_MODULES(UDUNITS2, udunits = 2.2.1, UDUNITS2_PKGCONFIG=yes, 
UDUNITS2_PKGCONFIG

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

2015-06-01 Thread Andrzej Hunt
 vcl/source/window/window2.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 60391b4726b6c00950fddb6088ffcc0a1ae142bc
Author: Andrzej Hunt andr...@ahunt.org
Date:   Sun May 31 16:14:10 2015 +0100

Allow unsetting underline attribute

Change-Id: Ib11f6e76a52c0b8c943d46b9f14b3b00642879d1
Reviewed-on: https://gerrit.libreoffice.org/16004
Tested-by: Jenkins c...@libreoffice.org
Tested-by: David Tardon dtar...@redhat.com
Reviewed-by: David Tardon dtar...@redhat.com

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index fc3b1ff..be4409c 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1558,10 +1558,10 @@ bool Window::set_font_attribute(const OString rKey, 
const OString rValue)
 aFont.SetItalic(ITALIC_NORMAL);
 SetControlFont(aFont);
 }
-else if (rKey == underline  toBool(rValue))
+else if (rKey == underline)
 {
 vcl::Font aFont(GetControlFont());
-aFont.SetUnderline(UNDERLINE_SINGLE);
+aFont.SetUnderline(toBool(rValue) ? UNDERLINE_SINGLE : UNDERLINE_NONE);
 SetControlFont(aFont);
 }
 else if (rKey == size)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 3 commits - sc/inc sc/qa sc/source

2015-06-01 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit 77971aa38eca3a52d559bfa5b9f7344e7e710d2b
Author: Andrzej Hunt andr...@ahunt.org
Date:   Mon Jun 1 18:10:29 2015 +0100

Add tests for output unit verification.

Change-Id: Ia273a64fdbb5e1fe57f41679e9d77e0df78987de

diff --git a/sc/qa/unit/units.cxx b/sc/qa/unit/units.cxx
index 4e9c2f9..e2ad7cc 100644
--- a/sc/qa/unit/units.cxx
+++ b/sc/qa/unit/units.cxx
@@ -205,6 +205,14 @@ void UnitsTest::testUnitVerification() {
 setNumberFormatUnit(address, m);
 mpDoc-SetValue(address, 1);
 
+// 6th column: header annotation for output verification
+address = ScAddress(5, 0, 0);
+mpDoc-SetString(address, foobar [cm]);
+
+// 7th column: another header annotation
+address = ScAddress(6, 0, 0);
+mpDoc-SetString(address, foobar (cm/s));
+
 ScFormulaCell* pCell;
 ScTokenArray* pTokens;
 
@@ -359,6 +367,52 @@ void UnitsTest::testUnitVerification() {
 pTokens = pCell-GetCode();
 CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::ERROR_INPUT_INCOMPATIBLE);
 }
+
+
+// Test output unit verification (i.e. using header annotations)
+
+// header in [cm], cell with cm
+address = ScAddress(5, 1, 0);
+mpDoc-SetFormula(address, =A1);
+pCell = mpDoc-GetFormulaCell(address);
+pTokens = pCell-GetCode();
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VERIFIED);
+
+
+// header in [cm], cell with 100*cm
+address.IncRow();
+mpDoc-SetFormula(address, =100*A1);
+pCell = mpDoc-GetFormulaCell(address);
+pTokens = pCell-GetCode();
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::ERROR_OUTPUT_SCALING);
+
+// header in [cm], cell with kg
+address.IncRow();
+mpDoc-SetFormula(address, =B1);
+pCell = mpDoc-GetFormulaCell(address);
+pTokens = pCell-GetCode();
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::ERROR_OUTPUT_INCOMPATIBLE);
+
+// header in [cm], cell with m
+address.IncRow();
+mpDoc-SetFormula(address, =E1);
+pCell = mpDoc-GetFormulaCell(address);
+pTokens = pCell-GetCode();
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::ERROR_OUTPUT_SCALING);
+
+// header in [cm], cell with 100*m
+address.IncRow();
+mpDoc-SetFormula(address, =100*E1);
+pCell = mpDoc-GetFormulaCell(address);
+pTokens = pCell-GetCode();
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VERIFIED);
+
+// header in (cm/s), formula resulting in cm/s
+address = ScAddress(6, 1, 0);
+mpDoc-SetFormula(address, =A1/C1);
+pCell = mpDoc-GetFormulaCell(address);
+pTokens = pCell-GetCode();
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VERIFIED);
 }
 
 void UnitsTest::testUnitFromFormatStringExtraction() {
commit 80c15be131e8bcb9063fd93a5aa2d32a36c8c72b
Author: Andrzej Hunt andr...@ahunt.org
Date:   Mon Jun 1 17:53:48 2015 +0100

Return status for formula errors

Returning a status (instead of a boolean) means we will be able to
print better error messages for the user in future.

Change-Id: I0b08913267fedb5735112acc7427156e07e32b31

diff --git a/sc/inc/units.hxx b/sc/inc/units.hxx
index b428d40..411fb84 100644
--- a/sc/inc/units.hxx
+++ b/sc/inc/units.hxx
@@ -38,11 +38,26 @@ struct RangeUnits {
 bool compatible;
 };
 
+/**
+ * The unit correctness status for a formula.
+ * UNKNOWN denotes that the units could not be verified
+ * (this can occur if e.g. an unsupported operator or formula
+ * is used).
+ */
+enum class FormulaStatus {
+VERIFIED,
+UNKNOWN,
+ERROR_INPUT_SCALING,
+ERROR_INPUT_INCOMPATIBLE,
+ERROR_OUTPUT_SCALING,
+ERROR_OUTPUT_INCOMPATIBLE
+};
+
 class Units {
 public:
 static ::boost::shared_ptr Units  GetUnits();
 
-virtual bool verifyFormula(ScTokenArray* pArray, const ScAddress 
rFormulaAddress, ScDocument* pDoc) = 0;
+virtual FormulaStatus verifyFormula(ScTokenArray* pArray, const ScAddress 
rFormulaAddress, ScDocument* pDoc) = 0;
 
 /*
  * Split the input into value and unit, where rInput == rValue + rUnit.
diff --git a/sc/qa/unit/units.cxx b/sc/qa/unit/units.cxx
index b35cd40..4e9c2f9 100644
--- a/sc/qa/unit/units.cxx
+++ b/sc/qa/unit/units.cxx
@@ -213,65 +213,65 @@ void UnitsTest::testUnitVerification() {
 mpDoc-SetFormula(address, =A1+A2);
 pCell = mpDoc-GetFormulaCell(address);
 pTokens = pCell-GetCode();
-CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc));
+CPPUNIT_ASSERT(mpUnitsImpl-verifyFormula(pTokens, address, mpDoc) == 
FormulaStatus::VERIFIED);
 
-// Test that addition of different units fails
+// Test that addition of different units fails - incompatible types
 address = ScAddress(0, 6, 0);
 mpDoc-SetFormula(address

[Libreoffice-commits] core.git: Branch 'feature/unitver' - sc/inc sc/source

2015-06-01 Thread Andrzej Hunt
 sc/inc/sc.hrc  |5 +++--
 sc/source/ui/src/units.src |9 +++--
 sc/source/ui/view/viewfunc.cxx |   18 +-
 3 files changed, 27 insertions(+), 5 deletions(-)

New commits:
commit a5106f8af396d45eda68a6977a52f9ae431f6757
Author: Andrzej Hunt andr...@ahunt.org
Date:   Mon Jun 1 18:37:26 2015 +0100

Show whether error is in formula or output in units warning

Change-Id: Ib21462b3d67bb9b960c0d37384cdcef5003a884e

diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index bac863f..42a0561 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -998,8 +998,9 @@
 #define STR_TITLE_DATE  (STR_START + 443)
 #define STR_UNKNOWN_USER_CONFLICT(STR_START + 444)
 
-#define STR_UNITS_ERRORINCELL   (STR_START + 450)
-#define BT_UNITS_EDIT_CELL  (STR_START + 451)
+#define STR_UNITS_ERROR_INPUT   (STR_START + 450)
+#define STR_UNITS_ERROR_OUTPUT  (STR_START + 451)
+#define BT_UNITS_EDIT_CELL  (STR_START + 452)
 
 #define STR_UNITS_CONVERSION_RECOMMENDED (STR_START + 455)
 #define BT_UNITS_CONVERT_THIS_CELL  (STR_START + 456)
diff --git a/sc/source/ui/src/units.src b/sc/source/ui/src/units.src
index 7a818e9..d666923 100644
--- a/sc/source/ui/src/units.src
+++ b/sc/source/ui/src/units.src
@@ -19,9 +19,14 @@
 
 #include sc.hrc
 
-String STR_UNITS_ERRORINCELL
+String STR_UNITS_ERROR_INPUT
 {
-Text [ en-US ] = Units error in formula in Cell $1 ;
+Text [ en-US ] = Units error in formula in Cell $1: incompatible units 
used in formula. ;
+};
+
+String STR_UNITS_ERROR_OUTPUT
+{
+Text [ en-US ] = Units error in formula in Cell $1: result units don't 
match specified units. ;
 };
 
 PushButton BT_UNITS_EDIT_CELL
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index b9a08c3..31b3870 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2855,7 +2855,23 @@ void ScViewFunc::NotifyUnitErrorInFormula( const 
ScAddress rAddress, ScDocument
 // after having carried out further edits on the document (whereby any tab 
changes/additions/removals
 // could change the number of the tab, with a name change being much more 
rare), hence having
 // all information (including tab name) could be useful.
-OUString sTitle = SC_RESSTR( STR_UNITS_ERRORINCELL );
+OUString sTitle;
+if (rStatus == FormulaStatus::ERROR_INPUT_SCALING ||
+rStatus == FormulaStatus::ERROR_INPUT_INCOMPATIBLE)
+{
+sTitle = SC_RESSTR( STR_UNITS_ERROR_INPUT );
+}
+else if (rStatus == FormulaStatus::ERROR_OUTPUT_SCALING ||
+ rStatus == FormulaStatus::ERROR_OUTPUT_INCOMPATIBLE)
+{
+sTitle = SC_RESSTR( STR_UNITS_ERROR_OUTPUT );
+}
+else
+{
+// We should not be showing a warning bar for any other statuses.
+assert(false);
+}
+
 sTitle = sTitle.replaceAll( $1, rAddress.GetColRowString() );
 OUString sCellAddress = rAddress.Format( SCA_BITS, pDoc );
 SfxInfoBarWindow* pInfoBar = pViewFrame-AppendInfoBar( sCellAddress, 
sTitle );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - external/udunits2

2015-06-01 Thread Andrzej Hunt
 external/udunits2/ExternalProject_udunits2.mk |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cf271ee07b6ab6b4e09ee1c0d7e21896d1fd39a2
Author: Andrzej Hunt andr...@ahunt.org
Date:   Mon Jun 1 19:28:39 2015 +0100

Don't require use of makeinfo for udunits2

The only way I could find of building _just_ the library,
without the extraneous (for our purposes) documentation/packaging,
seems to be calling this target.

Change-Id: I6469754752c322b2060f09705daa387bb463f906

diff --git a/external/udunits2/ExternalProject_udunits2.mk 
b/external/udunits2/ExternalProject_udunits2.mk
index 070dc67..52aef28 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -20,7 +20,7 @@ $(eval $(call gb_ExternalProject_register_targets,udunits2,\
 
 $(call gb_ExternalProject_get_state_target,udunits2,build) : $(call 
gb_ExternalProject_get_state_target,udunits2,configure)
+$(call gb_ExternalProject_run,build,\
-   $(MAKE) \
+   cd lib  $(MAKE) libudunits2.la \
)
 
 $(call gb_ExternalProject_get_state_target,udunits2,configure) :
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - sc/Library_sc.mk sc/source sc/UIConfig_scalc.mk

2015-06-01 Thread Andrzej Hunt
 sc/Library_sc.mk   |2 +-
 sc/UIConfig_scalc.mk   |4 +++-
 sc/source/ui/app/scdll.cxx |2 ++
 sc/source/ui/inc/reffact.hxx   |2 ++
 sc/source/ui/view/cellsh.cxx   |5 +
 sc/source/ui/view/cellsh1.cxx  |9 -
 sc/source/ui/view/tabvwsh.cxx  |2 ++
 sc/source/ui/view/tabvwshc.cxx |7 ++-
 8 files changed, 29 insertions(+), 4 deletions(-)

New commits:
commit 5c7d2d8fcad40ed1fa1e50a2e238a5ba353194c1
Author: Andrzej Hunt andr...@ahunt.org
Date:   Mon Jun 1 21:34:04 2015 +0100

Fix building with disabled unit verification.

Change-Id: I78633082a0e0dfcaa27515ce8d9c8635e50735e9

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 82a5237..5d96108 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -488,7 +488,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/miscdlgs/solverutil \
 sc/source/ui/miscdlgs/solvrdlg \
 sc/source/ui/miscdlgs/tabopdlg \
-sc/source/ui/miscdlgs/unitsconversiondlg \
 sc/source/ui/miscdlgs/warnbox \
 sc/source/ui/namedlg/namedefdlg \
 sc/source/ui/namedlg/namedlg \
@@ -695,6 +694,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/core/units/unitsimpl \
sc/source/core/units/util \
sc/source/core/units/utunit \
+sc/source/ui/miscdlgs/unitsconversiondlg \
 ))
 endif
 
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 77c821c..afdf4e1 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -181,7 +181,9 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/tpviewpage \
sc/uiconfig/scalc/ui/ttestdialog \
sc/uiconfig/scalc/ui/ungroupdialog \
-   sc/uiconfig/scalc/ui/unitsconversiondialog \
+$(if $(ENABLE_CALC_UNITVERIFICATION), \
+   sc/uiconfig/scalc/ui/unitsconversiondialog \
+   ) \
sc/uiconfig/scalc/ui/validationdialog \
sc/uiconfig/scalc/ui/validationcriteriapage \
sc/uiconfig/scalc/ui/validationhelptabpage \
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 242b0b7..b896e8a 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -250,7 +250,9 @@ void ScDLL::Init()
 ScFormulaDlgWrapper ::RegisterChildWindow(false, pMod);
 
 ScRandomNumberGeneratorDialogWrapper::RegisterChildWindow(false, pMod);
+#ifdef ENABLE_CALC_UNITVERIFICATION
 ScUnitsConversionDialogWrapper  ::RegisterChildWindow(false, pMod);
+#endif
 ScSamplingDialogWrapper ::RegisterChildWindow(false, pMod);
 ScDescriptiveStatisticsDialogWrapper::RegisterChildWindow(false, pMod);
 ScAnalysisOfVarianceDialogWrapper   ::RegisterChildWindow(false, pMod);
diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx
index 22ae265..5e1751a 100644
--- a/sc/source/ui/inc/reffact.hxx
+++ b/sc/source/ui/inc/reffact.hxx
@@ -73,12 +73,14 @@ private:
 ScRandomNumberGeneratorDialogWrapper() SAL_DELETED_FUNCTION;
 };
 
+#ifdef ENABLE_CALC_UNITVERIFICATION
 class ScUnitsConversionDialogWrapper :
 public ChildWindowWrapperSID_UNITSCONVERSION_DIALOG
 {
 private:
 ScUnitsConversionDialogWrapper() SAL_DELETED_FUNCTION;
 };
+#endif
 
 class ScAnalysisOfVarianceDialogWrapper :
 public ChildWindowWrapperSID_ANALYSIS_OF_VARIANCE_DIALOG
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index aba1368..8225b41 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -1089,6 +1089,11 @@ void ScCellShell::GetState(SfxItemSet rSet)
 }
 }
 break;
+#ifndef ENABLE_CALC_UNITVERIFICATION
+case SID_UNITSCONVERSION_DIALOG:
+rSet.DisableItem(nWhich);
+break;
+#endif
 
 } // switch ( nWitch )
 nWhich = aIter.NextWhich();
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index c8efa14..a0113f1 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -76,9 +76,12 @@
 #include markdata.hxx
 #include docpool.hxx
 #include condformatdlg.hxx
-#include unitsconversiondlg.hxx
 #include attrib.hxx
 
+#ifdef ENABLE_CALC_UNITVERIFICATION
+#include unitsconversiondlg.hxx
+#endif
+
 #include globstr.hrc
 #include scui_def.hxx
 #include svx/dialogs.hrc
@@ -128,7 +131,9 @@ void ScCellShell::ExecuteEdit( SfxRequest rReq )
 case SID_OPENDLG_CONDFRMT:
 case SID_OPENDLG_COLORSCALE:
 case SID_OPENDLG_DATABAR:
+#ifdef ENABLE_CALC_UNITVERIFICATION
 case SID_UNITSCONVERSION_DIALOG:
+#endif
 
 pScMod-InputEnterHandler();
 pTabViewShell-UpdateInputHandler();
@@ -1905,6 +1910,7 @@ void ScCellShell::ExecuteEdit( SfxRequest rReq )
 }
 break;
 
+#ifdef ENABLE_CALC_UNITVERIFICATION
 case SID_UNITSCONVERSION_DIALOG:
 {
 sal_uInt16 nId

[Libreoffice-commits] core.git: Branch 'feature/unitver' - external/udunits2

2015-06-01 Thread Andrzej Hunt
 external/udunits2/ExternalProject_udunits2.mk |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 624d84f1122ad1ab6dfe3aa06b398bc84a0b8b3b
Author: Andrzej Hunt andr...@ahunt.org
Date:   Mon Jun 1 21:43:39 2015 +0100

Remove unnecessary autoreconf

I'm not sure why this was ever necessary, and it seems to break
building on OSX.

Change-Id: I51a9e163d0066d974c190f191c68be0a2e8d9a46

diff --git a/external/udunits2/ExternalProject_udunits2.mk 
b/external/udunits2/ExternalProject_udunits2.mk
index 52aef28..fd54fc4 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -25,7 +25,6 @@ $(call gb_ExternalProject_get_state_target,udunits2,build) : 
$(call gb_ExternalP
 
 $(call gb_ExternalProject_get_state_target,udunits2,configure) :
$(call gb_ExternalProject_run,configure,\
-   autoreconf -i  \
MAKE=$(MAKE) ./configure \
$(if $(ENABLE_DEBUG),--enable-debug) \
--build=$(if $(filter 
WNT,$(OS)),i686-pc-cygwin,$(BUILD_PLATFORM)) \
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - vcl/source

2015-05-31 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit 1a4423f9986938e17d1f9589abb1fef4a8a1621a
Author: Andrzej Hunt andr...@ahunt.org
Date:   Sun May 31 16:14:10 2015 +0100

Allow unsetting underline attribute

Change-Id: Ib11f6e76a52c0b8c943d46b9f14b3b00642879d1

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index c38a2b2..f187280 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1558,10 +1558,10 @@ bool Window::set_font_attribute(const OString rKey, 
const OString rValue)
 aFont.SetItalic(ITALIC_NORMAL);
 SetControlFont(aFont);
 }
-else if (rKey == underline  toBool(rValue))
+else if (rKey == underline)
 {
 vcl::Font aFont(GetControlFont());
-aFont.SetUnderline(UNDERLINE_SINGLE);
+aFont.SetUnderline(toBool(rValue) ? UNDERLINE_SINGLE : UNDERLINE_NONE);
 SetControlFont(aFont);
 }
 else if (rKey == size)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - vcl/source

2015-05-31 Thread Andrzej Hunt
 vcl/source/window/builder.cxx |   19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

New commits:
commit de6b5a3ed8415cf419d708a2f90445d97e189e1a
Author: Andrzej Hunt andr...@ahunt.org
Date:   Sun May 31 20:59:41 2015 +0100

Support placeholder_text for GtkEntry/Edit in VclBuilder

Support for ComboBox and related classes will need to be added
separately, although they seem to reuse GtkEntry internally
in the .ui file.

Change-Id: Ibfda803663a22d5c6318fe9315b66b8af6189872

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 64d08c4..b8af547 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -878,6 +878,18 @@ namespace
 return sTooltipText;
 }
 
+OString extractPlaceholderText(VclBuilder::stringmap rMap)
+{
+OString sPlaceholderText;
+VclBuilder::stringmap::iterator aFind = 
rMap.find(OString(placeholder_text));
+if (aFind != rMap.end())
+{
+sPlaceholderText = aFind-second;
+rMap.erase(aFind);
+}
+return sPlaceholderText;
+}
+
 void setupFromActionName(Button *pButton, VclBuilder::stringmap rMap, 
const uno::Referenceframe::XFrame rFrame)
 {
 if (!rFrame.is())
@@ -1607,7 +1619,12 @@ VclPtrvcl::Window VclBuilder::makeObject(vcl::Window 
*pParent, const OString 
 }
 else if (name == GtkEntry)
 {
-xWindow = VclPtrEdit::Create(pParent, 
WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK);
+VclPtrInstanceEdit xEdit(pParent, 
WB_LEFT|WB_VCENTER|WB_BORDER|WB_3DLOOK);
+
+OUString 
sPlaceHolderText(OStringToOUString(extractPlaceholderText(rMap), 
RTL_TEXTENCODING_UTF8));
+xEdit-SetPlaceholderText(sPlaceHolderText);
+
+xWindow = xEdit;
 ensureDefaultWidthChars(rMap);
 }
 else if (name == GtkNotebook)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 3 commits - external/udunits2 sc/source vcl/source

2015-05-31 Thread Andrzej Hunt
 external/udunits2/ExternalProject_udunits2.mk |1 +
 sc/source/core/units/unitsimpl.cxx|2 +-
 vcl/source/window/window2.cxx |4 ++--
 3 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 2df2037b6d4c24a9b6501225b5cc3c3cd768c0a7
Author: Andrzej Hunt andr...@ahunt.org
Date:   Sun May 31 16:14:10 2015 +0100

Allow unsetting underline attribute

Change-Id: Ib11f6e76a52c0b8c943d46b9f14b3b00642879d1

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index c38a2b2..f187280 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1558,10 +1558,10 @@ bool Window::set_font_attribute(const OString rKey, 
const OString rValue)
 aFont.SetItalic(ITALIC_NORMAL);
 SetControlFont(aFont);
 }
-else if (rKey == underline  toBool(rValue))
+else if (rKey == underline)
 {
 vcl::Font aFont(GetControlFont());
-aFont.SetUnderline(UNDERLINE_SINGLE);
+aFont.SetUnderline(toBool(rValue) ? UNDERLINE_SINGLE : UNDERLINE_NONE);
 SetControlFont(aFont);
 }
 else if (rKey == size)
commit 4973d16c2871b66531bf697e37c1a724799ec8f7
Author: Andrzej Hunt andr...@ahunt.org
Date:   Sun May 31 16:13:35 2015 +0100

Unset MAKEFLAGS for udunits2 to prevent WaE.

Change-Id: I781aa3557b2f68b8e65319056619aa81be02b518

diff --git a/external/udunits2/ExternalProject_udunits2.mk 
b/external/udunits2/ExternalProject_udunits2.mk
index 070dc67..a9ccd67 100644
--- a/external/udunits2/ExternalProject_udunits2.mk
+++ b/external/udunits2/ExternalProject_udunits2.mk
@@ -25,6 +25,7 @@ $(call gb_ExternalProject_get_state_target,udunits2,build) : 
$(call gb_ExternalP
 
 $(call gb_ExternalProject_get_state_target,udunits2,configure) :
$(call gb_ExternalProject_run,configure,\
+   unset MAKEFLAGS  \
autoreconf -i  \
MAKE=$(MAKE) ./configure \
$(if $(ENABLE_DEBUG),--enable-debug) \
commit daea7451d850d0ad48ac76f03c890cff46a04c00
Author: Andrzej Hunt andr...@ahunt.org
Date:   Thu May 28 14:15:49 2015 +0100

Use GetParamCount instead of GetByte.

Change-Id: I8f49d198c2e49246a28839a77c37563e9a8b19a5

diff --git a/sc/source/core/units/unitsimpl.cxx 
b/sc/source/core/units/unitsimpl.cxx
index 0f79edb..fc4e899 100644
--- a/sc/source/core/units/unitsimpl.cxx
+++ b/sc/source/core/units/unitsimpl.cxx
@@ -172,7 +172,7 @@ UnitsResult UnitsImpl::getOutputUnitsForOpCode(stack 
RAUSItem  rStack, const
 }
 } else if (nOpCode = SC_OPCODE_START_2_PAR 
nOpCode  SC_OPCODE_STOP_2_PAR) {
-sal_uInt8 nParams = pToken-GetByte();
+sal_uInt8 nParams = pToken-GetParamCount();
 
 assert(nParams = rStack.size());
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 2 commits - officecfg/registry sc/inc sc/Library_sc.mk sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk

2015-05-31 Thread Andrzej Hunt
 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |5 
 sc/Library_sc.mk  |1 
 sc/UIConfig_scalc.mk  |1 
 sc/inc/sc.hrc |1 
 sc/inc/sccommands.h   |1 
 sc/inc/units.hxx  |2 
 sc/sdi/cellsh.sdi |1 
 sc/sdi/drawsh.sdi |1 
 sc/sdi/drtxtob.sdi|1 
 sc/sdi/scalc.sdi  |   24 
 sc/source/core/units/unitsimpl.cxx|6 
 sc/source/core/units/unitsimpl.hxx|2 
 sc/source/ui/app/scdll.cxx|1 
 sc/source/ui/inc/reffact.hxx  |7 
 sc/source/ui/inc/unitsconversiondlg.hxx   |   97 ++
 sc/source/ui/miscdlgs/unitsconversiondlg.cxx  |  272 
+++
 sc/source/ui/view/cellsh1.cxx |   12 
 sc/source/ui/view/tabvwsh.cxx |1 
 sc/source/ui/view/tabvwshc.cxx|7 
 sc/uiconfig/scalc/menubar/menubar.xml |2 
 sc/uiconfig/scalc/ui/unitsconversiondialog.ui |  347 
++
 21 files changed, 792 insertions(+)

New commits:
commit ad52aa65a5cd9eeaea4cb001a02074fda5736215
Author: Andrzej Hunt andr...@ahunt.org
Date:   Sun May 31 20:37:14 2015 +0100

Implement units conversion dialog.

Change-Id: Iea99d0c86de970e185bfc03e548be47f5235be5f

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 433c723..a57d7e2 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1413,6 +1413,11 @@
   value xml:lang=en-US~XML Source.../value
 /prop
   /node
+  node oor:name=.uno:ConvertUnits oor:op=replace
+prop oor:name=Label oor:type=xs:string
+  value xml:lang=en-USConvert ~Units/value
+/prop
+  /node
   node oor:name=.uno:DataSort oor:op=replace
 prop oor:name=Label oor:type=xs:string
   value xml:lang=en-US~Sort.../value
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 04052c6..82a5237 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -488,6 +488,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
 sc/source/ui/miscdlgs/solverutil \
 sc/source/ui/miscdlgs/solvrdlg \
 sc/source/ui/miscdlgs/tabopdlg \
+sc/source/ui/miscdlgs/unitsconversiondlg \
 sc/source/ui/miscdlgs/warnbox \
 sc/source/ui/namedlg/namedefdlg \
 sc/source/ui/namedlg/namedlg \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 5e4be53..77c821c 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -181,6 +181,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/tpviewpage \
sc/uiconfig/scalc/ui/ttestdialog \
sc/uiconfig/scalc/ui/ungroupdialog \
+   sc/uiconfig/scalc/ui/unitsconversiondialog \
sc/uiconfig/scalc/ui/validationdialog \
sc/uiconfig/scalc/ui/validationcriteriapage \
sc/uiconfig/scalc/ui/validationhelptabpage \
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 255dc71..bac863f 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -274,6 +274,7 @@
 #define SID_ZTEST_DIALOG(SC_MESSAGE_START + 80)
 #define SID_CHI_SQUARE_TEST_DIALOG  (SC_MESSAGE_START + 81)
 #define SID_SEARCH_RESULTS_DIALOG   (SC_MESSAGE_START + 82)
+#define SID_UNITSCONVERSION_DIALOG  (SC_MESSAGE_START + 83)
 
 // functions
 
diff --git a/sc/inc/sccommands.h b/sc/inc/sccommands.h
index 93a770e..9cc002e 100644
--- a/sc/inc/sccommands.h
+++ b/sc/inc/sccommands.h
@@ -24,6 +24,7 @@
 #define CMD_FID_COL_WIDTH   .uno:ColumnWidth
 #define CMD_SID_CREATE_SW_DRAWVIEW  .uno:CreateSWDrawView
 #define CMD_SID_OPENDLG_PIVOTTABLE  .uno:DataDataPilotRun
+#define CMD_SID_UNITSONVERSION_DIALOG   .uno:ConvertUnits
 #define CMD_SID_DATA_SELECT .uno:DataSelect
 #define CMD_SID_DEFINE_PRINTAREA.uno:DefinePrintArea
 #define CMD_FID_DELETE_CELL .uno:DeleteCell
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 6da3c75..162447a 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -31,6 +31,7 @@ interface CellSelection
 SID_DEFINE_COLROWNAMERANGES [ ExecMethod = ExecuteEdit; StateMethod = 
GetState

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

2015-05-27 Thread Andrzej Hunt
 libreofficekit/source/gtk/lokdocview.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 176c27f1946ae889910dd154742f2416b481569d
Author: Andrzej Hunt andr...@ahunt.org
Date:   Wed May 27 19:30:07 2015 +0100

loplugin:staticmethods

Change-Id: I8a6a6dcac8355796b984f6b37b791596fe9dca02

diff --git a/libreofficekit/source/gtk/lokdocview.cxx 
b/libreofficekit/source/gtk/lokdocview.cxx
index ebb09e7..b6ec892 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -171,7 +171,7 @@ struct LOKDocView_Impl
  */
 void renderDocument(GdkRectangle* pPartial);
 /// Sets rWidth and rHeight from a width, height string.
-void payloadToSize(const char* pPayload, long rWidth, long rHeight);
+static void payloadToSize(const char* pPayload, long rWidth, long 
rHeight);
 /// Returns the GdkRectangle of a width,height,x,y string.
 static GdkRectangle payloadToRectangle(const char* pPayload);
 /// Returns the GdkRectangles of a w,h,x,y;w2,h2,x2,y2;... string.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'feature/unitver' - 940 commits - accessibility/inc accessibility/source android/Bootstrap android/CustomTarget_android_desktop.mk android/CustomTarget_lo_androi

2015-05-24 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit c7cb454e1137346ea3b8ad1bc6090db4e213e9fe
Author: Andrzej Hunt andr...@ahunt.org
Date:   Sun May 24 10:35:39 2015 +0100

Update units error messsage for clarity.

Change-Id: Ib59b2317f962d01bcc65a981040c3452cee7206e

diff --git a/sc/source/ui/src/units.src b/sc/source/ui/src/units.src
index be4f970..7a818e9 100644
--- a/sc/source/ui/src/units.src
+++ b/sc/source/ui/src/units.src
@@ -21,7 +21,7 @@
 
 String STR_UNITS_ERRORINCELL
 {
-Text [ en-US ] = Error in formula in Cell $1 ;
+Text [ en-US ] = Units error in formula in Cell $1 ;
 };
 
 PushButton BT_UNITS_EDIT_CELL
commit a8b7811610f52480511841d55496dc869ef05439
Author: Andrzej Hunt andr...@ahunt.org
Date:   Tue May 12 21:16:13 2015 +0100

Convert convertCellUnits to handle ranges

Change-Id: Ibe95cbd9ea9efd08a48e0651f469434802bfa40e

diff --git a/sc/inc/units.hxx b/sc/inc/units.hxx
index b5e12da..8e15af4 100644
--- a/sc/inc/units.hxx
+++ b/sc/inc/units.hxx
@@ -107,7 +107,7 @@ public:
  * rsInputUnit overrides the automatic determination of input units, i.e. 
disables
  * input unit detection.
  */
-virtual bool convertCellUnits(const ScRange rRange,
+virtual bool convertCellUnits(const ScRangeList rRanges,
   ScDocument* pDoc,
   const OUString rsOutputUnit) = 0;
 
diff --git a/sc/qa/unit/units.cxx b/sc/qa/unit/units.cxx
index 29dfc2b..b35cd40 100644
--- a/sc/qa/unit/units.cxx
+++ b/sc/qa/unit/units.cxx
@@ -820,6 +820,7 @@ void UnitsTest::testRangeConversion() {
 // TODO: we need to test:
 // 1. mixture of units that can't be converted
 // 2. mixtures of local and header annotations
+// 3. actual sensible ranges
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(UnitsTest);
diff --git a/sc/source/core/units/unitsimpl.cxx 
b/sc/source/core/units/unitsimpl.cxx
index f2aa9e0..0f79edb 100644
--- a/sc/source/core/units/unitsimpl.cxx
+++ b/sc/source/core/units/unitsimpl.cxx
@@ -799,7 +799,7 @@ bool UnitsImpl::convertCellUnitsForColumnRange(const 
ScRange rRange,
 return bAllConverted;
 }
 
-bool UnitsImpl::convertCellUnits(const ScRange rRange,
+bool UnitsImpl::convertCellUnits(const ScRangeList rRangeList,
  ScDocument* pDoc,
  const OUString rsOutputUnit) {
 UtUnit aOutputUnit;
@@ -807,26 +807,28 @@ bool UnitsImpl::convertCellUnits(const ScRange rRange,
 return false;
 }
 
-ScRange aRange(rRange);
-aRange.PutInOrder();
-
-SCCOL nStartCol, nEndCol;
-SCROW nStartRow, nEndRow;
-SCTAB nStartTab, nEndTab;
-aRange.GetVars(nStartCol, nStartRow, nStartTab,
-   nEndCol, nEndRow, nEndTab);
-
-// Can only handle ranges in a single sheet for now
-assert(nStartTab == nEndTab);
-
-// Each column is independent hence we are able to handle each separately.
 bool bAllConverted = true;
-for (SCCOL nCol = nStartCol; nCol = nEndCol; nCol++) {
-ScRange aSubRange(ScAddress(nCol, nStartRow, nStartTab), 
ScAddress(nCol, nEndRow, nStartTab));
-bAllConverted = bAllConverted 
-convertCellUnitsForColumnRange(aSubRange, pDoc, 
aOutputUnit);
-}
 
+for (size_t i = 0; i  rRangeList.size(); i++) {
+ScRange aRange(*rRangeList[i]);
+
+aRange.PutInOrder();
+
+SCCOL nStartCol, nEndCol;
+SCROW nStartRow, nEndRow;
+SCTAB nStartTab, nEndTab;
+aRange.GetVars(nStartCol, nStartRow, nStartTab,
+   nEndCol, nEndRow, nEndTab);
+
+// Each column is independent hence we are able to handle each 
separately.
+for (SCTAB nTab = nStartTab; nTab = nEndTab; nTab++) {
+for (SCCOL nCol = nStartCol; nCol = nEndCol; nCol++) {
+ScRange aSubRange(ScAddress(nCol, nStartRow, nTab), 
ScAddress(nCol, nEndRow, nTab));
+bAllConverted = bAllConverted 
+convertCellUnitsForColumnRange(aSubRange, 
pDoc, aOutputUnit);
+}
+}
+}
 return bAllConverted;
 }
 
diff --git a/sc/source/core/units/unitsimpl.hxx 
b/sc/source/core/units/unitsimpl.hxx
index e7b4597..58e0971 100644
--- a/sc/source/core/units/unitsimpl.hxx
+++ b/sc/source/core/units/unitsimpl.hxx
@@ -103,7 +103,7 @@ public:
  const OUString rsNewUnit,
  const OUString rsOldUnit) 
SAL_OVERRIDE;
 
-virtual bool convertCellUnits(const ScRange rRange,
+virtual bool convertCellUnits(const ScRangeList rRanges,
   ScDocument* pDoc,
   const OUString rsOutputUnit) SAL_OVERRIDE;
 
commit 551979dc1ebe1d712ad1d1a78cbdb3f71e752e62
Author: Andrzej Hunt andr...@ahunt.org
Date:   Tue May 12 20:57:20 2015 +0100

Split convertCellUnits and change contract

This is in preparation for rewriting

[Libreoffice-commits] core.git: Branch 'feature/unitver' - 10 commits - sc/inc sc/qa sc/source

2015-05-12 Thread Andrzej Hunt
 sc/inc/units.hxx  |   27 +-
 sc/qa/unit/units.cxx  |  337 ++-
 sc/source/core/units/unitsimpl.cxx|  362 +++---
 sc/source/core/units/unitsimpl.hxx|   46 ++-
 sc/source/core/units/utunit.cxx   |3 
 sc/source/core/units/utunit.hxx   |   39 ++-
 sc/source/ui/condformat/condformatdlg.cxx |   33 ++
 sc/source/ui/inc/condformatdlg.hxx|4 
 8 files changed, 629 insertions(+), 222 deletions(-)

New commits:
commit f732a2444a6cc18c016cc79b0c364a87cc7d87e8
Author: Andrzej Hunt andr...@ahunt.org
Date:   Tue May 12 21:16:13 2015 +0100

Convert convertCellUnits to handle ranges

Change-Id: Ibe95cbd9ea9efd08a48e0651f469434802bfa40e

diff --git a/sc/inc/units.hxx b/sc/inc/units.hxx
index b5e12da..8e15af4 100644
--- a/sc/inc/units.hxx
+++ b/sc/inc/units.hxx
@@ -107,7 +107,7 @@ public:
  * rsInputUnit overrides the automatic determination of input units, i.e. 
disables
  * input unit detection.
  */
-virtual bool convertCellUnits(const ScRange rRange,
+virtual bool convertCellUnits(const ScRangeList rRanges,
   ScDocument* pDoc,
   const OUString rsOutputUnit) = 0;
 
diff --git a/sc/qa/unit/units.cxx b/sc/qa/unit/units.cxx
index 29dfc2b..b35cd40 100644
--- a/sc/qa/unit/units.cxx
+++ b/sc/qa/unit/units.cxx
@@ -820,6 +820,7 @@ void UnitsTest::testRangeConversion() {
 // TODO: we need to test:
 // 1. mixture of units that can't be converted
 // 2. mixtures of local and header annotations
+// 3. actual sensible ranges
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(UnitsTest);
diff --git a/sc/source/core/units/unitsimpl.cxx 
b/sc/source/core/units/unitsimpl.cxx
index f2aa9e0..0f79edb 100644
--- a/sc/source/core/units/unitsimpl.cxx
+++ b/sc/source/core/units/unitsimpl.cxx
@@ -799,7 +799,7 @@ bool UnitsImpl::convertCellUnitsForColumnRange(const 
ScRange rRange,
 return bAllConverted;
 }
 
-bool UnitsImpl::convertCellUnits(const ScRange rRange,
+bool UnitsImpl::convertCellUnits(const ScRangeList rRangeList,
  ScDocument* pDoc,
  const OUString rsOutputUnit) {
 UtUnit aOutputUnit;
@@ -807,26 +807,28 @@ bool UnitsImpl::convertCellUnits(const ScRange rRange,
 return false;
 }
 
-ScRange aRange(rRange);
-aRange.PutInOrder();
-
-SCCOL nStartCol, nEndCol;
-SCROW nStartRow, nEndRow;
-SCTAB nStartTab, nEndTab;
-aRange.GetVars(nStartCol, nStartRow, nStartTab,
-   nEndCol, nEndRow, nEndTab);
-
-// Can only handle ranges in a single sheet for now
-assert(nStartTab == nEndTab);
-
-// Each column is independent hence we are able to handle each separately.
 bool bAllConverted = true;
-for (SCCOL nCol = nStartCol; nCol = nEndCol; nCol++) {
-ScRange aSubRange(ScAddress(nCol, nStartRow, nStartTab), 
ScAddress(nCol, nEndRow, nStartTab));
-bAllConverted = bAllConverted 
-convertCellUnitsForColumnRange(aSubRange, pDoc, 
aOutputUnit);
-}
 
+for (size_t i = 0; i  rRangeList.size(); i++) {
+ScRange aRange(*rRangeList[i]);
+
+aRange.PutInOrder();
+
+SCCOL nStartCol, nEndCol;
+SCROW nStartRow, nEndRow;
+SCTAB nStartTab, nEndTab;
+aRange.GetVars(nStartCol, nStartRow, nStartTab,
+   nEndCol, nEndRow, nEndTab);
+
+// Each column is independent hence we are able to handle each 
separately.
+for (SCTAB nTab = nStartTab; nTab = nEndTab; nTab++) {
+for (SCCOL nCol = nStartCol; nCol = nEndCol; nCol++) {
+ScRange aSubRange(ScAddress(nCol, nStartRow, nTab), 
ScAddress(nCol, nEndRow, nTab));
+bAllConverted = bAllConverted 
+convertCellUnitsForColumnRange(aSubRange, 
pDoc, aOutputUnit);
+}
+}
+}
 return bAllConverted;
 }
 
diff --git a/sc/source/core/units/unitsimpl.hxx 
b/sc/source/core/units/unitsimpl.hxx
index e7b4597..58e0971 100644
--- a/sc/source/core/units/unitsimpl.hxx
+++ b/sc/source/core/units/unitsimpl.hxx
@@ -103,7 +103,7 @@ public:
  const OUString rsNewUnit,
  const OUString rsOldUnit) 
SAL_OVERRIDE;
 
-virtual bool convertCellUnits(const ScRange rRange,
+virtual bool convertCellUnits(const ScRangeList rRanges,
   ScDocument* pDoc,
   const OUString rsOutputUnit) SAL_OVERRIDE;
 
commit d60765f6ebba774787d3e553dbd680bf1de1fb0a
Author: Andrzej Hunt andr...@ahunt.org
Date:   Tue May 12 20:57:20 2015 +0100

Split convertCellUnits and change contract

This is in preparation for rewriting convertCellUnits to handle
ScRangeList's.

Change-Id

[Libreoffice-commits] core.git: Branch 'feature/unitver' - 5 commits - external/udunits2 sc/inc sc/qa sc/source

2015-05-11 Thread Andrzej Hunt
 external/udunits2/ExternalProject_udunits2.mk |1 
 sc/inc/units.hxx  |   22 ++
 sc/qa/unit/units.cxx  |   84 ++
 sc/source/core/data/column3.cxx   |2 
 sc/source/core/units/unitsimpl.cxx|   95 ++
 sc/source/core/units/unitsimpl.hxx|4 +
 sc/source/core/units/utunit.hxx   |5 +
 7 files changed, 211 insertions(+), 2 deletions(-)

New commits:
commit 59618d77b6150b50775d7d67f826c15a44ee505e
Author: Andrzej Hunt andr...@ahunt.org
Date:   Mon May 11 15:13:16 2015 +0100

Implement unit conversion for ranges.

Not entirely finished yet, some further refactoring needed elsewhere
to allow sensible implementation of the header editing.

Change-Id: I81af74d698098f901b17fcda413e7aac04c94274

diff --git a/sc/inc/units.hxx b/sc/inc/units.hxx
index 9837d36..381ec7d 100644
--- a/sc/inc/units.hxx
+++ b/sc/inc/units.hxx
@@ -16,6 +16,7 @@
 
 class ScAddress;
 class ScDocument;
+class ScRange;
 class ScTokenArray;
 
 namespace sc {
@@ -75,6 +76,27 @@ public:
  const OUString rsNewUnit,
  const OUString rsOldUnit) = 0;
 
+/**
+ * Convert cells from one unit to another.
+ *
+ * If possible the input unit will be determined automatically (using local
+ * and header units).
+ *
+ * Returns false if input units are not compatible with the desired output 
units,
+ * (including the case where some of the input units are compatibles but 
others
+ *  aren't).
+ *
+ * Local and header unit annotations are modified as appropriate such that 
the output
+ * remains unambiguous. Hence, if the header cell is included in rRange, 
its unit
+ * annotation is also updated as appropriate. If instead the header is 
excluded,
+ * but all other cells are selected in a column, then local annotations 
are added.
+ *
+ * rsInputUnit overrides the automatic determination of input units, i.e. 
disables
+ * input unit detection.
+ */
+virtual bool convertCellUnits(const ScRange rRange,
+  ScDocument* pDoc,
+  const OUString rsOutputUnit) = 0;
 
 virtual ~Units() {}
 };
diff --git a/sc/qa/unit/units.cxx b/sc/qa/unit/units.cxx
index e6ed779..8e83483 100644
--- a/sc/qa/unit/units.cxx
+++ b/sc/qa/unit/units.cxx
@@ -48,6 +48,7 @@ public:
 void testUnitFromHeaderExtraction();
 
 void testCellConversion();
+void testRangeConversion();
 
 CPPUNIT_TEST_SUITE(UnitsTest);
 
@@ -59,6 +60,7 @@ public:
 CPPUNIT_TEST(testUnitFromHeaderExtraction);
 
 CPPUNIT_TEST(testCellConversion);
+CPPUNIT_TEST(testRangeConversion);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -524,6 +526,88 @@ void UnitsTest::testCellConversion() {
 // to pass in the output of isCellConversionRecommended).
 }
 
+void UnitsTest::testRangeConversion() {
+const SCTAB nTab = 1;
+mpDoc-EnsureTable(nTab);
+
+// Column 1: convert [cm] to [cm].
+ScAddress headerAddress(0, 0, nTab);
+mpDoc-SetString(headerAddress, length [cm]);
+
+ScAddress address(headerAddress);
+
+vectordouble values({10, 20, 30, 40, 1, 0.5, 0.25});
+address.IncRow();
+mpDoc-SetValues(address, values);
+
+// Test conversion of range _not_ including header
+ScAddress endAddress( address.Col(), address.Row() + values.size() - 1, 
nTab);
+
+ScRange aRange(address, endAddress);
+CPPUNIT_ASSERT(mpUnitsImpl-convertCellUnits(aRange, mpDoc, cm));
+CPPUNIT_ASSERT(!mpUnitsImpl-convertCellUnits(aRange, mpDoc, kg));
+
+CPPUNIT_ASSERT(mpDoc-GetString(headerAddress) == length [cm]);
+
+for (double d: values) {
+// Test that the value is unchanged
+CPPUNIT_ASSERT(mpDoc-GetValue(address) == d);
+// And NO annotation has been added
+CPPUNIT_ASSERT(mpDoc-GetString(address) == OUString::number(d));
+address.IncRow();
+}
+
+// Test conversion of range including header (from cm to cm)
+aRange = ScRange(headerAddress, endAddress);
+CPPUNIT_ASSERT(mpUnitsImpl-convertCellUnits(aRange, mpDoc, cm));
+CPPUNIT_ASSERT(!mpUnitsImpl-convertCellUnits(aRange, mpDoc, kg));
+
+CPPUNIT_ASSERT(mpDoc-GetString(headerAddress) == length [cm]);
+
+address = headerAddress;
+address.IncRow();
+for (double d: values) {
+CPPUNIT_ASSERT_DOUBLES_EQUAL(mpDoc-GetValue(address), d, 1e-7);
+// And NO annotation has been added
+CPPUNIT_ASSERT(mpDoc-GetString(address) == OUString::number(d));
+address.IncRow();
+}
+
+// Convert just the values (but not header): [cm] to [m]
+address.SetRow(1);
+aRange = ScRange(address, endAddress);
+CPPUNIT_ASSERT(mpUnitsImpl-convertCellUnits(aRange, mpDoc, m));
+
+CPPUNIT_ASSERT(mpDoc-GetString(headerAddress) == length [cm

[Libreoffice-commits] core.git: Branch 'feature/unitver' - 14 commits - sc/Library_sc.mk sc/qa sc/source

2015-05-09 Thread Andrzej Hunt
 sc/Library_sc.mk   |1 
 sc/qa/unit/units.cxx   |  141 
 sc/source/core/units/raustack.cxx  |   54 ++
 sc/source/core/units/raustack.hxx  |   70 
 sc/source/core/units/unitsimpl.cxx |  308 -
 sc/source/core/units/unitsimpl.hxx |   57 ++
 sc/source/core/units/utunit.hxx|   18 ++
 7 files changed, 575 insertions(+), 74 deletions(-)

New commits:
commit eba23893a8671d0d951a9b87d355b124024cee24
Author: Andrzej Hunt andrzej.h...@collabora.com
Date:   Fri Apr 10 11:03:33 2015 +0100

Move and rename Range/Unit Stack.

This in preparation for implementing a combined Unit and Range iterator.

Change-Id: I08d28e175453f65c3696e9d1c6c20c7076d9b164

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 778415c..e22bda9 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -688,6 +688,7 @@ $(call gb_Library_add_exception_objects,sc,\
 
 ifeq ($(ENABLE_CALC_UNITVERIFICATION),TRUE)
 $(eval $(call gb_Library_add_exception_objects,sc,\
+sc/source/core/units/raustack \
 sc/source/core/units/units \
sc/source/core/units/unitsimpl \
sc/source/core/units/util \
diff --git a/sc/source/core/units/raustack.cxx 
b/sc/source/core/units/raustack.cxx
new file mode 100644
index 000..f838acf
--- /dev/null
+++ b/sc/source/core/units/raustack.cxx
@@ -0,0 +1,54 @@
+/* -*- 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 raustack.hxx
+
+using namespace sc::units;
+
+RangeListIterator::RangeListIterator(ScDocument* pDoc, const ScRangeList 
rRangeList)
+:
+mRangeList(rRangeList),
+mpDoc(pDoc),
+mIt(pDoc, ScRange()),
+nCurrentIndex(0)
+{
+}
+
+bool RangeListIterator::first() {
+if (mRangeList.size()  0) {
+mIt = ScCellIterator(mpDoc, *mRangeList[0]);
+return mIt.first();
+} else {
+return false;
+}
+}
+
+const ScAddress RangeListIterator::GetPos() const {
+return mIt.GetPos();
+}
+
+bool RangeListIterator::next() {
+if (!(mRangeList.size()  0) || nCurrentIndex = mRangeList.size()) {
+return false;
+}
+
+if (mIt.next()) {
+return true;
+} else if (++nCurrentIndex  mRangeList.size()) {
+mIt = ScCellIterator(mpDoc, *mRangeList[nCurrentIndex]);
+mIt.first();
+// TODO: if emtpy - skip to next...?
+return true;
+} else {
+return false;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/sc/source/core/units/raustack.hxx 
b/sc/source/core/units/raustack.hxx
new file mode 100644
index 000..b5cf48b
--- /dev/null
+++ b/sc/source/core/units/raustack.hxx
@@ -0,0 +1,70 @@
+/* -*- 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/.
+ *
+ */
+#ifndef INCLUDED_SC_SOURCE_CORE_UNITS_RAUSTACK_HXX
+#define INCLUDED_SC_SOURCE_CORE_UNITS_RAUSTACK_HXX
+
+#include boost/variant.hpp
+
+#include address.hxx
+#include dociter.hxx
+#include rangelst.hxx
+
+
+#include utunit.hxx
+
+namespace sc {
+namespace units {
+
+enum class RAUSItemType {
+UNITS,
+RANGE
+};
+
+struct RAUSItem {
+RAUSItemType type;
+boost::variant ScRange, UtUnit  item;
+};
+
+class RangeListIterator {
+private:
+const ScRangeList mRangeList;
+ScDocument* mpDoc;
+
+ScCellIterator mIt;
+size_t nCurrentIndex;
+
+public:
+RangeListIterator(ScDocument* pDoc, const ScRangeList rRangeList);
+
+bool first();
+
+const ScAddress GetPos() const;
+
+bool next();
+};
+
+}} // sc::units
+
+// class RangeAndUnitStack {
+
+
+
+// };
+
+// class RATSIterator {
+// public:
+// // TODO: need to be able to return non-initialisation
+// static RATSIterator getIterator(RangeAndTokenStack rStack, ScDoc* 
pDoc, int nItems);
+
+// }
+
+#endif // INCLUDED_SC_SOURCE_CORE_UNITS_RAUSTACK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/units/unitsimpl.cxx 
b/sc/source/core/units/unitsimpl.cxx
index 99e03af..e8fb261 100644
--- a/sc/source/core/units/unitsimpl.cxx
+++ b/sc/source/core/units/unitsimpl.cxx
@@ -11,7 +11,6 @@
 
 #include util.hxx
 
-#include dociter.hxx
 #include document.hxx
 #include refdata.hxx
 #include stringutil.hxx
@@ -85,55 +84,7 @@ UnitsImpl::~UnitsImpl() {
 // (i.e. if udunits can't handle being used across threads)?
 }
 
-class RangeListIterator {
-private:
-const ScRangeList mRangeList;
-ScDocument* mpDoc

[Libreoffice-commits] core.git: Branch 'feature/unitver' - 3946 commits - accessibility/inc accessibility/source android/Bootstrap android/experimental android/.gitignore android/mobile-config.py andr

2015-05-09 Thread Andrzej Hunt
Rebased ref, commits from common ancestor:
commit aa614666336f6e23720cd7acea88399b88f9deff
Author: Andrzej Hunt andr...@ahunt.org
Date:   Sat May 9 20:35:04 2015 +0100

Store pre-conversion value in cell annotation.

Change-Id: I67d8d1a7b0190b91107987a1ae4f03f2e91b06ca

diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 605b79a..b156587 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2971,11 +2971,27 @@ IMPL_LINK( ScViewFunc, 
UnitConversionRecommendedHandler, UnitConversionPushButto
 
 ScDocShellModificator aModificator( *pButton-mpDocSh );
 
+OUString sOriginalValue = pButton-mpDoc-GetString( pButton-aCellAddress 
);
+
 pUnits-convertCellToHeaderUnit( pButton-aCellAddress,
  pButton-mpDoc,
  pButton-sHeaderUnit,
  pButton-sCellUnit );
 
+ScPostIt* pNote = pButton-mpDoc-GetOrCreateNote( pButton-aCellAddress );
+OUString sCurrentNote = pNote-GetText();
+
+OUString sConversionNote(Original input:  + sOriginalValue);
+
+if (sCurrentNote.isEmpty())
+{
+pNote-SetText( pButton-aCellAddress, sConversionNote );
+}
+else
+{
+pNote-SetText( pButton-aCellAddress, sCurrentNote + \n\n + 
sConversionNote );
+}
+
 aModificator.SetDocumentModified();
 #endif
 
commit e5265133586501c5dccffed083fa2e1955ff765f
Author: Andrzej Hunt andr...@ahunt.org
Date:   Sat May 9 20:34:10 2015 +0100

Set document modified on local unit conversion.

Change-Id: I668817a7987d14728fb1de1abe3711e34d9a

diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 20d6872..a6b36b8 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -380,7 +380,8 @@ private:
  ScDocument* pDoc,
  const OUString 
sHeaderUnit,
  const ScAddress 
rHeaderAddress,
- const OUString sCellUnit 
);
+ const OUString sCellUnit,
+ ScDocShell* pDocSh );
 DECL_LINK( UnitConversionRecommendedHandler, UnitConversionPushButton* );
 };
 
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 595c5a9..605b79a 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -586,7 +586,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB 
nTab,
 ScAddress aHeaderAddress;
 
 if ( pUnits-isCellConversionRecommended( aAddress, pDoc, 
sHeaderUnit, aHeaderAddress, sCellUnit ) ) {
-NotifyUnitConversionRecommended( aAddress, pDoc, sHeaderUnit, 
aHeaderAddress, sCellUnit );
+NotifyUnitConversionRecommended( aAddress, pDoc, sHeaderUnit, 
aHeaderAddress, sCellUnit, pDocSh );
 } else {
 SfxViewFrame* pViewFrame = 
GetViewData().GetViewShell()-GetFrame();
 OUString sAddress = aAddress.Format( SCA_BITS, pDoc );
@@ -2904,26 +2904,30 @@ struct UnitConversionPushButton: public PushButton
 ScDocument* mpDoc;
 const OUString sHeaderUnit;
 const OUString sCellUnit;
+ScDocShell* mpDocSh;
 
 UnitConversionPushButton( vcl::Window* pParent,
   const ResId rResId,
   const ScAddress rCellAddress,
   ScDocument* pDoc,
   const OUString rsHeaderUnit,
-  const OUString rsCellUnit ):
+  const OUString rsCellUnit,
+  ScDocShell* pDocSh ):
 PushButton( pParent, rResId ),
 aCellAddress( rCellAddress ),
 mpDoc( pDoc ),
 sHeaderUnit( rsHeaderUnit ),
-sCellUnit( rsCellUnit )
+sCellUnit( rsCellUnit ),
+mpDocSh( pDocSh )
 {}
 };
 
 void ScViewFunc::NotifyUnitConversionRecommended( const ScAddress 
rCellAddress,
- ScDocument* pDoc,
- const OUString rsHeaderUnit,
- const ScAddress 
rHeaderAddress,
- const OUString rsCellUnit ) {
+  ScDocument* pDoc,
+  const OUString rsHeaderUnit,
+  const ScAddress 
rHeaderAddress,
+  const OUString rsCellUnit,
+  ScDocShell* pDocSh ) {
 SfxViewFrame* pViewFrame = GetViewData().GetViewShell()-GetFrame

  1   2   3   4   5   >