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
5d2f3957
Kaydet (Commit)
5d2f3957
authored
May 14, 2013
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Detect and rotate image at drag&drop or copy&paste in Writer.
Change-Id: Iaacbb78921f966703d4f1080f97d26ea4895281f
üst
bc584fc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
18 deletions
+48
-18
swdtflvr.cxx
sw/source/ui/dochdl/swdtflvr.cxx
+48
-18
No files found.
sw/source/ui/dochdl/swdtflvr.cxx
Dosyayı görüntüle @
5d2f3957
...
@@ -110,11 +110,15 @@
...
@@ -110,11 +110,15 @@
#include <swcrsr.hxx>
#include <swcrsr.hxx>
#include <SwRewriter.hxx>
#include <SwRewriter.hxx>
#include <globals.hrc>
#include <globals.hrc>
#include <app.hrc>
#include <osl/mutex.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/svapp.hxx>
#include <swserv.hxx>
#include <swserv.hxx>
#include <switerator.hxx>
#include <switerator.hxx>
#include <vcl/GraphicNativeTransform.hxx>
#include <vcl/GraphicNativeMetadata.hxx>
extern
bool
bFrmDrag
;
extern
bool
bFrmDrag
;
extern
bool
bDDINetAttr
;
extern
bool
bDDINetAttr
;
extern
bool
bExecuteDrag
;
extern
bool
bExecuteDrag
;
...
@@ -368,6 +372,24 @@ namespace
...
@@ -368,6 +372,24 @@ namespace
rSrcWrtShell
.
Copy
(
&
rDest
);
rSrcWrtShell
.
Copy
(
&
rDest
);
}
}
void
lclCheckAndPerformRotation
(
Graphic
&
aGraphic
)
{
GraphicNativeMetadata
aMetadata
;
if
(
aMetadata
.
read
(
aGraphic
)
)
{
sal_uInt16
aRotation
=
aMetadata
.
getRotation
();
if
(
aRotation
!=
0
)
{
QueryBox
aQueryBox
(
0
,
WB_YES_NO
|
WB_DEF_YES
,
SW_RES
(
STR_ROTATE_TO_STANDARD_ORIENTATION
)
);
if
(
aQueryBox
.
Execute
()
==
RET_YES
)
{
GraphicNativeTransform
aTransform
(
aGraphic
);
aTransform
.
rotate
(
aRotation
);
}
}
}
}
}
}
sal_Bool
SwTransferable
::
GetData
(
const
DataFlavor
&
rFlavor
)
sal_Bool
SwTransferable
::
GetData
(
const
DataFlavor
&
rFlavor
)
...
@@ -1864,38 +1886,42 @@ int SwTransferable::_PasteTargetURL( TransferableDataHelper& rData,
...
@@ -1864,38 +1886,42 @@ int SwTransferable::_PasteTargetURL( TransferableDataHelper& rData,
SwTransferable
::
_CheckForURLOrLNKFile
(
rData
,
sURL
);
SwTransferable
::
_CheckForURLOrLNKFile
(
rData
,
sURL
);
//!!! check at FileSystem - only then it make sense to test graphics !!!
//!!! check at FileSystem - only then it make sense to test graphics !!!
Graphic
aGr
f
;
Graphic
aGr
aphic
;
GraphicFilter
&
rFlt
=
GraphicFilter
::
GetGraphicFilter
();
GraphicFilter
&
rFlt
=
GraphicFilter
::
GetGraphicFilter
();
nRet
=
GRFILTER_OK
==
GraphicFilter
::
LoadGraphic
(
sURL
,
aEmptyStr
,
aGrf
,
&
rFlt
);
nRet
=
GRFILTER_OK
==
GraphicFilter
::
LoadGraphic
(
sURL
,
aEmptyStr
,
aGraphic
,
&
rFlt
);
if
(
nRet
)
if
(
nRet
)
{
{
//Check and Perform rotation if needed
lclCheckAndPerformRotation
(
aGraphic
);
switch
(
nAction
)
switch
(
nAction
)
{
{
case
SW_PASTESDR_INSERT
:
case
SW_PASTESDR_INSERT
:
SwTransferable
::
SetSelInShell
(
rSh
,
sal_False
,
pPt
);
SwTransferable
::
SetSelInShell
(
rSh
,
sal_False
,
pPt
);
rSh
.
Insert
(
sURL
,
aEmptyStr
,
aGr
f
);
rSh
.
Insert
(
sURL
,
aEmptyStr
,
aGr
aphic
);
break
;
break
;
case
SW_PASTESDR_REPLACE
:
case
SW_PASTESDR_REPLACE
:
if
(
rSh
.
IsObjSelected
()
)
if
(
rSh
.
IsObjSelected
()
)
{
{
rSh
.
ReplaceSdrObj
(
sURL
,
aEmptyStr
,
&
aGr
f
);
rSh
.
ReplaceSdrObj
(
sURL
,
aEmptyStr
,
&
aGr
aphic
);
Point
aPt
(
pPt
?
*
pPt
:
rSh
.
GetCrsrDocPos
()
);
Point
aPt
(
pPt
?
*
pPt
:
rSh
.
GetCrsrDocPos
()
);
SwTransferable
::
SetSelInShell
(
rSh
,
sal_True
,
&
aPt
);
SwTransferable
::
SetSelInShell
(
rSh
,
sal_True
,
&
aPt
);
}
}
else
else
rSh
.
ReRead
(
sURL
,
aEmptyStr
,
&
aGr
f
);
rSh
.
ReRead
(
sURL
,
aEmptyStr
,
&
aGr
aphic
);
break
;
break
;
case
SW_PASTESDR_SETATTR
:
case
SW_PASTESDR_SETATTR
:
if
(
rSh
.
IsObjSelected
()
)
if
(
rSh
.
IsObjSelected
()
)
rSh
.
Paste
(
aGr
f
);
rSh
.
Paste
(
aGr
aphic
);
else
if
(
OBJCNT_GRF
==
rSh
.
GetObjCntTypeOfSelection
()
)
else
if
(
OBJCNT_GRF
==
rSh
.
GetObjCntTypeOfSelection
()
)
rSh
.
ReRead
(
sURL
,
aEmptyStr
,
&
aGr
f
);
rSh
.
ReRead
(
sURL
,
aEmptyStr
,
&
aGr
aphic
);
else
else
{
{
SwTransferable
::
SetSelInShell
(
rSh
,
sal_False
,
pPt
);
SwTransferable
::
SetSelInShell
(
rSh
,
sal_False
,
pPt
);
rSh
.
Insert
(
sURL
,
aEmptyStr
,
aGr
f
);
rSh
.
Insert
(
sURL
,
aEmptyStr
,
aGr
aphic
);
}
}
break
;
break
;
default
:
default
:
...
@@ -2147,7 +2173,7 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
...
@@ -2147,7 +2173,7 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
{
{
int
nRet
=
0
;
int
nRet
=
0
;
Graphic
aGr
f
;
Graphic
aGr
aphic
;
INetBookmark
aBkmk
;
INetBookmark
aBkmk
;
sal_Bool
bCheckForGrf
=
sal_False
,
bCheckForImageMap
=
sal_False
;
sal_Bool
bCheckForGrf
=
sal_False
,
bCheckForImageMap
=
sal_False
;
...
@@ -2155,7 +2181,7 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
...
@@ -2155,7 +2181,7 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
{
{
case
SOT_FORMAT_BITMAP
:
case
SOT_FORMAT_BITMAP
:
case
SOT_FORMAT_GDIMETAFILE
:
case
SOT_FORMAT_GDIMETAFILE
:
nRet
=
rData
.
GetGraphic
(
nFmt
,
aGr
f
);
nRet
=
rData
.
GetGraphic
(
nFmt
,
aGr
aphic
);
break
;
break
;
case
SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
:
case
SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
:
...
@@ -2188,7 +2214,7 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
...
@@ -2188,7 +2214,7 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
break
;
break
;
default
:
default
:
nRet
=
rData
.
GetGraphic
(
nFmt
,
aGr
f
);
nRet
=
rData
.
GetGraphic
(
nFmt
,
aGr
aphic
);
break
;
break
;
}
}
...
@@ -2197,7 +2223,8 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
...
@@ -2197,7 +2223,8 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
//!!! check at FileSystem - only then it makes sense to test the graphics !!!
//!!! check at FileSystem - only then it makes sense to test the graphics !!!
GraphicFilter
&
rFlt
=
GraphicFilter
::
GetGraphicFilter
();
GraphicFilter
&
rFlt
=
GraphicFilter
::
GetGraphicFilter
();
nRet
=
GRFILTER_OK
==
GraphicFilter
::
LoadGraphic
(
aBkmk
.
GetURL
(),
aEmptyStr
,
nRet
=
GRFILTER_OK
==
GraphicFilter
::
LoadGraphic
(
aBkmk
.
GetURL
(),
aEmptyStr
,
aGrf
,
&
rFlt
);
aGraphic
,
&
rFlt
);
if
(
!
nRet
&&
SW_PASTESDR_SETATTR
==
nAction
&&
if
(
!
nRet
&&
SW_PASTESDR_SETATTR
==
nAction
&&
SOT_FORMAT_FILE
==
nFmt
&&
SOT_FORMAT_FILE
==
nFmt
&&
// only at frame selection
// only at frame selection
...
@@ -2211,6 +2238,9 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
...
@@ -2211,6 +2238,9 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
if
(
nRet
)
if
(
nRet
)
{
{
//Check and Perform rotation if needed
lclCheckAndPerformRotation
(
aGraphic
);
String
sURL
;
String
sURL
;
if
(
rSh
.
GetView
().
GetDocShell
()
->
ISA
(
SwWebDocShell
)
)
if
(
rSh
.
GetView
().
GetDocShell
()
->
ISA
(
SwWebDocShell
)
)
sURL
=
aBkmk
.
GetURL
();
sURL
=
aBkmk
.
GetURL
();
...
@@ -2219,18 +2249,18 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
...
@@ -2219,18 +2249,18 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
{
{
case
SW_PASTESDR_INSERT
:
case
SW_PASTESDR_INSERT
:
SwTransferable
::
SetSelInShell
(
rSh
,
sal_False
,
pPt
);
SwTransferable
::
SetSelInShell
(
rSh
,
sal_False
,
pPt
);
rSh
.
Insert
(
sURL
,
aEmptyStr
,
aGr
f
);
rSh
.
Insert
(
sURL
,
aEmptyStr
,
aGr
aphic
);
break
;
break
;
case
SW_PASTESDR_REPLACE
:
case
SW_PASTESDR_REPLACE
:
if
(
rSh
.
IsObjSelected
()
)
if
(
rSh
.
IsObjSelected
()
)
{
{
rSh
.
ReplaceSdrObj
(
sURL
,
aEmptyStr
,
&
aGr
f
);
rSh
.
ReplaceSdrObj
(
sURL
,
aEmptyStr
,
&
aGr
aphic
);
Point
aPt
(
pPt
?
*
pPt
:
rSh
.
GetCrsrDocPos
()
);
Point
aPt
(
pPt
?
*
pPt
:
rSh
.
GetCrsrDocPos
()
);
SwTransferable
::
SetSelInShell
(
rSh
,
sal_True
,
&
aPt
);
SwTransferable
::
SetSelInShell
(
rSh
,
sal_True
,
&
aPt
);
}
}
else
else
rSh
.
ReRead
(
sURL
,
aEmptyStr
,
&
aGr
f
);
rSh
.
ReRead
(
sURL
,
aEmptyStr
,
&
aGr
aphic
);
break
;
break
;
case
SW_PASTESDR_SETATTR
:
case
SW_PASTESDR_SETATTR
:
...
@@ -2247,13 +2277,13 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
...
@@ -2247,13 +2277,13 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
}
}
}
}
else
if
(
rSh
.
IsObjSelected
()
)
else
if
(
rSh
.
IsObjSelected
()
)
rSh
.
Paste
(
aGr
f
);
rSh
.
Paste
(
aGr
aphic
);
else
if
(
OBJCNT_GRF
==
rSh
.
GetObjCntTypeOfSelection
()
)
else
if
(
OBJCNT_GRF
==
rSh
.
GetObjCntTypeOfSelection
()
)
rSh
.
ReRead
(
sURL
,
aEmptyStr
,
&
aGr
f
);
rSh
.
ReRead
(
sURL
,
aEmptyStr
,
&
aGr
aphic
);
else
else
{
{
SwTransferable
::
SetSelInShell
(
rSh
,
sal_False
,
pPt
);
SwTransferable
::
SetSelInShell
(
rSh
,
sal_False
,
pPt
);
rSh
.
Insert
(
aBkmk
.
GetURL
(),
aEmptyStr
,
aGr
f
);
rSh
.
Insert
(
aBkmk
.
GetURL
(),
aEmptyStr
,
aGr
aphic
);
}
}
break
;
break
;
default
:
default
:
...
...
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