[Libreoffice-commits] .: officecfg/registry sc/uiconfig sfx2/inc sfx2/Library_sfx.mk sfx2/sdi sfx2/source svx/inc sw/sdi sw/uiconfig

Muthu Subramanian sumuthu at kemper.freedesktop.org
Tue Jul 24 03:08:35 PDT 2012


 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |    5 
 sc/uiconfig/scalc/menubar/menubar.xml                                |    1 
 sfx2/Library_sfx.mk                                                  |    1 
 sfx2/inc/bluthsndapi.hxx                                             |   54 +++++++
 sfx2/inc/sfx2/mailmodelapi.hxx                                       |   13 +
 sfx2/inc/sfx2/sfxsids.hrc                                            |    3 
 sfx2/sdi/sfx.sdi                                                     |   28 ++++
 sfx2/sdi/viwslots.sdi                                                |    5 
 sfx2/source/dialog/bluthsnd.cxx                                      |   70 ++++++++++
 sfx2/source/view/viewsh.cxx                                          |   21 +++
 svx/inc/globlmn_tmpl.hrc                                             |    5 
 sw/sdi/wviewsh.sdi                                                   |    4 
 sw/uiconfig/sglobal/menubar/menubar.xml                              |    1 
 sw/uiconfig/sweb/menubar/menubar.xml                                 |    1 
 sw/uiconfig/swreport/menubar/menubar.xml                             |    1 
 sw/uiconfig/swriter/menubar/menubar.xml                              |    1 
 sw/uiconfig/swxform/menubar/menubar.xml                              |    1 
 17 files changed, 208 insertions(+), 7 deletions(-)

New commits:
commit 1360309e64f8bbb21e23c94a65ada4aa282e1eb3
Author: Muthu Subramanian <sumuthu at suse.com>
Date:   Tue Jul 24 15:31:15 2012 +0530

    "Send via Bluetooth" (experimental) feature.
    
    This currently works only on Linux as of now.

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index 8525bee..bf1242a 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -4109,6 +4109,11 @@
                     <value xml:lang="en-US">E-mail as P~DF...</value>
                 </prop>
             </node>
+            <node oor:name=".uno:SendViaBluetooth" oor:op="replace">
+                <prop oor:name="Label" oor:type="xs:string">
+                    <value xml:lang="en-US">Send Via ~Bluetooth...</value>
+                </prop>
+            </node>
             <node oor:name=".uno:ExportToPDF" oor:op="replace">
                 <prop oor:name="Label" oor:type="xs:string">
                     <value xml:lang="en-US">Export as P~DF...</value>
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index 5a95a26..3108d0a 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -25,6 +25,7 @@
                     <menu:menuitem menu:id=".uno:SendMailDocAsOOo"/>
                     <menu:menuitem menu:id=".uno:SendMailDocAsMS"/>
                     <menu:menuitem menu:id=".uno:SendMailDocAsPDF"/>
+                    <menu:menuitem menu:id=".uno:SendViaBluetooth"/>
                 </menu:menupopup>
             </menu:menu>
             <menu:menuseparator/>
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 96d79df..06f64d0 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -155,6 +155,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/dialog/itemconnect \
     sfx2/source/dialog/inputdlg \
     sfx2/source/dialog/mailmodel \
+    sfx2/source/dialog/bluthsnd \
     sfx2/source/dialog/mgetempl \
     sfx2/source/dialog/navigat \
     sfx2/source/dialog/newstyle \
diff --git a/sfx2/inc/bluthsndapi.hxx b/sfx2/inc/bluthsndapi.hxx
new file mode 100644
index 0000000..6768ccc
--- /dev/null
+++ b/sfx2/inc/bluthsndapi.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *                       SUSE.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Muthu Subramanian <sumuthu at suse.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef INCLUDED_SFX_BLUETOOTHL_HXX
+#define INCLUDED_SFX_BLUETOOTH_HXX
+
+#include <vector>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "tools/link.hxx"
+#include <tools/string.hxx>
+#include "sfx2/dllapi.h"
+#include "mailmodelapi.hxx"
+
+
+// class SfxBluetoothModel_Impl -----------------------------------------------
+
+class SFX2_DLLPUBLIC SfxBluetoothModel:public SfxMailModel
+{
+public:
+    SendMailResult      SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+                                     const rtl::OUString& rType );
+    SendMailResult      Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame );
+};
+
+#endif // INCLUDED_SFX_BLUETOOTH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/inc/sfx2/mailmodelapi.hxx b/sfx2/inc/sfx2/mailmodelapi.hxx
index 19515c5..47bae9b 100644
--- a/sfx2/inc/sfx2/mailmodelapi.hxx
+++ b/sfx2/inc/sfx2/mailmodelapi.hxx
@@ -57,15 +57,20 @@ public:
         TYPE_ASPDF
     };
 
-private:
+protected:
     enum SaveResult
     {
         SAVE_SUCCESSFULL,
         SAVE_CANCELLED,
         SAVE_ERROR
     };
-
     ::std::vector< ::rtl::OUString > maAttachedDocuments;
+    SaveResult          SaveDocumentAsFormat( const rtl::OUString& aSaveFileName,
+                                              const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
+                                              const rtl::OUString& rType,
+                                              rtl::OUString& rFileNamePath );
+
+private:
     AddressList_Impl*   mpToList;
     AddressList_Impl*   mpCcList;
     AddressList_Impl*   mpBccList;
@@ -76,10 +81,6 @@ private:
     sal_Bool            mbLoadDone;
 
     void                ClearList( AddressList_Impl* pList );
-    SaveResult          SaveDocumentAsFormat( const rtl::OUString& aSaveFileName,
-                                              const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xFrameOrModel,
-                                              const rtl::OUString& rType,
-                                              rtl::OUString& rFileNamePath );
     SaveResult          ShowFilterOptionsDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR,
                                                  const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel,
                                                  const ::rtl::OUString& rFilterName,
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index a74b3af..f627d08 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -276,8 +276,9 @@
 #define SID_PASSWORDINTERACTION             (SID_SFX_START + 1723)
 #define SID_GOTOLINE                        (SID_SFX_START + 1724)
 #define SID_SHOWLINES                       (SID_SFX_START + 1725)
+#define	SID_BLUETOOTH_SENDDOC				(SID_SFX_START + 1726)
 
-//      SID_SFX_free_START                  (SID_SFX_START + 1726)
+//      SID_SFX_free_START                  (SID_SFX_START + 1727)
 //      SID_SFX_free_END                    (SID_SFX_START + 3999)
 
 #define SID_OPEN_NEW_VIEW                   (SID_SFX_START + 520)
diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi
index 8817513..92af180 100644
--- a/sfx2/sdi/sfx.sdi
+++ b/sfx2/sdi/sfx.sdi
@@ -5923,6 +5923,34 @@ SfxBoolItem SendMailDocAsPDF SID_MAIL_SENDDOCASPDF
     GroupId = GID_DOCUMENT;
 ]
 
+SfxBoolItem SendViaBluetooth SID_BLUETOOTH_SENDDOC
+()
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = TRUE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+    /* status: */
+    SlotType = SfxStringItem
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_DOCUMENT;
+]
+
+
 SfxBoolItem SendMailDocAsFormat SID_MAIL_SENDDOCASFORMAT
 (SfxStringItem Recipient SID_MAIL_RECIPIENT,SfxStringItem Subject SID_MAIL_SUBJECT,SfxStringItem MailText SID_MAIL_TEXT,SfxUInt16Item Priority SID_MAIL_PRIORITY,SfxStringItem TypeName SID_TYPE_NAME)
 [
diff --git a/sfx2/sdi/viwslots.sdi b/sfx2/sdi/viwslots.sdi
index ee7dd88..bfc770c 100644
--- a/sfx2/sdi/viwslots.sdi
+++ b/sfx2/sdi/viwslots.sdi
@@ -52,6 +52,11 @@ interface View
         ExecMethod = ExecMisc_Impl ;
         StateMethod = GetState_Impl ;
     ]
+    SID_BLUETOOTH_SENDDOC // ole(no) api(todo)
+    [
+        ExecMethod = ExecMisc_Impl ;
+        StateMethod = GetState_Impl ;
+    ]
      //---------------------------------------------------------------------
     SID_PRINTDOC // ole(no) api(play/rec)
     [
diff --git a/sfx2/source/dialog/bluthsnd.cxx b/sfx2/source/dialog/bluthsnd.cxx
new file mode 100644
index 0000000..e726662
--- /dev/null
+++ b/sfx2/source/dialog/bluthsnd.cxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ *                       SUSE.
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): Muthu Subramanian <sumuthu at suse.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <stdio.h>
+
+#include "bluthsndapi.hxx"
+
+SfxBluetoothModel::SendMailResult SfxBluetoothModel::SaveAndSend( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
+                            const rtl::OUString& rType )
+{
+    SaveResult		eSaveResult;
+    SendMailResult  eResult = SEND_MAIL_ERROR;
+    rtl::OUString   aFileName;
+
+    eSaveResult  = SaveDocumentAsFormat( rtl::OUString(), xFrame, rType, aFileName );
+    if( eSaveResult == SAVE_SUCCESSFULL )
+    {
+        maAttachedDocuments.push_back( aFileName );
+        return Send( xFrame );
+    }
+    else if( eSaveResult == SAVE_CANCELLED )
+        eResult = SEND_MAIL_CANCELLED;
+
+    return eResult;
+}
+
+SfxBluetoothModel::SendMailResult SfxBluetoothModel::Send( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& /*xFrame*/ )
+{
+    char bthsend[300];
+    SendMailResult eResult = SEND_MAIL_OK;
+    rtl::OUString aFileName = maAttachedDocuments[0];
+    snprintf(bthsend,300,"bluetooth-sendto %s",rtl::OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8).getStr() );
+    if( !system( bthsend ) )
+        eResult = SEND_MAIL_ERROR;
+    return eResult;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 6686b09..e1d0210 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -67,6 +67,7 @@
 #include "sfxlocal.hrc"
 #include <sfx2/sfxbasecontroller.hxx>
 #include "sfx2/mailmodelapi.hxx"
+#include "bluthsndapi.hxx"
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/event.hxx>
 #include <sfx2/fcontnr.hxx>
@@ -595,6 +596,26 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
             break;
         }
 
+        case SID_BLUETOOTH_SENDDOC:
+        {
+            SfxBluetoothModel aModel;
+            SfxObjectShell* pDoc = GetObjectShell();
+            if ( pDoc && pDoc->QueryHiddenInformation(
+                            WhenSaving, &GetViewFrame()->GetWindow() ) != RET_YES )
+                break;
+            uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() );
+            SfxMailModel::SendMailResult eResult = aModel.SaveAndSend( xFrame, rtl::OUString() );
+            if( eResult == SfxMailModel::SEND_MAIL_ERROR )
+            {
+                    InfoBox aBox( SFX_APP()->GetTopWindow(), SfxResId( MSG_ERROR_SEND_MAIL ));
+                    aBox.Execute();
+                    rReq.Ignore();
+            }
+            else
+                rReq.Done();
+        }
+        break;
+
         // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
         case SID_WEBHTML:
         {
diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc
index 0f56324..03c6dbe 100644
--- a/svx/inc/globlmn_tmpl.hrc
+++ b/svx/inc/globlmn_tmpl.hrc
@@ -441,6 +441,11 @@
     Identifier = SID_OBJECT_ROTATE ; \
     Command = ".uno:ToggleObjectRotateMode" ; \
 
+#define ITEM_FILE_BLUETOOTH_SENDDOC \
+    Identifier = SID_BLUETOOTH_SENDDOC ; \
+    Command = ".uno:SendViaBluetooth" ; \
+    HelpID = SID_BLUETOOTH_SENDDOC ; \
+    Text [ en-US ] = "Document via ~Bluetooth..." ; \
 
 #define ITEM_TRANSLITERATE_MENU\
     MenuItem\
diff --git a/sw/sdi/wviewsh.sdi b/sw/sdi/wviewsh.sdi
index 4c60069..8c99496 100644
--- a/sw/sdi/wviewsh.sdi
+++ b/sw/sdi/wviewsh.sdi
@@ -161,6 +161,10 @@ interface WebSourceView
     [
         StateMethod = GetState ;
     ]
+    SID_BLUETOOTH_SENDDOC
+    [
+        StateMethod = GetState ;
+    ]
     SID_EXPORTDOC
     [
         StateMethod = GetState ;
diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml
index 6e9c79a..b82b494 100644
--- a/sw/uiconfig/sglobal/menubar/menubar.xml
+++ b/sw/uiconfig/sglobal/menubar/menubar.xml
@@ -22,6 +22,7 @@
         <menu:menupopup>
           <menu:menuitem menu:id=".uno:SendMail"/>
           <menu:menuitem menu:id=".uno:SendMailDocAsPDF"/>
+          <menu:menuitem menu:id=".uno:SendViaBluetooth"/>
           <menu:menuseparator/>
           <menu:menuitem menu:id=".uno:NewGlobalDoc"/>
           <menu:menuitem menu:id=".uno:NewHtmlDoc"/>
diff --git a/sw/uiconfig/sweb/menubar/menubar.xml b/sw/uiconfig/sweb/menubar/menubar.xml
index 5010944..1f0efd7 100644
--- a/sw/uiconfig/sweb/menubar/menubar.xml
+++ b/sw/uiconfig/sweb/menubar/menubar.xml
@@ -19,6 +19,7 @@
         <menu:menupopup>
           <menu:menuitem menu:id=".uno:SendMail"/>
           <menu:menuitem menu:id=".uno:SendMailDocAsPDF"/>
+          <menu:menuitem menu:id=".uno:SendViaBluetooth"/>
         </menu:menupopup>
       </menu:menu>
       <menu:menuseparator/>
diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml
index e42fc69..f794fee 100644
--- a/sw/uiconfig/swreport/menubar/menubar.xml
+++ b/sw/uiconfig/swreport/menubar/menubar.xml
@@ -24,6 +24,7 @@
           <menu:menuitem menu:id=".uno:SendMailDocAsOOo"/>
           <menu:menuitem menu:id=".uno:SendMailDocAsMS"/>
           <menu:menuitem menu:id=".uno:SendMailDocAsPDF"/>
+          <menu:menuitem menu:id=".uno:SendViaBluetooth"/>
           <menu:menuseparator/>
           <menu:menuitem menu:id=".uno:NewGlobalDoc"/>
           <menu:menuitem menu:id=".uno:NewHtmlDoc"/>
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index 569240a..12f19b0 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -24,6 +24,7 @@
           <menu:menuitem menu:id=".uno:SendMailDocAsOOo"/>
           <menu:menuitem menu:id=".uno:SendMailDocAsMS"/>
           <menu:menuitem menu:id=".uno:SendMailDocAsPDF"/>
+          <menu:menuitem menu:id=".uno:SendViaBluetooth"/>
           <menu:menuseparator/>
           <menu:menuitem menu:id=".uno:NewGlobalDoc"/>
           <menu:menuitem menu:id=".uno:NewHtmlDoc"/>
diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml
index 49bcfb4..fd90dc4 100644
--- a/sw/uiconfig/swxform/menubar/menubar.xml
+++ b/sw/uiconfig/swxform/menubar/menubar.xml
@@ -24,6 +24,7 @@
           <menu:menuitem menu:id=".uno:SendMailDocAsOOo"/>
           <menu:menuitem menu:id=".uno:SendMailDocAsMS"/>
           <menu:menuitem menu:id=".uno:SendMailDocAsPDF"/>
+          <menu:menuitem menu:id=".uno:SendViaBluetooth"/>
           <menu:menuseparator/>
           <menu:menuitem menu:id=".uno:NewGlobalDoc"/>
           <menu:menuitem menu:id=".uno:NewHtmlDoc"/>


More information about the Libreoffice-commits mailing list