Hi Mikhail,

Here is the new patch for i6010, sorry I did not send it earlier, but again a new problem happens: the msole object doesn't print. After a quick debug I found it's because the current implementation of SfxViewShell::GetPrinter() always return a null pointer. I suppose some work is just undone here?( I'm still confused that the method has already widely used though ) Do you think we should implement this method or is there a workaround for our case? I'm looking forward to your suggestions.

Thanks and Best Regards,
Felix.


Mikhail Voitenko
Hi Felix,

I am awfully sorry for the delay with answer. I had to do some investigations to find out how a replacement image could be printed.

The implementation should be done on the container side in this case. The container side has the replacement image and access to the vcl implementation. So I would suggest to throw UnreachableStateException from the MSOLE object in case "Print" verb is provided to doVerb() call. The implementation in the sfx2/source/view/ipclient.cxx in method DoVerb() should check in case of this exception whether the PRINT verb is used ( it is already don for the default verb in similar way ). In this case the container should try to print the replacement image.

The printing can be implemented in following way:
- get the container SfxViewShell using GetViewShell() call from DoVerb
- if the shell is not NULL use pViewShell->GetPrinter() call to get the printer - if the printer is not null please get the graphics from the replacement image, that would need the following steps: - Please get the container object shell using pViewShell->GetObjectShell() - if it is not NULL please call pObjectShell->GetEmbeddedObjectContainer().GetGraphicStream( m_pImp->m_xObject ) - now the stream has to be converted to Graphic object, please see the implementation in svtools/source/misc/embedhlp.cxx in method EmbeddedObjectRef::GetReplacement() as example - after you have Graphic object you can execute pGraphic->Draw( pPrinter, Point( 0, 0 ) )

We can discuss further details/questions tomorrow on IRC meeting.

As for the testing, it would be nice to test the functionality on Linux, but in this case it is not really necessary I think. The implementation looks generally to be platform independent, so it is not necessary to spend time an prepare the linux build only for this.

Best regards,
Mikhail.

On 02/24/09 05:02, Zhang Xiaofei wrote:
Hi Mikhail,

Thank you for your hint, here I created a small fragmentary patch for the first step, please point out if there's obvious problems within. And I would like to hear the details regarding the image printing so that I can understand more about the related code before our next meeting, but only if your time permits , of course. :-) By the way do you think I should prepare a new linux build, please? I don't know if it is necessary for testing our new implementation and feel like need advice.

Thank you and Best Regards,
Felix.


Mikhail Voitenko
Hi Felix,

On 02/20/09 09:50, Zhang Xiaofei wrote:
Hi Mikhail,

Sorry but I searched the usage of GetVerbByShortcut() and couldn't find an example, I may need your hint on this little question regarding the first step: what exactly is the ShortCut of a Verb please? Is it in our case, "PRINT"?

Yes exactly, it is "PRINT" in this case. This is the shortcut that is used as the node name in the configuration. The method gets the information from the configuration and fills the verb description. You can find the implementation and the usage of the method in the comphelper/source/misc/mimeconfighelper.cxx

Best regards,
Mikhail.


Best Regards,
Felix.


Mikhail Voitenko
Hi Felix,

Thanks a lot for the patch, it looks good.

Now the MSOLE implementation should be adjusted as we have discussed.
The first step would be to let the getSupportedVerbs() implementation return the print verb. MSOLE objects are a special case, the verbs are either requested from the external server ( in case it is Windows system with installed server related to the object ), or just empty in case of Unix systems. The new implementation should add the print verb for both cases. To get the PRINT verb value from configuration please use "::comphelper::MimeConfigurationHelper::GetVerbByShortcut()" method.

The next step will be to implement the verb itself. In case getPreferredVisualRepresentation() can retrieve the replacement image the image could be printed by the object itself. Sometimes it might work even on Unix systems in case the image is stored in the object stream. Otherwise it should be printed in the container. I will send the details regarding the image printing tomorrow.

Best Regards,
Mikhail.

On 02/19/09 10:14, Zhang Xiaofei wrote:
Hi Mikhail,

I'm sorry our network broke down after our meeting yesterday. With this patch the temporary frame is hidden when document is printed now. Would you please review it for me?
Thank you for your help. :-)

Best Regards,
Felix.









Index: embeddedobj/source/commonembedding/embedobj.cxx
===================================================================
--- embeddedobj/source/commonembedding/embedobj.cxx     (revision 267538)
+++ embeddedobj/source/commonembedding/embedobj.cxx     (working copy)
@@ -88,7 +88,7 @@
                if ( m_aVerbTable[nInd][0] == nVerb )
                        return m_aVerbTable[nInd][1];
 
-       throw lang::IllegalArgumentException(); // TODO: unexpected verb 
provided
+       return -1;
 }
 
 //----------------------------------------------
@@ -547,18 +547,18 @@
                                                                                
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) 
);
 
        // for internal documents this call is just a duplicate of changeState
-       sal_Int32 nNewState = -1;
-       try
-       {
-               nNewState = ConvertVerbToState_Impl( nVerbID );
-       }
-       catch( uno::Exception& )
-       {}
+       sal_Int32 nNewState = ConvertVerbToState_Impl( nVerbID );
 
        if ( nNewState == -1 )
        {
-               // TODO/LATER: Save Copy as... verb ( -8 ) is implemented by 
container
+               // TODO/LATER: Save Copy as... verb ( 
embed::EmbedVerbs::OLEVERB_SAVECOPYAS ) is implemented by container
                // TODO/LATER: check if the verb is a supported one and if it 
is produce related operation
+        if ( nVerbID == embed::EmbedVerbs::OLEVERB_PRINT )
+        {
+            if ( m_nObjectState == embed::EmbedStates::LOADED )
+                SwitchStateTo_Impl( embed::EmbedStates::RUNNING );
+            m_pDocHolder->PrintDocument();
+        }
        }
        else
                changeState( nNewState );
Index: embeddedobj/source/commonembedding/specialobject.cxx
===================================================================
--- embeddedobj/source/commonembedding/specialobject.cxx        (revision 
267538)
+++ embeddedobj/source/commonembedding/specialobject.cxx        (working copy)
@@ -233,7 +233,7 @@
                throw embed::WrongStateException( 
::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
                                                                                
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) 
);
 
-    if ( nVerbID == -7 )
+    if ( nVerbID == embed::EmbedVerbs::OLEVERB_PROPERTIES )
     {
 
         uno::Reference < ui::dialogs::XExecutableDialog > xDlg( 
m_pDocHolder->GetComponent(), uno::UNO_QUERY );
Index: embeddedobj/source/general/docholder.cxx
===================================================================
--- embeddedobj/source/general/docholder.cxx    (revision 267538)
+++ embeddedobj/source/general/docholder.cxx    (working copy)
@@ -77,6 +77,9 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/embed/StateChangeInProgressException.hpp>
 
+#include <com/sun/star/view/XPrintable.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
 #include <com/sun/star/embed/EmbedMisc.hpp>
 #include <com/sun/star/embed/EmbedStates.hpp>
 #include <osl/diagnose.h>
@@ -531,7 +534,7 @@
 
     if ( m_xComponent.is() )
        {
-        if ( !LoadDocToFrame( sal_True ) )
+        if ( !LoadDocToFrame( sal_True, sal_False, m_xFrame ) )
         {
             CloseFrame();
             return sal_False;
@@ -924,7 +927,7 @@
         // TODO/LATER: get it for the real aspect
         awt::Size aSize;
         GetExtent( embed::Aspects::MSOLE_CONTENT, &aSize );
-        LoadDocToFrame(sal_False);
+        LoadDocToFrame( sal_False, sal_False, m_xFrame );
 
                if ( xOwnLM.is() )
                {
@@ -1013,32 +1016,41 @@
        }
 
        if ( m_xFrame.is() )
-        LoadDocToFrame(sal_False);
+        LoadDocToFrame( sal_False, sal_False, m_xFrame );
 }
 
 //---------------------------------------------------------------------------
-sal_Bool DocumentHolder::LoadDocToFrame( sal_Bool bInPlace )
+sal_Bool DocumentHolder::LoadDocToFrame( sal_Bool bInPlace, sal_Bool bHidden, 
uno::Reference< frame::XFrame >& xFrame )
 {
-    if ( m_xFrame.is() && m_xComponent.is() )
+    if ( xFrame.is() && m_xComponent.is() )
        {
         uno::Reference < frame::XModel > xDoc( m_xComponent, uno::UNO_QUERY );
         if ( xDoc.is() )
         {
             // load new document in to the frame
-            uno::Reference< frame::XComponentLoader > xComponentLoader( 
m_xFrame, uno::UNO_QUERY );
+            uno::Reference< frame::XComponentLoader > xComponentLoader( 
xFrame, uno::UNO_QUERY );
             if( !xComponentLoader.is() )
                 throw uno::RuntimeException();
 
-            uno::Sequence< beans::PropertyValue > aArgs( bInPlace ? 3 : 2 );
+            sal_Int32 nInd = 2;
+            uno::Sequence< beans::PropertyValue > aArgs( nInd );
             aArgs[0].Name = ::rtl::OUString::createFromAscii( "Model" );
             aArgs[0].Value <<= m_xComponent;
             aArgs[1].Name = ::rtl::OUString::createFromAscii( "ReadOnly" );
             aArgs[1].Value <<= m_bReadOnly;
             if ( bInPlace )
             {
-                aArgs[2].Name = ::rtl::OUString::createFromAscii( "PluginMode" 
);
-                aArgs[2].Value <<= sal_Int16(1);
+                aArgs.realloc( ++nInd );
+                aArgs[nInd-1].Name = ::rtl::OUString::createFromAscii( 
"PluginMode" );
+                aArgs[nInd-1].Value <<= sal_Int16(1);
             }
+            if ( bHidden)
+            {
+                aArgs.realloc( ++nInd );
+                aArgs[nInd-1].Name = ::rtl::OUString::createFromAscii( 
"Hidden" );
+                aArgs[nInd-1].Value <<= bHidden;
+            }
+            
                        ::rtl::OUString sUrl;
                        uno::Reference< lang::XServiceInfo> 
xServiceInfo(xDoc,uno::UNO_QUERY);
                        if (    xServiceInfo.is() 
@@ -1063,7 +1075,7 @@
         {
             uno::Reference < frame::XSynchronousFrameLoader > xLoader( 
m_xComponent, uno::UNO_QUERY );
             if ( xLoader.is() )
-                return xLoader->load( uno::Sequence < beans::PropertyValue 
>(), m_xFrame );
+                return xLoader->load( uno::Sequence < beans::PropertyValue 
>(), xFrame );
             else
                 return sal_False;
         }
@@ -1366,3 +1378,60 @@
     // deactivation is too unspecific to be useful; usually we only trigger 
code from activation
     // so UIDeactivation is actively triggered by the container
 }
+
+void DocumentHolder::PrintDocument()
+// TODO/LATER: This should be moved to the document implementation to allow 
printing of documents without view.
+{
+    if ( !m_xFrame.is() )
+    {
+        uno::Reference< lang::XSingleServiceFactory > xFrameFact(
+            m_xFactory->createInstance( ::rtl::OUString::createFromAscii( 
"com.sun.star.frame.TaskCreator" ) ),
+            uno::UNO_QUERY_THROW );
+
+        uno::Sequence< uno::Any > aOutplaceFrameProps( 2 );
+
+        beans::NamedValue aArgs;
+        aArgs.Name = ::rtl::OUString::createFromAscii( "TopWindow" );
+        aArgs.Value <<= sal_True;
+        aOutplaceFrameProps[0] <<= aArgs;
+
+        aArgs.Name = ::rtl::OUString::createFromAscii( "MakeVisible" );
+        aArgs.Value <<= sal_False;
+        aOutplaceFrameProps[1] <<= aArgs;
+
+
+        uno::Reference< frame::XFrame > xFrame;
+        xFrame.set( xFrameFact->createInstanceWithArguments( 
aOutplaceFrameProps ), uno::UNO_QUERY_THROW );
+
+        if ( LoadDocToFrame( sal_False, sal_True, xFrame ) )
+        {        
+            uno::Reference < view::XPrintable > xDoc ( m_xComponent, 
uno::UNO_QUERY );
+            if ( xDoc.is() )
+            {
+                uno::Sequence < beans::PropertyValue > aPrinterArgs( 1 );
+                aPrinterArgs[0].Name = 
::rtl::OUString::createFromAscii("Wait");
+                aPrinterArgs[0].Value <<= sal_True;
+                xDoc->print( aPrinterArgs );
+            }
+        }
+
+        uno::Reference<util::XCloseable> xCloseable( xFrame,uno::UNO_QUERY );
+        if( xCloseable.is() )
+            try {
+                xCloseable->close( sal_True );
+            }
+            catch( const uno::Exception& ) {
+            }
+    }
+    else
+    {
+        uno::Reference < view::XPrintable > xDoc ( m_xComponent, 
uno::UNO_QUERY );
+        if ( xDoc.is() )
+        {
+            uno::Sequence < beans::PropertyValue > aPrinterArgs( 1 );
+            aPrinterArgs[0].Name = ::rtl::OUString::createFromAscii("Wait");
+            aPrinterArgs[0].Value <<= sal_True;
+            xDoc->print( aPrinterArgs );
+        }        
+    }
+}
\ No newline at end of file
Index: embeddedobj/source/inc/docholder.hxx
===================================================================
--- embeddedobj/source/inc/docholder.hxx        (revision 267538)
+++ embeddedobj/source/inc/docholder.hxx        (working copy)
@@ -97,7 +97,8 @@
 
 
        ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 
GetDocFrame();
-    sal_Bool LoadDocToFrame( sal_Bool );
+    sal_Bool LoadDocToFrame( sal_Bool bInPlace, sal_Bool bHidden,
+                ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XFrame >& xFrame );
 
        ::com::sun::star::awt::Rectangle CalculateBorderedArea( const 
::com::sun::star::awt::Rectangle& aRect );
        ::com::sun::star::awt::Rectangle AddBorderToArea( const 
::com::sun::star::awt::Rectangle& aRect );
@@ -169,6 +170,8 @@
 
        void Show();
 
+    void PrintDocument();
+
        // sal_Bool SetVisArea( sal_Int64 nAspect, const 
::com::sun::star::awt::Rectangle& aRect );
        // sal_Bool GetVisArea( sal_Int64 nAspect, 
::com::sun::star::awt::Rectangle *pRect );
        sal_Bool SetExtent( sal_Int64 nAspect, const 
::com::sun::star::awt::Size& aSize );
Index: embeddedobj/source/msole/oleembed.cxx
===================================================================
--- embeddedobj/source/msole/oleembed.cxx       (revision 267538)
+++ embeddedobj/source/msole/oleembed.cxx       (working copy)
@@ -703,8 +703,11 @@
 
        if ( m_nObjectState == -1 )
                throw embed::WrongStateException( 
::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
-                                                                               
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) 
);
+        uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* 
>(this) ) );
 
+    if ( nVerbID == embed::EmbedVerbs::OLEVERB_PRINT )
+        throw embed::UnreachableStateException();
+
 #ifdef WNT
        if ( m_pOleComponent )
        {
@@ -757,7 +760,7 @@
        else
 #endif
        {
-               if ( nVerbID == -9 )
+        if ( nVerbID == embed::EmbedVerbs::OLEVERB_VIEWIMPORT )
                {
                        // the workaround verb to show the object in case no 
server is available
 
@@ -822,6 +825,12 @@
        if ( m_nObjectState == -1 )
                throw embed::WrongStateException( 
::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
                                                                                
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) 
);
+
+    uno::Sequence< embed::VerbDescriptor > aVerbs;
+
+    ::comphelper::MimeConfigurationHelper aConfigHelper( m_xFactory );
+    
+
 #ifdef WNT
        if ( m_pOleComponent )
        {
@@ -832,13 +841,18 @@
                //      throw embed::NeedsRunningStateException(); // TODO:
                // }
 
-               return m_pOleComponent->GetVerbList();
+        aVerbs = m_pOleComponent->GetVerbList();
+        aVerbs.realloc( aVerbs.getLength() + 1 );
+        aConfigHelper.GetVerbByShortcut( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "PRINT" ) ), aVerbs[aVerbs.getLength()-1] );
        }
        else
 #endif
        {
-               return uno::Sequence< embed::VerbDescriptor >();
-       }
+        aVerbs = uno::Sequence< embed::VerbDescriptor > (1);
+        aConfigHelper.GetVerbByShortcut( ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM( "PRINT" ) ), aVerbs[0] );
+    }
+
+    return aVerbs;
 }
 
 //----------------------------------------------
Index: offapi/com/sun/star/embed/EmbedVerbs.idl
===================================================================
--- offapi/com/sun/star/embed/EmbedVerbs.idl    (revision 266626)
+++ offapi/com/sun/star/embed/EmbedVerbs.idl    (working copy)
@@ -77,6 +77,26 @@
         */
        const long MS_OLEVERB_DISCARDUNDOSTATE = -6;
 
+       
//------------------------------------------------------------------------
+       /** lets the object display its properties.
+        */
+       const long OLEVERB_PROPERTIES = -7;
+
+       
//------------------------------------------------------------------------
+       /** lets the object save copy as a file.
+        */
+       const long OLEVERB_SAVECOPYAS = -8;
+
+       
//------------------------------------------------------------------------
+       /** lets MSOLE objects be imported in OOo document and shown readonly.
+        */
+       const long OLEVERB_VIEWIMPORT = -9;
+    
+    //------------------------------------------------------------------------
+       /** lets the object print itself.
+        */
+       const long OLEVERB_PRINT = -10;
+
 };
 
 //============================================================================
Index: officecfg/registry/data/org/openoffice/Office/Embedding.xcu
===================================================================
--- officecfg/registry/data/org/openoffice/Office/Embedding.xcu (revision 
266626)
+++ officecfg/registry/data/org/openoffice/Office/Embedding.xcu (working copy)
@@ -123,6 +123,21 @@
         <value>0</value>
       </prop>
     </node>
+    <node oor:name="DISCARDUNDOSTATE" oor:op="replace">
+      <prop oor:name="VerbUIName">
+        <value>Discard Undo State</value>
+        <value xml:lang="x-comment">Is not shown in UI. No translation is 
required.</value>
+      </prop>
+      <prop oor:name="VerbID">
+        <value>-6</value>
+      </prop>
+      <prop oor:name="VerbFlags">
+        <value>0</value>
+      </prop>
+      <prop oor:name="VerbAttributes">
+        <value>0</value>
+      </prop>
+    </node>
     <node oor:name="PROPERTIES" oor:op="replace">
       <prop oor:name="VerbUIName">
 
@@ -155,6 +170,37 @@
         <value>2</value>
       </prop>
     </node>
+    <node oor:name="VIEWIMPORT" oor:op="replace">
+      <prop oor:name="VerbUIName">
+        <value>View Import</value>
+        <value xml:lang="x-comment">Is not shown in UI. No translation is 
required.</value>
+      </prop>
+      <prop oor:name="VerbID">
+        <value>-9</value>
+      </prop>
+      <prop oor:name="VerbFlags">
+        <value>0</value>
+      </prop>
+      <prop oor:name="VerbAttributes">
+        <value>0</value>
+      </prop>
+    </node>
+    <node oor:name="PRINT" oor:op="replace">
+      <prop oor:name="VerbUIName">
+
+        <value xml:lang="en-US">P~rint</value>
+        <value xml:lang="x-comment">This verb will let the object be 
printed.</value>
+      </prop>
+      <prop oor:name="VerbID">
+        <value>-10</value>
+      </prop>
+      <prop oor:name="VerbFlags">
+        <value>0</value>
+      </prop>
+      <prop oor:name="VerbAttributes">
+        <value>2</value>
+      </prop>
+    </node>
   </node>
   <node oor:name="Objects">
     <node oor:name="970B1E81-CF2D-11CF-89CA-008029E4B0B1" oor:op="replace">
@@ -168,7 +214,7 @@
         <value>4294969728</value>
       </prop>
       <prop oor:name="ObjectVerbs">
-        <value>PRIMARY SHOW IPACTIVATE PROPERTIES</value>
+        <value>PRIMARY SHOW IPACTIVATE PROPERTIES PRINT</value>
       </prop>
     </node>
     <node oor:name="4CAA7761-6B8B-11CF-89CA-008029E4B0B1" oor:op="replace">
@@ -182,7 +228,7 @@
         <value>2432</value>
       </prop>
       <prop oor:name="ObjectVerbs">
-        <value>PRIMARY SHOW IPACTIVATE PROPERTIES</value>
+        <value>PRIMARY SHOW IPACTIVATE PROPERTIES PRINT</value>
       </prop>
     </node>
     <node oor:name="1A8A6701-DE58-11CF-89CA-008029E4B0B1" oor:op="replace">
@@ -196,7 +242,7 @@
         <value>2432</value>
       </prop>
       <prop oor:name="ObjectVerbs">
-        <value>PRIMARY SHOW IPACTIVATE PROPERTIES</value>
+        <value>PRIMARY SHOW IPACTIVATE PROPERTIES PRINT</value>
       </prop>
     </node>
     <node oor:name="47BBB4CB-CE4C-4E80-A591-42D9AE74950F" oor:op="replace" 
install:module="calc">
@@ -208,7 +254,7 @@
       </prop>
       <prop oor:name="ObjectMiscStatus"/>
       <prop oor:name="ObjectVerbs">
-        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS</value>
+        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS 
PRINT</value>
       </prop>
     </node>
     <node oor:name="12DCAE26-281F-416F-A234-C3086127382E" oor:op="replace" 
install:module="chart">
@@ -222,7 +268,7 @@
         <value>1</value>
       </prop>
       <prop oor:name="ObjectVerbs">
-        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE</value>
+        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE PRINT</value>
       </prop>
     </node>
     <node oor:name="4BAB8970-8A3B-45B3-991C-CBEEAC6BD5E3" oor:op="replace" 
install:module="draw">
@@ -234,7 +280,7 @@
       </prop>
       <prop oor:name="ObjectMiscStatus"/>
       <prop oor:name="ObjectVerbs">
-        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS</value>
+        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS 
PRINT</value>
       </prop>
     </node>
     <node oor:name="9176E48A-637A-4D1F-803B-99D9BFAC1047" oor:op="replace" 
install:module="impress">
@@ -246,7 +292,7 @@
       </prop>
       <prop oor:name="ObjectMiscStatus"/>
       <prop oor:name="ObjectVerbs">
-        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS</value>
+        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS 
PRINT</value>
       </prop>
     </node>
     <node oor:name="078B7ABA-54FC-457F-8551-6147E776A997" oor:op="replace" 
install:module="math">
@@ -260,7 +306,7 @@
         <value>8589934592</value>
       </prop>
       <prop oor:name="ObjectVerbs">
-        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS</value>
+        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS 
PRINT</value>
       </prop>
     </node>
     <node oor:name="8BC6B165-B1B2-4EDD-AA47-DAE2EE689DD6" oor:op="replace" 
install:module="writer">
@@ -272,7 +318,7 @@
       </prop>
       <prop oor:name="ObjectMiscStatus"/>
       <prop oor:name="ObjectVerbs">
-        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS</value>
+        <value>PRIMARY SHOW OPEN HIDE UIACTIVATE IPACTIVATE SAVECOPYAS 
PRINT</value>
       </prop>
     </node>
   </node>
Index: sfx2/source/view/ipclient.cxx
===================================================================
--- sfx2/source/view/ipclient.cxx       (revision 269064)
+++ sfx2/source/view/ipclient.cxx       (working copy)
@@ -50,6 +50,8 @@
 
 #include <com/sun/star/embed/EmbedMisc.hpp>
 #include <svtools/embedhlp.hxx>
+#include <svtools/filter.hxx>
+#include <unotools/ucbstreamhelper.hxx>
 #include <vcl/svapp.hxx>
 
 #include <sfx2/ipclient.hxx>
@@ -927,7 +929,7 @@
     if ( m_pImp->m_xObject.is() )
     {
                sal_Bool bSaveCopyAs = sal_False;
-               if ( nVerb == -8 ) // "Save Copy as..."
+               if ( nVerb == embed::EmbedVerbs::OLEVERB_SAVECOPYAS ) // "Save 
Copy as..."
                {
             svt::EmbeddedObjectRef::TryRunningState( m_pImp->m_xObject );
                        // TODO/LATER: this special verb should disappear when 
outplace activation is completely available
@@ -986,12 +988,12 @@
                        }
                                catch ( embed::UnreachableStateException& )
                                {
-                                       if ( nVerb == 0 || nVerb == 
embed::EmbedVerbs::MS_OLEVERB_OPEN )
+                                       if ( nVerb == 
embed::EmbedVerbs::MS_OLEVERB_PRIMARY || nVerb == 
embed::EmbedVerbs::MS_OLEVERB_OPEN )
                                        {
                                                // a workaround for the default 
verb, usually makes sence for alien objects
                                                try
                                                {
-                                                       
m_pImp->m_xObject->doVerb( -9 ); // open own view, a workaround verb that is 
not visible
+                                                       
m_pImp->m_xObject->doVerb( embed::EmbedVerbs::OLEVERB_VIEWIMPORT ); // open own 
view, a workaround verb that is not visible
 
                             if ( m_pImp->m_xObject->getCurrentState() == 
embed::EmbedStates::UI_ACTIVE )
                             {
@@ -1012,6 +1014,39 @@
                                                        nError = 
ERRCODE_SO_GENERALERROR;
                                                }
                                        }
+                    if ( nVerb == embed::EmbedVerbs::OLEVERB_PRINT )
+                    {
+                        try
+                        {
+                            SfxViewShell* pViewShell = GetViewShell();
+                            if ( pViewShell )
+                            {
+                                OutputDevice* pPrinter = 
(OutputDevice*)pViewShell->GetPrinter();
+                                if ( pPrinter ) 
+                                {
+                                    SfxObjectShell* pObjectShell = 
pViewShell->GetObjectShell();
+                                    if ( pObjectShell )
+                                    {
+                                        uno::Reference < io::XInputStream > 
xGraphicStream = pObjectShell->GetEmbeddedObjectContainer().GetGraphicStream( 
m_pImp->m_xObject );
+                                        SvStream* pGraphicStream = 
::utl::UcbStreamHelper::CreateStream( xGraphicStream );
+
+                                        if ( pGraphicStream )
+                                        {
+                                            GraphicFilter* pGF = 
GraphicFilter::GetGraphicFilter();
+                                            Graphic* pGraphic = new Graphic;
+                                            pGF->ImportGraphic( *pGraphic, 
String(), *pGraphicStream );
+                                            pGraphic->Draw( pPrinter, Point( 
0, 0 ) );
+                                        }
+                                    }
+                                }
+                            }
+
+                        }
+                        catch ( uno::Exception& )
+                        {
+                            nError = ERRCODE_SO_GENERALERROR;
+                        }
+                    }
                                }
                                catch ( embed::StateChangeInProgressException& )
                                {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@framework.openoffice.org
For additional commands, e-mail: dev-h...@framework.openoffice.org

Reply via email to