Anonymous avatar Anonymous committed 1906fa3 Merge

Merge with DEV300

Comments (0)

Files changed (24)

chart2/source/controller/chartapiwrapper/TitleWrapper.cxx

     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
     
     aWrappedProperties.push_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) );
-    aWrappedProperties.push_back( new WrappedTextRotationProperty() );
+    aWrappedProperties.push_back( new WrappedTextRotationProperty( m_eTitleType==TitleHelper::Y_AXIS_TITLE || m_eTitleType==TitleHelper::X_AXIS_TITLE ) );
     aWrappedProperties.push_back( new WrappedStackedTextProperty() );
     WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
     WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );

chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx

 
 #include "WrappedTextRotationProperty.hxx"
 #include "macros.hxx"
+#include <com/sun/star/beans/XPropertyState.hpp>
 
+using namespace ::com::sun::star;
 using ::com::sun::star::uno::Any;
 using ::rtl::OUString;
 
 {
 //.............................................................................
 
-WrappedTextRotationProperty::WrappedTextRotationProperty()
+WrappedTextRotationProperty::WrappedTextRotationProperty( bool bDirectState )
     : ::chart::WrappedProperty( C2U( "TextRotation" ), C2U( "TextRotation" ) )
+    , m_bDirectState( bDirectState )
 {
 }
 WrappedTextRotationProperty::~WrappedTextRotationProperty()
 {
 }
+
+beans::PropertyState WrappedTextRotationProperty::getPropertyState( const uno::Reference< beans::XPropertyState >& xInnerPropertyState ) const
+                        throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+    if( m_bDirectState )
+        return beans::PropertyState_DIRECT_VALUE;
+    return WrappedProperty::getPropertyState( xInnerPropertyState );
+}
+
 Any WrappedTextRotationProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
 {
     Any aRet;

chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx

 class WrappedTextRotationProperty : public WrappedProperty
 {
 public:
-    WrappedTextRotationProperty();
+    WrappedTextRotationProperty( bool bDirectState=false );
     virtual ~WrappedTextRotationProperty();
 
+    virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+                        throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
 protected:
     virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
     virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
+
+    bool m_bDirectState;
 };
 
 //.............................................................................

formula/source/core/api/FormulaCompiler.cxx

 
 //---------------------------------------------------------------------------
 
-void FormulaCompiler::UnionLine()
+void FormulaCompiler::IntersectionLine()
 {
     RangeLine();
-    while (pToken->GetOpCode() == ocUnion)
+    while (pToken->GetOpCode() == ocIntersect)
     {
         FormulaTokenRef p = pToken;
         NextToken();
 
 //---------------------------------------------------------------------------
 
-void FormulaCompiler::IntersectionLine()
+void FormulaCompiler::UnionLine()
 {
-    UnionLine();
-    while (pToken->GetOpCode() == ocIntersect)
+    IntersectionLine();
+    while (pToken->GetOpCode() == ocUnion)
     {
         FormulaTokenRef p = pToken;
         NextToken();
-        UnionLine();
+        IntersectionLine();
         PutCode(p);
     }
 }
         PutCode( p );
     }
     else
-        IntersectionLine();
+        UnionLine();
 }
 
 //---------------------------------------------------------------------------

framework/source/helper/statusindicatorfactory.cxx

 // includes of other projects
 #include <comphelper/sequenceashashmap.hxx>
 #include <comphelper/mediadescriptor.hxx>
+#include <comphelper/configurationhelper.hxx>
 #include <vcl/svapp.hxx>
 #include <vos/mutex.hxx>
 
 
     css::uno::Reference< css::frame::XFrame > xFrame      (m_xFrame.get()      , css::uno::UNO_QUERY);
     css::uno::Reference< css::awt::XWindow >  xPluggWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
+    css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR.get(), css::uno::UNO_QUERY);
 
     aReadLock.unlock();
     // <- SAFE ----------------------------------
     // is visible too.
     impl_showProgress();
 
-    if (xParentWindow.is())
-        xParentWindow->setVisible(sal_True);
+    ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex());
+    Window* pWindow = VCLUnoHelper::GetWindow(xParentWindow);
+    if ( pWindow )
+    {
+        bool bForceFrontAndFocus(false);
+        ::comphelper::ConfigurationHelper::readDirectKey(
+            xSMGR,
+            ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"),
+            ::rtl::OUString::createFromAscii("NewDocumentHandling"),
+            ::rtl::OUString::createFromAscii("ForceFocusAndToFront"),
+            ::comphelper::ConfigurationHelper::E_READONLY) >>= bForceFrontAndFocus;
+
+        pWindow->Show(sal_True, bForceFrontAndFocus ? SHOW_FOREGROUNDTASK : 0 );
+    }
+
     /*
     #i75167# dont disturb window manager handling .-)
     css::uno::Reference< css::awt::XTopWindow > xParentWindowTop(xParentWindow, css::uno::UNO_QUERY);

framework/source/loadenv/loadenv.cxx

 void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::XWindow >& xWindow      ,
                                                 sal_Bool bForceToFront)            
 {
-    css::uno::Reference< css::awt::XTopWindow > xTopWindow(xWindow, css::uno::UNO_QUERY);
+    // SAFE -> ----------------------------------
+    ReadGuard aReadLock(m_aLock);
+    css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR.get(), css::uno::UNO_QUERY );
+    aReadLock.unlock();
+    // <- SAFE ----------------------------------
 
-    if (xWindow.is())
-        xWindow->setVisible(sal_True);
+    ::vos::OClearableGuard aSolarGuard(Application::GetSolarMutex());
+    Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+    if ( pWindow )
+    {
+        bool bForceFrontAndFocus(false);
+        css::uno::Any a = ::comphelper::ConfigurationHelper::readDirectKey(
+            xSMGR,
+            ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/View"),
+            ::rtl::OUString::createFromAscii("NewDocumentHandling"),
+            ::rtl::OUString::createFromAscii("ForceFocusAndToFront"),
+            ::comphelper::ConfigurationHelper::E_READONLY);
+        a >>= bForceFrontAndFocus;
 
-    if (xTopWindow.is() && bForceToFront)
-        xTopWindow->toFront();
-
+        pWindow->Show(sal_True, (bForceFrontAndFocus || bForceToFront) ? SHOW_FOREGROUNDTASK : 0 );
+    }
+    
 /* #i19976#
     We tried to prevent a toFront() call in case the user putted the
     loading document into the background ..

i18npool/source/calendar/calendar_gregorian.cxx

 
         bool bNeedZone = !(fieldSet & (1 << CalendarFieldIndex::ZONE_OFFSET));
         bool bNeedDST  = !(fieldSet & (1 << CalendarFieldIndex::DST_OFFSET));
-        sal_Int32 nZone1, nDST1, nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone, nDST;
-        nZone1 = nDST1 = nZone = nDST = 0;
+        sal_Int32 nZone1, nDST1, nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone0, nDST0;
+        nZone1 = nDST1 = nZone0 = nDST0 = 0;
         nYear = nMonth = nDay = nHour = nMinute = nSecond = nMilliSecond = -1;
         if ( bNeedZone || bNeedDST )
         {
             }
             if ( !(fieldSet & (1 << CalendarFieldIndex::ZONE_OFFSET)) )
             {
-                nZone = body->get( UCAL_ZONE_OFFSET, status = U_ZERO_ERROR);
+                nZone0 = body->get( UCAL_ZONE_OFFSET, status = U_ZERO_ERROR);
                 if ( !U_SUCCESS(status) )
-                    nZone = 0;
+                    nZone0 = 0;
             }
             if ( !(fieldSet & (1 << CalendarFieldIndex::DST_OFFSET)) )
             {
-                nDST = body->get( UCAL_DST_OFFSET, status = U_ZERO_ERROR);
+                nDST0 = body->get( UCAL_DST_OFFSET, status = U_ZERO_ERROR);
                 if ( !U_SUCCESS(status) )
-                    nDST = 0;
+                    nDST0 = 0;
             }
 
             // Submit values to obtain a time zone and DST corresponding to the date/time.
-            submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone, nDST);
+            submitValues( nYear, nMonth, nDay, nHour, nMinute, nSecond, nMilliSecond, nZone0, nDST0);
 
             DUMP_ICU_CAL_MSG(("%s\n","setValue() in bNeedZone||bNeedDST after submitValues()"));
             DUMP_I18N_CAL_MSG(("%s\n","setValue() in bNeedZone||bNeedDST after submitValues()"));
                 nDST1 = 0;
         }
 
-        // The original submission, may lead to a different zone/DST.
+        // The original submission, may lead to a different zone/DST and 
+        // different date.
         submitFields();
         DUMP_ICU_CAL_MSG(("%s\n","setValue() after original submission"));
         DUMP_I18N_CAL_MSG(("%s\n","setValue() after original submission"));
             sal_Int32 nDST2 = body->get( UCAL_DST_OFFSET, status = U_ZERO_ERROR);
             if ( !U_SUCCESS(status) )
                 nDST2 = nDST1;
-            if ( nZone2 != nZone1 || nDST2 != nDST1 )
+            if ( nZone0 != nZone1 || nZone2 != nZone1 || nDST0 != nDST1 || nDST2 != nDST1 )
             {
                 // Due to different DSTs, resulting date values may differ if
                 // DST is onset at 00:00 and the very onsetRule date was
                 // is not what we want.
                 // Resubmit all values, this time including DST => date 01:00
                 // Similar for zone differences.
+                // If already the first full submission with nZone0 and nDST0 
+                // lead to date-1 23:00, the original submission was based on 
+                // that date if it wasn't a full date (nDST0 set, nDST1 not 
+                // set, nDST2==nDST1). If it was January 1st without year we're 
+                // even off by one year now. Resubmit all values including new 
+                // DST => date 00:00.
 
                 // Set field values accordingly in case they were used.
                 if (!bNeedZone)

officecfg/registry/schema/org/openoffice/Office/Common.xcs

 				</info>
 			</set>
 		</group>
-        <group oor:name="Save">
+    <group oor:name="Save">
 			<info>
 				<author>MBA</author>
 				<desc>Contains general settings about the saving process.</desc>
 				</constraints>
 				<value>0</value>
 			</prop>
+			<group oor:name="NewDocumentHandling">
+				<info>
+					<author>CD</author>
+					<desc>Contains settings to change new document window behavior.</desc>
+				</info>
+				<prop oor:name="ForceFocusAndToFront" oor:type="xs:boolean">
+					<info>
+						<author>CD</author>
+						<desc>Every new document window will be forced to front and grabs the focus.</desc>
+					</info>
+					<value>true</value>
+				</prop>
+			</group>
 			<group oor:name="AppWindow">
 				<info>
 					<author>MBA</author>

package/inc/ByteGrabber.hxx

 #include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 
+#include <osl/mutex.hxx>
+
 namespace com { namespace sun { namespace star {
 	namespace io { class XSeekable; class XInputStream; }
 } } }
 class ByteGrabber 
 {
 protected:
+    ::osl::Mutex m_aMutex;
+
 	com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
 	com::sun::star::uno::Reference < com::sun::star::io::XSeekable > xSeek;
 	com::sun::star::uno::Sequence < sal_Int8 > aSequence;

package/inc/ZipFile.hxx

 class ZipFile
 {
 protected:
+    ::osl::Mutex    m_aMutex;
+
     ::rtl::OUString	sComment; 	  	/* zip file comment */
 	EntryHash		aEntries;
 	ByteGrabber 	aGrabber;

package/source/zipapi/ByteGrabber.cxx

 ByteGrabber::~ByteGrabber()
 {
 }
+
 void ByteGrabber::setInputStream (uno::Reference < io::XInputStream > xNewStream)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
 	xStream = xNewStream;
 	xSeek = uno::Reference < io::XSeekable > (xNewStream, uno::UNO_QUERY);
 }
 										sal_Int32 nBytesToRead ) 
 	throw(io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
 	return xStream->readBytes(aData, nBytesToRead );
 }
 
 sal_Int64 SAL_CALL ByteGrabber::seek( sal_Int64 location ) 
 	throw(lang::IllegalArgumentException, io::IOException, uno::RuntimeException)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
 	if (xSeek.is() )
 	{
 		sal_Int64 nLen = xSeek->getLength();
 	else
 		throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
 }
+
 sal_Int64 SAL_CALL ByteGrabber::getPosition(  ) 
 		throw(io::IOException, uno::RuntimeException)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
 	if (xSeek.is() )
 		return xSeek->getPosition();
 	else
 		throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
 }
+
 sal_Int64 SAL_CALL ByteGrabber::getLength(  )
 		throw(io::IOException, uno::RuntimeException)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
 	if (xSeek.is() )
 		return xSeek->getLength();
 	else
 		throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
 }
+
 ByteGrabber& ByteGrabber::operator >> (sal_Int8& rInt8)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
 	if (xStream->readBytes(aSequence,1) != 1)
 		rInt8 = 0;
 	else
 		rInt8 = aSequence[0] & 0xFF;
 	return *this;
 }
+
 ByteGrabber& ByteGrabber::operator >> (sal_Int16& rInt16)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
 	if (xStream->readBytes ( aSequence, 2) != 2)
 		rInt16 = 0;
 	else
 	}
 	return *this;
 }
+
 ByteGrabber& ByteGrabber::operator >> (sal_Int32& rInt32)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	if (xStream->readBytes(aSequence, 4) != 4)
 		rInt32 = 0;
 	else
 
 ByteGrabber& ByteGrabber::operator >> (sal_uInt8& rInt8)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	if (xStream->readBytes(aSequence,1) != 1)
 		rInt8 = 0;
 	else
 }
 ByteGrabber& ByteGrabber::operator >> (sal_uInt16& rInt16)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	if (xStream->readBytes(aSequence, 2) != 2)
 		rInt16 = 0;
 	else
 }
 ByteGrabber& ByteGrabber::operator >> (sal_uInt32& ruInt32)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	if (xStream->readBytes(aSequence, 4) != 4)
 		ruInt32 = 0;
 	else

package/source/zipapi/ZipFile.cxx

 
 void ZipFile::setInputStream ( Reference < XInputStream > xNewStream )
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	xStream = xNewStream;
 	xSeek = Reference < XSeekable > ( xStream, UNO_QUERY );
 	aGrabber.setInputStream ( xStream );
 
 sal_Bool ZipFile::hasValidPassword ( ZipEntry & rEntry, const ORef < EncryptionData > &rData )
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	sal_Bool bRet = sal_False;
 	if ( rData->aKey.getLength() )
 	{
 			sal_Bool bIsEncrypted,
 			::rtl::OUString aMediaType )
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	return new XUnbufferedStream ( aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
 }
 
         SotMutexHolderRef aMutexHolder )
 	throw(IOException, ZipException, RuntimeException)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	if ( rEntry.nOffset <= 0 )
 		readLOC( rEntry );
 
 			ZipException,
 			RuntimeException )
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	if ( rEntry.nOffset <= 0 )
 		readLOC( rEntry );
 
         SotMutexHolderRef aMutexHolder )
 	throw(IOException, ZipException, RuntimeException)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	if ( rEntry.nOffset <= 0 )
 		readLOC( rEntry );
 
 			ZipException,
 			RuntimeException )
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	if ( rData.isEmpty() )
 		throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
 
 sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
 	throw(IOException, ZipException, RuntimeException)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	sal_Int32 nTestSig, nTime, nCRC, nSize, nCompressedSize;
 	sal_Int16 nVersion, nFlag, nHow, nPathLen, nExtraLen;
 	sal_Int32 nPos = -rEntry.nOffset;
 sal_Int32 ZipFile::findEND( )
 	throw(IOException, ZipException, RuntimeException)
 {
+    // this method is called in constructor only, no need for mutex
 	sal_Int32 nLength, nPos, nEnd;
 	Sequence < sal_Int8 > aBuffer;
 	try
 sal_Int32 ZipFile::readCEN()
 	throw(IOException, ZipException, RuntimeException)
 {
+    // this method is called in constructor only, no need for mutex
 	sal_Int32 nCenLen, nCenPos = -1, nCenOff, nEndPos, nLocPos;
 	sal_uInt16 nCount, nTotal;
 
 sal_Int32 ZipFile::recover()
 	throw(IOException, ZipException, RuntimeException)
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	sal_Int32 nLength;
 	Sequence < sal_Int8 > aBuffer;
 	Sequence < sal_Int32 > aHeaderOffsets;
 
 sal_Bool ZipFile::checkSizeAndCRC( const ZipEntry& aEntry )
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	sal_Int32 nSize = 0, nCRC = 0;
 
 	if( aEntry.nMethod == STORED )
 
 sal_Int32 ZipFile::getCRC( sal_Int32 nOffset, sal_Int32 nSize )
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	Sequence < sal_Int8 > aBuffer;
 	CRC32 aCRC;
 	sal_Int32 nBlockSize = ::std::min( nSize, static_cast< sal_Int32 >( 32000 ) );
 
 void ZipFile::getSizeAndCRC( sal_Int32 nOffset, sal_Int32 nCompressedSize, sal_Int32 *nSize, sal_Int32 *nCRC )
 {
+    ::osl::MutexGuard aGuard( m_aMutex );
+
 	Sequence < sal_Int8 > aBuffer;
 	CRC32 aCRC;
 	sal_Int32 nRealSize = 0;

sal/osl/unx/file.cxx

 #include <limits>
 
 #include <string.h>
+#include <pthread.h>
 #include <sys/mman.h>
 
 #if defined(MACOSX)
  ******************************************************************/
 struct FileHandle_Impl
 {
-    rtl_String * m_strFilePath; /* holds native file path */
-    int          m_fd;
+    pthread_mutex_t m_mutex;
+    rtl_String *    m_strFilePath; /* holds native file path */
+    int             m_fd;
 
     /** State
      */
         Allocator();
         ~Allocator();
     };
+
+    /** Guard.
+     */
+    class Guard
+    {
+        pthread_mutex_t * m_mutex;
+
+    public:
+        explicit Guard(pthread_mutex_t * pMutex);
+        ~Guard();
+    };
 };
 
 /*******************************************************************
         rtl_cache_free (m_cache, pBuffer);
 }
 
+FileHandle_Impl::Guard::Guard(pthread_mutex_t * pMutex)
+    : m_mutex (pMutex)
+{
+    OSL_PRECOND (m_mutex != 0, "FileHandle_Impl::Guard::Guard(): null pointer.");
+    (void) pthread_mutex_lock (m_mutex); // ignoring EINVAL ...
+}
+FileHandle_Impl::Guard::~Guard()
+{
+    OSL_PRECOND (m_mutex != 0, "FileHandle_Impl::Guard::~Guard(): null pointer.");
+    (void) pthread_mutex_unlock (m_mutex);
+}
+
 FileHandle_Impl::FileHandle_Impl (int fd, char const * path)
     : m_strFilePath (0),
       m_fd      (fd),
       m_bufsiz  (0),
       m_buffer  (0)
 {
+    (void) pthread_mutex_init(&m_mutex, 0);
     rtl_string_newFromStr (&m_strFilePath, path);
     Allocator::get().allocate (&m_buffer, &m_bufsiz);
     if (0 != m_buffer)
 {
     Allocator::get().deallocate (m_buffer), m_buffer = 0;
     rtl_string_release (m_strFilePath), m_strFilePath = 0;
+    (void) pthread_mutex_destroy(&m_mutex); // ignoring EBUSY ...
 }
 
 void* FileHandle_Impl::operator new (size_t n)
     if ((pImpl == 0) || (pImpl->m_fd < 0))
         return osl_File_E_INVAL;
 
+    (void) pthread_mutex_lock (&(pImpl->m_mutex));
+
     /* close(2) implicitly (and unconditionally) unlocks */
     OSL_TRACE("osl_closeFile(%d) => %s", pImpl->m_fd, rtl_string_getStr(pImpl->m_strFilePath));
     oslFileError result = pImpl->syncFile();
         result = oslTranslateFileError (OSL_FET_ERROR, errno);
     }
 
+    (void) pthread_mutex_unlock (&(pImpl->m_mutex));
     delete pImpl;
     return (result);
 }
     if ((0 == pImpl) || (-1 == pImpl->m_fd))
         return osl_File_E_INVAL;
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
+
     OSL_FILE_TRACE("osl_syncFile(%d)", pImpl->m_fd);
     oslFileError result = pImpl->syncFile();
     if (result != osl_File_E_None)
     sal_uInt64 uBytesRead = 0;
 
     // read at current fileptr; fileptr += uBytesRead;
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     oslFileError result = pImpl->readLineAt (
         pImpl->m_fileptr, ppSequence, &uBytesRead);
     if (result == osl_File_E_None)
 	size_t const nBytesRequested = sal::static_int_cast< size_t >(uBytesRequested);
 
     // read at current fileptr; fileptr += *pBytesRead;
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     oslFileError result = pImpl->readFileAt (
         pImpl->m_fileptr, pBuffer, nBytesRequested, pBytesRead);
     if (result == osl_File_E_None)
 	size_t const nBytesToWrite = sal::static_int_cast< size_t >(uBytesToWrite);
 
     // write at current fileptr; fileptr += *pBytesWritten;
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     oslFileError result = pImpl->writeFileAt (
         pImpl->m_fileptr, pBuffer, nBytesToWrite, pBytesWritten);
     if (result == osl_File_E_None)
 	size_t const nBytesRequested = sal::static_int_cast< size_t >(uBytesRequested);
 
     // read at specified fileptr
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     return pImpl->readFileAt (nOffset, pBuffer, nBytesRequested, pBytesRead);
 }
 
 	size_t const nBytesToWrite = sal::static_int_cast< size_t >(uBytesToWrite);
 
     // write at specified fileptr
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     return pImpl->writeFileAt (nOffset, pBuffer, nBytesToWrite, pBytesWritten);
 }
 
     if ((0 == pImpl) || (-1 == pImpl->m_fd) || (0 == pIsEOF))
         return osl_File_E_INVAL;
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     *pIsEOF = (pImpl->getPos() == pImpl->getSize());
     return osl_File_E_None;
 }
     if ((0 == pImpl) || (-1 == pImpl->m_fd) || (0 == pPos))
         return osl_File_E_INVAL;
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     *pPos = pImpl->getPos();
     return osl_File_E_None;
 }
 		return osl_File_E_OVERFLOW;
 	off_t nPos = 0, nOffset = sal::static_int_cast< off_t >(uOffset);
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     switch(uHow)
     {
         case osl_Pos_Absolut:
     if ((0 == pImpl) || (-1 == pImpl->m_fd) || (0 == pSize))
         return osl_File_E_INVAL;
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     *pSize = pImpl->getSize();
     return osl_File_E_None;
 }

sal/osl/w32/file.cxx

 //##################################################################
 struct FileHandle_Impl
 {
-    HANDLE m_hFile;
+    CRITICAL_SECTION m_mutex;
+    HANDLE           m_hFile;
 
 	/** State
 	 */
 		Allocator();
 		~Allocator();
 	};
+
+    /** Guard.
+     */
+    class Guard
+    {
+        LPCRITICAL_SECTION m_mutex;
+
+    public:
+        explicit Guard(LPCRITICAL_SECTION pMutex);
+        ~Guard();
+    };
 };
 
 FileHandle_Impl::Allocator &
 		rtl_cache_free (m_cache, pBuffer);
 }
 
+FileHandle_Impl::Guard::Guard(LPCRITICAL_SECTION pMutex)
+    : m_mutex (pMutex)
+{
+    OSL_PRECOND (m_mutex != 0, "FileHandle_Impl::Guard::Guard(): null pointer.");
+    ::EnterCriticalSection (m_mutex);
+}
+FileHandle_Impl::Guard::~Guard()
+{
+    OSL_PRECOND (m_mutex != 0, "FileHandle_Impl::Guard::~Guard(): null pointer.");
+    ::LeaveCriticalSection (m_mutex);
+}
+
 FileHandle_Impl::FileHandle_Impl(HANDLE hFile)
 	: m_hFile   (hFile),
 	  m_state   (STATE_READABLE | STATE_WRITEABLE),
 	  m_bufsiz  (0),
 	  m_buffer  (0)
 {
+    ::InitializeCriticalSection (&m_mutex);
 	Allocator::get().allocate (&m_buffer, &m_bufsiz);
 	if (m_buffer != 0)
 		memset (m_buffer, 0, m_bufsiz);
 FileHandle_Impl::~FileHandle_Impl()
 {
 	Allocator::get().deallocate (m_buffer), m_buffer = 0;
+    ::DeleteCriticalSection (&m_mutex);
 }
 
 void * FileHandle_Impl::operator new(size_t n)
 	if ((0 == pImpl) || !IsValidHandle(pImpl->m_hFile))
 		return osl_File_E_INVAL;
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
+
 	oslFileError result = pImpl->syncFile();
 	if (result != osl_File_E_None)
 		return result;
 	if ((0 == pImpl) || !IsValidHandle(pImpl->m_hFile))
 		return osl_File_E_INVAL;
 
+    ::EnterCriticalSection (&(pImpl->m_mutex));
+
 	oslFileError result = pImpl->syncFile();
 	if (result != osl_File_E_None)
 	{
 		result = oslTranslateFileError( GetLastError() );
 	}
 
+    ::LeaveCriticalSection (&(pImpl->m_mutex));
 	delete pImpl;
 	return (result);
 }
 	sal_uInt64 uBytesRead = 0;
 
 	// read at current filepos; filepos += uBytesRead;
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
 	oslFileError result = pImpl->readLineAt (
 		pImpl->m_filepos, ppSequence, &uBytesRead);
 	if (result == osl_File_E_None)
 		return osl_File_E_INVAL;
 
 	// read at current filepos; filepos += *pBytesRead;
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
 	oslFileError result = pImpl->readFileAt (
 		pImpl->m_filepos, pBuffer, uBytesRequested, pBytesRead);
 	if (result == osl_File_E_None)
 		return osl_File_E_INVAL;
 
 	// write at current filepos; filepos += *pBytesWritten;
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
 	oslFileError result = pImpl->writeFileAt (
 		pImpl->m_filepos, pBuffer, uBytesToWrite, pBytesWritten);
 	if (result == osl_File_E_None)
 	LONGLONG const nOffset = sal::static_int_cast< LONGLONG >(uOffset);
 
 	// read at specified fileptr
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
 	return pImpl->readFileAt (nOffset, pBuffer, uBytesRequested, pBytesRead);
 }
 
 	LONGLONG const nOffset = sal::static_int_cast< LONGLONG >(uOffset);
 
 	// write at specified fileptr
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
 	return pImpl->writeFileAt (nOffset, pBuffer, uBytesToWrite, pBytesWritten);
 }
 
 	if ((0 == pImpl) || !IsValidHandle(pImpl->m_hFile) || (0 == pIsEOF))
 		return osl_File_E_INVAL;
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
 	*pIsEOF = (pImpl->getPos() == pImpl->getSize());
 	return osl_File_E_None;
 }
 	if ((0 == pImpl) || !IsValidHandle(pImpl->m_hFile) || (0 == pPos))
 		return osl_File_E_INVAL;
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
 	*pPos = pImpl->getPos();
 	return osl_File_E_None;
 }
 		return osl_File_E_OVERFLOW;
 	LONGLONG nPos = 0, nOffset = sal::static_int_cast< LONGLONG >(uOffset);
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
 	switch (uHow)
 	{
 		case osl_Pos_Absolut:
 	if ((0 == pImpl) || !IsValidHandle(pImpl->m_hFile) || (0 == pSize))
 		return osl_File_E_INVAL;
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
     *pSize = pImpl->getSize();
     return osl_File_E_None;
 }
 	if (g_limit_longlong < uSize)
 		return osl_File_E_OVERFLOW;
 
+    FileHandle_Impl::Guard lock (&(pImpl->m_mutex));
 	oslFileError result = pImpl->syncFile();
 	if (result != osl_File_E_None)
 		return (result);

sc/source/core/data/bcaslot.cxx

 }
 
 
+void ScBroadcastAreaSlot::UpdateRemoveArea( ScBroadcastArea* pArea )
+{
+    ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.find( pArea));
+    if (aIter == aBroadcastAreaTbl.end())
+        return;
+    if (*aIter != pArea)
+        DBG_ERRORFILE( "UpdateRemoveArea: area pointer mismatch");
+    else
+    {
+        aBroadcastAreaTbl.erase( aIter);
+        pArea->DecRef();
+    }
+}
+
+
 void ScBroadcastAreaSlot::UpdateInsert( ScBroadcastArea* pArea )
 {
     ::std::pair< ScBroadcastAreas::iterator, bool > aPair = 
         }
     }
 
+    // Updating an area's range will modify the hash key, remove areas from all 
+    // affected slots. Will be reinserted later with the updated range.
+    ScBroadcastArea* pChain = pUpdateChain;
+    while (pChain)
+    {
+        ScBroadcastArea* pArea = pChain;
+        pChain = pArea->GetUpdateChainNext();
+        ScRange aRange( pArea->GetRange());
+        // remove from slots
+        for (SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab() && pArea->GetRef(); ++nTab)
+        {
+            TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab));
+            if (iTab == aTableSlotsMap.end())
+            {
+                DBG_ERRORFILE( "UpdateBroadcastAreas: Where's the TableSlot?!?");
+                continue;   // for
+            }
+            ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+            SCSIZE nStart, nEnd, nRowBreak;
+            ComputeAreaPoints( aRange, nStart, nEnd, nRowBreak );
+            SCSIZE nOff = nStart;
+            SCSIZE nBreak = nOff + nRowBreak;
+            ScBroadcastAreaSlot** pp = ppSlots + nOff;
+            while ( nOff <= nEnd && pArea->GetRef() )
+            {
+                if (*pp)
+                    (*pp)->UpdateRemoveArea( pArea);
+                if ( nOff < nBreak )
+                {
+                    ++nOff;
+                    ++pp;
+                }
+                else
+                {
+                    nStart += BCA_SLOTS_ROW;
+                    nOff = nStart;
+                    pp = ppSlots + nOff;
+                    nBreak = nOff + nRowBreak;
+                }
+            }
+        }
+        
+    }
+
     // shift sheets
     if (nDz)
     {

sc/source/core/inc/bcaslot.hxx

 	void				UpdateRemove( UpdateRefMode eUpdateRefMode,
 										const ScRange& rRange,
 										SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+    void                UpdateRemoveArea( ScBroadcastArea* pArea );
 	void				UpdateInsert( ScBroadcastArea* pArea );
 };
 

sc/source/core/tool/compiler.cxx

                     static const int kQuote     = (1 << 4);
                     // Past ' closing quote.
                     static const int kClose     = (1 << 5);
+                    // Encountered # file/sheet separator.
+                    static const int kFileSep   = (1 << 6);
                     // Past . sheet name separator.
-                    static const int kPast      = (1 << 6);
+                    static const int kPast      = (1 << 7);
                     // Marked name $$ follows sheet name separator, detected
                     // while we're still on the separator. Will be cleared when
                     // entering the name.
-                    static const int kMarkAhead = (1 << 7);
+                    static const int kMarkAhead = (1 << 8);
                     // In marked defined name.
-                    static const int kDefName   = (1 << 8);
+                    static const int kDefName   = (1 << 9);
 
                     bool bAddToSymbol = true;
                     if ((nMask & SC_COMPILER_C_ODF_RBRACKET) && !(nRefInName & kOpen))
                     {
                         // Not in col/row yet.
 
-                        if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen))
+                        if (SC_COMPILER_FILE_TAB_SEP == c && (nRefInName & kFileSep))
+                            nRefInName = 0;
+                        else if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen))
                         {
                             nRefInName &= ~kMarkAhead;
                             if (!(nRefInName & kDefName))
                             }
                             else
                             {
-                                if ('\'' == pSrc[0])
+                                switch (pSrc[0])
                                 {
-                                    // escapes embedded quote
-                                    nRefInName |= kQuote;
-                                }
-                                else
-                                {
-                                    // quote not followed by quote => close
-                                    nRefInName |= kClose;
-                                    nRefInName &= ~kOpen;
+                                    case '\'':
+                                        // escapes embedded quote
+                                        nRefInName |= kQuote;
+                                        break;
+                                    case SC_COMPILER_FILE_TAB_SEP:
+                                        // sheet name should follow
+                                        nRefInName |= kFileSep;
+                                        // fallthru
+                                    default:
+                                        // quote not followed by quote => close
+                                        nRefInName |= kClose;
+                                        nRefInName &= ~kOpen;
                                 }
                                 bAddToSymbol = !(nRefInName & kDefName);
                             }

sc/source/ui/docshell/externalrefmgr.cxx

         return TokenArrayRef();
 
     DocItem& rDoc = itrDoc->second;
-    RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find(rRange);
-    if (itrRange != rDoc.maRangeArrays.end())
-    {
-        return itrRange->second;
-    }
 
     TableNameIndexMap::iterator itrTabId = rDoc.maTableNameIndex.find(
         ScGlobal::pCharClass->upper(rTabName));
         // not all tables are cached.
         return TokenArrayRef();
 
+    ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
+    RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find( aCacheRange);
+    if (itrRange != rDoc.maRangeArrays.end())
+    {
+        return itrRange->second;
+    }
+
     TokenArrayRef pArray(new ScTokenArray);
     bool bFirstTab = true;
     for (size_t nTab = nTabFirstId; nTab <= nTabLastId; ++nTab)
 
         bFirstTab = false;
     }
-    rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
+    rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray));
     return pArray;
 }
 
         return;
     }
 
-    size_t nTab1 = itrTabName->second;
+    size_t nTabFirstId = itrTabName->second;
     SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
     SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
     vector<SingleRangeData>::const_iterator itrDataBeg = rData.begin(), itrDataEnd = rData.end();
     for (vector<SingleRangeData>::const_iterator itrData = itrDataBeg; itrData != itrDataEnd; ++itrData)
     {
-        size_t i = nTab1 + ::std::distance(itrDataBeg, itrData);
+        size_t i = nTabFirstId + ::std::distance(itrDataBeg, itrData);
         TableTypeRef& pTabData = rDoc.maTables[i];
         if (!pTabData.get())
             pTabData.reset(new Table);
         }
     }
 
-    rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
+    size_t nTabLastId = nTabFirstId + rRange.aEnd.Tab() - rRange.aStart.Tab();
+    ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
+    rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray));
 }
 
 bool ScExternalRefCache::isDocInitialized(sal_uInt16 nFileId)

scaddins/source/analysis/analysishelper.cxx

     NEWD( "in",         3.9370078740157480E01,  CDC_Length ); // Inch               39,37007874015748031496062992126
     NEWD( "ft",         3.2808398950131234E00,  CDC_Length ); // Foot               3,2808398950131233595800524934383
     NEWD( "yd",         1.0936132983377078E00,  CDC_Length ); // Yard               1,0936132983377077865266841644794
-    NEWD( "ang",        1.0000000000000000E10,  CDC_Length ); // Angstroem
+    NEWDP( "ang",       1.0000000000000000E10,  CDC_Length ); // Angstroem
     NEWD( "Pica",       2.8346456692913386E03,  CDC_Length ); // Pica (1/72 Inch)   2834,6456692913385826771653543307
     NEWD( "ell",        8.748906E-01,           CDC_Length ); // *** Ell
     NEWDP( "parsec",    3.240779E-17,           CDC_Length ); // *** Parsec
     NEWD( "in3",        6.1023744094732284E01,  CDC_Volume ); // *** Cubic Inch
     NEWD( "ft3",        3.5314666721488590E-02, CDC_Volume ); // *** Cubic Foot
     NEWD( "yd3",        1.3079506193143922E-03, CDC_Volume ); // *** Cubic Yard
-    NEWD( "ang3",       1.0000000000000000E27,  CDC_Volume ); // *** Cubic Angstroem
+    NEWDP( "ang3",      1.0000000000000000E27,  CDC_Volume ); // *** Cubic Angstroem
     NEWD( "Pica3",      2.2776990435870636E07,  CDC_Volume ); // *** Cubic Pica
     NEWD( "barrel",     6.289811E-03,           CDC_Volume ); // *** Barrel (=42gal?)
     NEWD( "bushel",     2.837759E-02,           CDC_Volume ); // *** Bushel
     // SPEED: 1 Meter per Second is...
     NEWDP( "m/s",   1.0000000000000000E00,  CDC_Speed ); // *** Meters per Second
     NEWDP( "m/sec", 1.0000000000000000E00,  CDC_Speed ); // *** Meters per Second also
-    NEWD( "m/h",    3.6000000000000000E03,  CDC_Speed ); // *** Meters per Hour
-    NEWD( "m/hr",   3.6000000000000000E03,  CDC_Speed ); // *** Meters per Hour also
+    NEWDP( "m/h",   3.6000000000000000E03,  CDC_Speed ); // *** Meters per Hour
+    NEWDP( "m/hr",  3.6000000000000000E03,  CDC_Speed ); // *** Meters per Hour also
     NEWD( "mph",    2.2369362920544023E00,  CDC_Speed ); // *** Britsh Miles per Hour
     NEWD( "kn",     1.9438444924406048E00,  CDC_Speed ); // *** Knot = Nautical Miles per Hour
     NEWD( "admkn",  1.9438446603753486E00,  CDC_Speed ); // *** Admiralty Knot

vcl/inc/vcl/window.hxx

 #define SHOW_NOPARENTUPDATE             ((USHORT)0x0001)
 #define SHOW_NOFOCUSCHANGE              ((USHORT)0x0002)
 #define SHOW_NOACTIVATE                 ((USHORT)0x0004)
+#define SHOW_FOREGROUNDTASK             ((USHORT)0x0008)
 
 // Flags for SetZOrder()
 #define WINDOW_ZORDER_BEFOR             ((USHORT)0x0001)

vcl/source/window/window.cxx

             // nach vorne, wenn es gewuenscht ist
             if ( ImplIsOverlapWindow() && !(nFlags & SHOW_NOACTIVATE) )
             {
-                ImplStartToTop( 0 );
+                ImplStartToTop(( nFlags & SHOW_FOREGROUNDTASK ) ? TOTOP_FOREGROUNDTASK : 0 );
                 ImplFocusToTop( 0, FALSE );
             }
 

vcl/win/source/window/salframe.cxx

         BringWindowToTop( hWnd );
     
     if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK )
-        SetForegroundWindow( hWnd );
+    {
+        // This magic code is necessary to connect the input focus of the
+        // current window thread and the thread which owns the window that
+        // should be the new foreground window.
+        HWND   hCurrWnd     = GetForegroundWindow();
+        DWORD  myThreadID   = GetCurrentThreadId();
+        DWORD  currThreadID = GetWindowThreadProcessId(hCurrWnd,NULL);
+        AttachThreadInput(myThreadID, currThreadID,TRUE);
+        SetForegroundWindow(hWnd);
+        AttachThreadInput(myThreadID,currThreadID,FALSE);
+    }
 
     if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN )
     {

xmlhelp/source/cxxhelp/provider/databases.cxx

 
 	for( sal_uInt32 i = 0; i < id.size(); ++i )
 	{
+        // the following object must live longer than the
+        // pointer returned by aDBData.getData()
+        DBData aDBData;
+
 		listId[i] = id[i];
 		listAnchor[i] = anchor[i];
 
 			DBHelp* pDBHelp = pDb->getDBHelp();
 			if( pDBHelp != NULL )
 			{
-				DBData aDBData;
 				bool bSuccess = pDBHelp->getValueForKey( idi, aDBData );
 				if( bSuccess )
 				{

xmlhelp/source/cxxhelp/provider/urlparameter.cxx

 
         ugblData = &userData;
 
+        xmlInitParser();
         xmlRegisterInputCallbacks(zipMatch, zipOpen, zipRead, uriClose);
         xmlRegisterInputCallbacks(helpMatch, helpOpen, helpRead, uriClose);
 		xmlRegisterInputCallbacks(fileMatch, fileOpen, fileRead, fileClose);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.