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
837631c6
Kaydet (Commit)
837631c6
authored
Haz 13, 2014
tarafından
Andrzej Hunt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
LIBLOK: implement getDocumentType, make doctypes unique.
Change-Id: I6cf810af55284cb6ddd9e0bfd879fd19508d127a
üst
eaa21b72
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
43 deletions
+90
-43
init.cxx
desktop/source/lib/init.cxx
+85
-39
LibreOfficeKit.h
include/LibreOfficeKit/LibreOfficeKit.h
+5
-4
No files found.
desktop/source/lib/init.cxx
Dosyayı görüntüle @
837631c6
...
...
@@ -307,31 +307,23 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
try
{
uno
::
Reference
<
frame
::
XModel
>
xDocument
(
pDocument
->
mxComponent
,
uno
::
UNO_QUERY_THROW
);
uno
::
Sequence
<
beans
::
PropertyValue
>
aSequence
=
xDocument
->
getArgs
();
MediaDescriptor
aMediaDescriptor
(
aSequence
);
OUString
sPropertyName
=
MediaDescriptor
::
PROP_DOCUMENTSERVICE
();
OUString
aDocumentService
=
aMediaDescriptor
.
getUnpackedValueOrDefault
(
sPropertyName
,
OUString
());
const
ExtensionMap
*
pMap
;
if
(
aDocumentService
.
isEmpty
(
))
switch
(
doc_getDocumentType
(
pThis
))
{
gImpl
->
maLastExceptionMsg
=
"unknown document type"
;
return
false
;
}
const
ExtensionMap
*
pMap
;
if
(
aDocumentService
==
"com.sun.star.sheet.SpreadsheetDocument"
)
case
LOK_DOCTYPE_SPREADSHEET
:
pMap
=
(
const
ExtensionMap
*
)
aCalcExtensionMap
;
else
if
(
aDocumentService
==
"com.sun.star.presentation.PresentationDocument"
)
break
;
case
LOK_DOCTYPE_PRESENTATION
:
pMap
=
(
const
ExtensionMap
*
)
aImpressExtensionMap
;
else
if
(
aDocumentService
==
"com.sun.star.drawing.DrawingDocument"
)
break
;
case
LOK_DOCTYPE_DRAWING
:
pMap
=
(
const
ExtensionMap
*
)
aDrawExtensionMap
;
else
if
(
aDocumentService
==
"com.sun.star.text.TextDocument"
)
break
;
case
LOK_DOCTYPE_TEXT
:
pMap
=
(
const
ExtensionMap
*
)
aWriterExtensionMap
;
else
{
gImpl
->
maLastExceptionMsg
=
"unknown document mapping"
;
break
;
case
LOK_DOCTYPE_OTHER
:
return
false
;
}
...
...
@@ -386,8 +378,49 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
static
LibreOfficeKitDocumentType
doc_getDocumentType
(
LibreOfficeKitDocument
*
pThis
)
{
(
void
)
pThis
;
return
WRITER
;
LibLODocument_Impl
*
pDocument
=
static_cast
<
LibLODocument_Impl
*>
(
pThis
);
try
{
uno
::
Reference
<
frame
::
XModel
>
xDocument
(
pDocument
->
mxComponent
,
uno
::
UNO_QUERY_THROW
);
uno
::
Sequence
<
beans
::
PropertyValue
>
aSequence
=
xDocument
->
getArgs
();
MediaDescriptor
aMediaDescriptor
(
aSequence
);
OUString
sPropertyName
=
MediaDescriptor
::
PROP_DOCUMENTSERVICE
();
OUString
aDocumentService
=
aMediaDescriptor
.
getUnpackedValueOrDefault
(
sPropertyName
,
OUString
());
if
(
aDocumentService
.
isEmpty
())
{
gImpl
->
maLastExceptionMsg
=
"unknown document type"
;
return
LOK_DOCTYPE_OTHER
;
}
if
(
aDocumentService
==
"com.sun.star.sheet.SpreadsheetDocument"
)
{
return
LOK_DOCTYPE_SPREADSHEET
;
}
else
if
(
aDocumentService
==
"com.sun.star.presentation.PresentationDocument"
)
{
return
LOK_DOCTYPE_PRESENTATION
;
}
else
if
(
aDocumentService
==
"com.sun.star.drawing.DrawingDocument"
)
{
return
LOK_DOCTYPE_DRAWING
;
}
else
if
(
aDocumentService
==
"com.sun.star.text.TextDocument"
)
{
return
LOK_DOCTYPE_TEXT
;
}
else
{
gImpl
->
maLastExceptionMsg
=
"unknown document mapping"
;
}
}
catch
(
const
uno
::
Exception
&
exception
)
{
gImpl
->
maLastExceptionMsg
=
"exception: "
+
exception
.
Message
;
}
return
LOK_DOCTYPE_OTHER
;
}
static
int
doc_getNumberOfParts
(
LibreOfficeKitDocument
*
pThis
)
...
...
@@ -412,30 +445,38 @@ void doc_paintTile (LibreOfficeKitDocument* pThis,
{
LibLODocument_Impl
*
pDocument
=
static_cast
<
LibLODocument_Impl
*>
(
pThis
);
Application
::
AcquireSolarMutex
(
1
);
switch
(
doc_getDocumentType
(
pThis
))
{
SwXTextDocument
*
pTxtDoc
=
dynamic_cast
<
SwXTextDocument
*
>
(
pDocument
->
mxComponent
.
get
()
);
SwDocShell
*
pDocShell
=
pTxtDoc
->
GetDocShell
();
SwDoc
*
pDoc
=
pDocShell
->
GetDoc
();
SwViewShell
*
pViewShell
=
pDoc
->
GetCurrentViewShell
();
case
LOK_DOCTYPE_TEXT
:
{
SwXTextDocument
*
pTxtDoc
=
dynamic_cast
<
SwXTextDocument
*
>
(
pDocument
->
mxComponent
.
get
()
);
SwDocShell
*
pDocShell
=
pTxtDoc
->
GetDocShell
();
SwDoc
*
pDoc
=
pDocShell
->
GetDoc
();
SwViewShell
*
pViewShell
=
pDoc
->
GetCurrentViewShell
();
ImplSVData
*
pSVData
=
ImplGetSVData
();
SvpSalInstance
*
pSalInstance
=
static_cast
<
SvpSalInstance
*
>
(
pSVData
->
mpDefInst
);
pSalInstance
->
setBitCountFormatMapping
(
32
,
::
basebmp
::
FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA
);
ImplSVData
*
pSVData
=
ImplGetSVData
();
SvpSalInstance
*
pSalInstance
=
static_cast
<
SvpSalInstance
*
>
(
pSVData
->
mpDefInst
);
pSalInstance
->
setBitCountFormatMapping
(
32
,
::
basebmp
::
FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA
);
VirtualDevice
aDevice
(
0
,
(
sal_uInt16
)
32
);
boost
::
shared_array
<
sal_uInt8
>
aBuffer
(
pBuffer
,
NoDelete
<
sal_uInt8
>
()
);
aDevice
.
SetOutputSizePixelScaleOffsetAndBuffer
(
Size
(
nCanvasWidth
,
nCanvasHeight
),
Fraction
(
1.0
),
Point
(),
aBuffer
,
true
);
VirtualDevice
aDevice
(
0
,
(
sal_uInt16
)
32
);
boost
::
shared_array
<
sal_uInt8
>
aBuffer
(
pBuffer
,
NoDelete
<
sal_uInt8
>
()
);
aDevice
.
SetOutputSizePixelScaleOffsetAndBuffer
(
Size
(
nCanvasWidth
,
nCanvasHeight
),
Fraction
(
1.0
),
Point
(),
aBuffer
,
true
);
pViewShell
->
PaintTile
(
aDevice
,
nCanvasWidth
,
nCanvasHeight
,
nTilePosX
,
nTilePosY
,
nTileWidth
,
nTileHeight
);
pViewShell
->
PaintTile
(
aDevice
,
nCanvasWidth
,
nCanvasHeight
,
nTilePosX
,
nTilePosY
,
nTileWidth
,
nTileHeight
);
SvpSalVirtualDevice
*
pSalDev
=
static_cast
<
SvpSalVirtualDevice
*
>
(
aDevice
.
getSalVirtualDevice
());
basebmp
::
BitmapDeviceSharedPtr
pBmpDev
=
pSalDev
->
getBitmapDevice
();
SvpSalVirtualDevice
*
pSalDev
=
static_cast
<
SvpSalVirtualDevice
*
>
(
aDevice
.
getSalVirtualDevice
());
basebmp
::
BitmapDeviceSharedPtr
pBmpDev
=
pSalDev
->
getBitmapDevice
();
*
pRowStride
=
pBmpDev
->
getScanlineStride
();
*
pRowStride
=
pBmpDev
->
getScanlineStride
();
}
break
;
default:
break
;
}
Application
::
ReleaseSolarMutex
();
}
...
...
@@ -446,7 +487,7 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
{
LibLODocument_Impl
*
pDocument
=
static_cast
<
LibLODocument_Impl
*>
(
pThis
);
if
(
true
)
// TODO: test that we have a writer document here (vs calc/impress/etc.
)
if
(
doc_getDocumentType
(
pThis
)
==
LOK_DOCTYPE_TEXT
)
{
SwXTextDocument
*
pTxtDoc
=
dynamic_cast
<
SwXTextDocument
*
>
(
pDocument
->
mxComponent
.
get
()
);
SwDocShell
*
pDocShell
=
pTxtDoc
->
GetDocShell
();
...
...
@@ -456,6 +497,11 @@ static void doc_getDocumentSize(LibreOfficeKitDocument* pThis,
*
pWidth
=
aDocumentSize
.
Width
();
*
pHeight
=
aDocumentSize
.
Height
();
}
else
{
pWidth
=
0
;
pHeight
=
0
;
}
}
static
char
*
lo_getError
(
LibreOfficeKit
*
pThis
)
...
...
include/LibreOfficeKit/LibreOfficeKit.h
Dosyayı görüntüle @
837631c6
...
...
@@ -33,10 +33,11 @@ typedef struct _LibreOfficeKitDocumentClass LibreOfficeKitDocumentClass;
#ifdef LOK_USE_UNSTABLE_API
typedef
enum
{
WRITER
,
SPREADSHEET
,
PRESENTATION
,
OTHER
LOK_DOCTYPE_TEXT
,
LOK_DOCTYPE_SPREADSHEET
,
LOK_DOCTYPE_PRESENTATION
,
LOK_DOCTYPE_DRAWING
,
LOK_DOCTYPE_OTHER
}
LibreOfficeKitDocumentType
;
#endif // LOK_USE_UNSTABLE_API
...
...
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