Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
ad2e7f5b
Kaydet (Commit)
ad2e7f5b
authored
Ara 10, 2012
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix SDK example
Change-Id: I3d31e0ad7e5015340a045230678760e3b20c59a1
üst
f2609cc7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
36 deletions
+31
-36
MyProtocolHandler.cxx
...examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
+17
-22
MyProtocolHandler.h
odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h
+12
-12
exports.cxx
odk/examples/cpp/complextoolbarcontrols/exports.cxx
+2
-2
No files found.
odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx
Dosyayı görüntüle @
ad2e7f5b
...
...
@@ -22,15 +22,15 @@
#include "MyProtocolHandler.h"
#include <com/sun/star/awt/MessageBoxButtons.hpp>
#include <com/sun/star/awt/Toolkit.hpp>
#include <com/sun/star/awt/XMessageBoxFactory.hpp>
#include <com/sun/star/frame/ControlCommand.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
#include <com/sun/star/sheet/XSpreadsheetView.hpp>
#include <com/sun/star/system/SystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/system/XSystemShellExecute.hpp>
#include <compphelper/componentcontext.hxx>
using
namespace
com
::
sun
::
star
::
awt
;
using
namespace
com
::
sun
::
star
::
frame
;
using
namespace
com
::
sun
::
star
::
system
;
...
...
@@ -38,7 +38,6 @@ using namespace com::sun::star::uno;
using
com
::
sun
::
star
::
beans
::
NamedValue
;
using
com
::
sun
::
star
::
beans
::
PropertyValue
;
using
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
;
using
com
::
sun
::
star
::
sheet
::
XSpreadsheetView
;
using
com
::
sun
::
star
::
text
::
XTextViewCursorSupplier
;
using
com
::
sun
::
star
::
util
::
URL
;
...
...
@@ -48,7 +47,7 @@ ListenerHelper aListenerHelper;
void
BaseDispatch
::
ShowMessageBox
(
const
Reference
<
XFrame
>&
rFrame
,
const
::
rtl
::
OUString
&
aTitle
,
const
::
rtl
::
OUString
&
aMsgText
)
{
if
(
!
mxToolkit
.
is
()
)
mxToolkit
=
Reference
<
XToolkit
>
(
Toolkit
::
create
(
comphelper
::
getComponentContext
(
mxMSF
)),
UNO_QUERY_THROW
);
mxToolkit
=
Toolkit
::
create
(
mxContext
);
Reference
<
XMessageBoxFactory
>
xMsgBoxFactory
(
mxToolkit
,
UNO_QUERY
);
if
(
rFrame
.
is
()
&&
xMsgBoxFactory
.
is
()
)
{
...
...
@@ -141,8 +140,8 @@ Reference< XDispatch > SAL_CALL MyProtocolHandler::queryDispatch( const URL& a
xRet
=
aListenerHelper
.
GetDispatch
(
mxFrame
,
aURL
.
Path
);
if
(
!
xRet
.
is
()
)
{
xRet
=
xCursor
.
is
()
?
(
BaseDispatch
*
)
new
WriterDispatch
(
mx
MSF
,
mxFrame
)
:
(
BaseDispatch
*
)
new
CalcDispatch
(
mx
MSF
,
mxFrame
);
xRet
=
xCursor
.
is
()
?
(
BaseDispatch
*
)
new
WriterDispatch
(
mx
Context
,
mxFrame
)
:
(
BaseDispatch
*
)
new
CalcDispatch
(
mx
Context
,
mxFrame
);
aListenerHelper
.
AddDispatch
(
xRet
,
mxFrame
,
aURL
.
Path
);
}
}
...
...
@@ -186,7 +185,7 @@ Sequence< ::rtl::OUString > SAL_CALL MyProtocolHandler_getSupportedServiceNames(
#undef SERVICE_NAME
Reference
<
XInterface
>
SAL_CALL
MyProtocolHandler_createInstance
(
const
Reference
<
X
MultiServiceFactory
>
&
rSMgr
)
Reference
<
XInterface
>
SAL_CALL
MyProtocolHandler_createInstance
(
const
Reference
<
X
ComponentContext
>
&
rSMgr
)
throw
(
Exception
)
{
return
(
cppu
::
OWeakObject
*
)
new
MyProtocolHandler
(
rSMgr
);
...
...
@@ -228,19 +227,15 @@ void SAL_CALL BaseDispatch::dispatch( const URL& aURL, const Sequence < Property
{
// open the LibreOffice web page
::
rtl
::
OUString
sURL
(
"http://www.libreoffice.org"
);
Reference
<
XSystemShellExecute
>
xSystemShellExecute
(
mxMSF
->
createInstance
(
"com.sun.star.system.SystemShellExecute"
),
UNO_QUERY
);
if
(
xSystemShellExecute
.
is
()
)
Reference
<
XSystemShellExecute
>
xSystemShellExecute
(
SystemShellExecute
::
create
(
mxContext
)
);
try
{
try
{
xSystemShellExecute
->
execute
(
sURL
,
::
rtl
::
OUString
(),
SystemShellExecuteFlags
::
URIS_ONLY
);
}
catch
(
Exception
&
rEx
)
{
(
void
)
rEx
;
}
xSystemShellExecute
->
execute
(
sURL
,
::
rtl
::
OUString
(),
SystemShellExecuteFlags
::
URIS_ONLY
);
}
catch
(
Exception
&
rEx
)
{
(
void
)
rEx
;
}
}
else
if
(
aURL
.
Path
==
"ComboboxCmd"
)
...
...
@@ -496,10 +491,10 @@ void SAL_CALL BaseDispatch::controlEvent( const ControlEvent& Event ) throw (Run
}
}
BaseDispatch
::
BaseDispatch
(
const
Reference
<
X
MultiServiceFactory
>
&
rxMSF
,
BaseDispatch
::
BaseDispatch
(
const
Reference
<
X
ComponentContext
>
&
rxContext
,
const
Reference
<
XFrame
>&
xFrame
,
const
::
rtl
::
OUString
&
rServiceName
)
:
mx
MSF
(
rxMSF
)
:
mx
Context
(
rxContext
)
,
mxFrame
(
xFrame
)
,
msDocService
(
rServiceName
)
,
mbButtonEnabled
(
sal_True
)
...
...
@@ -510,7 +505,7 @@ BaseDispatch::BaseDispatch( const Reference< XMultiServiceFactory > &rxMSF,
BaseDispatch
::~
BaseDispatch
()
{
mxFrame
.
clear
();
mx
MSF
.
clear
();
mx
Context
.
clear
();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.h
Dosyayı görüntüle @
ad2e7f5b
...
...
@@ -20,7 +20,7 @@
#ifndef _MyProtocolHandler_HXX
#define _MyProtocolHandler_HXX
#include <com/sun/star/awt/XToolkit.hpp>
#include <com/sun/star/awt/XToolkit
2
.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
...
...
@@ -56,12 +56,12 @@ class MyProtocolHandler : public cppu::WeakImplHelper3
>
{
private
:
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>
mxMSF
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>
mxContext
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XFrame
>
mxFrame
;
public
:
MyProtocolHandler
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>
&
rxMSF
)
:
mx
MSF
(
rxMSF
)
{}
MyProtocolHandler
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>
&
rxContext
)
:
mx
Context
(
rxContext
)
{}
// XDispatchProvider
virtual
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XDispatch
>
...
...
@@ -96,7 +96,7 @@ sal_Bool SAL_CALL MyProtocolHandler_supportsService( const ::rtl::OUString& Serv
throw
(
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XInterface
>
SAL_CALL
MyProtocolHandler_createInstance
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>
&
rSMgr
)
SAL_CALL
MyProtocolHandler_createInstance
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>
&
rContext
)
throw
(
::
com
::
sun
::
star
::
uno
::
Exception
);
class
BaseDispatch
:
public
cppu
::
WeakImplHelper2
...
...
@@ -107,14 +107,14 @@ class BaseDispatch : public cppu::WeakImplHelper2
{
protected
:
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XFrame
>
mxFrame
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>
mxMSF
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
awt
::
XToolkit
>
mxToolkit
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>
mxContext
;
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
awt
::
XToolkit
2
>
mxToolkit
;
::
rtl
::
OUString
msDocService
;
::
rtl
::
OUString
maComboBoxText
;
sal_Bool
mbButtonEnabled
;
public
:
BaseDispatch
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>
&
rxMSF
,
BaseDispatch
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>
&
rxContext
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XFrame
>&
xFrame
,
const
::
rtl
::
OUString
&
rServiceName
);
virtual
~
BaseDispatch
();
...
...
@@ -140,18 +140,18 @@ public:
class
WriterDispatch
:
public
BaseDispatch
{
public
:
WriterDispatch
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>
&
rxMSF
,
WriterDispatch
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>
&
rxContext
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XFrame
>&
xFrame
)
:
BaseDispatch
(
rx
MSF
,
xFrame
,
::
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"com.sun.star.text.TextDocument"
)
)
)
:
BaseDispatch
(
rx
Context
,
xFrame
,
::
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"com.sun.star.text.TextDocument"
)
)
)
{}
};
class
CalcDispatch
:
public
BaseDispatch
{
public
:
CalcDispatch
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XMultiServiceFactory
>
&
rxMSF
,
CalcDispatch
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>
&
rxContext
,
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
frame
::
XFrame
>&
xFrame
)
:
BaseDispatch
(
rx
MSF
,
xFrame
,
::
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"com.sun.star.sheet.SpreadSheetDocument"
)
)
)
:
BaseDispatch
(
rx
Context
,
xFrame
,
::
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"com.sun.star.sheet.SpreadSheetDocument"
)
)
)
{}
};
...
...
odk/examples/cpp/complextoolbarcontrols/exports.cxx
Dosyayı görüntüle @
ad2e7f5b
...
...
@@ -32,7 +32,7 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplNa
if
(
!
pServiceManager
||
!
pImplName
)
return
0
;
css
::
uno
::
Reference
<
css
::
lang
::
XSingleServiceFactory
>
xFactory
;
css
::
uno
::
Reference
<
css
::
uno
::
XInterface
>
xFactory
;
css
::
uno
::
Reference
<
css
::
lang
::
XMultiServiceFactory
>
xSMGR
(
reinterpret_cast
<
css
::
lang
::
XMultiServiceFactory
*
>
(
pServiceManager
),
css
::
uno
::
UNO_QUERY
);
::
rtl
::
OUString
sImplName
=
::
rtl
::
OUString
::
createFromAscii
(
pImplName
);
...
...
@@ -46,7 +46,7 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplNa
{
css
::
uno
::
Sequence
<
::
rtl
::
OUString
>
lNames
(
1
);
lNames
[
0
]
=
MYPROTOCOLHANDLER_SERVICENAME
;
xFactory
=
::
cppu
::
createSingle
Factory
(
xSMGR
,
sImplName
,
MyProtocolHandler_createInstanc
e
,
lNames
);
xFactory
=
::
cppu
::
createSingle
ComponentFactory
(
MyProtocolHandler_createInstance
,
sImplNam
e
,
lNames
);
}
if
(
!
xFactory
.
is
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment