[Libreoffice-commits] core.git: 2 commits - include/sfx2 sfx2/source sw/qa
Caolán McNamara
caolanm at redhat.com
Wed Jun 19 08:00:33 PDT 2013
include/sfx2/event.hxx | 54 ++++++++++++++++++++-----------
sfx2/source/doc/printhelper.cxx | 6 ++-
sfx2/source/view/viewprn.cxx | 13 +++++--
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 4 +-
4 files changed, 50 insertions(+), 27 deletions(-)
New commits:
commit db20a50fab35c15baf55f0146ed0cb80527053e8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jun 19 15:52:25 2013 +0100
sal_Int32 as long on 32bit, how we hate thee
Change-Id: I702509c7ad9dd3e84feb6d880264df36afe3c5b3
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 3dbb0a4..133cf6e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -823,7 +823,7 @@ void Test::testFdo64238_a()
uno::Reference< text::XTextRange > xFooterParagraph = getParagraphOfText( 1, xFooterText );
uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xFooterParagraph, uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
- int numOfRuns = 0;
+ sal_Int32 numOfRuns = 0;
while (xRunEnum->hasMoreElements())
{
uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
@@ -843,7 +843,7 @@ void Test::testFdo64238_b()
uno::Reference< text::XTextRange > xFooterParagraph = getParagraphOfText( 1, xFooterText );
uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xFooterParagraph, uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
- int numOfRuns = 0;
+ sal_Int32 numOfRuns = 0;
while (xRunEnum->hasMoreElements())
{
uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
commit 87dfa6dd336d596112c0beb6b42f082178461678
Author: Ariel Constenla-Haile <arielch at apache.org>
Date: Sun Feb 24 18:23:21 2013 +0000
Resolves: #i121810# Adapt SfxPrintingHint to work with...
the "new" XDocumentEventBroadcaster
(cherry picked from commit 1bfae56dd9d633a80924bfeefc03368100d75a8f)
Conflicts:
sfx2/inc/sfx2/event.hxx
sfx2/source/view/viewprn.cxx
Change-Id: I6b3e1edc396b82d85fe059e6cdf7ad0009d5b94b
diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx
index bcdc88e..6993185 100644
--- a/include/sfx2/event.hxx
+++ b/include/sfx2/event.hxx
@@ -21,6 +21,7 @@
#include "sal/config.h"
#include "sfx2/dllapi.h"
+#include "sfx2/sfx.hrc"
#include <tools/string.hxx>
#include <svl/hint.hxx>
#include <unotools/eventcfg.hxx>
@@ -29,6 +30,9 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XController2.hpp>
+#include <com/sun/star/view/PrintableState.hpp>
+
+namespace css = ::com::sun::star;
class SfxObjectShell;
@@ -62,22 +66,22 @@ public:
class SFX2_DLLPUBLIC SfxViewEventHint : public SfxEventHint
{
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > xViewController;
+ ::com::sun::star::uno::Reference< css::frame::XController2 > xViewController;
public:
TYPEINFO();
- SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& xController )
+ SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController >& xController )
: SfxEventHint( nId, aName, pObj )
- , xViewController( xController, ::com::sun::star::uno::UNO_QUERY )
+ , xViewController( xController, css::uno::UNO_QUERY )
{}
- SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 >& xController )
+ SfxViewEventHint( sal_uInt16 nId, const OUString& aName, SfxObjectShell *pObj, const css::uno::Reference< css::frame::XController2 >& xController )
: SfxEventHint( nId, aName, pObj )
, xViewController( xController )
{}
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController2 > GetController() const
+ css::uno::Reference< css::frame::XController2 > GetController() const
{ return xViewController; }
};
@@ -112,23 +116,35 @@ public:
};
class Printer;
-class SfxPrintingHint : public SfxHint
+
+class SfxPrintingHint : public SfxViewEventHint
{
- sal_Int32 nWhich;
+ sal_Int32 mnPrintableState;
com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aOpts;
public:
- TYPEINFO();
- SfxPrintingHint( sal_Int32 nEvent, const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rOpts )
- : nWhich( nEvent )
- , aOpts( rOpts )
- {}
-
- SfxPrintingHint( sal_Int32 nEvent )
- : nWhich( nEvent )
- {}
-
- sal_Int32 GetWhich() const { return nWhich; }
- const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& GetOptions() { return aOpts; }
+ TYPEINFO();
+
+ SfxPrintingHint(
+ sal_Int32 nEvent,
+ const css::uno::Sequence < css::beans::PropertyValue >& rOpts,
+ SfxObjectShell *pObj,
+ const css::uno::Reference< css::frame::XController2 >& xController )
+ : SfxViewEventHint(
+ SFX_EVENT_PRINTDOC,
+ GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ),
+ pObj,
+ xController )
+ , mnPrintableState( nEvent )
+ , aOpts( rOpts )
+ {}
+
+ SfxPrintingHint( sal_Int32 nEvent )
+ : SfxViewEventHint( SFX_EVENT_PRINTDOC, rtl::OUString(), 0, css::uno::Reference< css::frame::XController >() )
+ , mnPrintableState( nEvent )
+ {}
+
+ sal_Int32 GetWhich() const { return mnPrintableState; }
+ const css::uno::Sequence < css::beans::PropertyValue >& GetOptions() { return aOpts; }
};
#endif
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 1b00652..c042c6e 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -54,6 +54,8 @@
#include <sfx2/objsh.hxx>
#include <sfx2/event.hxx>
+#define SFX_PRINTABLESTATE_CANCELJOB -2
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -137,7 +139,7 @@ void SAL_CALL SfxPrintJob_Impl::cancelJob() throw (RuntimeException)
{
// FIXME: how to cancel PrintJob via API?!
if( m_pData->m_pObjectShell.Is() )
- m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( -2 ) );
+ m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( SFX_PRINTABLESTATE_CANCELJOB ) );
}
SfxPrintHelper::SfxPrintHelper()
@@ -792,7 +794,7 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin
SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint );
if ( &rBC != m_pObjectShell
|| !pPrintHint
- || pPrintHint->GetWhich() == -2 ) // -2 : CancelPrintJob
+ || pPrintHint->GetWhich() == SFX_PRINTABLESTATE_CANCELJOB )
return;
if ( pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_STARTED )
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 0a9c080..dab76f3 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -19,7 +19,6 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
-#include <com/sun/star/view/PrintableState.hpp>
#include "com/sun/star/view/XRenderable.hpp"
#include <svl/itempool.hxx>
@@ -55,7 +54,7 @@
using namespace com::sun::star;
using namespace com::sun::star::uno;
-TYPEINIT1(SfxPrintingHint, SfxHint);
+TYPEINIT1(SfxPrintingHint, SfxViewEventHint);
// -----------------------------------------------------------------------
class SfxPrinterController : public vcl::PrinterController, public SfxListener
@@ -321,9 +320,15 @@ void SfxPrinterController::jobStarted()
now.GetDay(), now.GetMonth(), now.GetYear() ) );
SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ), mpObjectShell ) );
- // FIXME: how to get all print options incl. AdditionalOptions easily?
uno::Sequence < beans::PropertyValue > aOpts;
- mpObjectShell->Broadcast( SfxPrintingHint( view::PrintableState_JOB_STARTED, aOpts ) );
+ aOpts = getJobProperties( aOpts );
+
+ uno::Reference< frame::XController2 > xController;
+ if ( mpViewShell )
+ xController.set( mpViewShell->GetController(), uno::UNO_QUERY );
+
+ mpObjectShell->Broadcast( SfxPrintingHint(
+ view::PrintableState_JOB_STARTED, aOpts, mpObjectShell, xController ) );
}
}
More information about the Libreoffice-commits
mailing list