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
2136f459
Kaydet (Commit)
2136f459
authored
May 31, 2013
tarafından
Armin Le Grand
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
i121863 Corrected D&D from MasterPage view, source SlideSorter, target 2nd DocumentView
üst
df229e84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
119 additions
and
40 deletions
+119
-40
drawdoc3.cxx
sd/source/core/drawdoc3.cxx
+119
-40
No files found.
sd/source/core/drawdoc3.cxx
Dosyayı görüntüle @
2136f459
...
@@ -1512,6 +1512,58 @@ void SdDrawDocument::RemoveUnnecessaryMasterPages(SdPage* pMasterPage, sal_Bool
...
@@ -1512,6 +1512,58 @@ void SdDrawDocument::RemoveUnnecessaryMasterPages(SdPage* pMasterPage, sal_Bool
|* Ist rLayoutName leer, so wird die erste MasterPage genommen
|* Ist rLayoutName leer, so wird die erste MasterPage genommen
\************************************************************************/
\************************************************************************/
// #121863# factored out functionality
bool
isMasterPageLayoutNameUnique
(
const
SdDrawDocument
&
rDoc
,
const
String
&
rCandidate
)
{
if
(
!
rCandidate
.
Len
())
{
return
false
;
}
const
sal_uInt16
nPageCount
(
rDoc
.
GetMasterPageCount
());
for
(
sal_uInt16
a
(
0
);
a
<
nPageCount
;
a
++
)
{
const
SdrPage
*
pCandidate
=
rDoc
.
GetMasterPage
(
a
);
String
aPageLayoutName
(
pCandidate
->
GetLayoutName
());
aPageLayoutName
.
Erase
(
aPageLayoutName
.
SearchAscii
(
SD_LT_SEPARATOR
));
if
(
aPageLayoutName
==
rCandidate
)
{
return
false
;
}
}
return
true
;
}
// #121863# factored out functinality
String
createNewMasterPageLayoutName
(
const
SdDrawDocument
&
rDoc
)
{
const
String
aBaseName
(
SdResId
(
STR_LAYOUT_DEFAULT_NAME
));
String
aRetval
;
sal_uInt16
nCount
(
0
);
while
(
!
aRetval
.
Len
())
{
aRetval
=
aBaseName
;
if
(
nCount
)
{
aRetval
+=
String
::
CreateFromInt32
(
nCount
);
}
nCount
++
;
if
(
!
isMasterPageLayoutNameUnique
(
rDoc
,
aRetval
))
{
aRetval
.
Erase
();
}
}
return
aRetval
;
}
void
SdDrawDocument
::
SetMasterPage
(
sal_uInt16
nSdPageNum
,
void
SdDrawDocument
::
SetMasterPage
(
sal_uInt16
nSdPageNum
,
const
String
&
rLayoutName
,
const
String
&
rLayoutName
,
SdDrawDocument
*
pSourceDoc
,
SdDrawDocument
*
pSourceDoc
,
...
@@ -1541,8 +1593,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
...
@@ -1541,8 +1593,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
String
aOldLayoutName
(
aOldPageLayoutName
);
String
aOldLayoutName
(
aOldPageLayoutName
);
aOldLayoutName
.
Erase
(
aOldLayoutName
.
SearchAscii
(
SD_LT_SEPARATOR
));
aOldLayoutName
.
Erase
(
aOldLayoutName
.
SearchAscii
(
SD_LT_SEPARATOR
));
String
aNewLayoutName
(
rLayoutName
);
if
(
pSourceDoc
)
if
(
pSourceDoc
)
{
{
List
*
pReplList
=
NULL
;
List
*
pReplList
=
NULL
;
...
@@ -1556,7 +1606,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
...
@@ -1556,7 +1606,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
// No LayoutName: take first MasterPage
// No LayoutName: take first MasterPage
pMaster
=
(
SdPage
*
)
pSourceDoc
->
GetMasterSdPage
(
0
,
PK_STANDARD
);
pMaster
=
(
SdPage
*
)
pSourceDoc
->
GetMasterSdPage
(
0
,
PK_STANDARD
);
pNotesMaster
=
(
SdPage
*
)
pSourceDoc
->
GetMasterSdPage
(
0
,
PK_NOTES
);
pNotesMaster
=
(
SdPage
*
)
pSourceDoc
->
GetMasterSdPage
(
0
,
PK_NOTES
);
aNewLayoutName
=
pMaster
->
GetName
();
}
}
else
else
{
{
...
@@ -1587,7 +1636,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
...
@@ -1587,7 +1636,6 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
// so take the first MasterPage
// so take the first MasterPage
pMaster
=
(
SdPage
*
)
pSourceDoc
->
GetMasterSdPage
(
0
,
PK_STANDARD
);
pMaster
=
(
SdPage
*
)
pSourceDoc
->
GetMasterSdPage
(
0
,
PK_STANDARD
);
pNotesMaster
=
(
SdPage
*
)
pSourceDoc
->
GetMasterSdPage
(
0
,
PK_NOTES
);
pNotesMaster
=
(
SdPage
*
)
pSourceDoc
->
GetMasterSdPage
(
0
,
PK_NOTES
);
aNewLayoutName
=
pMaster
->
GetName
();
}
}
}
}
...
@@ -1604,13 +1652,53 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
...
@@ -1604,13 +1652,53 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
return
;
return
;
}
}
const
String
aOriginalNewLayoutName
(
pMaster
->
GetName
()
);
String
aTargetNewLayoutName
(
aOriginalNewLayoutName
);
if
(
pSourceDoc
!=
this
)
{
// #121863# clone masterpages, they are from another model (!)
SdPage
*
pNewNotesMaster
=
dynamic_cast
<
SdPage
*
>
(
pNotesMaster
->
Clone
(
this
));
SdPage
*
pNewMaster
=
dynamic_cast
<
SdPage
*
>
(
pMaster
->
Clone
(
this
));
if
(
!
pNewNotesMaster
||
!
pNewMaster
)
{
delete
pNewNotesMaster
;
delete
pNewMaster
;
OSL_ASSERT
(
"SdDrawDocument::SetMasterPage() cloning of MasterPage/NoteAmsterPage failed!"
);
return
;
}
pNotesMaster
=
pNewNotesMaster
;
pMaster
=
pNewMaster
;
// layout name needs to be unique
aTargetNewLayoutName
=
pMaster
->
GetLayoutName
();
aTargetNewLayoutName
.
Erase
(
aTargetNewLayoutName
.
SearchAscii
(
SD_LT_SEPARATOR
));
if
(
!
isMasterPageLayoutNameUnique
(
*
this
,
aTargetNewLayoutName
))
{
aTargetNewLayoutName
=
createNewMasterPageLayoutName
(
*
this
);
String
aTemp
(
aTargetNewLayoutName
);
aTemp
.
AppendAscii
(
RTL_CONSTASCII_STRINGPARAM
(
SD_LT_SEPARATOR
));
aTemp
.
Append
(
String
(
SdResId
(
STR_LAYOUT_OUTLINE
)));
pMaster
->
SetName
(
aTargetNewLayoutName
);
pMaster
->
SetLayoutName
(
aTemp
);
pNotesMaster
->
SetName
(
aTargetNewLayoutName
);
pNotesMaster
->
SetLayoutName
(
aTemp
);
}
}
if
(
pSourceDoc
!=
this
)
if
(
pSourceDoc
!=
this
)
{
{
const
sal_uInt16
nMasterPageCount
=
GetMasterPageCount
();
const
sal_uInt16
nMasterPageCount
=
GetMasterPageCount
();
for
(
sal_uInt16
nMPage
=
0
;
nMPage
<
nMasterPageCount
;
nMPage
++
)
for
(
sal_uInt16
nMPage
=
0
;
nMPage
<
nMasterPageCount
;
nMPage
++
)
{
{
SdPage
*
pCheckMaster
=
(
SdPage
*
)
GetMasterPage
(
nMPage
);
SdPage
*
pCheckMaster
=
(
SdPage
*
)
GetMasterPage
(
nMPage
);
if
(
pCheckMaster
->
GetName
()
==
aNewLayoutName
)
if
(
pCheckMaster
->
GetName
()
==
a
Target
NewLayoutName
)
{
{
bLayoutReloaded
=
sal_True
;
bLayoutReloaded
=
sal_True
;
break
;
break
;
...
@@ -1635,8 +1723,18 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
...
@@ -1635,8 +1723,18 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
{
{
aName
=
pHisSheet
->
GetName
();
aName
=
pHisSheet
->
GetName
();
if
(
aName
.
Search
(
aNewLayoutName
)
==
0
)
// #121863# search in source styles with original style name from source of
// evtl. cloned master (not-cloned, renamed for uniqueness)
if
(
aName
.
Search
(
aOriginalNewLayoutName
)
==
0
)
{
{
// #121863# build name of evtl. cloned master style to search for
if
(
aOriginalNewLayoutName
!=
aTargetNewLayoutName
)
{
const
sal_uInt16
nPos
(
aName
.
SearchAscii
(
SD_LT_SEPARATOR
));
aName
.
Erase
(
0
,
nPos
);
aName
.
Insert
(
aTargetNewLayoutName
,
0
);
}
SfxStyleSheet
*
pMySheet
=
static_cast
<
SfxStyleSheet
*>
(
mxStyleSheetPool
->
Find
(
aName
,
SD_STYLE_FAMILY_MASTERPAGE
)
);
SfxStyleSheet
*
pMySheet
=
static_cast
<
SfxStyleSheet
*>
(
mxStyleSheetPool
->
Find
(
aName
,
SD_STYLE_FAMILY_MASTERPAGE
)
);
if
(
pMySheet
)
if
(
pMySheet
)
...
@@ -1672,10 +1770,13 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
...
@@ -1672,10 +1770,13 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
pReplData
->
nFamily
=
pMySheet
->
GetFamily
();
pReplData
->
nFamily
=
pMySheet
->
GetFamily
();
pReplData
->
aNewName
=
pMySheet
->
GetName
();
pReplData
->
aNewName
=
pMySheet
->
GetName
();
// #121863# re-create original name of styte used at page where to replace with
// this new style
String
aTemp
(
pMySheet
->
GetName
());
String
aTemp
(
pMySheet
->
GetName
());
sal_uInt16
nPos
=
aTemp
.
SearchAscii
(
SD_LT_SEPARATOR
);
const
sal_uInt16
nPos
(
aTemp
.
SearchAscii
(
SD_LT_SEPARATOR
)
);
aTemp
.
Erase
(
0
,
nPos
);
aTemp
.
Erase
(
0
,
nPos
);
aTemp
.
Insert
(
aOldLayoutName
,
0
);
aTemp
.
Insert
(
aOldLayoutName
,
0
);
pReplData
->
aName
=
aTemp
;
pReplData
->
aName
=
aTemp
;
pReplList
->
Insert
(
pReplData
,
LIST_APPEND
);
pReplList
->
Insert
(
pReplData
,
LIST_APPEND
);
}
}
...
@@ -1738,13 +1839,16 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
...
@@ -1738,13 +1839,16 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
String
aLayoutName
=
aPageLayoutName
;
String
aLayoutName
=
aPageLayoutName
;
aLayoutName
.
Erase
(
aLayoutName
.
SearchAscii
(
SD_LT_SEPARATOR
));
aLayoutName
.
Erase
(
aLayoutName
.
SearchAscii
(
SD_LT_SEPARATOR
));
if
(
pSourceDoc
!=
this
)
// #121863# Do *not* remove from original document any longer, it is potentially used there
{
// and would lead to crashes. Rely on the automatic process of removing unused masterpages
// Aus dem Source-Dokument austragen
// (see RemoveUnnecessaryMasterPages)
SdrPage
*
pTest
=
NULL
;
//if (pSourceDoc != this)
pTest
=
pSourceDoc
->
RemoveMasterPage
(
pNotesMaster
->
GetPageNum
());
//{
pTest
=
pSourceDoc
->
RemoveMasterPage
(
pMaster
->
GetPageNum
());
// // Aus dem Source-Dokument austragen
}
// SdrPage* pTest = NULL;
// pTest = pSourceDoc->RemoveMasterPage(pNotesMaster->GetPageNum());
// pTest = pSourceDoc->RemoveMasterPage(pMaster->GetPageNum());
//}
/*********************************************************************
/*********************************************************************
|* Neue MasterPages ins Dokument eintragen und den Standard- und
|* Neue MasterPages ins Dokument eintragen und den Standard- und
...
@@ -1884,32 +1988,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
...
@@ -1884,32 +1988,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
/*********************************************************************
/*********************************************************************
|* Einen neuen Layoutnamen ausdenken
|* Einen neuen Layoutnamen ausdenken
\********************************************************************/
\********************************************************************/
String
aName
=
String
(
SdResId
(
STR_LAYOUT_DEFAULT_NAME
));
String
aName
(
createNewMasterPageLayoutName
(
*
this
));
String
aTest
;
sal_Bool
bNotANewName
=
sal_True
;
sal_uInt16
nCount
=
0
;
sal_uInt16
nMPgCount
=
GetMasterPageCount
();
for
(
nCount
=
0
;
bNotANewName
;
nCount
++
)
{
// Testnamen bilden
aTest
=
aName
;
// Standard, Standard1, Standard2, ...
if
(
nCount
>
0
)
aTest
+=
String
::
CreateFromInt32
(
nCount
);
// gibt's schon eine, die so heisst?
bNotANewName
=
sal_False
;
for
(
sal_uInt16
nMPg
=
1
;
nMPg
<
nMPgCount
;
nMPg
++
)
{
const
SdrPage
*
pTest
=
GetMasterPage
(
nMPg
);
String
aPageLayoutName
(
pTest
->
GetLayoutName
());
aPageLayoutName
.
Erase
(
aPageLayoutName
.
SearchAscii
(
SD_LT_SEPARATOR
));
if
(
aPageLayoutName
==
aTest
)
bNotANewName
=
sal_True
;
}
}
aName
=
aTest
;
String
aPageLayoutName
(
aName
);
String
aPageLayoutName
(
aName
);
aPageLayoutName
.
AppendAscii
(
RTL_CONSTASCII_STRINGPARAM
(
SD_LT_SEPARATOR
));
aPageLayoutName
.
AppendAscii
(
RTL_CONSTASCII_STRINGPARAM
(
SD_LT_SEPARATOR
));
aPageLayoutName
+=
String
(
SdResId
(
STR_LAYOUT_OUTLINE
));
aPageLayoutName
+=
String
(
SdResId
(
STR_LAYOUT_OUTLINE
));
...
...
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