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
f403cecd
Kaydet (Commit)
f403cecd
authored
Haz 22, 2015
tarafından
Miklos Vajna
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
gtktiledviewer: do HTML copying if possible
Change-Id: I24e7b18442cb08814a73dd33b368b368039a11e4
üst
7b08304b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
2 deletions
+35
-2
gtktiledviewer.cxx
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+35
-2
No files found.
libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
Dosyayı görüntüle @
f403cecd
...
@@ -125,16 +125,49 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/)
...
@@ -125,16 +125,49 @@ static void toggleFindbar(GtkWidget* /*pButton*/, gpointer /*pItem*/)
}
}
}
}
/// Our GtkClipboardGetFunc implementation for HTML.
static
void
htmlGetFunc
(
GtkClipboard
*
/*pClipboard*/
,
GtkSelectionData
*
pSelectionData
,
guint
/*info*/
,
gpointer
pUserData
)
{
GdkAtom
aAtom
(
gdk_atom_intern
(
"text/html"
,
false
));
const
gchar
*
pSelection
=
static_cast
<
const
gchar
*>
(
pUserData
);
gtk_selection_data_set
(
pSelectionData
,
aAtom
,
8
,
reinterpret_cast
<
const
guchar
*>
(
pSelection
),
strlen
(
pSelection
));
}
/// Our GtkClipboardClearFunc implementation for HTML.
static
void
htmlClearFunc
(
GtkClipboard
*
/*pClipboard*/
,
gpointer
pData
)
{
g_free
(
pData
);
}
/// Same as gtk_clipboard_set_text(), but sets HTML.
static
void
clipboardSetHtml
(
GtkClipboard
*
pClipboard
,
const
char
*
pSelection
)
{
GtkTargetList
*
pList
=
gtk_target_list_new
(
0
,
0
);
GdkAtom
aAtom
(
gdk_atom_intern
(
"text/html"
,
false
));
gtk_target_list_add
(
pList
,
aAtom
,
0
,
0
);
gint
nTargets
=
0
;
GtkTargetEntry
*
pTargets
=
gtk_target_table_new_from_list
(
pList
,
&
nTargets
);
gtk_clipboard_set_with_data
(
pClipboard
,
pTargets
,
nTargets
,
htmlGetFunc
,
htmlClearFunc
,
g_strdup
(
pSelection
));
gtk_target_table_free
(
pTargets
,
nTargets
);
gtk_target_list_unref
(
pList
);
}
/// Handler for the copy button: write clipboard.
/// Handler for the copy button: write clipboard.
static
void
doCopy
(
GtkWidget
*
/*pButton*/
,
gpointer
/*pItem*/
)
static
void
doCopy
(
GtkWidget
*
/*pButton*/
,
gpointer
/*pItem*/
)
{
{
LOKDocView
*
pLOKDocView
=
LOK_DOC_VIEW
(
pDocView
);
LOKDocView
*
pLOKDocView
=
LOK_DOC_VIEW
(
pDocView
);
LibreOfficeKitDocument
*
pDocument
=
lok_doc_view_get_document
(
pLOKDocView
);
LibreOfficeKitDocument
*
pDocument
=
lok_doc_view_get_document
(
pLOKDocView
);
char
*
pUsedFormat
=
0
;
char
*
pUsedFormat
=
0
;
char
*
pSelection
=
pDocument
->
pClass
->
getTextSelection
(
pDocument
,
"text/
plain;charset=utf-8
"
,
&
pUsedFormat
);
char
*
pSelection
=
pDocument
->
pClass
->
getTextSelection
(
pDocument
,
"text/
html
"
,
&
pUsedFormat
);
GtkClipboard
*
pClipboard
=
gtk_clipboard_get_for_display
(
gtk_widget_get_display
(
pDocView
),
GDK_SELECTION_CLIPBOARD
);
GtkClipboard
*
pClipboard
=
gtk_clipboard_get_for_display
(
gtk_widget_get_display
(
pDocView
),
GDK_SELECTION_CLIPBOARD
);
gtk_clipboard_set_text
(
pClipboard
,
pSelection
,
-
1
);
std
::
string
aUsedFormat
(
pUsedFormat
);
if
(
aUsedFormat
==
"text/plain;charset=utf-8"
)
gtk_clipboard_set_text
(
pClipboard
,
pSelection
,
-
1
);
else
clipboardSetHtml
(
pClipboard
,
pSelection
);
free
(
pSelection
);
free
(
pSelection
);
free
(
pUsedFormat
);
free
(
pUsedFormat
);
...
...
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