[Libreoffice-commits] core.git: 3 commits - sal/osl sc/source sfx2/inc sfx2/source vcl/coretext

Tor Lillqvist tml at iki.fi
Tue Mar 26 09:44:46 PDT 2013


 sal/osl/unx/file.cxx             |   12 ++++++++++++
 sc/source/ui/docshell/docsh.cxx  |    8 ++++++--
 sc/source/ui/docshell/docsh4.cxx |    9 +++++++--
 sc/source/ui/unoobj/confuno.cxx  |    4 ++++
 sc/source/ui/view/viewfunc.cxx   |    2 ++
 sfx2/inc/sfx2/objsh.hxx          |    8 +++++++-
 sfx2/source/doc/objmisc.cxx      |    5 ++++-
 sfx2/source/doc/objstor.cxx      |    2 ++
 sfx2/source/doc/objxtor.cxx      |    3 ++-
 sfx2/source/doc/sfxbasemodel.cxx |    2 ++
 sfx2/source/view/viewfrm.cxx     |    6 ++++--
 vcl/coretext/salgdi.cxx          |    6 ++++++
 12 files changed, 58 insertions(+), 9 deletions(-)

New commits:
commit 83a486546f535b32a565d9215e7584c5572c2fb0
Author: Tor Lillqvist <tml at iki.fi>
Date:   Sat Mar 23 17:17:20 2013 +0200

    Shared documents make no sense for Android and iOS
    
    (When I say documents, I mean spreadsheets. Only Calc has code for
    this.)
    
    Change-Id: I05fd19885633f9e250940678d33e2e4c82c31a9d

diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 7a2aeba..045eaa5 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -635,6 +635,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
         {
             case SFX_EVENT_LOADFINISHED:
                 {
+#if !defined(ANDROID) && !defined(IOS)
                     // the readonly documents should not be opened in shared mode
                     if ( HasSharedXMLFlagSet() && !SC_MOD()->IsInSharedDocLoading() && !IsReadOnly() )
                     {
@@ -654,10 +655,12 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                             SetReadOnlyUI( sal_True );
                         }
                     }
+#endif
                 }
                 break;
             case SFX_EVENT_VIEWCREATED:
                 {
+#if !defined(ANDROID) && !defined(IOS)
                     if ( IsDocShared() && !SC_MOD()->IsInSharedDocLoading() )
                     {
                         ScAppOptions aAppOptions = SC_MOD()->GetAppOptions();
@@ -675,7 +678,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                             }
                         }
                     }
-
+#endif
                     try
                     {
                         uno::Reference< uno::XComponentContext > xContext(
@@ -717,6 +720,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                 break;
             case SFX_EVENT_SAVEDOC:
                 {
+#if !defined(ANDROID) && !defined(IOS)
                     if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() )
                     {
                         bool bSuccess = false;
@@ -900,7 +904,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
                         if ( !bSuccess )
                             SetError( ERRCODE_IO_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); // this error code will produce no error message, but will break the further saving process
                     }
-
+#endif
 
                     if (pSheetSaveData)
                         pSheetSaveData->SetInSupportedSave(true);
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 93d1ca0..42f7038 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -766,6 +766,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
                                 aDocument.SetChangeViewSettings(aChangeViewSet);
                             }
                         }
+#if !defined(ANDROID) && !defined(IOS)
                         else if ( nSlot == SID_DOCUMENT_MERGE && IsDocShared() && pChangeTrack )
                         {
                             sal_uLong nEnd = pChangeTrack->GetActionMax();
@@ -784,6 +785,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
                                 PostPaintGridAll();
                             }
                         }
+#endif
                     }
                     pOtherDocSh->DoClose();     // delete passiert mit der Ref
                 }
@@ -895,6 +897,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
         }
         break;
 
+#if !defined(ANDROID) && !defined(IOS)
         case SID_SHARE_DOC:
             {
                 ScViewData* pViewData = GetViewData();
@@ -1071,7 +1074,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
                 rReq.Done();
             }
             break;
-
+#endif
         case SID_OPEN_CALC:
         {
             SfxStringItem aApp(SID_DOC_SERVICE, rtl::OUString("com.sun.star.sheet.SpreadsheetDocument"));
@@ -2297,7 +2300,7 @@ IMPL_LINK( ScDocShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg )
     return 0;
 }
 
-//------------------------------------------------------------------
+#if !defined(ANDROID) && !defined(IOS)
 
 void ScDocShell::EnableSharedSettings( bool bEnable )
 {
@@ -2376,4 +2379,6 @@ uno::Reference< frame::XModel > ScDocShell::LoadSharedDocument()
     return xModel;
 }
 
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index f26007d..5dbac2b 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -257,11 +257,13 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
             }
             else if ( aPropertyName.compareToAscii( SC_UNO_SHAREDOC ) == 0 )
             {
+#if !defined(ANDROID) && !defined(IOS)
                 sal_Bool bDocShared = false;
                 if ( aValue >>= bDocShared )
                 {
                     pDocShell->SetSharedXMLFlag( bDocShared );
                 }
+#endif
             }
             else if ( aPropertyName.compareToAscii( SC_UNO_MODIFYPASSWORDINFO ) == 0 )
             {
@@ -416,7 +418,9 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const rtl::OUString
                 aRet <<= pDocShell->IsLoadReadonly();
             else if ( aPropertyName.compareToAscii( SC_UNO_SHAREDOC ) == 0 )
             {
+#if !defined(ANDROID) && !defined(IOS)
                 ScUnoHelpFunctions::SetBoolInAny( aRet, pDocShell->HasSharedXMLFlagSet() );
+#endif
             }
             else if ( aPropertyName.compareToAscii( SC_UNO_MODIFYPASSWORDINFO ) == 0 )
                 aRet <<= pDocShell->GetModifyPasswordInfo();
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 14caaa5..52544d7 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1533,6 +1533,7 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd, sal_Bool bRecord )
         ScDocShell* pDocSh = GetViewData()->GetDocShell();
         const ScMarkData& rMark = GetViewData()->GetMarkData();
 
+#if !defined(ANDROID) && !defined(IOS)
         // #i94841# [Collaboration] if deleting rows is rejected, the content is sometimes wrong
         if ( pDocSh->IsDocShared() && ( eCmd == DEL_DELROWS || eCmd == DEL_DELCOLS ) )
         {
@@ -1553,6 +1554,7 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd, sal_Bool bRecord )
             }
         }
         else
+#endif
         {
             pDocSh->GetDocFunc().DeleteCells( aRange, &rMark, eCmd, bRecord, false );
         }
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index 7e34147..866f238 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -271,15 +271,21 @@ public:
     virtual sal_Bool            AcceptStateUpdate() const;
     sal_Bool                    IsHelpDocument() const;
 
+#if !defined(ANDROID) && !defined(IOS)
     sal_Bool                    IsDocShared() const;
     ::rtl::OUString             GetSharedFileURL() const;
     sal_Bool                    SwitchToShared( sal_Bool bShared, sal_Bool bSave );
     SAL_DLLPRIVATE void         FreeSharedFile();
     SAL_DLLPRIVATE void         FreeSharedFile( const ::rtl::OUString& aTempFileURL );
     SAL_DLLPRIVATE void         DoNotCleanShareControlFile();
-
     void                        SetSharedXMLFlag( sal_Bool bFlag ) const;
     sal_Bool                    HasSharedXMLFlagSet() const;
+#else
+    sal_Bool                    IsDocShared() const
+        { return sal_False; };
+    ::rtl::OUString             GetSharedFileURL() const
+        { return ::rtl::OUString(); };
+#endif
 
     SAL_DLLPRIVATE void SetModalMode_Impl(sal_Bool bModal=sal_True);
     SAL_DLLPRIVATE void SetMacroMode_Impl(sal_Bool bModal=sal_True);
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index f150a01..ea8590a 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -495,7 +495,8 @@ void SfxObjectShell::SetModalMode_Impl( sal_Bool bModal )
     }
 }
 
-//--------------------------------------------------------------------
+#if !defined(ANDROID) && !defined(IOS)
+
 sal_Bool SfxObjectShell::SwitchToShared( sal_Bool bShared, sal_Bool bSave )
 {
     sal_Bool bResult = sal_True;
@@ -679,6 +680,8 @@ sal_Bool SfxObjectShell::IsDocShared() const
     return pImp->m_aSharedFileURL;
 }
 
+#endif
+
 //--------------------------------------------------------------------
 
 Size SfxObjectShell::GetFirstPageSize()
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 44b4e4c..dbe660f 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2687,6 +2687,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
             if ( pFilterOptItem )
                 pSet->Put( *pFilterOptItem );
 
+#if !defined(ANDROID) && !defined(IOS)
             if ( IsDocShared() && !aTempFileURL.isEmpty() )
             {
                 // this is a shared document that has to be disconnected from the old location
@@ -2701,6 +2702,7 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl
                     SwitchToShared( sal_True, sal_False );
                 }
             }
+#endif
         }
 
         if ( bWasReadonly && !bSaveTo )
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 6bc7a72..3830a29 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -390,9 +390,10 @@ SfxObjectShell::~SfxObjectShell()
     {
         pMedium->CloseAndReleaseStreams_Impl();
 
+#if !defined(ANDROID) && !defined(IOS)
         if ( IsDocShared() )
             FreeSharedFile();
-
+#endif
         DELETEX( pMedium );
     }
 
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 08e9b9f..8390069 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2952,6 +2952,7 @@ void SfxBaseModel::impl_store(  const   ::rtl::OUString&                   sURL
                     }
                     catch( const lang::IllegalArgumentException& )
                     {
+#if !defined(ANDROID) && !defined(IOS)
                         // some additional arguments do not allow to use saving, SaveAs should be done
                         // but only for normal documents, the shared documents would be overwritten in this case
                         // that would mean an information loss
@@ -2979,6 +2980,7 @@ void SfxBaseModel::impl_store(  const   ::rtl::OUString&                   sURL
                                 throw task::ErrorCodeIOException( ::rtl::OUString( "Cant change password for shared document."  ), uno::Reference< uno::XInterface >(), ERRCODE_SFX_SHARED_NOPASSWORDCHANGE );
                             }
                         }
+#endif
                     }
                 }
             }
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 98b2100..7ab428e 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -673,11 +673,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                     pNewSet->ClearItem( SID_DOC_SALVAGE );
                 }
 
+#if !defined(ANDROID) && !defined(IOS)
                 // TODO/LATER: Temporary solution, the SfxMedium must know the original URL as aLogicName
                 //             SfxMedium::Transfer_Impl() will be forbidden then.
                 if ( xOldObj->IsDocShared() )
                     pNewSet->Put( SfxStringItem( SID_FILE_NAME, xOldObj->GetSharedFileURL() ) );
-
+#endif
                 if ( pURLItem )
                     pNewSet->Put( SfxStringItem( SID_REFERER, pMedium->GetName() ) );
                 else
@@ -789,12 +790,13 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                         xNewObj->SetReadOnlyUI( !bForEdit );
                     }
 
+#if !defined(ANDROID) && !defined(IOS)
                     if ( xNewObj->IsDocShared() )
                     {
                         // the file is shared but the closing can change the sharing control file
                         xOldObj->DoNotCleanShareControlFile();
                     }
-
+#endif
                     // the Reload and Silent items were only temporary, remove them
                     xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_RELOAD );
                     xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_SILENT );
commit 434ba7317007f9d27dea3e8bbc52f69e074c2046
Author: Tor Lillqvist <tml at iki.fi>
Date:   Sat Mar 23 13:37:28 2013 +0200

    Initial hack attempt to get something rendered
    
    Change-Id: I13a407331184f08fd39095b7486d0a370d91ed93

diff --git a/vcl/coretext/salgdi.cxx b/vcl/coretext/salgdi.cxx
index 71abf43..7a064f0 100644
--- a/vcl/coretext/salgdi.cxx
+++ b/vcl/coretext/salgdi.cxx
@@ -283,6 +283,12 @@ bool SvpSalGraphics::CheckContext()
 {
     SAL_WARN_IF( mrContext == NULL, "vcl.ios", "CheckContext() failed" );
 
+    basegfx::B2IVector size = m_aDevice->getSize();
+    basebmp::RawMemorySharedArray pixelBuffer = m_aDevice->getBuffer();
+
+    mrContext = CGBitmapContextCreate(pixelBuffer.get(), size.getX(), size.getY(), 8, m_aDevice->getScanlineStride(),
+                                      CGColorSpaceCreateDeviceRGB(), kCGImageAlphaLast|kCGBitmapByteOrder32Little);
+
     return (mrContext != NULL);
 }
 
commit bdbb0d1cc13a11c8c857ee2d387771a8c2622488
Author: Tor Lillqvist <tml at iki.fi>
Date:   Sat Mar 23 13:36:57 2013 +0200

    Temporary hack for iOS: open files read-only if read-write open fails
    
    Change-Id: Ifc400d9843b23ef942c43af3a2b8830ccff71a7e

diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index d3f6251..008c61e 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -911,6 +911,18 @@ SAL_CALL osl_openFilePath( const char *cpFilePath, oslFileHandle* pHandle, sal_u
 
     /* open the file */
     int fd = open( cpFilePath, flags, mode );
+#ifdef IOS
+    /* Horrible hack: If opening for RDWR and getting EPERM, just try
+     * again for RDONLY. Quicker this way than to figure out why
+     * we get that oh so useful General Error when trying to open a
+     * read-only document.
+     */
+    if (-1 == fd && (flags & O_RDWR) && EPERM == errno)
+    {
+        int rdonly_flags = (flags & ~O_ACCMODE) | O_RDONLY;
+        fd = open( cpFilePath, rdonly_flags, mode );
+    }
+#endif
     if (-1 == fd)
     {
         int saved_errno = errno;


More information about the Libreoffice-commits mailing list