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
6a8719b1
Kaydet (Commit)
6a8719b1
authored
Nis 22, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
lok::Document::postUnoCommand: allow passing arguments
Change-Id: I6c24a8e392473f3985d3bde9b76a3148fd03bc9a
üst
5dc81ae2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
10 deletions
+57
-10
init.cxx
desktop/source/lib/init.cxx
+33
-3
LibreOfficeKit.h
include/LibreOfficeKit/LibreOfficeKit.h
+2
-1
LibreOfficeKit.hxx
include/LibreOfficeKit/LibreOfficeKit.hxx
+18
-2
LibreOfficeKitGtk.h
include/LibreOfficeKit/LibreOfficeKitGtk.h
+1
-1
gtktiledviewer.cxx
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+1
-1
lokdocview.cxx
libreofficekit/source/gtk/lokdocview.cxx
+2
-2
No files found.
desktop/source/lib/init.cxx
Dosyayı görüntüle @
6a8719b1
...
...
@@ -15,6 +15,7 @@
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/property_tree/json_parser.hpp>
#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKit.h>
...
...
@@ -52,6 +53,7 @@
#include <unotools/syslocaleoptions.hxx>
#include <unotools/mediadescriptor.hxx>
#include <osl/module.hxx>
#include <comphelper/sequence.hxx>
#include <app.hxx>
...
...
@@ -207,7 +209,8 @@ static void doc_postMouseEvent (LibreOfficeKitDocument* pThis,
int
nY
,
int
nCount
);
static
void
doc_postUnoCommand
(
LibreOfficeKitDocument
*
pThis
,
const
char
*
pCommand
);
const
char
*
pCommand
,
const
char
*
pArguments
);
static
void
doc_setTextSelection
(
LibreOfficeKitDocument
*
pThis
,
int
nType
,
int
nX
,
...
...
@@ -701,11 +704,38 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar
pDoc
->
postKeyEvent
(
nType
,
nCharCode
,
nKeyCode
);
}
static
void
doc_postUnoCommand
(
LibreOfficeKitDocument
*
/*pThis*/
,
const
char
*
pCommand
)
static
void
jsonToPropertyValues
(
const
char
*
pJSON
,
uno
::
Sequence
<
beans
::
PropertyValue
>&
rPropertyValues
)
{
boost
::
property_tree
::
ptree
aTree
;
std
::
stringstream
aStream
(
pJSON
);
boost
::
property_tree
::
read_json
(
aStream
,
aTree
);
std
::
vector
<
beans
::
PropertyValue
>
aArguments
;
for
(
const
std
::
pair
<
std
::
string
,
boost
::
property_tree
::
ptree
>&
rPair
:
aTree
)
{
const
std
::
string
&
rType
=
rPair
.
second
.
get
<
std
::
string
>
(
"type"
);
const
std
::
string
&
rValue
=
rPair
.
second
.
get
<
std
::
string
>
(
"value"
);
beans
::
PropertyValue
aValue
;
aValue
.
Name
=
OUString
::
fromUtf8
(
rPair
.
first
.
c_str
());
if
(
rType
==
"string"
)
aValue
.
Value
<<=
OUString
::
fromUtf8
(
rValue
.
c_str
());
else
if
(
rType
==
"boolean"
)
aValue
.
Value
<<=
OString
(
rValue
.
c_str
()).
toBoolean
();
else
SAL_WARN
(
"desktop.lib"
,
"jsonToPropertyValues: unhandled type '"
<<
rType
<<
"'"
);
aArguments
.
push_back
(
aValue
);
}
rPropertyValues
=
comphelper
::
containerToSequence
(
aArguments
);
}
static
void
doc_postUnoCommand
(
LibreOfficeKitDocument
*
/*pThis*/
,
const
char
*
pCommand
,
const
char
*
pArguments
)
{
OUString
aCommand
(
pCommand
,
strlen
(
pCommand
),
RTL_TEXTENCODING_UTF8
);
if
(
!
comphelper
::
dispatchCommand
(
aCommand
,
uno
::
Sequence
<
beans
::
PropertyValue
>
()))
uno
::
Sequence
<
beans
::
PropertyValue
>
aPropertyValues
;
jsonToPropertyValues
(
pArguments
,
aPropertyValues
);
if
(
!
comphelper
::
dispatchCommand
(
aCommand
,
aPropertyValues
))
{
gImpl
->
maLastExceptionMsg
=
"Failed to dispatch the .uno: command"
;
}
...
...
include/LibreOfficeKit/LibreOfficeKit.h
Dosyayı görüntüle @
6a8719b1
...
...
@@ -132,7 +132,8 @@ struct _LibreOfficeKitDocumentClass
/// @see lok::Document::postUnoCommand
void
(
*
postUnoCommand
)
(
LibreOfficeKitDocument
*
pThis
,
const
char
*
pCommand
);
const
char
*
pCommand
,
const
char
*
pArguments
);
/// @see lok::Document::setTextSelection
void
(
*
setTextSelection
)
(
LibreOfficeKitDocument
*
pThis
,
...
...
include/LibreOfficeKit/LibreOfficeKit.hxx
Dosyayı görüntüle @
6a8719b1
...
...
@@ -181,11 +181,27 @@ public:
/**
* Posts an UNO command to the document.
*
* Example argument string:
*
* {
* "SearchItem.SearchString":
* {
* "type": "string",
* "value": "foobar"
* },
* "SearchItem.Backward":
* {
* "type": "boolean",
* "value": "false"
* }
* }
*
* @param pCommand uno command to be posted to the document, like ".uno:Bold"
* @param pArguments arguments of the uno command.
*/
inline
void
postUnoCommand
(
const
char
*
pCommand
)
inline
void
postUnoCommand
(
const
char
*
pCommand
,
const
char
*
pArguments
=
0
)
{
mpDoc
->
pClass
->
postUnoCommand
(
mpDoc
,
pCommand
);
mpDoc
->
pClass
->
postUnoCommand
(
mpDoc
,
pCommand
,
pArguments
);
}
/**
...
...
include/LibreOfficeKit/LibreOfficeKitGtk.h
Dosyayı görüntüle @
6a8719b1
...
...
@@ -68,7 +68,7 @@ void lok_docview_set_edit (LOKDocView* pDocView,
gboolean
lok_docview_get_edit
(
LOKDocView
*
pDocView
);
/// Posts the .uno: command to the LibreOfficeKit.
void
lok_docview_post_command
(
LOKDocView
*
pDocView
,
const
char
*
pCommand
);
void
lok_docview_post_command
(
LOKDocView
*
pDocView
,
const
char
*
pCommand
,
const
char
*
pArguments
);
/// Posts a keyboard event to LibreOfficeKit.
void
lok_docview_post_key
(
GtkWidget
*
pWidget
,
GdkEventKey
*
pEvent
,
gpointer
pData
);
...
...
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
Dosyayı görüntüle @
6a8719b1
...
...
@@ -156,7 +156,7 @@ void toggleToolItem(GtkWidget* pWidget, gpointer /*pData*/)
GtkToolItem
*
pItem
=
GTK_TOOL_ITEM
(
pWidget
);
const
std
::
string
&
rString
=
g_aToolItemCommandNames
[
pItem
];
g_info
(
"toggleToolItem: lok_docview_post_command('%s')"
,
rString
.
c_str
());
lok_docview_post_command
(
pLOKDocView
,
rString
.
c_str
());
lok_docview_post_command
(
pLOKDocView
,
rString
.
c_str
()
,
0
);
}
}
...
...
libreofficekit/source/gtk/lokdocview.cxx
Dosyayı görüntüle @
6a8719b1
...
...
@@ -1162,9 +1162,9 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_get_edit(LOKDocView* pDocView)
return
pDocView
->
m_pImpl
->
m_bEdit
;
}
SAL_DLLPUBLIC_EXPORT
void
lok_docview_post_command
(
LOKDocView
*
pDocView
,
const
char
*
pCommand
)
SAL_DLLPUBLIC_EXPORT
void
lok_docview_post_command
(
LOKDocView
*
pDocView
,
const
char
*
pCommand
,
const
char
*
pArguments
)
{
pDocView
->
m_pImpl
->
m_pDocument
->
pClass
->
postUnoCommand
(
pDocView
->
m_pImpl
->
m_pDocument
,
pCommand
);
pDocView
->
m_pImpl
->
m_pDocument
->
pClass
->
postUnoCommand
(
pDocView
->
m_pImpl
->
m_pDocument
,
pCommand
,
pArguments
);
}
SAL_DLLPUBLIC_EXPORT
void
lok_docview_post_key
(
GtkWidget
*
/*pWidget*/
,
GdkEventKey
*
pEvent
,
gpointer
pData
)
...
...
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