Commits

Vladimir Glazunov  committed c547a14 Merge

CWS-TOOLING: integrate CWS jl146_DEV300

  • Participants
  • Parent commits 6953b64, c9a6af4

Comments (0)

Files changed (19)

File comphelper/source/misc/comphelper_services.cxx

 extern void createRegistryInfo_OfficeInstallationDirectories();
 extern void createRegistryInfo_OInstanceLocker();
 extern void createRegistryInfo_Map();
+extern void createRegistryInfo_OSimpleLogRing();
 
 //........................................................................
 namespace comphelper { namespace module
                 createRegistryInfo_OfficeInstallationDirectories();
                 createRegistryInfo_OInstanceLocker();
                 createRegistryInfo_Map();
+                createRegistryInfo_OSimpleLogRing();
             }
         }
     }

File comphelper/source/misc/documentiologring.cxx

 #include <com/sun/star/frame/DoubleInitializationException.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 
+#include <comphelper_module.hxx>
+
 #include "documentiologring.hxx"
 
 using namespace ::com::sun::star;
 }
 
 // ----------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::impl_staticGetSupportedServiceNames()
+uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames_static()
 {
     uno::Sequence< rtl::OUString > aResult( 1 );
-    aResult[0] = impl_staticGetServiceName();
+    aResult[0] = getServiceName_static();
     return aResult;
 }
 
 // ----------------------------------------------------------
-::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetImplementationName()
+::rtl::OUString SAL_CALL OSimpleLogRing::getImplementationName_static()
 {
     return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.logging.SimpleLogRing" ) );
 }
 
 // ----------------------------------------------------------
-::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetSingletonName()
+::rtl::OUString SAL_CALL OSimpleLogRing::getSingletonName_static()
 {
     return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.DocumentIOLogRing" ) );
 }
 
 // ----------------------------------------------------------
-::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetServiceName()
+::rtl::OUString SAL_CALL OSimpleLogRing::getServiceName_static()
 {
     return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.SimpleLogRing" ) );
 }
 
 // ----------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OSimpleLogRing::impl_staticCreateSelfInstance( const uno::Reference< uno::XComponentContext >& rxContext )
+uno::Reference< uno::XInterface > SAL_CALL OSimpleLogRing::Create( const uno::Reference< uno::XComponentContext >& rxContext )
 {
     return static_cast< cppu::OWeakObject* >( new OSimpleLogRing( rxContext ) );
 }
 // ----------------------------------------------------------
 ::rtl::OUString SAL_CALL OSimpleLogRing::getImplementationName() throw (uno::RuntimeException)
 {
-    return impl_staticGetImplementationName();
+    return getImplementationName_static();
 }
 
 // ----------------------------------------------------------
 ::sal_Bool SAL_CALL OSimpleLogRing::supportsService( const ::rtl::OUString& aServiceName ) throw (uno::RuntimeException)
 {
-    const uno::Sequence< rtl::OUString > & aSupportedNames = impl_staticGetSupportedServiceNames();
+    const uno::Sequence< rtl::OUString > & aSupportedNames = getSupportedServiceNames_static();
     for ( sal_Int32 nInd = 0; nInd < aSupportedNames.getLength(); nInd++ )
     {
         if ( aSupportedNames[ nInd ].equals( aServiceName ) )
 // ----------------------------------------------------------
 uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames() throw (uno::RuntimeException)
 {
-    return impl_staticGetSupportedServiceNames();
+    return getSupportedServiceNames_static();
 }
 
 } // namespace comphelper
 
+void createRegistryInfo_OSimpleLogRing()
+{
+    static ::comphelper::module::OAutoRegistration< ::comphelper::OSimpleLogRing > aAutoRegistration;
+    static ::comphelper::module::OSingletonRegistration< ::comphelper::OSimpleLogRing > aSingletonRegistration;
+}

File comphelper/source/misc/documentiologring.hxx

 	virtual ~OSimpleLogRing();
 
 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
-			impl_staticGetSupportedServiceNames();
+			getSupportedServiceNames_static();
 
-	static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
+	static ::rtl::OUString SAL_CALL getImplementationName_static();
 
-	static ::rtl::OUString SAL_CALL impl_staticGetSingletonName();
+	static ::rtl::OUString SAL_CALL getSingletonName_static();
 
-	static ::rtl::OUString SAL_CALL impl_staticGetServiceName();
+	static ::rtl::OUString SAL_CALL getServiceName_static();
 
 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
-		impl_staticCreateSelfInstance( 
-			const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+		Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
 
 // XSimpleLogRing
     virtual void SAL_CALL logString( const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException);

File desktop/source/deployment/dp_persmap.cxx

             OSL_ASSERT( false );
         }
         OString cstr_sysPath(
-            OUStringToOString( m_sysPath, osl_getThreadTextEncoding() ) );
+            OUStringToOString( m_sysPath, RTL_TEXTENCODING_UTF8 ) );
         char const * pcstr_sysPath = cstr_sysPath.getStr();
         
         u_int32_t flags = DB_CREATE;

File sc/source/core/tool/address.cxx

         {
             p = lcl_ParseQuotedName(p, rExternDocName);
             if (!*p || *p != ']' || !rExternDocName.Len())
+            {
+                rExternDocName.Erase();
                 return start;
+            }
         }
         else
         {
         // Excel does not allow [ and ] characters in sheet names though.
         p = lcl_ParseQuotedName(p, rExternDocName);
         if (!*p || *p != '!')
+        {
+            rExternDocName.Erase();
             return start;
+        }
         if (rExternDocName.Len())
         {
             xub_StrLen nOpen = rExternDocName.Search( '[');

File sfx2/inc/sfx2/docfile.hxx

 
     sal_Int8            ShowLockedDocumentDialog( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aData, sal_Bool bIsLoading, sal_Bool bOwnLock );
     sal_Bool            LockOrigFileOnDemand( sal_Bool bLoading, sal_Bool bNoUI );
-    void                UnlockFile();
+    void                UnlockFile( sal_Bool bReleaseLockStream );
 
 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorage( sal_Bool bCreateTempIfNo = sal_True );
     ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetOutputStorage();
 	SAL_DLLPRIVATE void Init_Impl();
 	SAL_DLLPRIVATE void ForceSynchronStream_Impl( sal_Bool bSynchron );
 
+    SAL_DLLPRIVATE void GetLockingStream_Impl();
 	SAL_DLLPRIVATE void GetMedium_Impl();
 	SAL_DLLPRIVATE sal_Bool TryDirectTransfer( const ::rtl::OUString& aURL, SfxItemSet& aTargetSet );
 	SAL_DLLPRIVATE void Transfer_Impl();

File sfx2/source/doc/docfile.cxx

     Reference < XInputStream > xInputStream;
     Reference < XStream > xStream;
 
+    uno::Reference< io::XStream > m_xLockingStream;
+
 	sal_uInt32					nLastStorageError;
 	::rtl::OUString				aCharset;
 
     // otherwise the document should be opened readonly
     // if user cancel the loading the ERROR_ABORT is set
 
+    if ( pImp->m_bLocked && bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
+    {
+        // if the document is already locked the system locking might be temporarely off after storing
+        // check whether the system file locking should be taken again
+        GetLockingStream_Impl();
+    }
+
     sal_Bool bResult = pImp->m_bLocked;
 
     if ( !bResult )
 
     if ( !bResult && !IsReadOnly() )
     {
-        // check whether the file is readonly in fs
-        // the check is only necessary if
-        // do it only for loading, some contents still might have problems with this property, let them not affect the saving
         sal_Bool bContentReadonly = sal_False;
-        if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( aLogicName ) )
+        if ( bLoading && ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
         {
-            // let the stream be opened to check the possibility to open it for editing
-            GetMedium_Impl();
+            // let the original document be opened to check the possibility to open it for editing
+            // and to let the writable stream stay open to hold the lock on the document
+            GetLockingStream_Impl();
         }
 
         // "IsReadOnly" property does not allow to detect whether the file is readonly always
         // so we try always to open the file for editing
         // the file is readonly only in case the read-write stream can not be opened
-        SFX_ITEMSET_ARG( pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, sal_False);
-        if ( bLoading && !pWriteStreamItem )
+        if ( bLoading && !pImp->m_xLockingStream.is() )
         {
             try
             {
 }
 
 //----------------------------------------------------------------
+void SfxMedium::GetLockingStream_Impl()
+{
+    if ( ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) )
+      && !pImp->m_xLockingStream.is() )
+    {
+        SFX_ITEMSET_ARG( pSet, pWriteStreamItem, SfxUnoAnyItem, SID_STREAM, sal_False);
+        if ( pWriteStreamItem )
+            pWriteStreamItem->GetValue() >>= pImp->m_xLockingStream;
+   
+        if ( !pImp->m_xLockingStream.is() )
+        {
+            // open the original document
+            uno::Sequence< beans::PropertyValue > xProps;
+            TransformItems( SID_OPENDOC, *GetItemSet(), xProps );
+            comphelper::MediaDescriptor aMedium( xProps );
+
+            aMedium.addInputStreamOwnLock();
+
+            uno::Reference< io::XInputStream > xInputStream;
+            aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= pImp->m_xLockingStream;
+            aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
+
+            if ( !pImp->pTempFile && !aName.Len() )
+            {
+                // the medium is still based on the original file, it makes sence to initialize the streams
+                if ( pImp->m_xLockingStream.is() )
+                    pImp->xStream = pImp->m_xLockingStream;
+
+                if ( xInputStream.is() )
+                    pImp->xInputStream = xInputStream;
+
+                if ( !pImp->xInputStream.is() && pImp->xStream.is() )
+                    pImp->xInputStream = pImp->xStream->getInputStream();
+            }
+        }
+    }
+}
+
+//----------------------------------------------------------------
 void SfxMedium::GetMedium_Impl()
 {
     if ( !pInStream )
                 TransformItems( SID_OPENDOC, *GetItemSet(), xProps );
                 comphelper::MediaDescriptor aMedium( xProps );
 
-                if ( bFromTempFile )
+                if ( pImp->m_xLockingStream.is() && !bFromTempFile )
                 {
-                    aMedium[comphelper::MediaDescriptor::PROP_URL()] <<= ::rtl::OUString( aFileName );
-                    aMedium.erase( comphelper::MediaDescriptor::PROP_READONLY() );
-                    aMedium.addInputStream();
-                }
-                else if ( ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
-                {
-                    // use the special locking approach only for file URLs
-                    aMedium.addInputStreamOwnLock();
+                    // the medium is not based on the temporary file, so the original stream can be used
+                    pImp->xStream = pImp->m_xLockingStream;
                 }
                 else
-                    aMedium.addInputStream();
-
-                // the ReadOnly property set in aMedium is ignored
-                // the check is done in LockOrigFileOnDemand() for file and non-file URLs
-
-                //TODO/MBA: what happens if property is not there?!
+                {
+                    if ( bFromTempFile )
+                    {
+                        aMedium[comphelper::MediaDescriptor::PROP_URL()] <<= ::rtl::OUString( aFileName );
+                        aMedium.erase( comphelper::MediaDescriptor::PROP_READONLY() );
+                        aMedium.addInputStream();
+                    }
+                    else if ( ::utl::LocalFileHelper::IsLocalFile( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ) )
+                    {
+                        // use the special locking approach only for file URLs
+                        aMedium.addInputStreamOwnLock();
+                    }
+                    else
+                        aMedium.addInputStream();
+
+                    // the ReadOnly property set in aMedium is ignored
+                    // the check is done in LockOrigFileOnDemand() for file and non-file URLs
+
+                    //TODO/MBA: what happens if property is not there?!
+                    aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= pImp->xStream;
+                    aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= pImp->xInputStream;
+                }
+
                 GetContent();
-                aMedium[comphelper::MediaDescriptor::PROP_STREAM()] >>= pImp->xStream;
-                aMedium[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= pImp->xInputStream;
                 if ( !pImp->xInputStream.is() && pImp->xStream.is() )
                     pImp->xInputStream = pImp->xStream->getInputStream();
             }
 
 	CloseStreams_Impl();
 
-    UnlockFile();
+    UnlockFile( sal_False );
 }
 
 void SfxMedium::CloseAndRelease()
 
 	CloseAndReleaseStreams_Impl();
 
-    UnlockFile();
+    UnlockFile( sal_True );
 }
 
-void SfxMedium::UnlockFile()
+void SfxMedium::UnlockFile( sal_Bool bReleaseLockStream )
 {
+    if ( pImp->m_xLockingStream.is() )
+    {
+        if ( bReleaseLockStream )
+        {
+            try
+            {
+                uno::Reference< io::XInputStream > xInStream = pImp->m_xLockingStream->getInputStream();
+                uno::Reference< io::XOutputStream > xOutStream = pImp->m_xLockingStream->getOutputStream();
+                if ( xInStream.is() )
+                    xInStream->closeInput();
+                if ( xOutStream.is() )
+                    xOutStream->closeOutput();
+            }
+            catch( uno::Exception& )
+            {}
+        }
+
+        pImp->m_xLockingStream = uno::Reference< io::XStream >();
+    }
+
     if ( pImp->m_bLocked )
     {
         try
 	uno::Reference< io::XInputStream > xInToClose = pImp->xInputStream;
 	uno::Reference< io::XOutputStream > xOutToClose;
 	if ( pImp->xStream.is() )
+    {
 		xOutToClose = pImp->xStream->getOutputStream();
 
+        // if the locking stream is closed here the related member should be cleaned
+        if ( pImp->xStream == pImp->m_xLockingStream )
+            pImp->m_xLockingStream = uno::Reference< io::XStream >();
+    }
+
 	// The probably exsisting SvStream wrappers should be closed first
     CloseStreams_Impl();
 

File sfx2/source/doc/objmisc.cxx

 
     if ( pImp->m_xLogRing.is() )
     {
-        ::rtl::OUString aFileURL =
-            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}" ) );
+#ifdef WNT
+        ::rtl::OUString aFileURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/bootstrap.ini:UserInstallation}" ) );
+#else
+        ::rtl::OUString aFileURL = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/bootstraprc:UserInstallation}" ) );
+#endif
+
         ::rtl::Bootstrap::expandMacros( aFileURL );
 
-        ::rtl::OUString aBuildID =
-            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/setup.ini:buildid}" ) );
+#ifdef WNT
+        ::rtl::OUString aBuildID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/setup.ini:buildid}" ) );
+#else
+        ::rtl::OUString aBuildID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/setuprc:buildid}" ) );
+#endif
+
         ::rtl::Bootstrap::expandMacros( aBuildID );
 
         if ( aFileURL.getLength() )

File testautomation/extensions/optional/includes/extensions.inc

             kontext
             if active.exists(5) then
                 sTemp = active.getText
-                try
-                    active.yes
-                catch
-                    warnlog( "Try...catch: Failed to click Yes-button" )
-                endcatch
+                printlog "Messagebox: " + sTemp
+                ' We only want to handle the installation target here which only 
+                ' pops up if we have the choice (rights to write to shared layer)
+                if active.getButtonCount = 3 then 
+                    try
+                        active.yes
+                    catch
+                        warnlog( "Try...catch: Failed to click Yes-button" )
+                    endcatch
+                else
+                    printlog "No installation target message (this is probably a root-installation)" 
+                endif
             endif
 
             '/// Progress dialog comes up ///'

File testautomation/extensions/optional/includes/publisher.inc

         cBasePath = convertpath( cBasePath )
     
     ' Modify this file to add test cases or attributes
-    dim cInfoFile as string
-        cinfoFile = cBasePath & "extension.info"
+    dim cInfoFile as string : cinfoFile = cBasePath & "extension.info"
         
     ' The number of files to test. Information about this is stored in the file
     ' specified by cInfoFile
     dim iFileCount as integer
     dim iCurrentFile as integer
+    dim iExtensionCount as integer
     dim iExitCounter as integer
-    dim iExtensionCount as integer
+    dim iCurrentExtensionCount as integer : iCurrentExtensionCount = 0
+    dim iTry as integer
     
     ' This is the data we get from the configuration file
     dim cCurrentFileName as string
     dim cConfigArray( 60 ) as string
     
     dim cTestString as string
+    dim bInstallationComplete as boolean : bInstallationComplete = false
     
     iExtensionCount = hGetExtensionCount()
     
     hGetDataFileSection( cInfoFile, cConfigArray(), "info", "", "" )
     iFileCount = int( hGetValueForKeyAsString( cConfigArray() , "filecount" ) )
     printlog( cInfoFile & " specifies " & iFileCount & " documents to load" )
+    
+    iExtensionCount = iExtensionCount + iFileCount
+    printlog( "Expected number of extensions after installation: " & iExtensionCount )
 
     printlog( "Installing extensions" )
     for iCurrentFile = 1 to iFileCount
         cCurrentFileName = hGetValueForKeyAsString( cConfigArray() , "file" )
         cCurrentFileName = cBasePath & cCurrentFileName
         sExtensionCLI( "add" , cCurrentFileName )
-        WaitSlot( 5000 )
+        wait 1000 ' This is required, sExtensionCLI is asynchronous.
         
     next iCurrentFile
-    printlog( "Finished installing extensions" )
-
+    printlog( "Finished installing extensions, now verifying..." )
+    
+    hNewDocument()
+    ToolsPackageManager
+   
     kontext "PackageManager"
-    if ( not PackageManager.exists() ) then
-        ToolsPackageManager
-        kontext "PackageManager"
-        if ( PackageManager.exists( 2 ) ) then
-            printlog( "Extension Manager UI has been opened" )
-        else
-            warnlog( "Failed to open Extension Manager UI" )
+    if ( PackageManager.exists( 3 ) ) then
+    
+        for iTry = 1 to 30 
+        
+            iCurrentExtensionCount = BrowsePackages.getItemCount()
+            
+            if ( iCurrentExtensionCount = iExtensionCount ) then
+                printlog( "All extensions have been installed, good." )
+                bInstallationComplete = true
+                exit for
+            endif
+            
+            printlog( "Waiting for listbox: Number of extensions: " & iCurrentExtensionCount )
+            
+        next iTry
+        
+        ' If one or more extensions have not been added to the list we better abort the
+        ' test as the remaining parts need all extensions to be installed causing
+        ' lots of cryptig errors to appear in the log.
+        if ( not bInstallationComplete ) then
+            warnlog( "Not all extensions have been installed. Aborting test." )
+            kontext "PackageManager" 
+            if ( PackageManager.exists() ) then
+                PackageManager.cancel()
+                PackageManager.notExists( 2 ) 
+            endif
             goto endsub
         endif
     else
-        warnlog( "#i84786# Unopkg processes block UI" )
+        warnlog( "The Extension Manager did not open, Aborting test" )
         goto endsub
     endif
+            
     
-    iExitCounter = 0
     kontext "PackageManager"
-    WaitSlot()
-    do while ( BrowsePackages.getItemCount() < ( iExtensionCount + iFileCount ) )
-        printlog( "Waiting for Extensions List to populate..." )
-        Wait( 1000 )
-        iExitCounter = iExitCounter + 1
-        if ( iExitCounter = 30 ) then
-            kontext "PackageManager"
-            PackageManager.cancel()
-            goto endsub
-        endif
-    loop
- 
-    kontext "PackageManager"
+    printlog( "Going for the update-dialog" )
     if ( Updates.isEnabled() ) then
     
         printlog( "Updates-button is enabled" )
                 wait( 1000 )
                 iExitCounter = iExitCounter + 1
                 if ( iExitCounter = 200 ) then 
-                    warnlog( "Update list for extensions is stalled (expected: 7), found: " & AvailableUpdatesList.getItemCount() )
+                    warnlog( "Update list for extensions is stalled (expected: 7), " & _
+                             "found: " & AvailableUpdatesList.getItemCount() )
                     kontext "ExtensionUpdate"
                     ExtensionUpdate.cancel()
+                    ExtensionUpdate.notExists( 2 )
                     kontext "PackageManager"
                     PackageManager.cancel()
+                    PackageManager.notExists( 2 )
                     goto endsub
                 endif
             loop
 
             kontext "ExtensionUpdate"
             ExtensionUpdate.cancel()
+            ExtensionUpdate.notExists( 2 )
         else
             warnlog( "Extension Update dialog is not open" )
         endif
     
     kontext "PackageManager"
     PackageManager.close()
+    PackageManager.notExists( 2 )
     
     printlog( "Removing extensions" )
     for iCurrentFile = 1 to iFileCount
         sExtensionCLI( "remove" , cCurrentFileName )
     next iCurrentFile
     printlog( "Finished removing extensions" )
+    
+    hFileCloseAll()
 
 endcase
 

File testautomation/global/tools/includes/required/t_doc1.inc

     case else             : WarnLog "hNewDocument: No Applikation named '" + gApplication + "' exists in this routine!"
     end select
     Sleep 2
+
 end sub
 '
 '-------------------------------------------------------------------------------

File testautomation/writer/optional/includes/dropdownLB/w_dropdownLB1.inc

     PrintLog "- Open a word document  which includes 2 entries."
     Call hFileOpen(sTestFile)
     Call sMakeReadOnlyDocumentEditable
+
+    Kontext "EditInputList"
+    if EditInputList.Exists then EditInputList.Cancel
+
     PrintLog "- Set focus in front of first line."
     Call wTypeKeys "<MOD1 Home>"
     PrintLog "- Edit/Fields."
 
     FeldbefehlBearbeitenFunktionen.Cancel
     
-    Call hCloseDocument ' <- close word document
+    Do Until GetDocumentCount = 0
+        Call hCloseDocument
+    Loop
     
 endcase
 

File testautomation/writer/optional/includes/insertgraphic/w_insertgraphic2.inc

 
 testcase tInsertGraphic_18
 
-  Dim sGraphicName1 as String
-  Dim sGraphicName2 as String
-  Dim sGraphicName3 as String
-  Dim sWidth as String
-  Dim sHeight as String
+    Dim sGraphicName1 as String
+    Dim sGraphicName2 as String
+    Dim sGraphicName3 as String
+    Dim sWidth as String
+    Dim sHeight as String
 
-  sGraphicName1 = "TEST1"
-  sGraphicName2 = "TEST2"
-  sGraphicName3 = "TEST3"
+    sGraphicName1 = "TEST1"
+    sGraphicName2 = "TEST2"
+    sGraphicName3 = "TEST3"
 
-  sWidth       = "7"+ gSeperator + "00" + gMeasurementUnit
-  sHeight      = "6"+ gSeperator + "00" + gMeasurementUnit
+    sWidth       = "7"+ gSeperator + "00" + gMeasurementUnit
+    sHeight      = "6"+ gSeperator + "00" + gMeasurementUnit
 
-  PrintLog "- Test Set different attributes via Contextmenu Arrange (send backward)"
- '/// Test Set different attributes via Contextmenu Arrange (send backward)
+    PrintLog "- Test Set different attributes via Contextmenu Arrange (send backward)"
+    '/// Test Set different attributes via Contextmenu Arrange (send backward)
 
-   Call hNewDocument
+    Call hNewDocument
 
-   Call wTypeKeys "<Return>"
+    Call wTypeKeys "<Return>"
 
-  '/// Insert three Graphics at the same place , and named in series
+    '/// Insert three Graphics at the same place , and named in series
 
-   'the 1st graphic
-   fInsertGraphics("Bughunter.jpg")
+    'the 1st graphic
+    fInsertGraphics("Bughunter.jpg")
 
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   ObjektName.SetText sGraphicName1
-   TabZusaetze.OK
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    ObjektName.SetText sGraphicName1
+    Kontext
+    Active.Setpage TabType
+    Kontext "TabType"
+    KeepRatio.UnCheck
+    Sleep 1
+    Width.SetText        sWidth
+    wait 500
+    Height.SetText       sHeight
+    wait 500
+    TabType.OK
 
-   fFormatGraphic("TabType")
-   KeepRatio.UnCheck
-   Sleep 1
-   Width.SetText        sWidth
-   wait 500
-   Height.SetText       sHeight
-   wait 500
-   TabType.OK
+    Call wTypeKeys "<ESCape>"
 
-   Call wTypeKeys "<ESCape>"
+    'the 2nd graphic
+    fInsertGraphics("flowers.gif")
 
-   'the 2nd graphic
-   fInsertGraphics("flowers.gif")
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    ObjektName.SetText sGraphicName2
+    TabZusaetze.OK
 
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   ObjektName.SetText sGraphicName2
-   TabZusaetze.OK
+    fFormatGraphic("TabType")
+    KeepRatio.UnCheck
+    Sleep 1
+    Width.SetText        sWidth
+    wait 500
+    Height.SetText       sHeight
+    wait 500
+    TabType.OK
 
-   fFormatGraphic("TabType")
-   KeepRatio.UnCheck
-   Sleep 1
-   Width.SetText        sWidth
-   wait 500
-   Height.SetText       sHeight
-   wait 500
-   TabType.OK
+    Call wTypeKeys "<ESCape>"
 
-   Call wTypeKeys "<ESCape>"
+    'the 3rd graphic
+    fInsertGraphics("game.bmp")
 
-   'the 3rd graphic
-   fInsertGraphics("game.bmp")
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    ObjektName.SetText sGraphicName3
+    TabZusaetze.OK
 
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   ObjektName.SetText sGraphicName3
-   TabZusaetze.OK
+    fFormatGraphic("TabType")
+    KeepRatio.UnCheck
+    Sleep 1
+    Width.SetText        sWidth
+    wait 500
+    Height.SetText       sHeight
+    wait 500
+    TabType.OK
 
-   fFormatGraphic("TabType")
-   KeepRatio.UnCheck
-   Sleep 1
-   Width.SetText        sWidth
-   wait 500
-   Height.SetText       sHeight
-   wait 500
-   TabType.OK
-
-   '/// ContextMenu  Arrange / Send backward
-   Call wOpenContextMenu
+    '/// ContextMenu  Arrange / Send backward
+    Call wOpenContextMenu
     hMenuSelectNr(1)
     Sleep 2
     hMenuSelectNr(3)
     Sleep 1
 
-   Call wTypeKeys "<ESCape>"
-   Sleep 1
+    Call wTypeKeys "<ESCape>"
+    Sleep 1
 
-   '/// Check if the attributes Arrange (send to back) works well
-   Call wNavigatorAuswahl(4,1)
-   Sleep 1
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   if ObjektName.GetText <> sGraphicName1  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName1 + " but get " +ObjektName.GetText
-   TabZusaetze.Cancel
+    '/// Check if the attributes Arrange (send to back) works well
+    Call wNavigatorAuswahl(4,1)
+    Sleep 1
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    if ObjektName.GetText <> sGraphicName1  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName1 + " but get " +ObjektName.GetText
+    TabZusaetze.Cancel
 
-   Call wNavigatorAuswahl(4,2)
-   Sleep 1
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   if ObjektName.GetText <> sGraphicName2  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName2 + " but get " +ObjektName.GetText
-   TabZusaetze.Cancel
+    Call wNavigatorAuswahl(4,2)
+    Sleep 1
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    if ObjektName.GetText <> sGraphicName2  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName2 + " but get " +ObjektName.GetText
+    TabZusaetze.Cancel
 
-   Call wNavigatorAuswahl(4,3)
-   Sleep 1
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   if ObjektName.GetText <> sGraphicName3  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName3 + " but get " +ObjektName.GetText
-   TabZusaetze.Cancel
+    Call wNavigatorAuswahl(4,3)
+    Sleep 1
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    if ObjektName.GetText <> sGraphicName3  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName3 + " but get " +ObjektName.GetText
+    TabZusaetze.Cancel
 
-   Call hCloseDocument
+    Call hCloseDocument
 
 endcase
 
 
 testcase tInsertGraphic_19
 
-  Dim sGraphicName1 as String
-  Dim sGraphicName2 as String
-  Dim sGraphicName3 as String
-  Dim sWidth as String
-  Dim sHeight as String
+    Dim sGraphicName1 as String
+    Dim sGraphicName2 as String
+    Dim sGraphicName3 as String
+    Dim sWidth as String
+    Dim sHeight as String
 
-  sGraphicName1 = "TEST1"
-  sGraphicName2 = "TEST2"
-  sGraphicName3 = "TEST3"
+    sGraphicName1 = "TEST1"
+    sGraphicName2 = "TEST2"
+    sGraphicName3 = "TEST3"
 
-  sWidth       = "7"+ gSeperator + "00" + gMeasurementUnit
-  sHeight      = "6"+ gSeperator + "00" + gMeasurementUnit
+    sWidth       = "7"+ gSeperator + "00" + gMeasurementUnit
+    sHeight      = "6"+ gSeperator + "00" + gMeasurementUnit
 
-  PrintLog "- Test Set different attributes via Contextmenu Arrange (bring to front)"
- '/// Test Set different attributes via Contextmenu Arrange (bring to front)
+    PrintLog "- Test Set different attributes via Contextmenu Arrange (bring to front)"
+    '/// Test Set different attributes via Contextmenu Arrange (bring to front)
 
-  Call hNewDocument
+    Call hNewDocument
 
-  Call wTypeKeys "<Return>"
+    Call wTypeKeys "<Return>"
 
-  '/// Insert three Graphics at the same place , and named in series
+    '/// Insert three Graphics at the same place , and named in series
 
-   'the 1st graphic
-   fInsertGraphics("Bughunter.jpg")
+    'the 1st graphic
+    fInsertGraphics("Bughunter.jpg")
 
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   ObjektName.SetText sGraphicName1
-   TabZusaetze.OK
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    ObjektName.SetText sGraphicName1
 
-   fFormatGraphic("TabType")
-   KeepRatio.UnCheck
-   Sleep 1
-   Width.SetText        sWidth
-   wait 500
-   Height.SetText       sHeight
-   wait 500
-   TabType.OK
+    Kontext
+    Active.Setpage TabType
+    Kontext "TabType"
 
-   Call wTypeKeys "<ESCape>"
+    KeepRatio.UnCheck
+    Sleep 1
+    Width.SetText        sWidth
+    wait 500
+    Height.SetText       sHeight
+    wait 500
+    TabType.OK
 
-   'the 2nd graphic
-   fInsertGraphics("flowers.gif")
+    Call wTypeKeys "<ESCape>"
 
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   ObjektName.SetText sGraphicName2
-   TabZusaetze.OK
+    'the 2nd graphic
+    fInsertGraphics("flowers.gif")
 
-   fFormatGraphic("TabType")
-   KeepRatio.UnCheck
-   Sleep 1
-   Width.SetText        sWidth
-   wait 500
-   Height.SetText       sHeight
-   wait 500
-   TabType.OK
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    ObjektName.SetText sGraphicName2
+    TabZusaetze.OK
 
-   Call wTypeKeys "<ESCape>"
+    fFormatGraphic("TabType")
+    KeepRatio.UnCheck
+    Sleep 1
+    Width.SetText        sWidth
+    wait 500
+    Height.SetText       sHeight
+    wait 500
+    TabType.OK
 
-   'the 3rd graphic
-   fInsertGraphics("game.bmp")
+    Call wTypeKeys "<ESCape>"
 
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   ObjektName.SetText sGraphicName3
-   TabZusaetze.OK
+    'the 3rd graphic
+    fInsertGraphics("game.bmp")
 
-   fFormatGraphic("TabType")
-   KeepRatio.UnCheck
-   Sleep 1
-   Width.SetText        sWidth
-   wait 500
-   Height.SetText       sHeight
-   wait 500
-   TabType.OK
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    ObjektName.SetText sGraphicName3
+    TabZusaetze.OK
 
-   '/// Format / Arrange / Send to back
-   FormatArrangeSendToBack
-   Sleep 2
+    fFormatGraphic("TabType")
+    KeepRatio.UnCheck
+    Sleep 1
+    Width.SetText        sWidth
+    wait 500
+    Height.SetText       sHeight
+    wait 500
+    TabType.OK
 
-   '/// ContextMenu Arrange / bring to front
-   Call wOpenContextMenu
+    '/// Format / Arrange / Send to back
+    FormatArrangeSendToBack
+    Sleep 2
+
+    '/// ContextMenu Arrange / bring to front
+    Call wOpenContextMenu
     hMenuSelectNr(1)
     Sleep 2
     hMenuSelectNr(1)
     Sleep 1
 
-   Call wTypeKeys "<ESCape>"
-   Sleep 1
+    Call wTypeKeys "<ESCape>"
+    Sleep 1
 
-   '/// Check if the attributes Arrange (send to back) works well
-   Call wNavigatorAuswahl(4,1)
-   Sleep 1
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   if ObjektName.GetText <> sGraphicName1  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName1 + " but get " +ObjektName.GetText
-   TabZusaetze.Cancel
+    '/// Check if the attributes Arrange (send to back) works well
+    Call wNavigatorAuswahl(4,1)
+    Sleep 1
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    if ObjektName.GetText <> sGraphicName1  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName1 + " but get " +ObjektName.GetText
+    TabZusaetze.Cancel
 
-   Call wNavigatorAuswahl(4,2)
-   Sleep 1
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   if ObjektName.GetText <> sGraphicName2  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName2 + " but get " +ObjektName.GetText
-   TabZusaetze.Cancel
+    Call wNavigatorAuswahl(4,2)
+    Sleep 1
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    if ObjektName.GetText <> sGraphicName2  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName2 + " but get " +ObjektName.GetText
+    TabZusaetze.Cancel
 
-   Call wNavigatorAuswahl(4,3)
-   Sleep 1
-   fFormatGraphic("TabZusaetze")
-   Sleep 1
-   if ObjektName.GetText <> sGraphicName3  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName3 + " but get " +ObjektName.GetText
-   TabZusaetze.Cancel
+    Call wNavigatorAuswahl(4,3)
+    Sleep 1
+    fFormatGraphic("TabZusaetze")
+    Sleep 1
+    if ObjektName.GetText <> sGraphicName3  then Warnlog "The graphic's name is not correct ,should be "+sGraphicName3 + " but get " +ObjektName.GetText
+    TabZusaetze.Cancel
 
-   Call hCloseDocument
+    Call hCloseDocument
 
 endcase
 

File testautomation/writer/optional/includes/regression/issuezilla/w_issuezilla_regression.inc

 	Call hNewDocument
     printlog "- Open test document"
 	Call hFileOpen ( gTesttoolPath + "writer\optional\input\regression\issuezilla\i103265.odt" )
+    Call sMakeReadOnlyDocumentEditable
     printlog "- Update TOC"
 	ToolsUpdateAllIndexes
 	
 
 	printlog "- Save as HTML"
 	gApplication = "HTML"	
-	Call hFileSaveAsWithFilterKill ( gOfficePath + "user\work\ODFHyperlinksInTOCs.html", "HTML" )
+	Call hFileSaveAsWithFilterKill ( gOfficePath + "user\work\ODFHyperlinksInTOCs.html", "HTML (StarWriter)" )
     Call hCloseDocument
 	
     printlog "- Reload"

File testautomation/writer/required/includes/w_005b_.inc

     Call hNewDocument
 
     printlog " Paste a rectangle from draw via clipboard"
-    if gPlatgroup = "unx" then
-        Call wZeichenobjektEinfuegen ( "Rechteck", 10, 30, 20, 45 )
-        sleep (1)
-        gMouseClick ( 15, 38 )
-    else
-        Call wZeichenobjektEinfuegen ( "Rechteck", 45, 30, 55, 45 )
-        sleep (1)
-        Call wObjektSelektieren ( 43, 25, 60, 50 )
-    endif
-
+    Call wZeichenobjektEinfuegen ( "Rechteck", 45, 30, 55, 45 )
+    sleep (1)
+    Call wObjektSelektieren ( 43, 25, 60, 50 )
     Sleep 1
     try
         printlog " Format / Anchor / As Character"
         printlog " Insert a textobject from toolbar"
         Sleep 2
 
-        if gPlatgroup = "unx" then
-            Call gMouseMove(10, 20, 30, 40)
-        else
-            Call gMouseMove(50, 20, 70, 40)
-        endif
+        Call gMouseMove(50, 20, 70, 40)
         hUseAsyncSlot( "FormatStyleBold" )
 
         printlog " Format / Style / Bold"
     Textobjekt.Click
     printlog " Insert a textbox via 'Draw functions' toolbar"
 
-    if gPlatgroup = "unx" then
-        Call gMouseMove(10, 20, 30, 40)
-    else
-        Call gMouseMove(50, 20, 70, 40)
-    endif
+    Call gMouseMove(50, 20, 70, 40)
     printlog " Insert some text in document"
 
     Call wTypeKeys ("Ein Wort")
     Textobjekt.Click
     printlog " In a textbox via 'Draw Functions' toolbox"
 
-    if gPlatgroup = "unx" then
-        Call gMouseMove(10, 20, 30, 40)
-    else
-        Call gMouseMove(50, 20, 70, 40)
-    endif
+    Call gMouseMove(50, 20, 70, 40)
     Sleep 1
 
     printlog " Format / Spacing / Single line"
     Textobjekt.Click
     printlog " In a textbox via 'Draw Functions' toolbox"
 
-    if gPlatgroup = "unx" then
-        Call gMouseMove(10, 20, 30, 40)
-    else
-        Call gMouseMove(50, 20, 70, 40)
-    endif
+    Call gMouseMove(50, 20, 70, 40)
 
     printlog " Format / Paragraph "
     hUseAsyncSlot( "FormatParagraph" )

File testautomation/writer/required/includes/w_020_.inc

         Call sMenufunktionen("-Checkbox-")
 
         Kontext "FormControls"
-        if Ucase(gApplication) <> "HTML" then
+        if gApplication <> "HTML" then
             wait 500
             Label.Click
             printlog " Insert a textbox from toolbox"
-            if gplatgroup = "unx" then
-                Call hMalZeichnenMitSelektion ( 10, 40, 21, 25 )
-            else
-                Call hMalZeichnenMitSelektion ( 57, 20, 68, 25 )
-            endif
+            Call hMalZeichnenMitSelektion ( 57, 20, 68, 25 )
             printlog "+ Open Control Properties"
             Call sMenufunktionen("-Textbox-")
         end if
             Combobox.Click
             printlog " Insert a Combobox from toolbox"
             Wait 500
-            if gPlatgroup = "unx" then
-                Call hMalZeichnenMitSelektion ( 41, 40, 52, 35 )
-            else
-                Call hMalZeichnenMitSelektion ( 57, 30, 68, 35 )
-            endif
+            Call hMalZeichnenMitSelektion ( 57, 30, 68, 35 )
             printlog "+ Step through pages of upcoming Autopilot"
             Call sAutopilot_ListboxCombobox("Combo")
             printlog "+ Open Control Properties"

File testautomation/writer/required/w_updt.bas

 
     Printlog "******* Ressource-Test Writer Document *******"
 
+    Call wChangeDefaultView()
+
     Call hStatusIn ( "writer", "w_updt.bas" )
     Call w_001_              ' Menu File
     Call w_001a_             ' Menu File

File testautomation/writer/tools/includes/w_tool1.inc

 
     Kontext
     try
-        FormatControl
-        Sleep 1
+        FormatControl 
+        WaitSlot()
+        
         Kontext "ControlPropertiesDialog"
-        if ControlPropertiesDialog.Exists then
+        if ControlPropertiesDialog.Exists( 2 ) then
             ControlPropertiesDialog.Close
+            ControlPropertiesDialog.notExists( 2 )
         else
             FormatControl
             Wait 500
             Kontext "ControlPropertiesDialog"
-            if ControlPropertiesDialog.Exists then
+            if ControlPropertiesDialog.Exists( 2 ) then
                 ControlPropertiesDialog.Close
+                ControlPropertiesDialog.notExists( 2 )
             else
                 Warnlog "  - Controlfieldproperties "+ Fuer_Was +" from Menu not available!"
             end if

File testautomation/writer/tools/includes/w_tool2.inc

     next ik
 
 end function
+
+
+sub wChangeDefaultView()
+
+    ' #i107038: This code forces the writer to display one page only which is
+    ' zoomed to pagewidth, filling the entire - previously maximized - window.
+    ' This is required because the VCL Testtool might eventually draw objects
+    ' outside the document window depending on display size
+
+    Call hNewDocument
+    ViewZoom
+    Kontext "Massstab"
+    Vergroesserung100.check
+    Singlepage.check
+    Massstab.Ok
+    Call hCloseDocument
+
+end sub