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
abebf10e
Kaydet (Commit)
abebf10e
authored
Şub 01, 2013
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sw: move implementation of SwXTextView::select into unocore
Change-Id: Ica2758ea48945e024d9e8636bede31cca0cf0057
üst
ddc9b4d1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
266 additions
and
223 deletions
+266
-223
unocrsrhelper.hxx
sw/inc/unocrsrhelper.hxx
+19
-2
unocrsrhelper.cxx
sw/source/core/unocore/unocrsrhelper.cxx
+184
-5
unotxvw.cxx
sw/source/ui/uno/unotxvw.cxx
+63
-216
No files found.
sw/inc/unocrsrhelper.hxx
Dosyayı görüntüle @
abebf10e
...
...
@@ -16,8 +16,8 @@
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _UNOCRSRHELPER_HXX
#define _UNOCRSRHELPER_HXX
#ifndef
SW
_UNOCRSRHELPER_HXX
#define
SW
_UNOCRSRHELPER_HXX
#include <map>
...
...
@@ -25,6 +25,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <swtypes.hxx>
#include <flyenum.hxx>
#include <pam.hxx>
...
...
@@ -32,14 +33,18 @@ class String;
class
SfxItemSet
;
class
SfxItemPropertySet
;
struct
SfxItemPropertySimpleEntry
;
class
SdrObject
;
class
SwTxtNode
;
class
SwPaM
;
class
SwCursor
;
class
SwUnoCrsr
;
class
SwUnoTableCrsr
;
class
SwFmtColl
;
struct
SwSortOptions
;
class
SwDoc
;
namespace
sw
{
namespace
mark
{
class
IMark
;
}
}
namespace
com
{
namespace
sun
{
namespace
star
{
namespace
uno
{
class
Any
;
...
...
@@ -212,6 +217,18 @@ namespace SwUnoCursorHelper
SwPaM
&
rPam
,
SfxItemSet
&
rItemSet
)
throw
(
::
com
::
sun
::
star
::
lang
::
IllegalArgumentException
);
/// try to get something that can be selected out of the XInterface
/// at most one of the out parameters gets assigned a non-null value
/// o_rpPaM is newly allocated and must be deleted; other parameters not
SW_DLLPUBLIC
void
GetSelectableFromAny
(
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XInterface
>
const
&
xIfc
,
SwDoc
&
rTargetDoc
,
SwPaM
*&
o_rpPaM
,
std
::
pair
<
OUString
,
FlyCntType
>
&
o_rFrame
,
OUString
&
o_rTableName
,
SwUnoTableCrsr
const
*&
o_rpTableCursor
,
::
sw
::
mark
::
IMark
const
*&
o_rpMark
,
std
::
vector
<
SdrObject
*>
&
o_rSdrObjects
);
}
// namespace SwUnoCursorHelper
#endif
...
...
sw/source/core/unocore/unocrsrhelper.cxx
Dosyayı görüntüle @
abebf10e
...
...
@@ -17,12 +17,23 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <svx/svxids.hrc>
#include <unocrsrhelper.hxx>
#include <map>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/text/XTextSection.hpp>
#include <svx/svxids.hrc>
#include <svx/unoshape.hxx>
#include <cmdid.h>
#include <unocrsrhelper.hxx>
#include <unotextrange.hxx>
#include <unodraw.hxx>
#include <unofootnote.hxx>
#include <unobookmark.hxx>
#include <unorefmark.hxx>
#include <unostyle.hxx>
#include <unoidx.hxx>
...
...
@@ -62,15 +73,12 @@
#include <sfx2/docfile.hxx>
#include <sfx2/fcontnr.hxx>
#include <svl/stritem.hxx>
#include <com/sun/star/beans/PropertyState.hpp>
#include <SwStyleNameMapper.hxx>
#include <redline.hxx>
#include <numrule.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <SwNodeNum.hxx>
#include <fmtmeta.hxx>
...
...
@@ -87,6 +95,177 @@ using ::rtl::OUString;
namespace
SwUnoCursorHelper
{
static
SwPaM
*
lcl_createPamCopy
(
const
SwPaM
&
rPam
)
{
SwPaM
*
const
pRet
=
new
SwPaM
(
*
rPam
.
GetPoint
());
::
sw
::
DeepCopyPaM
(
rPam
,
*
pRet
);
return
pRet
;
}
void
GetSelectableFromAny
(
uno
::
Reference
<
uno
::
XInterface
>
const
&
xIfc
,
SwDoc
&
rTargetDoc
,
SwPaM
*&
o_rpPaM
,
std
::
pair
<
OUString
,
FlyCntType
>
&
o_rFrame
,
OUString
&
o_rTableName
,
SwUnoTableCrsr
const
*&
o_rpTableCursor
,
::
sw
::
mark
::
IMark
const
*&
o_rpMark
,
std
::
vector
<
SdrObject
*>
&
o_rSdrObjects
)
{
uno
::
Reference
<
drawing
::
XShapes
>
const
xShapes
(
xIfc
,
UNO_QUERY
);
if
(
xShapes
.
is
())
{
sal_Int32
nShapes
(
xShapes
->
getCount
());
for
(
sal_Int32
i
=
0
;
i
<
nShapes
;
++
i
)
{
uno
::
Reference
<
lang
::
XUnoTunnel
>
xShape
;
xShapes
->
getByIndex
(
i
)
>>=
xShape
;
if
(
xShape
.
is
())
{
SvxShape
*
const
pSvxShape
(
::
sw
::
UnoTunnelGetImplementation
<
SvxShape
>
(
xShape
));
if
(
pSvxShape
)
{
SdrObject
*
const
pSdrObject
=
pSvxShape
->
GetSdrObject
();
if
(
pSdrObject
)
{
// hmm... needs view to verify it's in right doc...
o_rSdrObjects
.
push_back
(
pSdrObject
);
}
}
}
}
return
;
}
uno
::
Reference
<
lang
::
XUnoTunnel
>
const
xTunnel
(
xIfc
,
UNO_QUERY
);
if
(
!
xTunnel
.
is
())
// everything below needs tunnel
{
return
;
}
SwXShape
*
const
pShape
(
::
sw
::
UnoTunnelGetImplementation
<
SwXShape
>
(
xTunnel
));
if
(
pShape
)
{
uno
::
Reference
<
uno
::
XAggregation
>
const
xAgg
(
pShape
->
GetAggregationInterface
());
if
(
xAgg
.
is
())
{
SvxShape
*
const
pSvxShape
(
::
sw
::
UnoTunnelGetImplementation
<
SvxShape
>
(
xTunnel
));
if
(
pSvxShape
)
{
SdrObject
*
const
pSdrObject
=
pSvxShape
->
GetSdrObject
();
if
(
pSdrObject
)
{
// hmm... needs view to verify it's in right doc...
o_rSdrObjects
.
push_back
(
pSdrObject
);
}
}
}
return
;
}
OTextCursorHelper
*
const
pCursor
(
::
sw
::
UnoTunnelGetImplementation
<
OTextCursorHelper
>
(
xTunnel
));
if
(
pCursor
)
{
if
(
pCursor
->
GetDoc
()
==
&
rTargetDoc
)
{
o_rpPaM
=
lcl_createPamCopy
(
*
pCursor
->
GetPaM
());
}
return
;
}
SwXTextRanges
*
const
pRanges
(
::
sw
::
UnoTunnelGetImplementation
<
SwXTextRanges
>
(
xTunnel
));
if
(
pRanges
)
{
SwUnoCrsr
const
*
pUnoCrsr
=
pRanges
->
GetCursor
();
if
(
pUnoCrsr
->
GetDoc
()
==
&
rTargetDoc
)
{
o_rpPaM
=
lcl_createPamCopy
(
*
pUnoCrsr
);
}
return
;
}
// check these before Range to prevent misinterpretation of text frames
// and cells also implement XTextRange
SwXFrame
*
const
pFrame
(
::
sw
::
UnoTunnelGetImplementation
<
SwXFrame
>
(
xTunnel
));
if
(
pFrame
)
{
SwFrmFmt
*
const
pFrmFmt
(
pFrame
->
GetFrmFmt
());
if
(
pFrmFmt
&&
pFrmFmt
->
GetDoc
()
==
&
rTargetDoc
)
{
o_rFrame
=
std
::
make_pair
(
pFrmFmt
->
GetName
(),
pFrame
->
GetFlyCntType
());
}
return
;
}
SwXTextTable
*
const
pTextTable
(
::
sw
::
UnoTunnelGetImplementation
<
SwXTextTable
>
(
xTunnel
));
if
(
pTextTable
)
{
SwFrmFmt
*
const
pFrmFmt
(
pTextTable
->
GetFrmFmt
());
if
(
pFrmFmt
&&
pFrmFmt
->
GetDoc
()
==
&
rTargetDoc
)
{
o_rTableName
=
pFrmFmt
->
GetName
();
}
return
;
}
SwXCell
*
const
pCell
(
::
sw
::
UnoTunnelGetImplementation
<
SwXCell
>
(
xTunnel
));
if
(
pCell
)
{
SwFrmFmt
*
const
pFrmFmt
(
pCell
->
GetFrmFmt
());
if
(
pFrmFmt
&&
pFrmFmt
->
GetDoc
()
==
&
rTargetDoc
)
{
SwTableBox
*
pBox
=
pCell
->
GetTblBox
();
SwTable
*
const
pTable
=
SwTable
::
FindTable
(
pFrmFmt
);
// ??? what's the benefit of setting pBox in this convoluted way?
pBox
=
pCell
->
FindBox
(
pTable
,
pBox
);
if
(
pBox
)
{
SwPosition
const
aPos
(
*
pBox
->
GetSttNd
());
SwPaM
aPam
(
aPos
);
aPam
.
Move
(
fnMoveForward
,
fnGoNode
);
o_rpPaM
=
lcl_createPamCopy
(
aPam
);
}
}
return
;
}
uno
::
Reference
<
text
::
XTextRange
>
const
xTextRange
(
xTunnel
,
UNO_QUERY
);
if
(
xTextRange
.
is
())
{
SwUnoInternalPaM
aPam
(
rTargetDoc
);
if
(
::
sw
::
XTextRangeToSwPaM
(
aPam
,
xTextRange
))
{
o_rpPaM
=
lcl_createPamCopy
(
aPam
);
}
return
;
}
SwXCellRange
*
const
pCellRange
(
::
sw
::
UnoTunnelGetImplementation
<
SwXCellRange
>
(
xTunnel
));
if
(
pCellRange
)
{
SwUnoCrsr
const
*
const
pUnoCrsr
(
pCellRange
->
GetTblCrsr
());
if
(
pUnoCrsr
&&
pUnoCrsr
->
GetDoc
()
==
&
rTargetDoc
)
{
// probably can't copy it to o_rpPaM for this since it's
// a SwTableCursor
o_rpTableCursor
=
dynamic_cast
<
SwUnoTableCrsr
const
*>
(
pUnoCrsr
);
}
return
;
}
::
sw
::
mark
::
IMark
const
*
const
pMark
(
SwXBookmark
::
GetBookmarkInDoc
(
&
rTargetDoc
,
xTunnel
));
if
(
pMark
)
{
o_rpMark
=
pMark
;
return
;
}
}
uno
::
Reference
<
text
::
XTextContent
>
GetNestedTextContent
(
SwTxtNode
&
rTextNode
,
xub_StrLen
const
nIndex
,
bool
const
bParent
)
...
...
sw/source/ui/uno/unotxvw.cxx
Dosyayı görüntüle @
abebf10e
...
...
@@ -65,7 +65,6 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <editeng/outliner.hxx>
#include <editeng/editview.hxx>
#include <unobookmark.hxx>
#include <unoparagraph.hxx>
#include <unocrsrhelper.hxx>
#include <unotextrange.hxx>
...
...
@@ -88,12 +87,6 @@ using comphelper::HelperBaseNoState;
using
::
rtl
::
OUString
;
static
SwPaM
*
lcl_createPamCopy
(
const
SwPaM
&
rPam
)
{
SwPaM
*
const
pRet
=
new
SwPaM
(
*
rPam
.
GetPoint
());
::
sw
::
DeepCopyPaM
(
rPam
,
*
pRet
);
return
pRet
;
}
/******************************************************************
* SwXTextView
...
...
@@ -239,244 +232,98 @@ uno::Any SAL_CALL SwXTextView::queryInterface( const uno::Type& aType )
sal_Bool
SwXTextView
::
select
(
const
uno
::
Any
&
aInterface
)
throw
(
lang
::
IllegalArgumentException
,
uno
::
RuntimeException
)
{
SolarMutexGuard
aGuard
;
uno
::
Reference
<
uno
::
XInterface
>
xInterface
;
if
(
GetView
()
&&
(
aInterface
>>=
xInterface
))
if
(
!
GetView
()
||
!
(
aInterface
>>=
xInterface
))
{
SwWrtShell
&
rSh
=
GetView
()
->
GetWrtShell
();
SwDoc
*
pDoc
=
GetView
()
->
GetDocShell
()
->
GetDoc
();
uno
::
Reference
<
lang
::
XUnoTunnel
>
xIfcTunnel
(
xInterface
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
text
::
XTextCursor
>
xCrsr
(
xInterface
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
container
::
XIndexAccess
>
xPosN
(
xInterface
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
text
::
XTextRange
>
xPos
(
xInterface
,
uno
::
UNO_QUERY
);
SwXFrame
*
pFrame
=
xIfcTunnel
.
is
()
?
reinterpret_cast
<
SwXFrame
*>
(
xIfcTunnel
->
getSomething
(
SwXFrame
::
getUnoTunnelId
()))
:
0
;
SwXCell
*
pCell
=
xIfcTunnel
.
is
()
?
reinterpret_cast
<
SwXCell
*>
(
xIfcTunnel
->
getSomething
(
SwXCell
::
getUnoTunnelId
()))
:
0
;
SwPaM
*
pPam
=
0
;
SwXTextRanges
*
pPosN
=
0
;
if
(
xCrsr
.
is
())
{
//
OTextCursorHelper
*
pCursor
=
xIfcTunnel
.
is
()
?
reinterpret_cast
<
OTextCursorHelper
*>
(
xIfcTunnel
->
getSomething
(
OTextCursorHelper
::
getUnoTunnelId
()))
:
0
;
return
sal_False
;
}
if
(
pCursor
&&
pCursor
->
GetDoc
()
==
GetView
()
->
GetDocShell
()
->
GetDoc
())
{
pPam
=
lcl_createPamCopy
(
*
pCursor
->
GetPaM
());
}
}
else
if
(
xPosN
.
is
()
&&
xIfcTunnel
.
is
()
&&
0
!=
(
pPosN
=
reinterpret_cast
<
SwXTextRanges
*>
(
xIfcTunnel
->
getSomething
(
SwXTextRanges
::
getUnoTunnelId
()))))
{
const
SwUnoCrsr
*
pUnoCrsr
=
pPosN
->
GetCursor
();
if
(
pUnoCrsr
)
{
pPam
=
lcl_createPamCopy
(
*
pUnoCrsr
);
}
}
// prevent misinterpretation of text frames that provide a XTextRange interface, too
else
if
(
!
pFrame
&&
!
pCell
&&
xPos
.
is
())
SwWrtShell
&
rSh
=
GetView
()
->
GetWrtShell
();
SwDoc
*
pDoc
=
GetView
()
->
GetDocShell
()
->
GetDoc
();
std
::
vector
<
SdrObject
*>
sdrObjects
;
uno
::
Reference
<
awt
::
XControlModel
>
const
xCtrlModel
(
xInterface
,
UNO_QUERY
);
if
(
xCtrlModel
.
is
())
{
uno
::
Reference
<
awt
::
XControl
>
xControl
;
SdrObject
*
const
pSdrObject
=
GetControl
(
xCtrlModel
,
xControl
);
if
(
pSdrObject
)
// hmm... needs view to verify it's in right doc...
{
SwUnoInternalPaM
aPam
(
*
pDoc
);
if
(
::
sw
::
XTextRangeToSwPaM
(
aPam
,
xPos
))
{
pPam
=
lcl_createPamCopy
(
aPam
);
}
sdrObjects
.
push_back
(
pSdrObject
);
}
if
(
pPam
)
}
else
{
SwPaM
*
pPaM
(
0
);
std
::
pair
<
OUString
,
FlyCntType
>
frame
;
OUString
tableName
;
SwUnoTableCrsr
const
*
pTableCursor
(
0
);
::
sw
::
mark
::
IMark
const
*
pMark
(
0
);
SwUnoCursorHelper
::
GetSelectableFromAny
(
xInterface
,
*
pDoc
,
pPaM
,
frame
,
tableName
,
pTableCursor
,
pMark
,
sdrObjects
);
if
(
pPaM
)
{
rSh
.
EnterStdMode
();
rSh
.
SetSelection
(
*
pPam
);
while
(
pPam
->
GetNext
()
!=
pPam
)
delete
pPam
->
GetNext
();
delete
pPam
;
rSh
.
SetSelection
(
*
pPaM
);
// the pPaM has been copied - delete it
while
(
pPaM
->
GetNext
()
!=
pPaM
)
delete
pPaM
->
GetNext
();
delete
pPaM
;
return
sal_True
;
}
if
(
pFrame
)
else
if
(
!
frame
.
first
.
isEmpty
()
)
{
SwFrmFmt
*
pFrmFmt
=
pFrame
->
GetFrmFmt
();
if
(
pFrmFmt
&&
pFrmFmt
->
GetDoc
()
==
pDoc
)
{
sal_Bool
bSuccess
=
rSh
.
GotoFly
(
pFrmFmt
->
GetName
(),
pFrame
->
GetFlyCntType
());
if
(
bSuccess
)
{
rSh
.
HideCrsr
();
rSh
.
EnterSelFrmMode
();
}
return
sal_True
;
}
}
uno
::
Reference
<
text
::
XTextTable
>
xTbl
(
xInterface
,
uno
::
UNO_QUERY
);
if
(
xTbl
.
is
()
&&
xIfcTunnel
.
is
())
{
SwXTextTable
*
pTable
=
reinterpret_cast
<
SwXTextTable
*>
(
xIfcTunnel
->
getSomething
(
SwXTextTable
::
getUnoTunnelId
()));
SwFrmFmt
*
pTblFrmFmt
=
pTable
?
((
SwXTextTable
*
)
pTable
)
->
GetFrmFmt
()
:
0
;
if
(
pTblFrmFmt
&&
pTblFrmFmt
->
GetDoc
()
==
pDoc
)
bool
const
bSuccess
(
rSh
.
GotoFly
(
frame
.
first
,
frame
.
second
));
if
(
bSuccess
)
{
rSh
.
EnterStdMode
();
rSh
.
GotoTable
(
pTblFrmFmt
->
GetName
()
);
rSh
.
HideCrsr
();
rSh
.
EnterSelFrmMode
(
);
}
return
sal_True
;
}
if
(
pCell
)
{
SwFrmFmt
*
pTblFrmFmt
=
pCell
->
GetFrmFmt
();
if
(
pTblFrmFmt
&&
pTblFrmFmt
->
GetDoc
()
==
pDoc
)
{
SwTableBox
*
pBox
=
pCell
->
GetTblBox
();
SwTable
*
pTable
=
SwTable
::
FindTable
(
pTblFrmFmt
);
pBox
=
pCell
->
FindBox
(
pTable
,
pBox
);
if
(
pBox
)
{
const
SwStartNode
*
pSttNd
=
pBox
->
GetSttNd
();
SwPosition
aPos
(
*
pSttNd
);
SwPaM
aPam
(
aPos
);
aPam
.
Move
(
fnMoveForward
,
fnGoNode
);
rSh
.
EnterStdMode
();
rSh
.
SetSelection
(
aPam
);
return
sal_True
;
}
}
}
SwXCellRange
*
pRange
=
xIfcTunnel
.
is
()
?
reinterpret_cast
<
SwXCellRange
*>
(
xIfcTunnel
->
getSomething
(
SwXCellRange
::
getUnoTunnelId
()))
:
0
;
if
(
pRange
)
else
if
(
!
tableName
.
isEmpty
())
{
const
SwUnoCrsr
*
pUnoCrsr
=
pRange
->
GetTblCrsr
();
if
(
pUnoCrsr
)
{
UnoActionRemoveContext
aContext
(
pDoc
);
rSh
.
EnterStdMode
();
rSh
.
SetSelection
(
*
pUnoCrsr
);
return
sal_True
;
}
rSh
.
EnterStdMode
();
rSh
.
GotoTable
(
tableName
);
return
sal_True
;
}
uno
::
Reference
<
text
::
XTextContent
>
xBkm
(
xInterface
,
uno
::
UNO_QUERY
);
if
(
xBkm
.
is
()
&&
xIfcTunnel
.
is
())
else
if
(
pTableCursor
)
{
::
sw
::
mark
::
IMark
const
*
const
pMark
(
SwXBookmark
::
GetBookmarkInDoc
(
pDoc
,
xIfcTunnel
)
);
if
(
pMark
)
{
rSh
.
EnterStdMode
();
rSh
.
GotoMark
(
pMark
);
return
sal_True
;
}
UnoActionRemoveContext
const
aContext
(
pDoc
);
rSh
.
EnterStdMode
();
rSh
.
SetSelection
(
*
pTableCursor
);
return
sal_True
;
}
// IndexMark, Index, TextField, Draw, Section, Footnote, Paragraph
//
// detect controls
uno
::
Reference
<
awt
::
XControlModel
>
xCtrlModel
(
xInterface
,
UNO_QUERY
);
if
(
xCtrlModel
.
is
())
else
if
(
pMark
)
{
uno
::
Reference
<
awt
::
XControl
>
XControl
;
SdrObject
*
pObj
=
GetControl
(
xCtrlModel
,
XControl
);
if
(
pObj
)
{
SdrView
*
pDrawView
=
rSh
.
GetDrawView
();
SdrPageView
*
pPV
=
pDrawView
->
GetSdrPageView
();
if
(
pPV
&&
pObj
->
GetPage
()
==
pPV
->
GetPage
()
)
{
pDrawView
->
SdrEndTextEdit
();
pDrawView
->
UnmarkAll
();
pDrawView
->
MarkObj
(
pObj
,
pPV
);
}
return
sal_True
;
}
rSh
.
EnterStdMode
();
rSh
.
GotoMark
(
pMark
);
return
sal_True
;
}
// sdrObjects handled below
}
sal_Bool
bRet
(
sal_False
);
if
(
sdrObjects
.
size
())
{
uno
::
Reference
<
drawing
::
XShapes
>
xShapeColl
(
xInterface
,
uno
::
UNO_QUERY
);
uno
::
Reference
<
beans
::
XPropertySet
>
xTmpProp
(
xInterface
,
uno
::
UNO_QUERY
);
SwXShape
*
pSwXShape
=
0
;
if
(
xIfcTunnel
.
is
())
pSwXShape
=
reinterpret_cast
<
SwXShape
*>
(
xIfcTunnel
->
getSomething
(
SwXShape
::
getUnoTunnelId
()));
SvxShape
*
pSvxShape
=
0
;
if
(
pSwXShape
)
{
uno
::
Reference
<
uno
::
XAggregation
>
xAgg
=
pSwXShape
->
GetAggregationInterface
();
if
(
xAgg
.
is
())
{
pSvxShape
=
reinterpret_cast
<
SvxShape
*>
(
xIfcTunnel
->
getSomething
(
SvxShape
::
getUnoTunnelId
()));
}
}
SdrView
*
const
pDrawView
=
rSh
.
GetDrawView
();
SdrPageView
*
const
pPV
=
pDrawView
->
GetSdrPageView
();
if
(
pSvxShape
||
xShapeColl
.
is
()
)
// Drawing drawing::Layer
for
(
size_t
i
=
0
;
i
<
sdrObjects
.
size
();
++
i
)
{
SdrView
*
pDrawView
=
rSh
.
GetDrawView
();
if
(
pDrawView
)
SdrObject
*
const
pSdrObject
(
sdrObjects
[
i
]);
// GetSelectableFromAny did not check pSdrObject is in right doc!
if
(
pPV
&&
pSdrObject
->
GetPage
()
==
pPV
->
GetPage
())
{
pDrawView
->
SdrEndTextEdit
();
pDrawView
->
UnmarkAll
();
if
(
pSvxShape
)
// einzelnes Shape
{
SdrObject
*
pObj
=
pSvxShape
->
GetSdrObject
();
if
(
pObj
)
{
SdrPageView
*
pPV
=
pDrawView
->
GetSdrPageView
();
if
(
pPV
&&
pObj
->
GetPage
()
==
pPV
->
GetPage
()
)
{
pDrawView
->
MarkObj
(
pObj
,
pPV
);
return
sal_True
;
}
}
}
else
// Shape Collection
{
sal_Bool
bSelected
=
sal_False
;
SdrPageView
*
pPV
=
NULL
;
long
nCount
=
xShapeColl
->
getCount
();
for
(
long
i
=
0
;
i
<
nCount
;
i
++
)
{
uno
::
Reference
<
drawing
::
XShape
>
xShapeInt
;
uno
::
Any
aAny
=
xShapeColl
->
getByIndex
(
i
);
aAny
>>=
xShapeInt
;
if
(
xShapeInt
.
is
())
{
uno
::
Reference
<
lang
::
XUnoTunnel
>
xShapeTunnel
(
xShapeInt
,
uno
::
UNO_QUERY
);
SvxShape
*
pShape
=
xShapeTunnel
.
is
()
?
reinterpret_cast
<
SvxShape
*>
(
xShapeTunnel
->
getSomething
(
SvxShape
::
getUnoTunnelId
()))
:
0
;
if
(
pShape
)
{
SdrObject
*
pObj
=
pShape
->
GetSdrObject
();
if
(
pObj
)
{
if
(
!
pPV
)
// erstes Objekt
{
pPV
=
pDrawView
->
GetSdrPageView
();
}
if
(
pPV
&&
pObj
->
GetPage
()
==
pPV
->
GetPage
()
)
{
pDrawView
->
MarkObj
(
pObj
,
pPV
);
bSelected
=
sal_True
;
}
}
}
}
}
return
bSelected
;
}
pDrawView
->
MarkObj
(
pSdrObject
,
pPV
);
bRet
=
sal_True
;
}
}
}
return
sal_False
;
return
bRet
;
}
uno
::
Any
SwXTextView
::
getSelection
(
void
)
throw
(
uno
::
RuntimeException
)
...
...
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