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
6a2fbb82
Kaydet (Commit)
6a2fbb82
authored
Eki 22, 2013
tarafından
Ptyl Dragon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
added callback for render
Change-Id: I56f47926eeff6ab57903c8eedf6528465fc41c9e
üst
679faffc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
92 deletions
+70
-92
tiledrendering.cxx
sw/qa/tiledrendering/tiledrendering.cxx
+70
-92
tiledrendering.glade
sw/qa/tiledrendering/tiledrendering.glade
+0
-0
No files found.
sw/qa/tiledrendering/tiledrendering.cxx
Dosyayı görüntüle @
6a2fbb82
...
...
@@ -21,145 +21,123 @@
#include <vcl/vclmain.hxx>
#include <vcl/field.hxx>
#include <vcl/button.hxx>
#include <sfx2/filedlghelper.hxx>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
ui
::
dialogs
;
using
namespace
::
sfx2
;
class
TiledRendering
App
:
public
Application
class
UIPreview
App
:
public
Application
{
private
:
uno
::
Reference
<
uno
::
XComponentContext
>
xContext
;
uno
::
Reference
<
lang
::
XMultiComponentFactory
>
xFactory
;
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
xSFactory
;
uno
::
Reference
<
uno
::
XInterface
>
xDesktop
;
uno
::
Reference
<
frame
::
XComponentLoader
>
xLoader
;
uno
::
Reference
<
lang
::
XComponent
>
xComponent
;
public
:
virtual
void
Init
();
virtual
int
Main
();
void
Open
(
OUString
&
aFileUrl
);
};
using
namespace
com
::
sun
::
star
;
class
TiledRenderingDialog
:
public
ModalDialog
{
private
:
TiledRenderingApp
*
app
;
public
:
TiledRenderingDialog
(
TiledRenderingApp
*
app_
)
:
ModalDialog
(
DIALOG_NO_PARENT
,
"TiledRendering"
,
"qa/sw/ui/tiledrendering.ui"
),
app
(
app_
)
{
TiledRenderingDialog
()
:
ModalDialog
(
DIALOG_NO_PARENT
,
"TiledRendering"
,
"qa/sw/ui/tiledrendering.ui"
){
PushButton
*
renderButton
;
get
(
renderButton
,
"buttonRenderTile"
);
renderButton
->
SetClickHdl
(
LINK
(
this
,
TiledRenderingDialog
,
RenderHdl
));
PushButton
*
chooseDocumentButton
;
get
(
chooseDocumentButton
,
"buttonChooseDocument"
);
chooseDocumentButton
->
SetClickHdl
(
LINK
(
this
,
TiledRenderingDialog
,
ChooseDocumentHdl
));
SetStyle
(
GetStyle
()
|
WB_CLOSEABLE
);
}
virtual
~
TiledRenderingDialog
()
{
}
virtual
~
TiledRenderingDialog
(){}
DECL_LINK
(
RenderHdl
,
Button
*
);
DECL_LINK
(
ChooseDocumentHdl
,
Button
*
);
sal_Int32
ExtractInt
(
const
char
*
name
)
{
NumericField
*
pField
;
get
(
pField
,
name
);
OUString
aString
(
pField
->
GetText
()
);
return
aString
.
toInt32
();
sal_Int32
extractInt
(
const
char
*
name
){
NumericField
*
pField
;
get
(
pField
,
name
)
;
OUString
aString
(
pField
->
GetText
()
);
SAL_INFO
(
"TiledRenderingDialog"
,
"param "
<<
name
<<
" returned "
<<
aString
);
return
aString
.
toInt32
();
}
};
IMPL_LINK
(
TiledRenderingDialog
,
RenderHdl
,
Button
*
,
EMPTYARG
)
{
ExtractInt
(
"spinContextWidth"
);
ExtractInt
(
"spinContextHeight"
);
ExtractInt
(
"spinTilePosX"
);
ExtractInt
(
"spinTilePosY"
);
ExtractInt
(
"spinTileWidth"
);
ExtractInt
(
"spinTileHeight"
);
return
1
;
extractInt
(
"spinContextWidth"
);
extractInt
(
"spinContextHeight"
);
extractInt
(
"spinTilePosX"
);
extractInt
(
"spinTilePosY"
);
extractInt
(
"spinTileWidth"
);
extractInt
(
"spinTileHeight"
);
return
1
;
}
IMPL_LINK
(
TiledRenderingDialog
,
ChooseDocumentHdl
,
Button
*
,
EMPTYARG
)
void
UIPreviewApp
::
Init
(
)
{
FileDialogHelper
aDlgHelper
(
TemplateDescription
::
FILEOPEN_SIMPLE
,
0
);
uno
::
Reference
<
XFilePicker
>
xFP
=
aDlgHelper
.
GetFilePicker
();
if
(
aDlgHelper
.
Execute
()
==
ERRCODE_NONE
)
{
OUString
aFileUrl
=
xFP
->
getFiles
().
getConstArray
()[
0
];
app
->
Open
(
aFileUrl
);
}
return
1
;
}
void
TiledRenderingApp
::
Open
(
OUString
&
aFileUrl
){
static
const
OUString
TARGET
(
"_default"
);
static
const
Sequence
<
beans
::
PropertyValue
>
PROPS
(
0
);
if
(
xComponent
.
get
())
{
xComponent
->
dispose
();
xComponent
.
clear
();
}
xComponent
.
set
(
xLoader
->
loadComponentFromURL
(
aFileUrl
,
TARGET
,
0
,
PROPS
));
}
void
TiledRenderingApp
::
Init
()
{
xContext
.
set
(
cppu
::
defaultBootstrap_InitialComponentContext
());
xFactory
.
set
(
xContext
->
getServiceManager
());
xSFactory
.
set
(
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
(
xFactory
,
uno
::
UNO_QUERY_THROW
));
uno
::
Reference
<
uno
::
XComponentContext
>
xContext
=
cppu
::
defaultBootstrap_InitialComponentContext
();
uno
::
Reference
<
lang
::
XMultiComponentFactory
>
xFactory
=
xContext
->
getServiceManager
();
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
xSFactory
=
uno
::
Reference
<
lang
::
XMultiServiceFactory
>
(
xFactory
,
uno
::
UNO_QUERY_THROW
);
comphelper
::
setProcessServiceFactory
(
xSFactory
);
// Create UCB (for backwards compatibility, in case some code still uses
// plain createInstance w/o args directly to obtain an instance):
::
ucb
::
UniversalContentBroker
::
create
(
comphelper
::
getProcessComponentContext
()
);
xDesktop
.
set
(
xFactory
->
createInstanceWithContext
(
OUString
(
"com.sun.star.frame.Desktop"
),
xContext
));
xLoader
.
set
(
frame
::
Desktop
::
create
(
xContext
));
::
ucb
::
UniversalContentBroker
::
create
(
comphelper
::
getProcessComponentContext
()
);
}
int
TiledRendering
App
::
Main
()
int
UIPreview
App
::
Main
()
{
if
(
GetCommandLineParamCount
()
>
0
)
{
OUString
aFileUrl
;
osl
::
File
::
getFileURLFromSystemPath
(
GetCommandLineParam
(
0
),
aFileUrl
);
Open
(
aFileUrl
);
}
//std::vector<OUString> uifiles;
//for (sal_uInt16 i = 0; i < GetCommandLineParamCount(); ++i)
//{
// OUString aFileUrl;
// osl::File::getFileURLFromSystemPath(GetCommandLineParam(i), aFileUrl);
// uifiles.push_back(aFileUrl);
//}
//if (uifiles.empty())
//{
// fprintf(stderr, "Usage: ui-previewer file.ui\n");
// return EXIT_FAILURE;
//}
// turn on tooltips
Help
::
EnableQuickHelp
();
try
{
TiledRenderingDialog
pDialog
(
this
);
TiledRenderingDialog
pDialog
;
pDialog
.
Execute
();
/*
{
VclBuilder aBuilder(pDialog, OUString(), "sw/qa/tiledrendering/tiledrendering.ui");
Dialog *pRealDialog = dynamic_cast<Dialog*>(aBuilder.get_widget_root());
if (!pRealDialog)
pRealDialog = pDialog;
if (pRealDialog)
{
pRealDialog->SetText(OUString("LibreOffice ui-previewer"));
pRealDialog->SetStyle(pDialog->GetStyle()|WB_CLOSEABLE);
pRealDialog->Execute();
}
}*/
}
catch
(
const
uno
::
Exception
&
e
)
{
fprintf
(
stderr
,
"fatal error: %s
\n
"
,
OUStringToOString
(
e
.
Message
,
osl_getThreadTextEncoding
()).
getStr
());
}
return
EXIT_SUCCESS
;
}
void
render
(){
}
void
vclmain
::
createApplication
()
{
static
TiledRendering
App
aApp
;
static
UIPreview
App
aApp
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sw/qa/tiledrendering/tiledrendering.glade
0 → 100644
Dosyayı görüntüle @
6a2fbb82
This diff is collapsed.
Click to expand it.
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